optframework.utils.general_scripts.convert_exp_data_Batch module
Convert experimental data into data that can be directly input into opt
- optframework.utils.general_scripts.convert_exp_data_Batch.interpolate_data(original_data, original_coords, new_coords)[source]
- optframework.utils.general_scripts.convert_exp_data_Batch.generate_nonuniform_coords(min_val, max_val, num_points)[source]
- optframework.utils.general_scripts.convert_exp_data_Batch.process_data_xQ(merged_data, measurement_count)[source]
- optframework.utils.general_scripts.convert_exp_data_Batch.save_average_xQ_data(x_avg_array, Q_x_ref, sorted_time_labels)[source]
- optframework.utils.general_scripts.convert_exp_data_Batch.generate_nonuniform_grid(x_min, x_max, num_points, gamma=2.0, reverse=False)[source]
Generate a non-uniform grid on [x_min, x_max], with controllable density.
- Parameters:
x_min (float): Minimum of the grid x_max (float): Maximum of the grid num_points (int): Number of grid points gamma (float): Controls density: >1 = dense at start, <1 = dense at end reverse (bool): If True, reverse the grid (dense at max side)
- Returns:
numpy.ndarray: Non-uniform grid array
- optframework.utils.general_scripts.convert_exp_data_Batch.interpolate_Qx(x_vals, Q_vals, x_target, method='int1d', fraction=1)[source]
Interpolate Q(x) with various methods, and clip to [0, 1].
- Parameters:
x_vals (1D array): Original x coordinates for Q(x) Q_vals (1D array): Corresponding Q(x) values x_target (1D array): Interpolation target points method (str): One of ‘int1d’, ‘pchip’, ‘akima’, ‘spline_monotonic’ fraction (float): Portion of data (0 < fraction <= 1.0) to use for interpolation
- Returns:
qx_interp (1D array): Interpolated and clipped Q(x) values on x_target
- optframework.utils.general_scripts.convert_exp_data_Batch.fit_lognormal_cdf(x, Q, method='zscore', weight_mode='uniform', clip_eps=1e-06)[source]
Fit a log-normal CDF to (x, Q) data using one of three methods: - ‘curve_fit’: Nonlinear least squares - ‘zscore’: Inverse normal CDF + linear regression - ‘global_opt’: Global optimization (DE) with optional tail weighting
- Parameters:
x (array-like): Positive values (e.g., particle size) Q (array-like): Cumulative values (0–1 range) method (str): One of [‘curve_fit’, ‘zscore’, ‘global_opt’] weight_mode (str): ‘uniform’, ‘tail’, ‘head’, ‘center’ clip_eps (float): Min/max clipping for numerical stability
- Returns:
f(x): Fitted CDF function (callable) (σ, μ): Log-normal parameters
- optframework.utils.general_scripts.convert_exp_data_Batch.wrap_with_linear_extrapolation(f_raw, x_sub, y_sub)[source]
Wrap a given interpolator with linear extrapolation on both ends.
- Parameters:
f_raw (callable): Base interpolator function f(x) x_sub, y_sub (array-like): Original data points used for interpolation
- Returns:
f(x): Interpolated + linearly extrapolated function
- optframework.utils.general_scripts.convert_exp_data_Batch.plot_xQ_profiles(x_Q_df, Q_x_int_df, qx_int_df)[source]
- optframework.utils.general_scripts.convert_exp_data_Batch.plot_Qx_time_G_profiles(Q_x_int_df_list)[source]