cherab.nagdis.experiment.ConditionalAverage¶
- class cherab.nagdis.experiment.ConditionalAverage(path: Path | str, dt: int)Source¶
Bases:
objectClass to perform conditional average of dataset.
- Parameters:
Methods
average(peak_time[, time_eps])Average the dataset.
average_per_tau(peak_times, d_tau[, tau_eps])Average the dataset per tau.
create_images(ds[, time_name])Create images from the dataset.
create_t_y_contour(ds[, time_name])Create t-y contour from the dataset.
get_peaks_time([signal, height, prominence])Get time of peaks in the dataset.
-
get_peaks_time(signal: str =
'I_sat', height: ArrayLike | None =2.5, prominence: float | None =None) ndarraySource¶ Get time of peaks in the dataset.
- Parameters:
- signal: str =
'I_sat'¶ Signal to find peaks.
- height: ArrayLike | None =
2.5¶ Factor of standard deviation to set the height of peaks, by default 2.5. If a float, the height is set to
mean + height * std. If an array_like with two elements, the height is set to(mean + height[0] * std, mean + height[1] * std). Otherwise, raise ValueError.- prominence: float | None =
None¶ Required prominence of peaks, by default the standard deviation of the signal.
- signal: str =
- Returns:
numpy.ndarray – Time of peaks in microseconds [µs].
- Raises:
ValueError – If
heightis not a float, tuple of two floats, or None.
-
average_per_tau(peak_times: ArrayLike, d_tau: int, tau_eps: float | None =
None) DatasetSource¶ Average the dataset per tau.
Average the data \(f(t)\) like:
\[ \begin{align}\begin{aligned}f_\mathrm{avg}(\tau) = \frac{1}{|T(\tau)|}\sum_{t \in T(\tau)} f(t),\\\begin{split}T(\tau) \equiv \left\{ t' \in T_\mathrm{video} \middle | \begin{gathered} t' = t_\mathrm{peak} + \tau\\ t_\mathrm{peak} \in T_\mathrm{peak} \end{gathered} \right\},\end{split}\end{aligned}\end{align} \]where \(\tau \in \{-\Delta t, -\Delta t + \Delta \tau, \ldots, \Delta t\}\), \(T_\mathrm{peak}\) is the set of peak times from the waveform signal, and \(T_\mathrm{video}\) is the set of video times. This function enables to enhance the \(\tau\) resolution even if the frequency of the video dataset is lower than the signal dataset.
- Parameters:
- Returns:
xarray.Dataset – Conditional Averaged dataset.
-
average(peak_time, time_eps: float | None =
None) DatasetSource¶ Average the dataset.
Average the data \(f(t)\) like:
\[ \begin{align}\begin{aligned}f_\mathrm{avg}(\tau) &= \frac{1}{|T|}\sum_{t \in T} f(t + \tau),\\T &\equiv \{t' \mid t'\in T_\mathrm{peak}\cap T_\mathrm{video}\},\end{aligned}\end{align} \]where \(\tau \in [-\Delta t, \Delta t]\), \(T_\mathrm{peak}\) is the set of peak times from the waveform signal, and \(T_\mathrm{video}\) is the set of video times.
-
static create_images(ds: Dataset, time_name: str =
'tau') DataArraySource¶ Create images from the dataset.
This function is a proxy for the
create_imagesfunction in theutilsmodule.