Process reference: langmuir

Generated from the docstrings of vaft.process.langmuir: 8 public functions. Each entry is what vaft.process.describe("langmuir.<name>") prints. All process categories

Overview

This module is machine-independent: raw VEST field selection, shot-era bias voltage/tip geometry, and ODS population belong in vaft.machine_mapping.langmuir_probes. Callers here pass already-selected physical signals (or raw counts plus explicit calibration factors) and get back electron temperature/density.

Functions

calibrate_currentConvert a raw probe current record to amperes.
calibrate_voltageConvert a raw probe voltage record to physical volts.
electron_densityElectron density from the ion saturation current and the solved temperature. Convention
median_filter_signalMedian-filter a waveform along its only axis. Convention
probe_surface_areaCollection area of a cylindrical probe tip. Convention
process_triple_probeRun the full triple-probe chain on one voltage and current channel pair. Convention
remove_offsetSubtract a signal’s pre-plasma baseline, taken as its leading samples. Convention
solve_electron_temperatureSolve the classical triple-probe relation for the electron temperature. Convention

calibrate_current

Machine-independent source
calibrate_current(raw, *, divisor=100.0)
Show source vaft/process/langmuir.py, lines 160–197
def calibrate_current(raw: np.ndarray, *, divisor: float = 100.0) -> np.ndarray:
    """Convert a raw probe current record to amperes.

    Parameters
    ----------
    raw : array_like
        Digitized probe signal [V].
    divisor : float, optional
        Shunt or amplifier divisor, non-zero [-].

    Returns
    -------
    np.ndarray
        Probe current [A].

    Raises
    ------
    ValueError
        The divisor is zero.

    Defaults
    --------
    ``divisor = 100.0`` is machine-specific, the VEST current divisor mirrored
    from ``vest.yaml``, and carries the same caveat as the voltage gain: a caller
    on another machine must supply its own.

    Applicability
    -------------
    Machine-independent.  The arithmetic is a scale factor; only the default
    carries a VEST number, and a caller on another machine passes its own.

    Provenance
    ----------
    .. [1] ``vest.yaml`` ``langmuir_probes`` current divisor.
    """
    if float(divisor) == 0:
        raise ValueError("calibrate_current: divisor must be non-zero")
    return np.asarray(raw, dtype=float) / float(divisor)

Convert a raw probe current record to amperes.

NameTypeUnitDescription
rawarray_likeV

Digitized probe signal.

divisorfloat, optional-

Shunt or amplifier divisor, non-zero.

Returns
—np.ndarrayA

Probe current.

Raises

  • ValueError The divisor is zero.
Defaults · Applicability · Provenance

Defaults

divisor = 100.0 is machine-specific, the VEST current divisor mirrored from vest.yaml, and carries the same caveat as the voltage gain: a caller on another machine must supply its own.

Applicability

Machine-independent. The arithmetic is a scale factor; only the default carries a VEST number, and a caller on another machine passes its own.

Provenance

  1. vest.yaml langmuir_probes current divisor.

calibrate_voltage

Machine-independent source
calibrate_voltage(raw, *, gain=22.0)
Show source vaft/process/langmuir.py, lines 127–157
def calibrate_voltage(raw: np.ndarray, *, gain: float = 22.0) -> np.ndarray:
    """Convert a raw probe voltage record to physical volts.

    Parameters
    ----------
    raw : array_like
        Digitized probe signal [V].
    gain : float, optional
        Multiplicative divider gain [-].

    Returns
    -------
    np.ndarray
        Probe voltage [V].

    Defaults
    --------
    ``gain = 22.0`` is machine-specific: it is the VEST probe divider, mirrored
    from ``vest.yaml``. This module is otherwise machine-independent, so a caller
    on another machine must pass its own value rather than inherit this one.

    Applicability
    -------------
    Machine-independent.  The arithmetic is a scale factor; only the default
    carries a VEST number, and a caller on another machine passes its own.

    Provenance
    ----------
    .. [1] ``vest.yaml`` ``langmuir_probes`` voltage gain.
    """
    return np.asarray(raw, dtype=float) * float(gain)

Convert a raw probe voltage record to physical volts.

NameTypeUnitDescription
rawarray_likeV

Digitized probe signal.

gainfloat, optional-

Multiplicative divider gain.

Returns
—np.ndarrayV

Probe voltage.

Defaults · Applicability · Provenance

Defaults

gain = 22.0 is machine-specific: it is the VEST probe divider, mirrored from vest.yaml. This module is otherwise machine-independent, so a caller on another machine must pass its own value rather than inherit this one.

Applicability

