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_current | Convert a raw probe current record to amperes. |
calibrate_voltage | Convert a raw probe voltage record to physical volts. |
electron_density | Electron density from the ion saturation current and the solved temperature. Convention |
median_filter_signal | Median-filter a waveform along its only axis. Convention |
probe_surface_area | Collection area of a cylindrical probe tip. Convention |
process_triple_probe | Run the full triple-probe chain on one voltage and current channel pair. Convention |
remove_offset | Subtract a signal’s pre-plasma baseline, taken as its leading samples. Convention |
solve_electron_temperature | Solve the classical triple-probe relation for the electron temperature. Convention |
No function matches.
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.
| Name | Type | Unit | Description |
|---|---|---|---|
raw | array_like | V | Digitized probe signal. |
divisor | float, optional | - | Shunt or amplifier divisor, non-zero. |
| Returns | |||
| — | np.ndarray | A | Probe current. |
Raises
ValueErrorThe 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
vest.yamllangmuir_probescurrent 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.
| Name | Type | Unit | Description |
|---|---|---|---|
raw | array_like | V | Digitized probe signal. |
gain | float, optional | - | Multiplicative divider gain. |
| Returns | |||
| — | np.ndarray | V | 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
vest.yamllangmuir_probesvoltage 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.
| Name | Type | Unit | Description |
|---|---|---|---|
vd2 | array_like | V | Voltage difference between the first probe pair. |
te | array_like | eV | Electron temperature per sample, same shape. |
current | array_like | A | Probe current, same shape. |
tip_radius_m | float | m | Tip radius. |
tip_length_m | float | m | Exposed tip length. |
ion_mass_kg | float | kg | Ion mass; required, with no assumed species. |
e | float, optional | C | Elementary charge. |
| Returns | |||
n_e | np.ndarray | m^-3 | Electron density, NaN where non-physical. |
valid | np.ndarray | - |
|
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
ValueErrorThe 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
- 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.
| Name | Type | Unit | Description |
|---|---|---|---|
data | array_like | any | The waveform. |
kernel_size | int | - | Width of the median window in samples; must be odd. |
| Returns | |||
| — | np.ndarray | any | 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
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; seeprocess_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.
| Name | Type | Unit | Description |
|---|---|---|---|
tip_radius_m | float | m | Tip radius, strictly positive. |
tip_length_m | float | m | Exposed tip length, strictly positive. |
| Returns | |||
| — | float | m^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
ValueErrorEither 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
- 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.
| Name | Type | Unit | Description |
|---|---|---|---|
time_v | array_like | s | Time base of the voltage record. |
vd2_raw | array_like | V | Raw voltage record. |
time_i | array_like | s | Time base of the current record; must agree with time_v. |
i_raw | array_like | V | Raw current record. |
vd3 | float | V | The second pair’s voltage difference, constant over the record. |
tip_radius_m | float | m | Tip radius. |
tip_length_m | float | m | Exposed tip length. |
ion_mass_kg | float | kg | Ion mass; required. |
voltage_gain | float, optional | - | Divider gain for the voltage channel. |
current_divisor | float, optional | - | Divisor for the current channel. |
n_baseline_samples | int, optional | - | Leading samples forming the baseline. |
median_kernel | int, optional | - | Median filter width; no filtering when unset. |
time_rtol | float, optional | - | Relative tolerance on the time-base comparison. |
time_atol | float, optional | s | Absolute tolerance on that comparison. |
| Returns | |||
| — | dict of str to np.ndarray | - |
|
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
ValueErrorThe two time bases do not agree.
Processing steps · Defaults · Applicability · Limitations · Provenance
Processing steps
- Verify that the voltage and current time bases agree, and refuse if not.
- Remove the leading-sample baseline from both records.
- Optionally median-filter both.
- Calibrate to volts and amperes.
- Solve the triple-probe relation for the temperature.
- 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
- 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 - baselineSubtract a signal’s pre-plasma baseline, taken as its leading samples.
| Name | Type | Unit | Description |
|---|---|---|---|
data | array_like | any | The waveform, in whatever unit it has. |
n_baseline_samples | int, optional | - | How many leading samples make up the baseline. |
| Returns | |||
| — | np.ndarray | any | 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
ValueErrorThe 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
vest.yamllangmuir_probesprocessing, 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.
| Name | Type | Unit | Description |
|---|---|---|---|
vd2 | array_like | V | Voltage difference between the first probe pair. |
vd3 | array_like | V | Voltage difference between the second pair, same shape. |
te_bounds | tuple of float, optional | eV | Bracket the root is searched in. |
rtol | float, optional | - | Relative tolerance of the root finder. |
| Returns | |||
te | np.ndarray | eV | Electron temperature per sample, NaN where no root was found. |
solver_ok | np.ndarray | - |
|
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
ValueErrorThe 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
- The classical triple-probe relation; the transcription discrepancy is recorded in issue #152.