API: vaft.data

Generated from each module's __all__ by python -m vaft._api_catalog: 278 published objects in 29 modules. Signatures and summaries are read from the source; nothing here is written by hand. All API pages

vaft.data
ANALYTIC_STATE_UNITSdata
CLOSURE_MODESdata
CURRENT_NORMALIZATIONSdata
CURRENT_POLICIESdata
ION_SPECIESdata
ITERATION_STATUSESdata
KIN_COLUMNSdata
KIN_HEADERdata
KINETIC_UNITSdata
MARS_FIELD_FILESdata
MARS_PROFILE_FILESdata
MARS_PROFILE_LABELSdata
MARS_RADIAL_VARIABLESdata
PFILE_LABELSdata
PFILE_SECTION_ORDERdata
PFILE_TO_CONTAINERdata
PFILE_UNIT_LADDERdata
PFILE_UNITSdata
PRESSURE_CLOSURESdata
PRESSURE_CONSTRAINTSdata
PROFILE_FIELDSdata
SCALAR_TARGET_KINDSdata
STATE_STATUSESdata
SYNTHETIC_PROFILE_STATUSESdata
SYNTHETIC_PROFILE_UNITSdata
unified_diagnostics_fixturefunction
unified_diagnostics_manifestfunction
VAFT_INTERNAL_COCOSdata
vaft.data.aeqdsk
AEQDSKclass
AEQDSKErrorclass
COUNT_NAMESdata
HEAD_SCALARSdata
read_aeqdskfunction
SENTINELSdata
SIGNAL_ARRAYSdata
TAIL_SCALARSdata
TRAILING_SCALARSdata
vaft.data.analytic_plasma_state
ANALYTIC_STATE_UNITSdata
AnalyticPlasmaStateclass
AnalyticProfileclass
BarrierStepclass
vaft.data.atomic
ATOMIC_NUMBERSdata
AtomicSpeciesclass
charge_state_offunction
ELEMENT_NAMESdata
format_speciesfunction
ionization_stage_offunction
ISOTOPE_NAMESdata
parse_speciesfunction
STANDARD_ATOMIC_WEIGHTSdata
vaft.data.cocos
COCOS_INDICESdata
cocos_specfunction
CocosSpecclass
CodeConventionclass
convention_forfunction
known_codesfunction
register_conventionfunction
VAFT_INTERNAL_COCOSdata
vaft.data.eqdsk
BCENTR_FPOL_RTOLdata
flux_exponent_tierfunction
FLUX_EXPONENT_TIERSdata
from_equilibriumfunction
from_imasfunction
from_omasfunction
GEQDSKclass
geqdsk_filenamesfunction
GFILE_HEADER_PATTERNdata
GFILE_NAME_PATTERNdata
infer_source_shot_timefunction
ods_flux_exponentfunction
ods_psi_to_wb_per_radian_factorfunction
read_geqdskfunction
slice_flux_exponentfunction
to_imasfunction
to_omasfunction
vacuum_b0_magnitudefunction
write_geqdskfunction
vaft.data.equilibrium
BoundaryRepresentationclass
Contourclass
CurrentMomentRepresentationclass
DerivationProvenanceclass
DerivedValueclass
EquilibriumConventionclass
EquilibriumDataclass
FourierFitResultclass
FourierSequenceResultclass
FourierSurfaceclass
Gapclass
GlobalEquilibriumDescriptorsclass
GradShafranovResidualModesclass
GuazzottoFreidbergEquilibriumclass
MillerFitResultclass
MillerSequenceResultclass
MillerSurfaceclass
MXHChebyshevRepresentationclass
SOLOVEV_BASIS_SIZESdata
SOLOVEV_CONSTRAINT_KINDSdata
SolovevConstraintclass
SolovevEquilibriumclass
SolovevFitclass
StationaryPointclass
StrikePointclass
Topologyclass
XPointclass
vaft.data.equilibrium_kinetic_iteration
CLOSURE_MODESdata
ConvergenceCriteriaclass
CURRENT_NORMALIZATIONSdata
CURRENT_POLICIESdata
CurrentPolicyclass
CurrentSourceclass
EquilibriumKineticSpecclass
ITERATION_STATUSESdata
IterationStateclass
PressureSourceclass
SelfConsistentStateclass
STATE_STATUSESdata
vaft.data.flare_products
FlareBoundaryclass
FlareColumnclass
FlareGridclass
FlareMeshclass
FlareProductclass
read_flare_boundaryfunction
read_flare_gridfunction
read_flare_meshfunction
read_flare_productfunction
RECTANGULAR_MESHESdata
resolve_geometryfunction
vaft.data.keqdsk
KEQDSKclass
read_keqdskfunction
write_namelists_to_odsfunction
vaft.data.kinetic_profiles
KIN_COLUMNSdata
KIN_HEADERdata
KINETIC_UNITSdata
KineticProfilesclass
normalize_psifunction
PROFILE_FIELDSdata
PsiNormalizationclass
read_kinfunction
Speciesclass
write_kinfunction
vaft.data.mars_profiles
MARS_FIELD_FILESdata
MARS_PROFILE_FILESdata
MARS_PROFILE_LABELSdata
MARS_RADIAL_VARIABLESdata
MarsProfileclass
MarsProfileFormatErrorclass
read_mars_profilefunction
read_mars_profilesfunction
write_mars_profilefunction
write_mars_profilesfunction
vaft.data.meqdsk
EFIT_K_TO_M_TRANSFORMSdata
EFIT_MAPPING_SOURCE_REVISIONdata
MEQDSKclass
MVariableclass
read_meqdskfunction
vaft.data.open_adas
ADASDataErrorclass
ADASDownloadErrorclass
ADF11Dataclass
ADF11FormatErrorclass
default_adf11_filesfunction
get_adf11_pathfunction
OPEN_ADAS_DOWNLOAD_URLdata
read_adf11function
vaft.data.pfile
kinetic_profiles_from_pfilefunction
PFileclass
PFILE_LABELSdata
PFILE_SECTION_ORDERdata
PFILE_TO_CONTAINERdata
PFILE_UNIT_LADDERdata
PFILE_UNITSdata
PFileFormatErrorclass
PFileSectionclass
read_pfilefunction
write_pfilefunction
vaft.data.public
ChecksumErrorclass
CONFINEMENT_COLUMNSdata
fetch_sourcefunction
FetchErrorclass
MHD_STATE_COLUMNSdata
OPTIONAL_CONFINEMENT_COLUMNSdata
PR08_MACHINESdata
PROVENANCE_KINDSdata
SOURCESdata
TRANSITION_COLUMNSdata
vaft.data.public.analysis
confinement_coveragefunction
h_factorfunction
predict_confinement_timefunction
SCALING_INPUTSdata
transition_marginfunction
vaft.data.public.itpa_hmode
DB5_COLUMN_MAPdata
DB5_DEFINITIONSdata
normalize_db5function
read_db5function
vaft.data.public.itpa_profile
fetch_pr08function
PR08_BASE_URLdata
pr08_mapping_coveragefunction
PR08_PINNEDdata
PR08_REFERENCEdata
pr08_to_omasfunction
Pr08Dischargeclass
read_pr08function
read_pr08_0dfunction
read_ufilesfunction
UFileSignalclass
vaft.data.public.itpa_tc26
normalize_tc26function
read_tc26function
TC26_DEFINITIONSdata
TC26_REFERENCEdata
TC26_SHA256data
vaft.data.public.pr08_mhd_state
fetch_pr08_populationfunction
MHD_STATE_COLUMNSdata
mhd_state_coveragefunction
pr08_inventoryfunction
PR08_MACHINESdata
pr08_mhd_state_tablefunction
pr08_release_inventoryfunction
projection_coveragefunction
PROVENANCE_KINDSdata
read_pr08_zero_dfunction
SOURCE_CORRECTIONSdata
UNIT_SLIP_FACTORdata
vaft.data.public.schema
ColumnSpecclass
CONFINEMENT_COLUMNSdata
empty_confinement_tablefunction
empty_transition_tablefunction
make_record_idfunction
OPTIONAL_CONFINEMENT_COLUMNSdata
TRANSITION_COLUMNSdata
validate_confinement_tablefunction
validate_transition_tablefunction
vaft.data.public.tcv_lh
normalize_tcv_lhfunction
read_tcv_lhfunction
TCV_LH_DEFINITIONSdata
vaft.data.public.vest_confinement
load_vest_tier_a_confinementfunction
vest_ods_to_confinement_rowsfunction
VEST_REFERENCE_RADIUS_Mdata
VEST_SUMMARY_DEFINITIONSdata
vest_summary_to_confinement_tablefunction
VEST_TIER_A_BLOCK_SPLIT_SHOTdata
VEST_TIER_A_SELECTIONSdata
vaft.data.reference_samples
semantic_sample_viewfunction
sha256_filefunction
verify_sample_artifactsfunction
vaft.data.resources
available_samplesfunction
data_pathfunction
require_repository_samplefunction
samplefunction
sample_camera_visible_frame_pathsfunction
sample_geqdskfunction
sample_manifestfunction
vaft.data.spectroscopy
describe_availablefunction
matchesfunction
parse_emission_termfunction
parse_line_labelfunction
SERIES_NAMESdata
SpectralLineIdentityclass
vaft.data.synthetic_kinetic_profiles
Compositionclass
GradientProfileclass
ION_SPECIESdata
IonSpeciesclass
PRESSURE_CLOSURESdata
PRESSURE_CONSTRAINTSdata
PressureClosureReportclass
ProfileSpecclass
SCALAR_TARGET_KINDSdata
ScalarTargetclass
SqrtPressureSplitclass
SYNTHETIC_PROFILE_STATUSESdata
SYNTHETIC_PROFILE_UNITSdata
SyntheticKineticProfilesclass
SyntheticKineticSpecclass
SyntheticProfileErrorclass
TabulatedProfileclass
TargetResidualclass
TemperatureAssumptionclass
vaft.data.vfit
read_vfitfunction
VFITKindfunction
VFITResultclass

vaft.data

File-format and data-structure compatibility helpers.

ANALYTIC_STATE_UNITS

data
ANALYTIC_STATE_UNITS = <builtins.mappingproxy>

CLOSURE_MODES

data
CLOSURE_MODES = ('equilibrium_pressure', 'kinetic_pressure')

CURRENT_NORMALIZATIONS

data
CURRENT_NORMALIZATIONS = <builtins.mappingproxy>

CURRENT_POLICIES

data
CURRENT_POLICIES = ('preserve_ffprime_shape', 'analytic_ffprime_shape')

ION_SPECIES

data
ION_SPECIES = <builtins.mappingproxy>

ITERATION_STATUSES

