rizer.io.experimental_data.preprocess_data#
Functions#
|
Plot diameter data and the mean with error bars. |
|
Preprocess diameter data from a pickle file and save the mean to a .npz file. |
|
|
|
Compute cumulated Joule energy (+ propagated std) and package the npz payload. |
|
Preprocess electrical signals from oscilloscope data. |
|
Plot electron density vs time with error bars. |
|
Preprocess electron density data from a raw CSV file. |
Module Contents#
- rizer.io.experimental_data.preprocess_data.plot_diameters(time_ns: numpy.ndarray, diameter_mm: numpy.ndarray, mean_time_ns: numpy.ndarray, mean_diameter_mm: numpy.ndarray, std_diameter_mm: numpy.ndarray)#
Plot diameter data and the mean with error bars.
- Parameters:
time_ns (
numpy.ndarray) – Time data in nanoseconds.diameter_mm (
numpy.ndarray) – Diameter data in millimeters.mean_time_ns (
numpy.ndarray) – Mean time data in nanoseconds.mean_diameter_mm (
numpy.ndarray) – Mean diameter data in millimeters.std_diameter_mm (
numpy.ndarray) – Standard deviation of diameter data in millimeters.
- rizer.io.experimental_data.preprocess_data.preprocess_diameters(input_filepath: pathlib.Path, output_mean_filepath: pathlib.Path, plot: bool = True, offset_time_ns: float = 10000000.0, outlier_threshold: float | None = None) dict[str, numpy.ndarray]#
Preprocess diameter data from a pickle file and save the mean to a .npz file.
- Parameters:
input_filepath (
pathlib.Path) – Path to the input pickle file containing diameter data.output_mean_filepath (
pathlib.Path) – Path to the output .npz file where the mean diameter data will be saved.plot (
bool, optional) – If True, plot the diameter data and the mean with error bars, by default Trueoffset_time_ns (
float, optional) – Offset for the time values, by default 1e7outlier_threshold (
floatorNone, optional) – Threshold for outlier removal in diameter data. If None, no outlier removal is performed
- Returns:
The saved payload, keyed by rizer.io.experimental_data.load_experiment_data.SECTION_DIAMETERS_NPZ_KEYS (
time[s],d_mean[m],d_std[m],r2[-]).- Return type:
dictofstrtonumpy.ndarray
- rizer.io.experimental_data.preprocess_data.plot_electrical_signals(times_v: numpy.ndarray, voltages: numpy.ndarray, mean_voltage: numpy.ndarray, std_voltage: numpy.ndarray, times_i: numpy.ndarray, currents: numpy.ndarray, mean_current: numpy.ndarray, std_current: numpy.ndarray)#
- rizer.io.experimental_data.preprocess_data.compute_electrical_signals_npz_payload(time_s: numpy.ndarray, voltage_mean: numpy.ndarray, voltage_std: numpy.ndarray, current_mean: numpy.ndarray, current_std: numpy.ndarray) dict[str, numpy.ndarray]#
Compute cumulated Joule energy (+ propagated std) and package the npz payload.
Uses a left-Riemann cumulative sum (numpy.cumsum), matching rizer.misc.simulation.post_process_quantities.compute_voltage_current_energy’s
E_p = cumsum(I_p * V_p * dt)convention exactly.- Parameters:
time_s (
numpy.ndarray) – Time, seconds.voltage_mean (
numpy.ndarray) – Mean/std of voltage [V] and current [A], same shape as time_s.voltage_std (
numpy.ndarray) – Mean/std of voltage [V] and current [A], same shape as time_s.current_mean (
numpy.ndarray) – Mean/std of voltage [V] and current [A], same shape as time_s.current_std (
numpy.ndarray) – Mean/std of voltage [V] and current [A], same shape as time_s.
- Returns:
Keyed by rizer.io.experimental_data.load_experiment_data.ELECTRICAL_SIGNALS_NPZ_KEYS.
- Return type:
dictofstrtonumpy.ndarray
- rizer.io.experimental_data.preprocess_data.preprocess_electrical_signals(data_folder: pathlib.Path, output_filepath: pathlib.Path, pattern: str | None, max_iter: int = 1000, plot: bool = False, offset_time_v: float | None = None, offset_time_i: float | None = None, voltage_channel: str = 'C1', current_channel: str = 'C2') dict[str, numpy.ndarray]#
Preprocess electrical signals from oscilloscope data.
- Parameters:
data_folder (
pathlib.Path) – Path to the folder containing the oscilloscope data folders.output_filepath (
pathlib.Path) – Path to the output .npz file where the mean and std data will be saved.pattern (
strorNone) – Pattern to match the oscilloscope data folders. If None, all folders in the data_folder will be processed.max_iter (
int, optional) – Maximum number of folders to process, by default 1000plot (
bool, optional) – Whether to plot the processed data, by default Falseoffset_time_v (
floatorNone, optional) – Offset for voltage time data, by default Noneoffset_time_i (
floatorNone, optional) – Offset for current time data, by default Nonevoltage_channel (
str, optional) – Channel name for voltage data, by default “C1”current_channel (
str, optional) – Channel name for current data, by default “C2”
- Returns:
The saved payload, keyed by rizer.io.experimental_data.load_experiment_data.ELECTRICAL_SIGNALS_NPZ_KEYS.
- Return type:
dictofstrtonumpy.ndarray- Raises:
FileNotFoundError – If the data folder or required files do not exist.
- rizer.io.experimental_data.preprocess_data.plot_electron_density(time: numpy.ndarray, ne: numpy.ndarray, ne_std: numpy.ndarray, r2: numpy.ndarray)#
Plot electron density vs time with error bars.
- Parameters:
time (
numpy.ndarray) – Time data in nanoseconds.ne (
numpy.ndarray) – Electron density data in m^-3.ne_std (
numpy.ndarray) – Standard deviation of electron density data in m^-3.r2 (
numpy.ndarray) – R^2 of the fit.
- rizer.io.experimental_data.preprocess_data.preprocess_electron_density(input_filepath: pathlib.Path | list[pathlib.Path], output_filepath: pathlib.Path, plot: bool = True, offset_time_ns: float = 10000000.0) dict[str, numpy.ndarray]#
Preprocess electron density data from a raw CSV file.
Save the processed data to a .npz file.
Missing values in the input data are replaced with np.nan. For a given time, it is possible that multiple measurements of electron density are available.
- Parameters:
input_filepath (
pathlib.Pathorlistofpathlib.Path) – Path to the input CSV file or a list of paths.output_filepath (
pathlib.Path) – Path to the output .npz file.plot (
bool, optional) – Whether to plot the data, by default Trueoffset_time_ns (
float, optional) – Time offset in nanoseconds, by default 1e7
- Returns:
The saved payload, keyed by rizer.io.experimental_data.load_experiment_data.ELECTRON_DENSITY_NPZ_KEYS (
time[s],ne_mean[m^-3],ne_std[m^-3],r2[-]).- Return type:
dictofstrtonumpy.ndarray