Machine-independent. The arithmetic is a scale factor; only the default carries a VEST number, and a caller on another machine passes its own.

Provenance

  1. vest.yaml langmuir_probes voltage gain.

electron_density

Machine-independentConvention-sensitive source
electron_density(vd2, te, current, *, tip_radius_m, tip_length_m, ion_mass_kg, e=1.602176634e-19)

Semantics: consumes electron_temperature · produces electron_density (ontology)

Electron density from the ion saturation current and the solved temperature.

NameTypeUnitDescription
vd2array_likeV

Voltage difference between the first probe pair.

tearray_likeeV

Electron temperature per sample, same shape.

currentarray_likeA

Probe current, same shape.

tip_radius_mfloatm

Tip radius.

tip_length_mfloatm

Exposed tip length.

ion_mass_kgfloatkg

Ion mass; required, with no assumed species.

efloat, optionalC

Elementary charge.

Returns
n_enp.ndarraym^-3

Electron density, NaN where non-physical.

validnp.ndarray-

True where the density is finite and positive.

Convention

n_e = sqrt(m_i) * I * exp(1/2) / (S * e * sqrt(e*Te) * (exp(Vd2/Te) - 1)). Everything is SI except the temperature, which is in electron-volts and is converted where the formula needs joules. The ion mass has no default: the density scales as its square root, so assuming a species would put a silent factor into every result.

Raises

  • ValueError The ion mass is not positive, or the three arrays differ in shape.
Applicability · Limitations · Provenance

Applicability

Machine-independent.

Limitations

Non-physical or non-finite results are flagged rather than replaced, so the mask must be honoured. Inherits the assumptions of solve_electron_temperature and the thin-sheath geometric area of probe_surface_area.

Provenance

  1. The ion-saturation-current form of the triple-probe density relation; see issue #152 for the port’s history.

median_filter_signal

Machine-independentConvention-sensitive source
median_filter_signal(data, kernel_size)
Show source vaft/process/langmuir.py, lines 87–124
def median_filter_signal(data: np.ndarray, kernel_size: int) -> np.ndarray:
    """Median-filter a waveform along its only axis.

    Parameters
    ----------
    data : array_like
        The waveform [any].
    kernel_size : int
        Width of the median window in samples; must be odd [-].

    Returns
    -------
    np.ndarray
        The filtered waveform, same length [any].

    Convention
    ----------
    A median filter is zero phase: it moves no feature in time, unlike a causal
    low-pass. It removes isolated spikes without the smoothing a mean filter
    applies to a real edge, which is why a probe trace uses it.

    Applicability
    -------------
    Machine-independent.

    Limitations
    -----------
    The kernel must be odd; SciPy raises otherwise. Edges are handled by zero
    padding, so the first and last half-kernel of samples are pulled toward zero.
    A feature narrower than half the kernel is removed whether or not it is noise.

    Provenance
    ----------
    .. [1] ``scipy.signal.medfilt``. Issue #152 does not record the kernel size the
       original workflow used, which is why the pipeline leaves this unset rather
       than guessing one; see :func:`process_triple_probe`.
    """
    return medfilt(np.asarray(data, dtype=float), kernel_size=int(kernel_size))

Median-filter a waveform along its only axis.

NameTypeUnitDescription
dataarray_likeany

The waveform.

kernel_sizeint-

Width of the median window in samples; must be odd.

Returns
—np.ndarrayany

The filtered waveform, same length.

Convention

A median filter is zero phase: it moves no feature in time, unlike a causal low-pass. It removes isolated spikes without the smoothing a mean filter applies to a real edge, which is why a probe trace uses it.

Applicability · Limitations · Provenance

Applicability

Machine-independent.

Limitations

The kernel must be odd; SciPy raises otherwise. Edges are handled by zero padding, so the first and last half-kernel of samples are pulled toward zero. A feature narrower than half the kernel is removed whether or not it is noise.

Provenance

  1. scipy.signal.medfilt. Issue #152 does not record the kernel size the original workflow used, which is why the pipeline leaves this unset rather than guessing one; see process_triple_probe.

probe_surface_area