data
ITERATION_STATUSES = ('converged', 'max_iterations', 'diverged', 'oscillating', 'stagnated', 'drifting', 'kinetic_generation_failed', 'inv...

KIN_COLUMNS

data
KIN_COLUMNS = ('psi_norm', 'n_i', 'n_e', 'T_i', 'T_e', 'omega_exb')

KIN_HEADER

data
KIN_HEADER = '             psi         ni(m^-3)         ne(m^-3)           ti(eV)           te(eV)      wexb(rad/s)'

KINETIC_UNITS

data
KINETIC_UNITS = <builtins.dict>

MARS_FIELD_FILES

data
MARS_FIELD_FILES = <builtins.dict>

MARS_PROFILE_FILES

data
MARS_PROFILE_FILES = <builtins.dict>

MARS_PROFILE_LABELS

data
MARS_PROFILE_LABELS = <builtins.dict>

MARS_RADIAL_VARIABLES

data
MARS_RADIAL_VARIABLES = <builtins.dict>

PFILE_LABELS

data
PFILE_LABELS = <builtins.dict>

PFILE_SECTION_ORDER

data
PFILE_SECTION_ORDER = ('ne', 'ni', 'nz1', 'nb', 'te', 'ti', 'ptot', 'pb', 'omeg', 'omegp', 'omgvb', 'omgpp', 'omgeb', 'er', 'ommvb', 'ommpp...

PFILE_TO_CONTAINER

data
PFILE_TO_CONTAINER = <builtins.dict>

PFILE_UNIT_LADDER

data
PFILE_UNIT_LADDER = <builtins.dict>

PFILE_UNITS

data
PFILE_UNITS = <builtins.dict>

PRESSURE_CLOSURES

data
PRESSURE_CLOSURES = <builtins.dict>

PRESSURE_CONSTRAINTS

data
PRESSURE_CONSTRAINTS = ('equilibrium', 'thermal_energy', 'kinetic')

PROFILE_FIELDS

data
PROFILE_FIELDS = ('n_e', 'n_i', 'n_z', 'n_fast', 'T_e', 'T_i', 'T_z', 'omega_tor', 'omega_exb', 'omega_pol', 'p_total', 'p_fast', 'e_r...

SCALAR_TARGET_KINDS

data
SCALAR_TARGET_KINDS = ('axis', 'separatrix', 'line_average', 'volume_average', 'greenwald_fraction')

STATE_STATUSES

data
STATE_STATUSES = ('initial', 'accepted', 'kinetic_generation_failed', 'invalid_pressure_source', 'chease_failed', 'validation_failed')

SYNTHETIC_PROFILE_STATUSES

data
SYNTHETIC_PROFILE_STATUSES = ('success', 'invalid_equilibrium', 'invalid_profile_model', 'invalid_gradient_model', 'invalid_normalization', 'inval...

SYNTHETIC_PROFILE_UNITS

data
SYNTHETIC_PROFILE_UNITS = <builtins.mappingproxy>

unified_diagnostics_fixture

function source
unified_diagnostics_fixture()

Load the offline VEST cross-shot fixture as an OMAS ODS.

unified_diagnostics_manifest

function source
unified_diagnostics_manifest() -> dict

Validate and return the provenance contract for the VEST cross-shot fixture.

VAFT_INTERNAL_COCOS

data
VAFT_INTERNAL_COCOS = 11

vaft.data.aeqdsk

Parser for EFIT a-files, mapped from EFIT/efit/write_a.f90.

AEQDSK

class source
AEQDSK(shot: int, time_ms: float, jflag: int, lflag: int, limloc: str, nco2v: int, nco2r: int, qmflag: str, nlold: int, nlnew: int, scalars: Mapping[str, float], arrays: Mapping[str, np.ndarray], counts: Mapping[str, int], fit_type: str = '', source: Path | None = None) -> None

One EFIT a-file, named per write_a.f90.

15 fields · 5 members
  • shot: int
  • time_ms: float
  • jflag: int
  • lflag: int
  • limloc: str
  • nco2v: int
  • nco2r: int
  • qmflag: str
  • nlold: int
  • nlnew: int
  • scalars: Mapping[str, float]
  • arrays: Mapping[str, np.ndarray]
  • counts: Mapping[str, int]
  • fit_type: str
  • source: Path | None
  • chisq property — EFIT’s own total chi-square for the slice. source
  • terror property — Final normalized Grad-Shafranov iteration error. source
  • accepted property — EFIT’s acceptance verdict. source
  • time_seconds property source
  • to_omas method — Store the a-file as equilibrium code parameters for one slice. source

AEQDSKError

class source

Raised when an a-file cannot be read as one.

COUNT_NAMES

data
COUNT_NAMES = ('nsilop', 'magpri', 'nfsum', 'nesum')

HEAD_SCALARS

data
HEAD_SCALARS = ('chisq', 'rcencm', 'bcentr', 'ipmeas', 'ipmhd', 'rcntr', 'zcntr', 'aminor', 'elong', 'utri', 'ltri', 'volume', 'rcur...

read_aeqdsk

function source
read_aeqdsk(path: str | Path) -> AEQDSK

Read a formatted EFIT a-file into the fields write_a.f90 writes.

Also exported as vaft.data.read_aeqdsk.

SENTINELS

data
SENTINELS = (100000000000.0, -999.0)

SIGNAL_ARRAYS

data
SIGNAL_ARRAYS = ('csilop', 'cmpr2', 'ccbrsp', 'eccurt')

TAIL_SCALARS

data
TAIL_SCALARS = ('shear', 'bpolav', 's1', 's2', 's3', 'qout', 'sepin', 'sepout', 'septop', 'sibdry', 'area', 'wmhd', 'terror', 'elong...

TRAILING_SCALARS

data
TRAILING_SCALARS = ('pbinj', 'rvsin', 'zvsin', 'rvsout', 'zvsout', 'unused_1', 'unused_2', 'unused_3', 'unused_4', 'unused_5', 'zuperts'...

vaft.data.analytic_plasma_state

Records for analytic confinement-regime plasma states (#1045).

ANALYTIC_STATE_UNITS

data
ANALYTIC_STATE_UNITS = <builtins.mappingproxy>

AnalyticPlasmaState

class source
AnalyticPlasmaState(label: str, psi_norm: np.ndarray, n_e: np.ndarray, n_i: np.ndarray, n_impurity: np.ndarray, T_e: np.ndarray, T_i: np.ndarray, p_e: np.ndarray, p_i: np.ndarray, p_total: np.ndarray, dp_e_dpsi_norm: np.ndarray, dp_i_dpsi_norm: np.ndarray, dp_total_dpsi_norm: np.ndarray, profiles: Mapping[str, AnalyticProfile], z_eff: float = 1.0, impurity_charge: float = 6.0, coordinate: str = 'psi_norm', metadata: Mapping[str, Any] = <factory>) -> None

Prescribed kinetic profiles and the pressures derived from them, on psi_norm.

Also exported as vaft.data.AnalyticPlasmaState.

18 fields · 4 members
  • label: str
  • psi_norm: np.ndarray
  • n_e: np.ndarray
  • n_i: np.ndarray
  • n_impurity: np.ndarray
  • T_e: np.ndarray
  • T_i: np.ndarray
  • p_e: np.ndarray
  • p_i: np.ndarray
  • p_total: np.ndarray
  • dp_e_dpsi_norm: np.ndarray
  • dp_i_dpsi_norm: np.ndarray
  • dp_total_dpsi_norm: np.ndarray
  • profiles: Mapping[str, AnalyticProfile]
  • z_eff: float
  • impurity_charge: float
  • coordinate: str
  • metadata: Mapping[str, Any]
  • rho_pol_norm property — sqrt(psi_norm), the poloidal-flux radius [-]. source
  • dp_total_drho_pol_norm property — dp_total/d rho_pol_norm = 2 rho_pol_norm dp_total/dpsi_norm [Pa]. source
  • unit method — The unit of one of the state’s arrays. source
  • to_kinetic_profiles method — The state as the package’s kinetic-profile container, same units, same grid. source

AnalyticProfile

class source
AnalyticProfile(quantity: str, unit: str, axis_value: float, separatrix_value: float, core_alpha: float, core_beta: float, core_amplitude: float, pedestal: BarrierStep | None = None, pedestal_top_value: float | None = None, itb: BarrierStep | None = None, coordinate: str = 'psi_norm') -> None

One analytic kinetic profile: a smooth core plus up to two barrier steps.

Also exported as vaft.data.AnalyticProfile.

11 fields · 1 members
  • quantity: str
  • unit: str
  • axis_value: float
  • separatrix_value: float
  • core_alpha: float
  • core_beta: float
  • core_amplitude: float
  • pedestal: BarrierStep | None
  • pedestal_top_value: float | None
  • itb: BarrierStep | None
  • coordinate: str
  • barriers property — The barrier steps present, pedestal first [-]. source

BarrierStep

class source
BarrierStep(position: float, width: float, height: float) -> None

One localized tanh step of a profile, in normalized poloidal flux.

Also exported as vaft.data.BarrierStep.

3 fields · 2 members
  • position: float
  • width: float
  • height: float
  • knee property — Inner edge of the steep-gradient layer, position - width/2 [-]. source
  • foot property — Outer edge of the steep-gradient layer, position + width/2 [-]. source

vaft.data.atomic

Atomic identity: elements, isotopes, charge states and how species are written.

ATOMIC_NUMBERS

data
ATOMIC_NUMBERS = <builtins.dict>

Also exported as vaft.spectroscopy.ATOMIC_NUMBERS (deprecated).

AtomicSpecies

class source
AtomicSpecies(element: str, mass_number: int | None = None, ionization_stage: int | None = None) -> None

An element, optionally narrowed to one isotope and one charge.

Also exported as vaft.spectroscopy.Species (deprecated).

3 fields · 3 members
  • element: str
  • mass_number: int | None
  • ionization_stage: int | None
  • charge_state property — The ionic charge, or None when the stage is unspecified. source
  • atomic_number property — Nuclear charge, or None for an element outside the table. source
  • from_charge_state classmethod — Build from the C2+ spelling rather than the C III one. source

charge_state_of

function source
charge_state_of(ionization_stage: int) -> int

The ionic charge of a spectroscopic stage: C III -> C2+.

Also exported as vaft.spectroscopy.charge_state_of (deprecated).

ELEMENT_NAMES

data
ELEMENT_NAMES = <builtins.dict>

Also exported as vaft.spectroscopy.ELEMENT_NAMES (deprecated).

format_species

function source
format_species(species: AtomicSpecies) -> str

Spell a species the way spectroscopy does: C III, D, He.

Also exported as vaft.spectroscopy.format_species (deprecated).

ionization_stage_of

function source
ionization_stage_of(charge_state: int) -> int

The spectroscopic stage of an ionic charge: C2+ -> C III.

Also exported as vaft.spectroscopy.ionization_stage_of (deprecated).

ISOTOPE_NAMES

data
ISOTOPE_NAMES = <builtins.dict>

Also exported as vaft.spectroscopy.ISOTOPE_NAMES (deprecated).

parse_species

function source
parse_species(text: Any) -> AtomicSpecies | None

Resolve a species term to an identity, or None if it is not one.

STANDARD_ATOMIC_WEIGHTS

data
STANDARD_ATOMIC_WEIGHTS = <builtins.mappingproxy>

vaft.data.cocos

Explicit COCOS coordinate-convention management.

COCOS_INDICES

data
COCOS_INDICES = (1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18)

cocos_spec

function source
cocos_spec(index: int) -> CocosSpec

Return the CocosSpec for index.

Also exported as vaft.data.cocos_spec.

CocosSpec

class source
CocosSpec(index: int, sigma_bp: int, sigma_rpz: int, sigma_rhotp: int, exp_bp: int, sign_q_pos: int, sign_pprime_pos: int) -> None

The sign and exponent parameters of one COCOS index.

Also exported as vaft.data.CocosSpec.

7 fields · 3 members
  • index: int
  • sigma_bp: int
  • sigma_rpz: int
  • sigma_rhotp: int
  • exp_bp: int
  • sign_q_pos: int
  • sign_pprime_pos: int
  • psi_per_radian property — True when psi is in weber/radian (COCOS 1-8). source
  • bp_factor property — The Sauter Eq. 20 coefficient sigma_RphiZ * sigma_Bp / (2*pi)**e_Bp. source
  • expected_sign method — Sign a quantity must carry under this convention, from Sauter Eq. 23. source

CodeConvention

class source
CodeConvention(name: str, cocos: int | None, psi_unit: str, reference: str, notes: str = '', confirmed: bool = True) -> None

The COCOS convention one external code or file format works in.

Also exported as vaft.data.CodeConvention.

6 fields · 1 members
  • name: str
  • cocos: int | None
  • psi_unit: str
  • reference: str
  • notes: str
  • confirmed: bool
  • identifies_per_file property source

convention_for

function source
convention_for(code: str) -> CodeConvention

Return the declared convention for code.

Also exported as vaft.data.convention_for.

known_codes

function source
known_codes() -> tuple[str, ...]

Every code with a declared convention, in sorted order.

Also exported as vaft.data.known_codes.

register_convention

function source
register_convention(convention: CodeConvention) -> CodeConvention

Add convention to the registry, refusing to silently replace an entry.

Also exported as vaft.data.register_convention.

VAFT_INTERNAL_COCOS

data
VAFT_INTERNAL_COCOS = 11

vaft.data.eqdsk

EFIT EQDSK/GEQDSK compatibility helpers implemented inside VAFT.

BCENTR_FPOL_RTOL

data
BCENTR_FPOL_RTOL = 0.001

flux_exponent_tier

function source
flux_exponent_tier(readers: Sequence[SliceReader]) -> tuple[str | None, dict[int, Literal[0, 1]]]

The strongest probe tier that decides anything, and what each slice said.

FLUX_EXPONENT_TIERS

data
FLUX_EXPONENT_TIERS = ('slope', 'ampere', 'contour_q')

from_equilibrium

function source
from_equilibrium(equilibrium: Any) -> GEQDSK

Create a GEQDSK from a complete lightweight equilibrium model.

Also exported as vaft.data.from_equilibrium.

from_imas

function source
from_imas(source: Any, *, paths: Optional[list] = None, time: Optional[float] = None, occurrence: Optional[dict] = None, imas_version: Optional[str] = None) -> GEQDSK

Load equilibrium data from IMAS through OMAS and return GEQDSK.

Also exported as vaft.data.from_imas.

from_omas

function source
from_omas(ods: Any, time_index: int = 0, profile_index: int = 0, allow_derived_data: bool = True) -> GEQDSK

Build a GEQDSK wrapper from an OMAS ODS equilibrium time slice.

Also exported as vaft.data.from_omas.

GEQDSK

class source
GEQDSK(mapping: MutableMapping[str, Any], source: Optional[Path] = None, metadata: dict[str, Any] = <factory>, namelists: dict[str, dict[str, Any]] = <factory>) -> None

Neutral VAFT representation of an EFIT GEQDSK/g-file.

Also exported as vaft.data.GEQDSK.

4 fields · 7 members
  • mapping: MutableMapping[str, Any]
  • source: Optional[Path]
  • metadata: dict[str, Any]
  • namelists: dict[str, dict[str, Any]]
  • get method source
  • keys method source
  • to_omas method — Convert this GEQDSK into an OMAS ODS equilibrium subtree. source
  • to_imas method — Convert this GEQDSK through OMAS and save it to an IMAS target. source
  • write method — Write this GEQDSK to disk. source
  • to_equilibrium method — Adapt this file object to VAFT’s lightweight scientific model. source
  • from_equilibrium classmethod — Create a GEQDSK object from a complete lightweight model. source

geqdsk_filenames

function source
geqdsk_filenames(shot: int, times: Sequence[float]) -> list[str]

Return one EFIT-style g<shot>.<time_ms> name per slice, in order.

GFILE_HEADER_PATTERN

data
GFILE_HEADER_PATTERN = <re.Pattern>

GFILE_NAME_PATTERN

data
GFILE_NAME_PATTERN = <re.Pattern>

infer_source_shot_time

function source
infer_source_shot_time(source: Optional[Path]) -> tuple[int, Optional[float]]

Infer (shot, time_in_seconds) from an EFIT g-file name.

ods_flux_exponent

function source
ods_flux_exponent(ods: Any, time_index: int = 0) -> Literal[0, 1] | None

e_Bp for a whole ODS, by tier across every slice, or None.

ods_psi_to_wb_per_radian_factor

function source
ods_psi_to_wb_per_radian_factor(ods: Any, time_index: int = 0) -> float

Factor converting an ODS equilibrium’s stored psi to Wb/rad.

read_geqdsk

function source
read_geqdsk(path: str | Path) -> GEQDSK

Read an EFIT GEQDSK/g-file using VAFT’s standalone parser.

Also exported as vaft.data.read_geqdsk.

slice_flux_exponent

function source
slice_flux_exponent(time_slice: Any) -> Literal[0, 1] | None

The flux exponent one equilibrium time slice’s own data supports.

to_imas

function source
to_imas(geqdsk: GEQDSK | Mapping[str, Any], target: Any, *, occurrence: Optional[dict] = None, imas_version: Optional[str] = None) -> Any

Convert GEQDSK through OMAS and write to an IMAS target.

Also exported as vaft.data.to_imas.

to_omas

function source
to_omas(geqdsk: GEQDSK | Mapping[str, Any], ods: Any = None, time_index: int = 0, profile_index: int = 0, allow_derived_data: bool = True) -> Any

Convert GEQDSK data to an OMAS ODS without OMFIT.

Also exported as vaft.data.to_omas.

vacuum_b0_magnitude

function source
vacuum_b0_magnitude(data: Mapping[str, Any]) -> float

|B0| at RCENTR, from FPOL in preference to BCENTR.

write_geqdsk

function source
write_geqdsk(geqdsk: GEQDSK | Mapping[str, Any], path: str | Path) -> Path

Write GEQDSK data to disk using standard EFIT g-file ordering.

Also exported as vaft.data.write_geqdsk.

vaft.data.equilibrium

Portable, format-independent representations of axisymmetric equilibria.

BoundaryRepresentation

class source
BoundaryRepresentation(lcfs: Contour | None, limiter: Contour | None, x_points: tuple[XPoint, ...], topology: Topology, d_r_sep: DerivedValue, gaps: tuple[Gap, ...], strike_points: tuple[StrikePoint, ...], fourier_coefficients: Mapping[str, np.ndarray], fourier_reconstruction_error: DerivedValue, provenance: DerivationProvenance, reason: str | None = None, stationary_points: tuple[StationaryPoint, ...] = (), wall_contact_distance: DerivedValue | None = None) -> None

Also exported as vaft.data.BoundaryRepresentation.

13 fields
  • lcfs: Contour | None
  • limiter: Contour | None
  • x_points: tuple[XPoint, ...]
  • topology: Topology
  • d_r_sep: DerivedValue
  • gaps: tuple[Gap, ...]
  • strike_points: tuple[StrikePoint, ...]
  • fourier_coefficients: Mapping[str, np.ndarray]
  • fourier_reconstruction_error: DerivedValue
  • provenance: DerivationProvenance
  • reason: str | None
  • stationary_points: tuple[StationaryPoint, ...]
  • wall_contact_distance: DerivedValue | None

Contour

class source
Contour(r: np.ndarray, z: np.ndarray, closed: bool = True) -> None

Also exported as vaft.data.Contour.

3 fields · 1 members
  • r: np.ndarray
  • z: np.ndarray
  • closed: bool
  • points property source

CurrentMomentRepresentation

class source
CurrentMomentRepresentation(total_current: float, centroid_r: float, centroid_z: float, central_moments: Mapping[tuple[int, int], float], max_order: int, current_density_source: str, provenance: DerivationProvenance) -> None

Toroidal current density reduced to its total, centroid and central moments (#943).

Also exported as vaft.data.CurrentMomentRepresentation.

7 fields · 1 members
  • total_current: float
  • centroid_r: float
  • centroid_z: float
  • central_moments: Mapping[tuple[int, int], float]
  • max_order: int
  • current_density_source: str
  • provenance: DerivationProvenance
  • covariance property — The second-order tensor [[mu_20, mu_11], [mu_11, mu_02]] [m^2]. source

DerivationProvenance

class source
DerivationProvenance(method: str, source_type: str = 'native', source_fields: tuple[str, ...] = (), source_time: float | None = None, radial_coordinate: str | None = None, interpolation: str | None = None, fit_range: tuple[float, float] | None = None, tolerances: Mapping[str, float] = <factory>, convention: EquilibriumConvention | None = None, notes: tuple[str, ...] = ()) -> None

Also exported as vaft.data.DerivationProvenance.

10 fields
  • method: str
  • source_type: str
  • source_fields: tuple[str, ...]
  • source_time: float | None
  • radial_coordinate: str | None
  • interpolation: str | None
  • fit_range: tuple[float, float] | None
  • tolerances: Mapping[str, float]
  • convention: EquilibriumConvention | None
  • notes: tuple[str, ...]

DerivedValue

class source
DerivedValue(value: Any | None, unit: str, definition: str, provenance: DerivationProvenance, quality: Mapping[str, Any] = <factory>, reason: str | None = None) -> None

A value together with its definition, provenance, and availability.

Also exported as vaft.data.DerivedValue.

6 fields · 1 members
  • value: Any | None
  • unit: str
  • definition: str
  • provenance: DerivationProvenance
  • quality: Mapping[str, Any]
  • reason: str | None
  • available property source

EquilibriumConvention

class source
EquilibriumConvention(cocos: int | None = None, candidates: tuple[int, ...] = (), psi_per_radian: bool | None = None, clockwise_phi: bool | None = None, ip_sign: int | None = None, bt_sign: int | None = None, q_sign: int | None = None, source: str = 'unknown', identified: tuple[int, ...] = ()) -> None

Coordinate and sign convention, and the evidence used to identify it.

Also exported as vaft.data.EquilibriumConvention.

9 fields · 2 members
  • cocos: int | None
  • candidates: tuple[int, ...]
  • psi_per_radian: bool | None
  • clockwise_phi: bool | None
  • ip_sign: int | None
  • bt_sign: int | None
  • q_sign: int | None
  • source: str
  • identified: tuple[int, ...]
  • ambiguous property source
  • contradicted property — True when a declared index is not among the ones the data supports. source

EquilibriumData

class source
EquilibriumData(r: np.ndarray | None = None, z: np.ndarray | None = None, psi: np.ndarray | None = None, psi_axis: float | None = None, psi_boundary: float | None = None, magnetic_axis: tuple[float, float] | None = None, lcfs: Contour | None = None, limiter: Contour | None = None, psi_1d: np.ndarray | None = None, pressure: np.ndarray | None = None, f: np.ndarray | None = None, q: np.ndarray | None = None, pprime: np.ndarray | None = None, ffprime: np.ndarray | None = None, ip: float | None = None, bt0: float | None = None, r0: float | None = None, time: float | None = None, convention: EquilibriumConvention = <factory>, metadata: Mapping[str, Any] = <factory>) -> None

One axisymmetric equilibrium, shape-normalized for numerical algorithms.

Also exported as vaft.data.EquilibriumData.

20 fields
  • r: np.ndarray | None
  • z: np.ndarray | None
  • psi: np.ndarray | None
  • psi_axis: float | None
  • psi_boundary: float | None
  • magnetic_axis: tuple[float, float] | None
  • lcfs: Contour | None
  • limiter: Contour | None
  • psi_1d: np.ndarray | None
  • pressure: np.ndarray | None
  • f: np.ndarray | None
  • q: np.ndarray | None
  • pprime: np.ndarray | None
  • ffprime: np.ndarray | None
  • ip: float | None
  • bt0: float | None
  • r0: float | None
  • time: float | None
  • convention: EquilibriumConvention
  • metadata: Mapping[str, Any]

FourierFitResult

class source
FourierFitResult(surface: FourierSurface, contour: Contour, reconstructed: Contour, rms_error: float, normalized_rms_error: float, max_error: float, hausdorff_distance: float, accepted: bool, reason: str | None, provenance: DerivationProvenance) -> None

Also exported as vaft.data.FourierFitResult.

10 fields
  • surface: FourierSurface
  • contour: Contour
  • reconstructed: Contour
  • rms_error: float
  • normalized_rms_error: float
  • max_error: float
  • hausdorff_distance: float
  • accepted: bool
  • reason: str | None
  • provenance: DerivationProvenance

FourierSequenceResult

class source
FourierSequenceResult(fits: tuple[FourierFitResult, ...], skipped: tuple[float, ...] = (), provenance: DerivationProvenance | None = None) -> None

Also exported as vaft.data.FourierSequenceResult.

3 fields · 1 members
  • fits: tuple[FourierFitResult, ...]
  • skipped: tuple[float, ...]
  • provenance: DerivationProvenance | None
  • coefficient method — (radial values, coefficient) of one family and harmonic across the sequence. source

FourierSurface

class source
FourierSurface(r_cos: np.ndarray, r_sin: np.ndarray, z_cos: np.ndarray, z_sin: np.ndarray, radial_value: float | None = None, radial_coordinate: str = 'psi_n', angle_convention: str = 'arc_length') -> None

A closed contour as a truncated Fourier series in a uniform arc-length angle (#945).

Also exported as vaft.data.FourierSurface.

7 fields · 3 members
  • r_cos: np.ndarray
  • r_sin: np.ndarray
  • z_cos: np.ndarray
  • z_sin: np.ndarray
  • radial_value: float | None
  • radial_coordinate: str
  • angle_convention: str
  • modes property — Highest poloidal harmonic kept. source
  • reference_r property — The m = 0 radial term: the perimeter centroid’s major radius. source
  • reference_z property — The m = 0 vertical term: the perimeter centroid’s height. source

Gap

class source
Gap(name: str, angle: float, distance: DerivedValue, plasma_point: tuple[float, float] | None = None, wall_point: tuple[float, float] | None = None) -> None

Also exported as vaft.data.Gap.

5 fields
  • name: str
  • angle: float
  • distance: DerivedValue
  • plasma_point: tuple[float, float] | None
  • wall_point: tuple[float, float] | None

GlobalEquilibriumDescriptors

class source
GlobalEquilibriumDescriptors(values: Mapping[str, DerivedValue], radial_coordinates: Mapping[str, DerivedValue] = <factory>, rational_surfaces: Mapping[float, tuple[DerivedValue, ...]] = <factory>, validation: ValidationReport = <factory>) -> None

Also exported as vaft.data.GlobalEquilibriumDescriptors.

4 fields
  • values: Mapping[str, DerivedValue]
  • radial_coordinates: Mapping[str, DerivedValue]
  • rational_surfaces: Mapping[float, tuple[DerivedValue, ...]]
  • validation: ValidationReport

GradShafranovResidualModes

class source
GradShafranovResidualModes(radial_values: np.ndarray, cos: np.ndarray, sin: np.ndarray, rms: np.ndarray, scale: float, radial_coordinate: str = 'psi_n', angle_convention: str = 'arc_length', skipped: tuple[float, ...] = (), provenance: DerivationProvenance | None = None) -> None

The Grad-Shafranov residual projected onto poloidal harmonics, surface by surface (#948).

9 fields · 1 members
  • radial_values: np.ndarray
  • cos: np.ndarray
  • sin: np.ndarray
  • rms: np.ndarray
  • scale: float
  • radial_coordinate: str
  • angle_convention: str
  • skipped: tuple[float, ...]
  • provenance: DerivationProvenance | None
  • amplitude method — sqrt(cos**2 + sin**2) of harmonic m on every surface [T/m]. source

GuazzottoFreidbergEquilibrium

class source
GuazzottoFreidbergEquilibrium(topology: str, inverse_aspect_ratio: float, nu: float, alpha: float, coefficients: np.ndarray, separation_h: np.ndarray, separation_k: np.ndarray, magnetic_axis: tuple[float, float], elongation: float | None = None, triangularity: float | None = None, x_point_elongation: float | None = None, x_point_triangularity: float | None = None, eigen_residual: float = 0.0, condition_number: float = nan, series_terms: int = 250, status: str = 'converged', metadata: Mapping[str, Any] = <factory>, current_pedestal: float = 0.0, pressure_pedestal: float = 0.0, bootstrap_fraction: float = 0.0, mach_number: float = 0.0, adiabatic_index: float | None = None) -> None

An analytic Guazzotto-Freidberg (2021, Part 1) equilibrium in normalized form (#1148).

Also exported as vaft.data.GuazzottoFreidbergEquilibrium.

22 fields
  • topology: str
  • inverse_aspect_ratio: float
  • nu: float
  • alpha: float
  • coefficients: np.ndarray
  • separation_h: np.ndarray
  • separation_k: np.ndarray
  • magnetic_axis: tuple[float, float]
  • elongation: float | None
  • triangularity: float | None
  • x_point_elongation: float | None
  • x_point_triangularity: float | None
  • eigen_residual: float
  • condition_number: float
  • series_terms: int
  • status: str
  • metadata: Mapping[str, Any]
  • current_pedestal: float
  • pressure_pedestal: float
  • bootstrap_fraction: float
  • mach_number: float
  • adiabatic_index: float | None

MillerFitResult

class source
MillerFitResult(surface: MillerSurface, contour: Contour, reconstructed: Contour, rms_error: float, normalized_rms_error: float, max_error: float, hausdorff_distance: float, converged: bool, accepted: bool, reason: str | None, provenance: DerivationProvenance) -> None

Also exported as vaft.data.MillerFitResult.

11 fields
  • surface: MillerSurface
  • contour: Contour
  • reconstructed: Contour
  • rms_error: float
  • normalized_rms_error: float
  • max_error: float
  • hausdorff_distance: float
  • converged: bool
  • accepted: bool
  • reason: str | None
  • provenance: DerivationProvenance

MillerSequenceResult

class source
MillerSequenceResult(fits: tuple[MillerFitResult, ...], derivative_reason: str | None = None, provenance: DerivationProvenance | None = None) -> None

Also exported as vaft.data.MillerSequenceResult.

3 fields
  • fits: tuple[MillerFitResult, ...]
  • derivative_reason: str | None
  • provenance: DerivationProvenance | None

MillerSurface

class source
MillerSurface(r: float, r0: float, z0: float, kappa: float, delta: float, zeta: float = 0.0, radial_value: float | None = None, radial_coordinate: str = 'psi_n', d_r0_dr: float | None = None, d_kappa_dr: float | None = None, d_delta_dr: float | None = None, q: float | None = None, magnetic_shear: float | None = None, alpha: float | None = None, indentation: float = 0.0) -> None

Also exported as vaft.data.MillerSurface.

15 fields
  • r: float
  • r0: float
  • z0: float
  • kappa: float
  • delta: float
  • zeta: float
  • radial_value: float | None
  • radial_coordinate: str
  • d_r0_dr: float | None
  • d_kappa_dr: float | None
  • d_delta_dr: float | None
  • q: float | None
  • magnetic_shear: float | None
  • alpha: float | None
  • indentation: float

MXHChebyshevRepresentation

class source
MXHChebyshevRepresentation(r0: float, z0: float, harmonics: int, radial_order: int, profiles: Mapping[str, tuple[float, tuple[float, ...]]], parameter_count: int, metrics: Mapping[str, float], status: str, reason: str | None, provenance: DerivationProvenance) -> None

Flux surfaces as MXH shapes with shifted-Chebyshev radial profiles (Xie & Li 2026; #1166).

Also exported as vaft.data.MXHChebyshevRepresentation.

10 fields
  • r0: float
  • z0: float
  • harmonics: int
  • radial_order: int
  • profiles: Mapping[str, tuple[float, tuple[float, ...]]]
  • parameter_count: int
  • metrics: Mapping[str, float]
  • status: str
  • reason: str | None
  • provenance: DerivationProvenance

SOLOVEV_BASIS_SIZES

data
SOLOVEV_BASIS_SIZES = <builtins.dict>

SOLOVEV_CONSTRAINT_KINDS

data
SOLOVEV_CONSTRAINT_KINDS = ('psi', 'dpsi_dr', 'dpsi_dz', 'd2psi_dr2', 'd2psi_dz2', 'd2psi_drdz')

SolovevConstraint

class source
SolovevConstraint(r: float, z: float, kind: str, value: float, combination: tuple[tuple[str, float], ...] = ()) -> None

One linear condition on psi at a point: kind of psi equals value.

Also exported as vaft.data.SolovevConstraint.

5 fields
  • r: float
  • z: float
  • kind: str
  • value: float
  • combination: tuple[tuple[str, float], ...]

SolovevEquilibrium

class source
SolovevEquilibrium(coefficients: np.ndarray, pprime: float, ffprime: float, rref: float, psi_boundary: float = 0.0, pressure_boundary: float = 0.0, f_boundary: float = 1.0, f_sign: int | None = None, rank: int | None = None, residual_norm: float | None = None, metadata: Mapping[str, Any] = <factory>, basis: str = 'classic') -> None

Also exported as vaft.data.SolovevEquilibrium.

12 fields
  • coefficients: np.ndarray
  • pprime: float
  • ffprime: float
  • rref: float
  • psi_boundary: float
  • pressure_boundary: float
  • f_boundary: float
  • f_sign: int | None
  • rank: int | None
  • residual_norm: float | None
  • metadata: Mapping[str, Any]
  • basis: str

SolovevFit

class source
SolovevFit(model: 'SolovevEquilibrium | None', metrics: Mapping[str, Any], status: str, reason: str | None, provenance: DerivationProvenance) -> None

A Solov’ev model fitted to an existing equilibrium, with its fidelity (#1166).

Also exported as vaft.data.SolovevFit.

5 fields
  • model: 'SolovevEquilibrium | None'
  • metrics: Mapping[str, Any]
  • status: str
  • reason: str | None
  • provenance: DerivationProvenance

StationaryPoint

class source
StationaryPoint(r: float, z: float, psi: float, psi_n: float, kind: str, hessian_determinant: float, curvature: float = 0.0) -> None

A point where grad(psi) vanishes, classified by its Hessian.

Also exported as vaft.data.StationaryPoint.

7 fields
  • r: float
  • z: float
  • psi: float
  • psi_n: float
  • kind: str
  • hessian_determinant: float
  • curvature: float

StrikePoint

class source
StrikePoint(r: float, z: float, branch: str, flux_expansion: DerivedValue, incidence_angle: DerivedValue) -> None

Also exported as vaft.data.StrikePoint.

5 fields
  • r: float
  • z: float
  • branch: str
  • flux_expansion: DerivedValue
  • incidence_angle: DerivedValue

Topology

class source

How the last closed flux surface is bounded.

Also exported as vaft.data.Topology.

6 fields · 3 members
  • LIMITED: 'limited'
  • LOWER_SINGLE_NULL: 'lower_single_null'
  • UPPER_SINGLE_NULL: 'upper_single_null'
  • DOUBLE_NULL: 'double_null'
  • DIVERTED: 'diverted'
  • AMBIGUOUS: 'ambiguous'
  • is_diverted property — True when a boundary-relevant X-point was identified. source
  • is_limited property source
  • is_determinate property source

XPoint

class source
XPoint(r: float, z: float, psi: float, psi_n: float, active: bool, hessian_determinant: float) -> None

Also exported as vaft.data.XPoint.

6 fields
  • r: float
  • z: float
  • psi: float
  • psi_n: float
  • active: bool
  • hessian_determinant: float

vaft.data.equilibrium_kinetic_iteration

Records for the self-consistent equilibrium / kinetic-profile iteration (#123).

CLOSURE_MODES

data
CLOSURE_MODES = ('equilibrium_pressure', 'kinetic_pressure')

ConvergenceCriteria

class source
ConvergenceCriteria(pressure_rtol: float | None = 0.001, profile_rtol: float | None = 0.001, q_rtol: float | None = 0.001, coordinate_atol: float | None = 0.001, scalar_rtol: float | None = 0.001, axis_atol: float | None = 0.0001, normalization_rtol: float = 0.001, boundary_rtol: float = 0.01, max_iterations: int = 10, relaxation: float = 1.0, divergence_window: int = 2, oscillation_window: int = 4, oscillation_ratio: float = 0.9, stagnation_window: int = 3, stagnation_ratio: float = 0.95, monotone_rtol: float = 1e-06) -> None

Tolerances, the iteration cap and the failure detectors.

Also exported as vaft.data.ConvergenceCriteria.

16 fields · 1 members
  • pressure_rtol: float | None
  • profile_rtol: float | None
  • q_rtol: float | None
  • coordinate_atol: float | None
  • scalar_rtol: float | None
  • axis_atol: float | None
  • normalization_rtol: float
  • boundary_rtol: float
  • max_iterations: int
  • relaxation: float
  • divergence_window: int
  • oscillation_window: int
  • oscillation_ratio: float
  • stagnation_window: int
  • stagnation_ratio: float
  • monotone_rtol: float
  • enabled method — The enabled tolerances by name [-, m for axis_atol]. source

CURRENT_NORMALIZATIONS

data
CURRENT_NORMALIZATIONS = <builtins.mappingproxy>

CURRENT_POLICIES

data
CURRENT_POLICIES = ('preserve_ffprime_shape', 'analytic_ffprime_shape')

CurrentPolicy

class source
CurrentPolicy(kind: str = 'preserve_ffprime_shape', normalization: str = 'plasma_current', current_profile: AnalyticProfile | None = None) -> None

The non-pressure source of the next CHEASE solve, and its normalization.

Also exported as vaft.data.CurrentPolicy.

3 fields · 2 members
  • kind: str
  • normalization: str
  • current_profile: AnalyticProfile | None
  • ncscal property — CHEASE’s NCSCAL for the normalization [-]. source
  • describe method — What the policy holds and what it leaves to CHEASE, in words [-]. source

CurrentSource

class source
CurrentSource(psi_norm: np.ndarray, shape: np.ndarray, amplitude: float, ffprime: np.ndarray, method: str) -> None

The FF' handed to CHEASE for one update, and how it was built.

Also exported as vaft.data.CurrentSource.

5 fields
  • psi_norm: np.ndarray
  • shape: np.ndarray
  • amplitude: float
  • ffprime: np.ndarray
  • method: str

EquilibriumKineticSpec

class source
EquilibriumKineticSpec(kinetic: SyntheticKineticSpec, closure: str = 'kinetic_pressure', current_policy: CurrentPolicy = <factory>, convergence: ConvergenceCriteria = <factory>, label: str = 'self-consistent') -> None

What the self-consistent iteration is told, separate from the equilibrium.

Also exported as vaft.data.EquilibriumKineticSpec.

5 fields
  • kinetic: SyntheticKineticSpec
  • closure: str
  • current_policy: CurrentPolicy
  • convergence: ConvergenceCriteria
  • label: str

ITERATION_STATUSES

data
ITERATION_STATUSES = ('converged', 'max_iterations', 'diverged', 'oscillating', 'stagnated', 'drifting', 'kinetic_generation_failed', 'inv...

IterationState

class source
IterationState(index: int, status: str, message: str, equilibrium: Any = None, geqdsk_path: Path | None = None, kinetic: SyntheticKineticProfiles | None = None, psi_norm: np.ndarray | None = None, p_eq: np.ndarray | None = None, p_kin: np.ndarray | None = None, q: np.ndarray | None = None, rho_tor_norm: np.ndarray | None = None, scalars: Mapping[str, float] = <factory>, metrics: Mapping[str, float] = <factory>, validation: Mapping[str, Any] = <factory>, pressure_source: PressureSource | None = None, current_source: CurrentSource | None = None, chease_workdir: Path | None = None, chease_inputs: Mapping[str, Any] = <factory>, rational_surfaces: Mapping[str, float] = <factory>) -> None

One immutable state of the iteration.

Also exported as vaft.data.IterationState.

19 fields · 1 members
  • index: int
  • status: str
  • message: str
  • equilibrium: Any
  • geqdsk_path: Path | None
  • kinetic: SyntheticKineticProfiles | None
  • psi_norm: np.ndarray | None
  • p_eq: np.ndarray | None
  • p_kin: np.ndarray | None
  • q: np.ndarray | None
  • rho_tor_norm: np.ndarray | None
  • scalars: Mapping[str, float]
  • metrics: Mapping[str, float]
  • validation: Mapping[str, Any]
  • pressure_source: PressureSource | None
  • current_source: CurrentSource | None
  • chease_workdir: Path | None
  • chease_inputs: Mapping[str, Any]
  • rational_surfaces: Mapping[str, float]
  • accepted property — Whether this state is a usable equilibrium / kinetic pair [-]. source

PressureSource

class source
PressureSource(kinetic_psi_norm: np.ndarray, raw_pressure: np.ndarray, relaxed_pressure: np.ndarray, relaxation: float, psi_norm: np.ndarray, pressure: np.ndarray, dpressure_dpsi_norm: np.ndarray, pprime: np.ndarray, psi_span: float, method: str, rise_max_relative: float = 0.0, rise_points_removed: int = 0) -> None

The pressure handed to CHEASE for one update, and how it was built.

Also exported as vaft.data.PressureSource.

12 fields
  • kinetic_psi_norm: np.ndarray
  • raw_pressure: np.ndarray
  • relaxed_pressure: np.ndarray
  • relaxation: float
  • psi_norm: np.ndarray
  • pressure: np.ndarray
  • dpressure_dpsi_norm: np.ndarray
  • pprime: np.ndarray
  • psi_span: float
  • method: str
  • rise_max_relative: float
  • rise_points_removed: int

SelfConsistentState

class source
SelfConsistentState(spec: EquilibriumKineticSpec, status: str, message: str, initial: IterationState, iterations: tuple[IterationState, ...], final: IterationState | None, ods: Any, policy: Mapping[str, Any], provenance: Mapping[str, Any], baseline: IterationState | None = None) -> None

The result of the equilibrium / kinetic iteration: every state, and the final ODS.

Also exported as vaft.data.SelfConsistentState.

10 fields · 12 members
  • spec: EquilibriumKineticSpec
  • status: str
  • message: str
  • initial: IterationState
  • iterations: tuple[IterationState, ...]
  • final: IterationState | None
  • ods: Any
  • policy: Mapping[str, Any]
  • provenance: Mapping[str, Any]
  • baseline: IterationState | None
  • converged property — Whether every enabled criterion was met [-]. source
  • states property — The initial state followed by every iteration [-]. source
  • initial_equilibrium property — The g-file object the iteration started from [-]. source
  • final_equilibrium property — The final accepted state’s g-file object, None when there is none [-]. source
  • final_core_profiles property — The final accepted state’s kinetic profiles [-]. source
  • history method — One metric or scalar per state, NaN where a state lacks it [-]. source
  • convergence_history property — Every metric recorded on any state, one value per state [-]. source
  • pressure_residuals property — The p_kin - p_eq residuals per state [-]. source
  • profile_residuals property — The per-channel changes since the previous state [-]. source
  • coordinate_mapping_history property — rho_tor_norm on the kinetic grid, per state [-]. source
  • validation property — Each state’s validation record [-]. source
  • assumption_table method — (quantity, role) rows: held, recomputed from the kinetic state, by CHEASE, a control or a metric [-]. source

STATE_STATUSES

data
STATE_STATUSES = ('initial', 'accepted', 'kinetic_generation_failed', 'invalid_pressure_source', 'chease_failed', 'validation_failed')

vaft.data.flare_products

Reading FLARE’s ASCII products.

FlareBoundary

class source
FlareBoundary(contours: tuple[np.ndarray, ...], units: str, source: Path) -> None

The axisymmetric surfaces of a FLARE model boundary, in metres.

3 fields · 1 members
  • contours: tuple[np.ndarray, ...]
  • units: str
  • source: Path
  • points property — The one contour, when the model has exactly one (N, 2) [m]. source

FlareColumn

class source
FlareColumn(index: int, name: str, label: str = '', units: str = '') -> None

One column of a FLARE product, as its header described it.

4 fields
  • index: int
  • name: str
  • label: str
  • units: str

FlareGrid

class source
FlareGrid(kind: str | None, header: Mapping[str, str], rows: tuple[np.ndarray, ...], source: Path) -> None

One FLARE mesh file.

4 fields · 2 members
  • kind: str | None
  • header: Mapping[str, str]
  • rows: tuple[np.ndarray, ...]
  • source: Path
  • values property — The rows as one array, when every row is the same width. source
  • nodes property — The # NODES shape, empty when the file does not declare one. source

FlareMesh

class source
FlareMesh(kind: str, u: np.ndarray, v: np.ndarray, u_label: str, v_label: str, r: np.ndarray, z: np.ndarray, phi_deg: np.ndarray, length_units: str, angle_units: str, source: Path) -> None

A FLARE mesh with every node placed in (R, z, phi).

11 fields · 3 members
  • kind: str
  • u: np.ndarray
  • v: np.ndarray
  • u_label: str
  • v_label: str
  • r: np.ndarray
  • z: np.ndarray
  • phi_deg: np.ndarray
  • length_units: str
  • angle_units: str
  • source: Path
  • node_shape property — (n_v, n_u) – the shape a node-centred dataset reshapes to. source
  • cell_shape property — (n_v - 1, n_u - 1) – the shape a cell-centred dataset reshapes to. source
  • toroidally_swept property — Whether the mesh spans a toroidal range rather than one plane. source

FlareProduct

class source
FlareProduct(kind: str | None, header: Mapping[str, str], columns: tuple[FlareColumn, ...], values: np.ndarray, source: Path, grid: FlareGrid | None = None) -> None

One FLARE data file: what it says it is, and its numbers.

6 fields · 6 members
  • kind: str | None
  • header: Mapping[str, str]
  • columns: tuple[FlareColumn, ...]
  • values: np.ndarray
  • source: Path
  • grid: FlareGrid | None
  • geometry property — The mesh file this references, empty when it stands alone. source
  • grid_shape property — The shape one of this product’s columns takes on the mesh it names. source
  • cell_centred property — Whether the values sit on cells rather than nodes. source
  • mesh property — The mesh this product names, with every node placed in (R, z, phi). source
  • on_mesh method — One column laid out on the mesh, as values[i_v, i_u]. source
  • column method — One column by the name its header gave it. source

read_flare_boundary

function source
read_flare_boundary(path: str | Path) -> FlareBoundary

Read a FLARE model’s axisymmetric boundary, converted to metres.

read_flare_grid

function source
read_flare_grid(path: str | Path) -> FlareGrid

Read one FLARE mesh file.

read_flare_mesh

function source
read_flare_mesh(grid: FlareGrid) -> FlareMesh

Interpret one FLARE mesh: its axes, and where its nodes sit.

read_flare_product

function source
read_flare_product(path: str | Path, *, load_grid: bool = True) -> FlareProduct

Read one FLARE data file, and the mesh it names.

RECTANGULAR_MESHES

data
RECTANGULAR_MESHES = ('rmesh', 'rmesh3d', 'tpzmesh3d')

resolve_geometry

function source
resolve_geometry(product: FlareProduct) -> Path | None

Where a product’s # GEOMETRY mesh would be, beside the product.

vaft.data.keqdsk

Standalone parser for EFIT k-file Fortran namelists.

KEQDSK

class source
KEQDSK(namelists: Mapping[str, Mapping[str, Any]], source: Path | None = None) -> None

Parsed EFIT k-file, retaining every submitted namelist value.

Also exported as vaft.data.KEQDSK.

2 fields · 1 members
  • namelists: Mapping[str, Mapping[str, Any]]
  • source: Path | None
  • to_omas method — Store the exact submitted namelists as equilibrium code parameters. source

read_keqdsk

function source
read_keqdsk(path: str | Path) -> KEQDSK

Read all namelists from an EFIT k-file using Fortran semantics.

Also exported as vaft.data.read_keqdsk.

write_namelists_to_ods

function source
write_namelists_to_ods(ods: Any, namelists: Mapping[str, Mapping[str, Any]], *, time_index: int = 0) -> Any

Write parsed Fortran namelists to equilibrium.code.parameters.

vaft.data.kinetic_profiles

Kinetic profiles as a file-format container, and GPEC .kin I/O.

KIN_COLUMNS

data
KIN_COLUMNS = ('psi_norm', 'n_i', 'n_e', 'T_i', 'T_e', 'omega_exb')

KIN_HEADER

data
KIN_HEADER = '             psi         ni(m^-3)         ne(m^-3)           ti(eV)           te(eV)      wexb(rad/s)'

KINETIC_UNITS

data
KINETIC_UNITS = <builtins.dict>

KineticProfiles

class source
KineticProfiles(psi_norm: np.ndarray, n_e: np.ndarray | None = None, n_i: np.ndarray | None = None, n_z: np.ndarray | None = None, n_fast: np.ndarray | None = None, T_e: np.ndarray | None = None, T_i: np.ndarray | None = None, T_z: np.ndarray | None = None, omega_tor: np.ndarray | None = None, omega_exb: np.ndarray | None = None, omega_pol: np.ndarray | None = None, p_total: np.ndarray | None = None, p_fast: np.ndarray | None = None, e_radial: np.ndarray | None = None, normalization: PsiNormalization = <factory>, species: tuple[Species, ...] = (), extras: Mapping[str, np.ndarray] = <factory>, provenance: Mapping[str, str] = <factory>, source: str = '') -> None

Kinetic profiles on one radial coordinate, in the container’s units.

Also exported as vaft.data.KineticProfiles.

19 fields · 3 members
  • psi_norm: np.ndarray
  • n_e: np.ndarray | None
  • n_i: np.ndarray | None
  • n_z: np.ndarray | None
  • n_fast: np.ndarray | None
  • T_e: np.ndarray | None
  • T_i: np.ndarray | None
  • T_z: np.ndarray | None
  • omega_tor: np.ndarray | None
  • omega_exb: np.ndarray | None
  • omega_pol: np.ndarray | None
  • p_total: np.ndarray | None
  • p_fast: np.ndarray | None
  • e_radial: np.ndarray | None
  • normalization: PsiNormalization
  • species: tuple[Species, ...]
  • extras: Mapping[str, np.ndarray]
  • provenance: Mapping[str, str]
  • source: str
  • available method — Names of the profile fields this set actually carries. source
  • field method — One profile by name, from a field or from extras. source
  • unit method — The container’s unit for name; "" for an extra. source

normalize_psi

function source
normalize_psi(profiles: KineticProfiles, *, method: str, axis: float | None = None, edge: float | None = None) -> KineticProfiles

Rescale the radial coordinate, explicitly, recording that it happened.

Also exported as vaft.data.normalize_psi.

PROFILE_FIELDS

data
PROFILE_FIELDS = ('n_e', 'n_i', 'n_z', 'n_fast', 'T_e', 'T_i', 'T_z', 'omega_tor', 'omega_exb', 'omega_pol', 'p_total', 'p_fast', 'e_r...

PsiNormalization

class source
PsiNormalization(method: str = 'as_read', source: str = '', axis_value: float | None = None, edge_value: float | None = None) -> None

How a profile set’s radial coordinate came to be what it is.

Also exported as vaft.data.PsiNormalization.

4 fields
  • method: str
  • source: str
  • axis_value: float | None
  • edge_value: float | None

read_kin

function source
read_kin(path: str | Path) -> KineticProfiles

Read a GPEC .kin file.

Also exported as vaft.data.read_kin.

Species

class source
Species(label: str, n: float, z: float, a: float) -> None

One ion species from a pfile’s N Z A block.

Also exported as vaft.data.Species.

4 fields
  • label: str
  • n: float
  • z: float
  • a: float

write_kin

function source
write_kin(profiles: KineticProfiles, path: str | Path, *, header: bool = True, allow_zero_rotation: bool = False) -> Path

Write a GPEC .kin file.

Also exported as vaft.data.write_kin.

vaft.data.mars_profiles

MARS profile inputs: one quantity per file, in SI, on MARS’s own coordinate.

MARS_FIELD_FILES

data
MARS_FIELD_FILES = <builtins.dict>

MARS_PROFILE_FILES

data
MARS_PROFILE_FILES = <builtins.dict>

MARS_PROFILE_LABELS

data
MARS_PROFILE_LABELS = <builtins.dict>

MARS_RADIAL_VARIABLES

data
MARS_RADIAL_VARIABLES = <builtins.dict>

MarsProfile

class source
MarsProfile(coordinate: np.ndarray, values: np.ndarray, irad: int = 1, source: str = '') -> None

One PROF*.IN: an abscissa and one quantity, as written.

Also exported as vaft.data.MarsProfile.

4 fields · 2 members
  • coordinate: np.ndarray
  • values: np.ndarray
  • irad: int
  • source: str
  • radial_variable property — What coordinate is, in words. source
  • psi_norm method — The coordinate as normalised poloidal flux. source

MarsProfileFormatError

class source

The file is not shaped like a MARS profile input.

Also exported as vaft.data.MarsProfileFormatError.

read_mars_profile

function source
read_mars_profile(path: str | Path) -> MarsProfile

Read one PROF*.IN, in the file’s own coordinate and units.

Also exported as vaft.data.read_mars_profile.

read_mars_profiles

function source
read_mars_profiles(directory: str | Path) -> KineticProfiles

Read a directory of PROF*.IN into the kinetic-profile container.

Also exported as vaft.data.read_mars_profiles.

write_mars_profile

function source
write_mars_profile(profile: MarsProfile, path: str | Path) -> Path

Write one PROF*.IN, in the coordinate the profile already carries.

Also exported as vaft.data.write_mars_profile.

write_mars_profiles

function source
write_mars_profiles(profiles: KineticProfiles, directory: str | Path, *, include_extras: bool = True) -> tuple[Path, ...]

Write the PROF*.IN files a profile set can fill.

Also exported as vaft.data.write_mars_profiles.

vaft.data.meqdsk

Standalone parser and OMAS mapping for current EFIT NetCDF m-files.

EFIT_K_TO_M_TRANSFORMS

data
EFIT_K_TO_M_TRANSFORMS = <builtins.dict>

EFIT_MAPPING_SOURCE_REVISION

data
EFIT_MAPPING_SOURCE_REVISION = '4d10ed592f8c9d295d393d0cf331f2d8f6be3034'

MEQDSK

class source
MEQDSK(variables: Mapping[str, MVariable], dimensions: Mapping[str, int | None], attributes: Mapping[str, Any], source: Path | None = None) -> None

Parsed EFIT m-file with native variables and NetCDF metadata.

Also exported as vaft.data.MEQDSK.

4 fields · 2 members
  • variables: Mapping[str, MVariable]
  • dimensions: Mapping[str, int | None]
  • attributes: Mapping[str, Any]
  • source: Path | None
  • time_seconds method — Return embedded EFIT time in seconds (write_m.F90 stores msec). source
  • to_omas method — Map current EFIT m-file output to schema-native equilibrium fields. source

MVariable

class source
MVariable(data: np.ndarray, dimensions: tuple[str, ...] = (), attributes: Mapping[str, Any] | None = None) -> None
3 fields
  • data: np.ndarray
  • dimensions: tuple[str, ...]
  • attributes: Mapping[str, Any] | None

read_meqdsk

function source
read_meqdsk(path: str | Path) -> MEQDSK

Read a NetCDF m-file emitted by the current EFIT write_m.F90.

Also exported as vaft.data.read_meqdsk.

vaft.data.open_adas

Small, dependency-free OPEN-ADAS ADF11 client used by VAFT.

ADASDataError

class source

Base exception for OPEN-ADAS lookup and ADF11 data failures.

ADASDownloadError

class source

Raised when an ADF11 file cannot be downloaded.

ADF11Data

class source
ADF11Data(path: Path, file_type: str, log_density_cm3: np.ndarray, log_temperature_eV: np.ndarray, log_coefficients: np.ndarray, z1: np.ndarray, metastables: np.ndarray) -> None

Parsed unresolved ADF11 coefficient table in native log10 units.

7 fields · 1 members
  • path: Path
  • file_type: str
  • log_density_cm3: np.ndarray
  • log_temperature_eV: np.ndarray
  • log_coefficients: np.ndarray
  • z1: np.ndarray
  • metastables: np.ndarray
  • n_charge_states property source

ADF11FormatError

class source

Raised when an ADF11 file is malformed or inconsistent.

default_adf11_files

function source
default_adf11_files(species: str) -> dict[str, str]

Return VAFT’s default acd, scd and plt files for species.

get_adf11_path

function source
get_adf11_path(filename: str, cache_dir: str | os.PathLike[str] | None = None, *, timeout: float = 30.0) -> Path

Locate filename in the VAFT cache, downloading it from OPEN-ADAS if absent.

OPEN_ADAS_DOWNLOAD_URL

data
OPEN_ADAS_DOWNLOAD_URL = 'https://open.adas.ac.uk/download/adf11'

read_adf11

function source
read_adf11(path: str | os.PathLike[str]) -> ADF11Data

Parse an unresolved ADF11 file and return its native log10 coefficient table.

vaft.data.pfile

The Osborne pfile: a native transcript, and its conversion.

kinetic_profiles_from_pfile

function source
kinetic_profiles_from_pfile(pfile: PFile) -> KineticProfiles

Convert a pfile into the kinetic-profile container.

Also exported as vaft.data.kinetic_profiles_from_pfile.

PFile

class source
PFile(psi_norm: np.ndarray, sections: tuple[PFileSection, ...] = (), species: tuple[Species, ...] = (), source: str = '') -> None

One Osborne pfile as it was written: sections in order, units as declared.

Also exported as vaft.data.PFile.

4 fields · 3 members
  • psi_norm: np.ndarray
  • sections: tuple[PFileSection, ...]
  • species: tuple[Species, ...]
  • source: str
  • keys method — The section names, in file order. source
  • section method — One section by its pfile name. source
  • unit method — The unit the file declares for key. source

PFILE_LABELS

data
PFILE_LABELS = <builtins.dict>

PFILE_SECTION_ORDER

data
PFILE_SECTION_ORDER = ('ne', 'ni', 'nz1', 'nb', 'te', 'ti', 'ptot', 'pb', 'omeg', 'omegp', 'omgvb', 'omgpp', 'omgeb', 'er', 'ommvb', 'ommpp...

PFILE_TO_CONTAINER

data
PFILE_TO_CONTAINER = <builtins.dict>

PFILE_UNIT_LADDER

data
PFILE_UNIT_LADDER = <builtins.dict>

PFILE_UNITS

data
PFILE_UNITS = <builtins.dict>

PFileFormatError

class source

The file is not shaped like an Osborne pfile.

Also exported as vaft.data.PFileFormatError.

PFileSection

class source
PFileSection(key: str, unit: str, psi_norm: np.ndarray, values: np.ndarray, derivative: np.ndarray | None = None) -> None

One block of a pfile, in the file’s own units.

Also exported as vaft.data.PFileSection.

5 fields · 1 members
  • key: str
  • unit: str
  • psi_norm: np.ndarray
  • values: np.ndarray
  • derivative: np.ndarray | None
  • label property — What the quantity is, or "" for a section not catalogued here. source

read_pfile

function source
read_pfile(path: str | Path) -> PFile

Read an Osborne pfile.

Also exported as vaft.data.read_pfile.

write_pfile

function source
write_pfile(pfile: PFile, path: str | Path, *, recompute_derivatives: bool = False) -> Path

Write an Osborne pfile.

Also exported as vaft.data.write_pfile.

vaft.data.public

Public multi-machine databases mapped into common VAFT semantics (#1205).

ChecksumError

class source

The file does not match the SHA-256 pinned for its release.

CONFINEMENT_COLUMNS

data
CONFINEMENT_COLUMNS = <builtins.dict>

fetch_source

function source
fetch_source(key: str, *, cache: str | os.PathLike[str] | None = None, timeout: float = 120.0) -> Path

Fetch a registered public database file by its SOURCES key.

FetchError

class source

The upstream host could not deliver the file (network or HTTP failure).

MHD_STATE_COLUMNS

data
MHD_STATE_COLUMNS = <builtins.dict>

OPTIONAL_CONFINEMENT_COLUMNS

data
OPTIONAL_CONFINEMENT_COLUMNS = ('w_global_J', 'tau_e_global_s', 'w_global_definition', 'tau_e_global_definition')

PR08_MACHINES

data
PR08_MACHINES = <builtins.dict>

PROVENANCE_KINDS

data
PROVENANCE_KINDS = ('source_direct', 'source_corrected', 'equilibrium_derived', 'deterministic_derived', 'model_imputed', 'source_invali...

SOURCES

data
SOURCES = <builtins.dict>

TRANSITION_COLUMNS

data
TRANSITION_COLUMNS = <builtins.dict>

vaft.data.public.analysis

Scaling predictions and coverage on the canonical confinement table.

confinement_coverage

function source
confinement_coverage(table: pd.DataFrame, columns: tuple[str, ...] = ('i_p_A', 'b_t_T', 'n_e_line_avg_m3', 'p_loss_W', 'tau_e_th_s', 'r_geo_m', 'epsilon', 'kappa', 'kappa_area', 'delta',..., *, by: str = 'machine') -> pd.DataFrame

Count finite values per column and group.

Also exported as vaft.data.public.confinement_coverage.

h_factor

function source
h_factor(table: pd.DataFrame, scaling: str = 'H98y2', *, kappa_column: str = 'kappa_area', thermal_as_global=False) -> pd.Series

Confinement enhancement factor tau_observed / tau_scaling per row, on the scaling’s energy basis.

Also exported as vaft.data.public.h_factor.

predict_confinement_time

function source
predict_confinement_time(table: pd.DataFrame, scaling: str = 'H98y2', *, kappa_column: str = 'kappa_area') -> pd.Series

Scaling-law thermal confinement time for every row of a confinement table.

Also exported as vaft.data.public.predict_confinement_time.

SCALING_INPUTS

data
SCALING_INPUTS = <builtins.dict>

transition_margin

function source
transition_margin(table: pd.DataFrame) -> pd.Series

Loss power over the record’s scaling threshold, p_loss_W / p_lh_scaling_W.

Also exported as vaft.data.public.transition_margin.

vaft.data.public.itpa_hmode

ITPA global H-mode confinement database (DB5.2.3) reader and normaliser.

DB5_COLUMN_MAP

data
DB5_COLUMN_MAP = <builtins.dict>

DB5_DEFINITIONS

data
DB5_DEFINITIONS = <builtins.dict>

normalize_db5

function source
normalize_db5(raw: pd.DataFrame, *, release: str = 'DB5.2.3') -> pd.DataFrame

Map a raw DB5.2.3 table into the canonical confinement table.

Also exported as vaft.data.public.normalize_db5.

read_db5

function source
read_db5(path: str | os.PathLike[str] | None = None, *, cache: str | os.PathLike[str] | None = None) -> pd.DataFrame

Read the raw DB5.2.3 CSV with its original column names.

Also exported as vaft.data.public.read_db5.

vaft.data.public.itpa_profile

ITPA International Multi-Tokamak Confinement Profile Database (PR08) reader and ODS mapping.

fetch_pr08

function source
fetch_pr08(machine: str, shot, *, cache: str | os.PathLike[str] | None = None, sha256: dict[str, str] | None = None, allow_unpinned: bool = False, timeout: float = 120.0) -> Pr08Discharge

Download one PR08 discharge (checksum-verified) and read it.

Also exported as vaft.data.public.fetch_pr08.

PR08_BASE_URL

data
PR08_BASE_URL = 'https://tokamak-profiledb.ccfe.ac.uk/PR08/itpa_pr08'

pr08_mapping_coverage

function source
pr08_mapping_coverage(discharge: Pr08Discharge) -> pd.DataFrame

Which PR08 variables reached the ODS, where, and why the others did not.

Also exported as vaft.data.public.pr08_mapping_coverage.

PR08_PINNED

data
PR08_PINNED = <builtins.dict>

PR08_REFERENCE

data
PR08_REFERENCE = "D. Boucher et al., 'The International Multi-Tokamak Profile Database', Nucl. Fusion 40 (2000) 1955, doi:10.1088/0029...

pr08_to_omas

function source
pr08_to_omas(discharge: Pr08Discharge, ods=None)

Map a PR08 discharge into an ODS, without interpolation or invented data.

Also exported as vaft.data.public.pr08_to_omas.

Pr08Discharge

class source
Pr08Discharge(machine: str, shot: str, zero_d: pd.DataFrame, one_d: dict[str, UFileSignal], two_d: dict[str, UFileSignal], comments: str = '', files: dict[str, str] = <factory>, verification: dict[str, str] = <factory>) -> None

One PR08 discharge, as released.

8 fields
  • machine: str
  • shot: str
  • zero_d: pd.DataFrame
  • one_d: dict[str, UFileSignal]
  • two_d: dict[str, UFileSignal]
  • comments: str
  • files: dict[str, str]
  • verification: dict[str, str]

read_pr08

function source
read_pr08(directory: str | os.PathLike[str], machine: str, shot) -> Pr08Discharge

Read one PR08 discharge from a local directory.

Also exported as vaft.data.public.read_pr08.

read_pr08_0d

function source
read_pr08_0d(path: str | os.PathLike[str]) -> pd.DataFrame

Read a PR08 _0d.dat file, CSV or fixed-width.

read_ufiles

function source
read_ufiles(path: str | os.PathLike[str]) -> dict[str, UFileSignal]

Read a file of concatenated ASCII UFILEs (PR08 _1d / _2d files).

UFileSignal

class source
UFileSignal(name: str, unit: str, time: np.ndarray, values: np.ndarray, rho: np.ndarray | None = None, comment: str = '') -> None

One UFILE block, in the file’s own names and units.

6 fields
  • name: str
  • unit: str
  • time: np.ndarray
  • values: np.ndarray
  • rho: np.ndarray | None
  • comment: str

vaft.data.public.itpa_tc26

ITPA TC-26 metal-wall L-H threshold database reader and normaliser.

normalize_tc26

function source
normalize_tc26(raw: pd.DataFrame, *, release: str | None = None) -> pd.DataFrame

Map a raw TC-26 table into the canonical transition table.

Also exported as vaft.data.public.normalize_tc26.

read_tc26

function source
read_tc26(path: str | os.PathLike[str]) -> pd.DataFrame

Read the TC-26 CSV with its original column names, missing markers resolved.

Also exported as vaft.data.public.read_tc26.

TC26_DEFINITIONS

data
TC26_DEFINITIONS = <builtins.dict>

TC26_REFERENCE

data
TC26_REFERENCE = "E. Delabie et al., 'Empirical scaling of the L-H threshold power for metal wall tokamaks using a multi-device databa...

TC26_SHA256

data
TC26_SHA256 = 'b900e13fcb7973ae9b85f4df5264e65cc19ed3bef026076739331e3868878582'

vaft.data.public.pr08_mhd_state

PR08 global MHD states as one canonical row-oriented table (#1736).

fetch_pr08_population

function source
fetch_pr08_population(*, machines: Optional[Sequence[str]] = None, cache=None, timeout: float = 120.0) -> list

Download (checksum-verified) and read every pinned PR08 0D file.

Also exported as vaft.data.public.fetch_pr08_population.

MHD_STATE_COLUMNS

data
MHD_STATE_COLUMNS = <builtins.dict>

mhd_state_coverage

function source
mhd_state_coverage(table: pd.DataFrame) -> pd.DataFrame

States and finite values per machine and quantity.

Also exported as vaft.data.public.mhd_state_coverage.

pr08_inventory

function source
pr08_inventory(*, base_url: str = 'https://tokamak-profiledb.ccfe.ac.uk/PR08/itpa_pr08', timeout: float = 60.0) -> pd.DataFrame

Crawl the live PR08 directory index (network).

Also exported as vaft.data.public.pr08_inventory.

PR08_MACHINES

data
PR08_MACHINES = <builtins.dict>

pr08_mhd_state_table

function source
pr08_mhd_state_table(discharges: Iterable[Pr08ZeroD]) -> pd.DataFrame

The canonical global MHD-state table of PR08 discharges.

Also exported as vaft.data.public.pr08_mhd_state_table.

pr08_release_inventory

function source
pr08_release_inventory() -> pd.DataFrame

The PR08 release as pinned in this package (offline).

Also exported as vaft.data.public.pr08_release_inventory.

projection_coverage

function source
projection_coverage(table: pd.DataFrame) -> pd.DataFrame

Which registered operational-space projections each machine’s states can be drawn on.

Also exported as vaft.data.public.projection_coverage.

PROVENANCE_KINDS

data
PROVENANCE_KINDS = ('source_direct', 'source_corrected', 'equilibrium_derived', 'deterministic_derived', 'model_imputed', 'source_invali...

read_pr08_zero_d

function source
read_pr08_zero_d(path, machine_dir: str, shot: str, *, directory: Optional[str] = None) -> Pr08ZeroD

Read one local PR08 _0d.dat file for pr08_mhd_state_table.

Also exported as vaft.data.public.read_pr08_zero_d.

SOURCE_CORRECTIONS

data
SOURCE_CORRECTIONS = <builtins.dict>

UNIT_SLIP_FACTOR

data
UNIT_SLIP_FACTOR = 100.0

vaft.data.public.schema

Canonical tables shared by every public-database source.

ColumnSpec

class source
ColumnSpec(unit: str, description: str) -> None

Unit and meaning of one canonical column.

2 fields
  • unit: str
  • description: str

CONFINEMENT_COLUMNS

data
CONFINEMENT_COLUMNS = <builtins.dict>

empty_confinement_table

function source
empty_confinement_table() -> pd.DataFrame

An empty canonical confinement table with the right columns and dtypes.

Also exported as vaft.data.public.empty_confinement_table.

empty_transition_table

function source
empty_transition_table() -> pd.DataFrame

An empty canonical transition table with the right columns and dtypes.

Also exported as vaft.data.public.empty_transition_table.

make_record_id

function source
make_record_id(machine: str, shot, time_s) -> str

Canonical record identifier.

OPTIONAL_CONFINEMENT_COLUMNS

data
OPTIONAL_CONFINEMENT_COLUMNS = ('w_global_J', 'tau_e_global_s', 'w_global_definition', 'tau_e_global_definition')

TRANSITION_COLUMNS

data
TRANSITION_COLUMNS = <builtins.dict>

validate_confinement_table

function source
validate_confinement_table(table: pd.DataFrame) -> pd.DataFrame

Check a table against the canonical schema and return it column-ordered.

Also exported as vaft.data.public.validate_confinement_table.

validate_transition_table

function source
validate_transition_table(table: pd.DataFrame) -> pd.DataFrame

Check a table against the canonical transition schema.

Also exported as vaft.data.public.validate_transition_table.

vaft.data.public.tcv_lh

TCV L-H transition database (public limited dataset) reader and normaliser.

normalize_tcv_lh

function source
normalize_tcv_lh(raw: pd.DataFrame, *, release: str = 'Zenodo 14996664 (2025-03-09)') -> pd.DataFrame

Map a raw TCV L-H table into the canonical transition table.

Also exported as vaft.data.public.normalize_tcv_lh.

read_tcv_lh

function source
read_tcv_lh(path: str | os.PathLike[str] | None = None, *, cache: str | os.PathLike[str] | None = None) -> pd.DataFrame

Read the TCV lhdatabase.h5 with its original variable names.

Also exported as vaft.data.public.read_tcv_lh.

TCV_LH_DEFINITIONS

data
TCV_LH_DEFINITIONS = <builtins.dict>

vaft.data.public.vest_confinement

VEST side of the canonical confinement table.

load_vest_tier_a_confinement

function source
load_vest_tier_a_confinement(selection: str | None = 'primary', *, path=None) -> pd.DataFrame

VEST Tier A confinement rows with a measured ohmic power balance (#548).

Also exported as vaft.data.public.load_vest_tier_a_confinement.

vest_ods_to_confinement_rows

function source
vest_ods_to_confinement_rows(ods, *, effective_mass_amu: float, release: str = '') -> pd.DataFrame

Canonical confinement rows from a VEST ODS, one per equilibrium slice.

Also exported as vaft.data.public.vest_ods_to_confinement_rows.

VEST_REFERENCE_RADIUS_M

data
VEST_REFERENCE_RADIUS_M = 0.4

VEST_SUMMARY_DEFINITIONS

data
VEST_SUMMARY_DEFINITIONS = <builtins.dict>

vest_summary_to_confinement_table

function source
vest_summary_to_confinement_table(summary: pd.DataFrame, *, effective_mass_amu: float, release: str = '') -> pd.DataFrame

Convert core_profiles summary rows into the canonical confinement table.

Also exported as vaft.data.public.vest_summary_to_confinement_table.

VEST_TIER_A_BLOCK_SPLIT_SHOT

data
VEST_TIER_A_BLOCK_SPLIT_SHOT = 42000

VEST_TIER_A_SELECTIONS

data
VEST_TIER_A_SELECTIONS = <builtins.mappingproxy>

vaft.data.reference_samples

Semantic normalization and verification for paired reference samples.

semantic_sample_view

function source
semantic_sample_view(data: Any, manifest: Mapping[str, Any]) -> dict[str, Any]

Flatten an ODS and retain representation-independent semantic leaves.

sha256_file

function source
sha256_file(path: str | Path) -> str

verify_sample_artifacts

function source
verify_sample_artifacts(sample_root: str | Path, manifest: Mapping[str, Any]) -> dict[str, str]

Verify all representation checksums and return computed digests.

vaft.data.resources

Access packaged VAFT sample and fixture data.

available_samples

function source
available_samples() -> tuple[int, ...]

Return registered sample shot numbers in ascending order.

Also exported as vaft.data.available_samples.

data_path

function source
data_path(name: str = '') -> Path

Return an absolute path inside the packaged vaft/data directory.

Also exported as vaft.data.data_path.

require_repository_sample

function source
require_repository_sample(path: Path) -> Path

Return an archived sample path or explain how to obtain it.

sample

function source
sample(shot: int, representation: str = 'omas') -> Path

Return an artifact path compatible with the requested data adapter.

Also exported as vaft.data.sample.

sample_camera_visible_frame_paths

function source
sample_camera_visible_frame_paths(shot: int = 39915) -> list[tuple[float, Path]]

Return (time_s, path) pairs for packaged FAST-camera sample frames.

Also exported as vaft.data.sample_camera_visible_frame_paths.

sample_geqdsk

function source
sample_geqdsk(name: str = 'efit/g039915.00319')

Load one packaged GEQDSK sample as a vaft.data.eqdsk.GEQDSK.

Also exported as vaft.data.sample_geqdsk.

sample_manifest

function source
sample_manifest(shot: int) -> dict

Return the validated manifest for one registered reference sample.

Also exported as vaft.data.sample_manifest.

vaft.data.spectroscopy

Spectral-line identity: what a line is, and the IMAS processed_line.label codec.

describe_available

function source
describe_available(labels: Iterable[str]) -> str

Name the semantic choices a set of stored labels offers.

Also exported as vaft.spectroscopy.describe_available (deprecated).

matches

function source
matches(term: SpectralLineIdentity, identity: SpectralLineIdentity) -> bool

Whether a parsed selector selects a parsed line.

Also exported as vaft.spectroscopy.matches (deprecated).

parse_emission_term

function source
parse_emission_term(term: Any) -> SpectralLineIdentity | None

Resolve a user-facing emission= term to a selector identity.

Also exported as vaft.spectroscopy.parse_emission_term (deprecated).

parse_line_label

function source
parse_line_label(label: Any) -> SpectralLineIdentity | None

Parse a stored processed_line.label into an identity.

Also exported as vaft.spectroscopy.parse_line_label (deprecated).

SERIES_NAMES

data
SERIES_NAMES = ('alpha', 'beta', 'gamma', 'delta', 'epsilon')

Also exported as vaft.spectroscopy.SERIES_NAMES (deprecated).

SpectralLineIdentity

class source
SpectralLineIdentity(species: AtomicSpecies, series: str | None = None, wavelength_angstrom: float | None = None, label: str = '') -> None

What one spectral line is: a species, a series member, a wavelength.

Also exported as vaft.spectroscopy.LineIdentity (deprecated).

4 fields
  • species: AtomicSpecies
  • series: str | None
  • wavelength_angstrom: float | None
  • label: str

vaft.data.synthetic_kinetic_profiles

Records for synthetic kinetic profiles generated from a magnetic equilibrium (#122).

Composition

class source
Composition(main_ion: str = 'H', impurity: str | None = None, z_eff: float = 1.0, impurity_charge: float | None = None) -> None

A hydrogenic main ion and at most one fully stripped impurity.

Also exported as vaft.data.Composition.

4 fields
  • main_ion: str
  • impurity: str | None
  • z_eff: float
  • impurity_charge: float | None

GradientProfile

class source
GradientProfile(x: np.ndarray, a_over_L: np.ndarray, boundary_value: float, boundary_position: float = 1.0, coordinate: str = 'rho_tor_norm', unit: str = '') -> None

A profile defined by its normalized logarithmic gradient (Level 3).

Also exported as vaft.data.GradientProfile.

6 fields · 2 members
  • x: np.ndarray
  • a_over_L: np.ndarray
  • boundary_value: float
  • boundary_position: float
  • coordinate: str
  • unit: str
  • gradient method — a/L_f at x by linear interpolation between the knots [-]. source
  • integral method — int_0^x a/L_f ds, exact for the piecewise-linear gradient [-]. source

ION_SPECIES

data
ION_SPECIES = <builtins.mappingproxy>

IonSpecies

class source
IonSpecies(label: str, z: float, a: float, role: str) -> None

One ion species of a generated state: label, charge, mass and role.

Also exported as vaft.data.IonSpecies.

4 fields · 1 members
  • label: str
  • z: float
  • a: float
  • role: str
  • element property — The element symbol, hydrogen for D and T [-]. source

PRESSURE_CLOSURES

data
PRESSURE_CLOSURES = <builtins.dict>

PRESSURE_CONSTRAINTS

data
PRESSURE_CONSTRAINTS = ('equilibrium', 'thermal_energy', 'kinetic')

PressureClosureReport

class source
PressureClosureReport(mode: str, closure: str | None, held: tuple[str, ...], solved: tuple[str, ...], absolute_residual: np.ndarray | None, relative_residual: np.ndarray | None, max_relative_residual: float, rms_relative_residual: float, thermal_energy_eq: float, thermal_energy_kin: float, thermal_energy_relative_difference: float, pressure_floor: float, tolerance: float, locally_consistent: bool, closure_exact_up_to_psi_n: float = nan, edge_max_relative_residual: float = nan) -> None

How the kinetic pressure compares with the equilibrium’s, and why.

Also exported as vaft.data.PressureClosureReport.

16 fields
  • mode: str
  • closure: str | None
  • held: tuple[str, ...]
  • solved: tuple[str, ...]
  • absolute_residual: np.ndarray | None
  • relative_residual: np.ndarray | None
  • max_relative_residual: float
  • rms_relative_residual: float
  • thermal_energy_eq: float
  • thermal_energy_kin: float
  • thermal_energy_relative_difference: float
  • pressure_floor: float
  • tolerance: float
  • locally_consistent: bool
  • closure_exact_up_to_psi_n: float
  • edge_max_relative_residual: float

ProfileSpec

class source
ProfileSpec(shape: Any, target: ScalarTarget | None = None, peaking_factor: float | None = None) -> None

One kinetic channel: a shape, and optionally what normalizes it.

Also exported as vaft.data.ProfileSpec.

3 fields
  • shape: Any
  • target: ScalarTarget | None
  • peaking_factor: float | None

SCALAR_TARGET_KINDS

data
SCALAR_TARGET_KINDS = ('axis', 'separatrix', 'line_average', 'volume_average', 'greenwald_fraction')

ScalarTarget

class source
ScalarTarget(kind: str, value: float) -> None

One scalar a profile is normalized to by scaling its amplitude.

Also exported as vaft.data.ScalarTarget.

2 fields
  • kind: str
  • value: float

SqrtPressureSplit

class source
SqrtPressureSplit(te_axis: float | None = None, ne_over_te: float | None = None) -> None

The Level 0 amplitude: exactly one of an axis T_e or a fixed n_e/T_e.

Also exported as vaft.data.SqrtPressureSplit.

2 fields
  • te_axis: float | None
  • ne_over_te: float | None

SYNTHETIC_PROFILE_STATUSES

data
SYNTHETIC_PROFILE_STATUSES = ('success', 'invalid_equilibrium', 'invalid_profile_model', 'invalid_gradient_model', 'invalid_normalization', 'inval...

SYNTHETIC_PROFILE_UNITS

data
SYNTHETIC_PROFILE_UNITS = <builtins.mappingproxy>

SyntheticKineticProfiles

class source
SyntheticKineticProfiles(label: str, status: str, message: str, fidelity_level: int, psi_norm: np.ndarray, rho_pol_norm: np.ndarray, rho_tor_norm: np.ndarray | None, psi: np.ndarray | None, volume: np.ndarray, n_e: np.ndarray, n_i: np.ndarray, n_impurity: np.ndarray, T_e: np.ndarray, T_i: np.ndarray, z_eff: np.ndarray, p_e: np.ndarray, p_i: np.ndarray, p_total: np.ndarray, p_eq: np.ndarray, species: tuple[IonSpecies, ...], pressure: PressureClosureReport, targets: tuple[TargetResidual, ...], validation: Mapping[str, Any], resolved: Mapping[str, Any], spec: SyntheticKineticSpec, provenance: Mapping[str, Any], time: float | None = None) -> None

A synthetic kinetic state generated from an equilibrium, with its checks.

Also exported as vaft.data.SyntheticKineticProfiles.

27 fields · 5 members
  • label: str
  • status: str
  • message: str
  • fidelity_level: int
  • psi_norm: np.ndarray
  • rho_pol_norm: np.ndarray
  • rho_tor_norm: np.ndarray | None
  • psi: np.ndarray | None
  • volume: np.ndarray
  • n_e: np.ndarray
  • n_i: np.ndarray
  • n_impurity: np.ndarray
  • T_e: np.ndarray
  • T_i: np.ndarray
  • z_eff: np.ndarray
  • p_e: np.ndarray
  • p_i: np.ndarray
  • p_total: np.ndarray
  • p_eq: np.ndarray
  • species: tuple[IonSpecies, ...]
  • pressure: PressureClosureReport
  • targets: tuple[TargetResidual, ...]
  • validation: Mapping[str, Any]
  • resolved: Mapping[str, Any]
  • spec: SyntheticKineticSpec
  • provenance: Mapping[str, Any]
  • time: float | None
  • ok property — Whether every requested constraint was met [-]. source
  • unit method — The unit of one of the result’s arrays. source
  • coordinate method — The grid expressed in psi_norm, rho_pol_norm or rho_tor_norm [-]. source
  • a_over_L method — -d ln f/dx of n_e, T_e or T_i, by second-order differences on the grid [-]. source
  • to_kinetic_profiles method — The state as the package’s kinetic-profile container, same units, same grid. source

SyntheticKineticSpec

class source
SyntheticKineticSpec(temperature: TemperatureAssumption, composition: Composition = <factory>, n_e: ProfileSpec | None = None, T_e: ProfileSpec | None = None, pressure_constraint: str = 'kinetic', closure: str | None = None, sqrt_split: SqrtPressureSplit | None = None, psi_norm: np.ndarray | None = None, label: str = 'synthetic', edge_floor: float = 0.01, edge_value: float | None = None) -> None

Everything the generator is told, separate from the equilibrium it is applied to.

Also exported as vaft.data.SyntheticKineticSpec.

11 fields
  • temperature: TemperatureAssumption
  • composition: Composition
  • n_e: ProfileSpec | None
  • T_e: ProfileSpec | None
  • pressure_constraint: str
  • closure: str | None
  • sqrt_split: SqrtPressureSplit | None
  • psi_norm: np.ndarray | None
  • label: str
  • edge_floor: float
  • edge_value: float | None

SyntheticProfileError

class source
SyntheticProfileError(status: str, message: str)

An assumption set the generator refuses, with the status that names why.

Also exported as vaft.data.SyntheticProfileError.

TabulatedProfile

class source
TabulatedProfile(x: np.ndarray, values: np.ndarray, coordinate: str = 'rho_tor_norm', interpolation: str = 'pchip', extrapolation: str = 'refuse', unit: str = '') -> None

A user-supplied profile on a declared radial coordinate.

Also exported as vaft.data.TabulatedProfile.

6 fields
  • x: np.ndarray
  • values: np.ndarray
  • coordinate: str
  • interpolation: str
  • extrapolation: str
  • unit: str

TargetResidual

class source
TargetResidual(name: str, definition: str, requested: float, achieved: float, residual: float, relative_residual: float, solver_status: str, tolerance: float, met: bool) -> None

One requested constraint beside the value recomputed from the final profiles.

Also exported as vaft.data.TargetResidual.

9 fields
  • name: str
  • definition: str
  • requested: float
  • achieved: float
  • residual: float
  • relative_residual: float
  • solver_status: str
  • tolerance: float
  • met: bool

TemperatureAssumption

class source
TemperatureAssumption(ti_over_te: Any = None, T_i: ProfileSpec | None = None, electron_pressure_fraction: float | None = None, source: str = 'assumed') -> None

How the ion temperature follows, exactly one route of three.

Also exported as vaft.data.TemperatureAssumption.

4 fields · 1 members
  • ti_over_te: Any
  • T_i: ProfileSpec | None
  • electron_pressure_fraction: float | None
  • source: str
  • route property — "ratio", "profile" or "partition" [-]. source

vaft.data.vfit

Read VFIT FEM/GSE MATLAB results and convert them to OMAS.

read_vfit

function source
read_vfit(path: str | Path, kind: Literal['auto', 'fem', 'gse'] = 'auto') -> VFITResult

Read a VFIT v5/v7 MAT result.

Also exported as vaft.data.read_vfit.

VFITKind

function
VFITKind(*args, **kwargs)

VFITResult

class source
VFITResult(kind: VFITKind, source: Path, shot: int, times: np.ndarray, raw: Mapping[str, Any]) -> None

A normalized VFIT FEM or Grad–Shafranov-equilibrium MAT result.

Also exported as vaft.data.VFITResult.

5 fields · 7 members
  • kind: VFITKind
  • source: Path
  • shot: int
  • times: np.ndarray
  • raw: Mapping[str, Any]
  • time_count property source
  • to_omas method — Convert all result times to OMAS equilibrium slices. source
  • to_imas method — Convert through OMAS and save using VAFT’s IMAS writer. source
  • plot_equilibrium method — Plot a VFIT equilibrium field with boundary and flux-surface overlays. source
  • plot_profiles method — Plot available 1D VFIT profiles (q/J; additionally P/F for GSE). source
  • plot_wall_currents method — Plot discretized VEST passive-wall current at one equilibrium time. source
  • plot_magnetics_residuals method — Plot VFIT magnetic-constraint residuals at their R-Z probe locations. source

results matching ""

    No results matching ""