merge_voltage_clusters

plasmapy.analysis.swept_langmuir.helpers.merge_voltage_clusters(
voltage: ndarray,
current: ndarray,
voltage_step_size: float | None = None,
filter_nan: bool = False,
) tuple[ndarray, ndarray][source]

Search the voltage array for closely spaced voltage clusters based on the voltage_step_size parameter and merge those clusters, and associated current values, into a single point.

This function is intended to merge together identical, or close, voltage points to remove small step sizes in the swept langmuir trace before differentiation.

Parameters:
  • voltage (numpy.ndarray) – 1D numpy.ndarray representing the voltage of the swept Langmuir trace. Voltage needs to be monotonically ascending. No units are assumed or checked, but values should be in volts.

  • current (numpy.ndarray) – 1D numpy.ndarray representing the current of the swept Langmuir trace. Values should start from a negative ion-saturation current and increase to a positive electron-saturation current. No units are assumed or checked, but values should be in amperes.

  • voltage_step_size (float | None, default: None) – A non-zero, positive step size for the voltage array cluster identification. A value of 0 will merge only duplicate voltage values. A value of None will default to 95% of the average step size of the voltage array (only counting duplicate voltages once).

  • filter_nan (bool, default: False) – Set True to automatically filter nan values from the voltage and current arrays.

Returns:

Notes

An identified voltage cluster can span a voltage range larger than voltage_step_size and still have every voltage step being smaller than voltage_step_size. In this scenario, the voltage cluster will be divided up into \(N\)-sections for averaging, where \(N\) is given by

\[N = \texttt{floor}\left( \frac{V_{cluster,max} - V_{cluster,min}}{\texttt{voltage_step_size}} \right)\]