Machine-independentConvention-sensitive source
probe_surface_area(*, tip_radius_m, tip_length_m)
Show source vaft/process/langmuir.py, lines 200–244
def probe_surface_area(*, tip_radius_m: float, tip_length_m: float) -> float:
    """Collection area of a cylindrical probe tip.

    Parameters
    ----------
    tip_radius_m : float
        Tip radius, strictly positive [m].
    tip_length_m : float
        Exposed tip length, strictly positive [m].

    Returns
    -------
    float
        The collecting surface area [m^2].

    Raises
    ------
    ValueError
        Either dimension is not positive.

    Convention
    ----------
    The lateral area of a cylinder, ``2*pi*r*l``. The end cap is excluded, which
    is the usual convention for a probe whose length far exceeds its radius, and
    the sheath is assumed thin enough that the collecting area is the geometric
    one.

    Applicability
    -------------
    Machine-independent.

    Limitations
    -----------
    A thick sheath at low density collects over an area larger than the geometric
    one, which this does not model; the density inferred from it is then an
    overestimate.

    Provenance
    ----------
    .. [1] The standard cylindrical-probe collection area used by the
       triple-probe density relation in :func:`electron_density`.
    """
    if tip_radius_m <= 0 or tip_length_m <= 0:
        raise ValueError("probe_surface_area: tip_radius_m and tip_length_m must be positive")
    return 2.0 * np.pi * float(tip_radius_m) * float(tip_length_m)

Collection area of a cylindrical probe tip.

NameTypeUnitDescription
tip_radius_mfloatm

Tip radius, strictly positive.

tip_length_mfloatm

Exposed tip length, strictly positive.

Returns
—floatm^2

The collecting surface area.

Convention

The lateral area of a cylinder, 2*pi*r*l. The end cap is excluded, which is the usual convention for a probe whose length far exceeds its radius, and the sheath is assumed thin enough that the collecting area is the geometric one.

Raises

  • ValueError Either dimension is not positive.
Applicability · Limitations · Provenance

Applicability

Machine-independent.

Limitations

A thick sheath at low density collects over an area larger than the geometric one, which this does not model; the density inferred from it is then an overestimate.

Provenance

  1. The standard cylindrical-probe collection area used by the triple-probe density relation in electron_density.

process_triple_probe

Machine-independentConvention-sensitive source
process_triple_probe(time_v, vd2_raw, time_i, i_raw, vd3, *, tip_radius_m, tip_length_m, ion_mass_kg, voltage_gain=22.0, current_divisor=100.0, n_baseline_samples=500, median_kernel=None, time_rtol=1e-06, time_atol=1e-09)

Run the full triple-probe chain on one voltage and current channel pair.

NameTypeUnitDescription
time_varray_likes

Time base of the voltage record.

vd2_rawarray_likeV

Raw voltage record.

time_iarray_likes

Time base of the current record; must agree with time_v.

i_rawarray_likeV

Raw current record.

vd3floatV

The second pair’s voltage difference, constant over the record.

tip_radius_mfloatm

Tip radius.

tip_length_mfloatm

Exposed tip length.

ion_mass_kgfloatkg

Ion mass; required.

voltage_gainfloat, optional-

Divider gain for the voltage channel.

current_divisorfloat, optional-

Divisor for the current channel.

n_baseline_samplesint, optional-

Leading samples forming the baseline.

median_kernelint, optional-

Median filter width; no filtering when unset.

time_rtolfloat, optional-

Relative tolerance on the time-base comparison.

time_atolfloat, optionals

Absolute tolerance on that comparison.

Returns
—dict of str to np.ndarray-

time in seconds, vd2 in volts, current in amperes, te in electron-volts, n_e in inverse cubic metres, and solver_ok as the combined validity mask.

Convention

Mismatched time bases are an error, not something to fix by truncating to the shorter record; index-truncating two differently sampled channels silently misaligns them. The second pair’s voltage is a scalar broadcast over the record, since it is a fixed bias rather than a measurement.

Raises

  • ValueError The two time bases do not agree.
Processing steps · Defaults · Applicability · Limitations · Provenance

Processing steps

  1. Verify that the voltage and current time bases agree, and refuse if not.
  2. Remove the leading-sample baseline from both records.
  3. Optionally median-filter both.
  4. Calibrate to volts and amperes.
  5. Solve the triple-probe relation for the temperature.
  6. Compute the density, and combine the two validity masks.

Defaults

The gain, divisor and baseline length are machine-specific VEST values mirrored from vest.yaml. median_kernel is deliberately unset: issue #152 does not record the kernel the original workflow used, so no filtering is applied rather than a guessed width. The time tolerances are numerical conveniences.

Applicability

Machine-independent. The chain is generic; the calibration, baseline and geometry arguments carry VEST defaults that another machine overrides.

Limitations

Inherits every assumption of the two inference steps. The returned mask is the conjunction of the temperature and density masks, so a sample invalid in either is invalid in the result.

Provenance

  1. Issue #152, the port of the VEST triple-probe workflow that this chain reproduces, including the decisions it left unresolved.

remove_offset

Machine-independentConvention-sensitive source
remove_offset(data, *, n_baseline_samples=500)
Show source vaft/process/langmuir.py, lines 32–84
def remove_offset(data: np.ndarray, *, n_baseline_samples: int = 500) -> np.ndarray:
    """Subtract a signal's pre-plasma baseline, taken as its leading samples.

    Parameters
    ----------
    data : array_like
        The waveform, in whatever unit it has [any].
    n_baseline_samples : int, optional
        How many leading samples make up the baseline [-].

    Returns
    -------
    np.ndarray
        The waveform with its baseline mean removed [any].

    Raises
    ------
    ValueError
        The record is shorter than the requested baseline.

    Defaults
    --------
    ``n_baseline_samples = 500`` is an acquisition-era value carried from the VEST
    probe digitizer settings, where the leading samples precede the discharge. It
    is a sample count, not a duration, so it means a different interval on a
    different sample rate.

    Convention
    ----------
    The mean of the leading window, not a fitted trend, so a baseline that drifts
    during the shot is not removed.

    Applicability
    -------------
    Machine-independent.

    Limitations
    -----------
    Assumes the leading window is signal-free. A probe already collecting current
    at the start of the record has its baseline biased by that current.

    Provenance
    ----------
    .. [1] ``vest.yaml`` ``langmuir_probes`` processing, which carries the VEST
       sample count this default mirrors.
    """
    values = np.asarray(data, dtype=float)
    if values.size < int(n_baseline_samples):
        raise ValueError(
            f"remove_offset: need at least {n_baseline_samples} samples, got {values.size}"
        )
    baseline = float(np.mean(values[: int(n_baseline_samples)]))
    return values - baseline

Subtract a signal’s pre-plasma baseline, taken as its leading samples.

NameTypeUnitDescription
dataarray_likeany

The waveform, in whatever unit it has.

n_baseline_samplesint, optional-

How many leading samples make up the baseline.

Returns
—np.ndarrayany

The waveform with its baseline mean removed.

Convention

The mean of the leading window, not a fitted trend, so a baseline that drifts during the shot is not removed.

Raises

  • ValueError The record is shorter than the requested baseline.
Defaults · Applicability · Limitations · Provenance

Defaults

n_baseline_samples = 500 is an acquisition-era value carried from the VEST probe digitizer settings, where the leading samples precede the discharge. It is a sample count, not a duration, so it means a different interval on a different sample rate.

Applicability

Machine-independent.

Limitations

Assumes the leading window is signal-free. A probe already collecting current at the start of the record has its baseline biased by that current.

Provenance

  1. vest.yaml langmuir_probes processing, which carries the VEST sample count this default mirrors.

solve_electron_temperature

Machine-independentConvention-sensitive source
solve_electron_temperature(vd2, vd3, *, te_bounds=(0.1, 500.0), rtol=1e-06)

Semantics: produces electron_temperature (ontology)

Solve the classical triple-probe relation for the electron temperature.

NameTypeUnitDescription
vd2array_likeV

Voltage difference between the first probe pair.

vd3array_likeV

Voltage difference between the second pair, same shape.

te_boundstuple of float, optionaleV

Bracket the root is searched in.

rtolfloat, optional-

Relative tolerance of the root finder.

Returns
tenp.ndarrayeV

Electron temperature per sample, NaN where no root was found.

solver_oknp.ndarray-

True where a root was found inside the bracket.

Convention

Solves (1 - exp(-Vd2/Te)) / (1 - exp(-Vd3/Te)) = 1/2, the theoretical triple-probe relation, sample by sample by bracketed root finding. The one half on the right is the definition of the technique, not a tunable.

Raises

  • ValueError The two voltage arrays do not have the same shape.
Defaults · Applicability · Limitations · Provenance

Defaults

The bracket and the tolerance are numerical conveniences: the bracket spans the range a probe measurement can plausibly occupy, and the tolerance is far below the scatter of the voltages that feed it.

Applicability

Machine-independent.

Limitations

A sample with no root inside the bracket yields NaN and a false flag rather than a substituted value, so a caller must honour the mask. The relation assumes a Maxwellian electron distribution, equal collecting areas on the three tips, and a thin sheath.

The implemented relation is the theoretically correct one. The MATLAB expression quoted by issue #152 parses as a different equation, a 1 - a/b transcription of (1-a)/b, and no reference data was available to arbitrate; this deliberately does not reproduce that apparent transcription error.

Provenance

  1. The classical triple-probe relation; the transcription discrepancy is recorded in issue #152.

results matching ""

    No results matching ""