omas.ODS

class omas.ODS(imas_version='3.41.0', consistency_check=True, cocos=11, cocosio=None, coordsio=None, unitsio=None, uncertainio=None, dynamic=None)[source]

OMAS Data Structure class

__init__(imas_version='3.41.0', consistency_check=True, cocos=11, cocosio=None, coordsio=None, unitsio=None, uncertainio=None, dynamic=None)[source]
Parameters
  • imas_version – IMAS version to use as a constrain for the nodes names

  • consistency_check – whether to enforce consistency with IMAS schema

  • cocos – internal COCOS representation (this can only be set when the object is created)

  • cocosio – COCOS representation of the data that is read/written from/to the ODS

  • coordsio – ODS with coordinates to use for the data that is read/written from/to the ODS

  • unitsio – ODS will return data with units if True

  • uncertainio – ODS will return data with uncertainties if True

  • dynamic – internal keyword used for dynamic data loading

Methods

__init__([imas_version, consistency_check, ...])

param imas_version

IMAS version to use as a constrain for the nodes names

clear()

remove data from a branch

close()

codeparams2dict()

Convert code.parameters to a CodeParameters dictionary object

codeparams2xml()

Convert code.parameters to a XML string

coordinates([key])

return dictionary with coordinates of a given ODS location

copy()

return

copy.deepcopy of current ODS object

copy_attrs_from(ods)

copy omas_ods_attrs attributes from input ods

dataset([homogeneous])

Return xarray.Dataset representation of a whole ODS

diff(ods[, ignore_type, ignore_empty, ...])

return differences between this ODS and the one passed

diff_attrs(ods[, attrs, verbose])

Checks if two ODSs have any difference in their attributes

document([what])

RST documentation of the ODs content

flat(**kw)

Flat dictionary representation of the data

from_structure(structure[, depth])

Generate an ODS starting from a hierarchical structure made of dictionaries and lists

full_paths(**kw)

Traverse the ods and return paths from root of ODS that have data

full_pretty_paths(**kw)

Traverse the ods and return paths from root of ODS that have data formatted nicely

get(key[, default])

Check if key is present and if not return default value without creating value in omas data structure

getraw(key)

Method to access data stored in ODS with no processing of the key, and it is thus faster than the ODS.__getitem__(key) Effectively behaves like a pure Python dictionary/list __getitem__.

homogeneous_time([key, default])

Dynamically evaluate whether time is homogeneous or not NOTE: this method does not read ods['ids_properties.homogeneous_time'] instead it uses the time info to figure it out

info(location)

return node info

items()

keys([dynamic])

Return list of keys

list_coordinates([absolute_location])

return dictionary with coordinates in a given ODS

load(*args, **kw)

Load OMAS data

open(*args, **kw)

Dynamically load OMAS data for seekable storage formats

paths([return_empty_leaves, ...])

Traverse the ods and return paths to its leaves

physics_check_iter_scenario_requirements()

Check that the current ODS satisfies the ITER scenario database requirements as defined in https://confluence.iter.org/x/kQqOE

physics_consistent_times([attempt_fix, ...])

Assign .time and .ids_properties.homogeneous_time info for top-level structures since these are required for writing an IDS to IMAS

physics_core_profiles_consistent([update, ...])

Calls all core_profiles consistency functions including

physics_core_profiles_currents([time_index, ...])

This function sets currents in ods['core_profiles']['profiles_1d'][time_index]

physics_core_profiles_densities([update, ...])

Density, density_thermal, and density_fast for electrons and ions are filled and are self-consistent

physics_core_profiles_pressures([update])

Calculates individual ions pressures

physics_core_profiles_zeff([update, ...])

calculates effective charge

physics_core_sources_j_parallel_sum([time_index])

ods function used to sum all j_parallel contributions from core_sources (j_actuator)

physics_current_from_eq(time_index)

This function sets the currents in ods['core_profiles']['profiles_1d'][time_index] using ods['equilibrium']['time_slice'][time_index]['profiles_1d']['j_tor']

physics_derive_equilibrium_profiles_2d_quantity(...)

This function derives values of empty fields in prpfiles_2d from other parameters in the equilibrium ods Currently only the magnetic field components are supported

physics_equilibrium_consistent()

Calculate missing derived quantities for equilibrium IDS

physics_equilibrium_form_constraints([...])

generate equilibrium constraints from experimental data in ODS

physics_equilibrium_ggd_to_rectangular([...])

Convert GGD data to profiles 2D

physics_equilibrium_profiles_2d_map(...[, ...])

This routines creates interpolators for quantities and stores them in the cache for future use.

physics_equilibrium_stored_energy([update])

Calculate MHD stored energy from equilibrium pressure and volume

physics_equilibrium_transpose_RZ([flip_dims])

Transpose 2D grid values for RZ grids under equilibrium.time_slice.:.profiles_2d.:.

physics_imas_info()

add ids_properties.version_put.

physics_magnetics_sanitize([remove_bpol_probe])

Take data in legacy magnetics.bpol_probe and store it in current magnetics.b_field_pol_probe and magnetics.b_field_tor_probe

physics_remap_flux_coordinates(time_index, ...)

Maps from one magnetic coordinate system to another.

physics_resolve_equilibrium_profiles_2d_grid_index(...)

Convenience function to identify which of profiles_2d[:].grid_type.index matches the specified grid_identifier

physics_summary_consistent_global_quantities([...])

Generate summary.global_quantities from global_quantities of other IDSs

physics_summary_currents([time_index, update])

Calculatess plasma currents from core_profiles for each time slice and stores them in the summary ods

physics_summary_global_quantities([update])

Calculates global quantities for each time slice and stores them in the summary ods:

physics_summary_greenwald([update])

Calculates Greenwald Fraction for each time slice and stores them in the summary ods.

physics_summary_heating_power([update])

Integrate power densities to the total and heating and current drive systems and fills summary.global_quantities

physics_summary_lineaverage_density([...])

Calculates line-average electron density for each time slice and stores them in the summary ods

physics_summary_taue([thermal, update])

Calculates Energy confinement time estimated from the IPB98(y,2) scaling for each time slice and stores them in the summary ods

physics_summary_thermal_stored_energy([update])

Calculates the stored energy based on the contents of core_profiles for all time-slices

physics_wall_add([machine])

Add wall information to the ODS

plot_bolometer_overlay([ax, ...])

Overlays bolometer chords

plot_charge_exchange_overlay([ax, which_pos])

Overlays Charge Exchange Recombination (CER) spectroscopy channel locations

plot_core_profiles_currents_summary([...])

Plot currents in core_profiles_1d

plot_core_profiles_pressures([time_index, ...])

Plot pressures in ods['core_profiles']['profiles_1d'][time_index]

plot_core_profiles_summary([time_index, ...])

Plot densities and temperature profiles for electrons and all ion species as per ods['core_profiles']['profiles_1d'][time_index]

plot_core_sources_summary([time_index, ...])

Plot sources for electrons and all ion species

plot_core_transport_fluxes([time_index, ...])

Plot densities and temperature profiles for all species, rotation profile, TGYRO fluxes and fluxes from power_balance per STEP state.

plot_ec_launchers_CX([time_index, time, ax, ...])

Plot EC launchers in poloidal cross-section

plot_ec_launchers_CX_topview([time_index, ...])

Plot EC launchers in toroidal cross-section

plot_equilibrium_CX([time_index, time, ...])

Plot equilibrium cross-section as per ods['equilibrium']['time_slice'][time_index]

plot_equilibrium_CX_topview([time_index, ...])

Plot equilibrium toroidal cross-section as per ods['equilibrium']['time_slice'][time_index]

plot_equilibrium_quality([fig])

Plot equilibrium convergence error and total Chi-squared as a function of time

plot_equilibrium_summary([time_index, time, ...])

Plot equilibrium cross-section and P, q, P', FF' profiles as per ods['equilibrium']['time_slice'][time_index]

plot_gas_injection_overlay([ax, ...])

Plots overlays of gas injectors

plot_interferometer_overlay([ax])

Plots overlays of interferometer chords.

plot_langmuir_probes_overlay([ax, ...])

Overlays Langmuir probe locations

plot_lh_antennas_CX([time_index, time, ax, ...])

Plot LH antenna position in poloidal cross-section

plot_lh_antennas_CX_topview([time_index, ...])

Plot LH antenna in toroidal cross-section

plot_magnetics_bpol_probe_data([...])

plot bpol_probe time traces and equilibrium constraints

plot_magnetics_diamagnetic_flux_data([...])

plot diamagnetic_flux time trace and equilibrium constraint

plot_magnetics_flux_loop_data([...])

plot flux_loop time traces and equilibrium constraints

plot_magnetics_ip_data([...])

plot ip time trace and equilibrium constraint

plot_magnetics_overlay([ax, show_flux_loop, ...])

Plot magnetics on a tokamak cross section plot

plot_nbi_summary([ax])

Plot summary of NBI power time traces

plot_overlay([ax, allow_autoscale, ...])

Plots overlays of hardware/diagnostic locations on a tokamak cross section plot

plot_pellets_trajectory_CX([time_index, ...])

Plot pellets trajectory in poloidal cross-section

plot_pellets_trajectory_CX_topview([...])

Plot pellet trajectory in toroidal cross-section

plot_pf_active_data([...])

plot pf_active time traces

plot_pf_active_overlay([ax])

Plots overlays of active PF coils.

plot_position_control_overlay([ax, t, ...])

Overlays position_control data

plot_pulse_schedule_overlay([ax, t])

Overlays relevant data from pulse_schedule, such as position control

plot_quantity(key[, yname, xname, yunits, ...])

Provides convenient way to plot 1D quantities in ODS

plot_summary([fig, quantity])

Plot summary time traces.

plot_tf_b_field_tor_vacuum_r_data([...])

plot b_field_tor_vacuum_r time trace and equilibrium constraint

plot_thomson_scattering_overlay([ax])

Overlays Thomson channel locations

plot_wall_overlay([ax, component_index, ...])

Plot walls on a tokamak cross section plot

plot_waves_beam_CX([time_index, time, ax])

Plot waves beams in poloidal cross-section

plot_waves_beam_profile([time_index, time, ...])

Plot 1d profiles of waves beams given quantity

plot_waves_beam_summary([time_index, time, fig])

Plot waves beam summary: CX, power_density, and current_parallel_density

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

pretty_paths(**kw)

Traverse the ods and return paths that have data formatted nicely

prune()

Prune ODS branches that are leafless

relax(other[, alpha])

Blend floating point data in this ODS with corresponding floating point in other ODS

same_init_ods([cls])

Initializes a new ODS with the same attributes as this one

sample([ntimes, homogeneous_time])

Populates the ods with sample data

sample_bolometer([nc])

Adds fake bolometer chord locations This method operates in place

sample_charge_exchange([nc])

Adds fake CER channel locations This method operates in-place

sample_core_profiles([time_index, ...])

Add sample core_profiles data This method operates in in-place.

sample_core_sources([time_index])

Add sample core_profiles data This method operates in in-place.

sample_core_transport([time_index])

Add sample core_profiles data This method operates in in-place

sample_dataset_description()

sample_ec_launchers([ngyros, ntimes])

Adds fake ec launchers data to support testing This method operates in in-place

sample_equilibrium([time_index, ...])

Add sample equilibrium data This method operates in in-place.

sample_gas_injection()

Adds fake gas injection locations This method operates in place

sample_ic_antennas()

Add sample ic_antennas data This method operates in in-place.

sample_interferometer()

Adds fake interferometer locations This method operates in place

sample_langmuir_probes()

Adds fake Langmuir probe locations This method operates in place

sample_magnetics()

Adds fake magnetic probe locations This method operates in place

sample_nbi([nunits, ntimes])

Adds fake nbi data to support testing This method operates in in-place

sample_pf_active([nc_weird, nc_undefined])

Adds fake active PF coil locations This method operates in in-place

sample_pulse_schedule()

Adds fake control target data to support testing This method operates in in-place

sample_summary()

Add sample core_profiles data This method operates in in-place

sample_thomson_scattering([nc])

Adds fake Thomson scattering channel locations This method operates in place

sample_wall()

Adds fake wall data This method operates in in-place

satisfy_imas_requirements([attempt_fix, ...])

Assign .time and .ids_properties.homogeneous_time info for top-level structures since these are required for writing an IDS to IMAS

save(*args, **kw)

Save OMAS data

search_paths(search_pattern[, n, ...])

Find ODS locations that match a pattern

set_time_array(key, time_index, value)

Convenience function for setting time dependent arrays

setdefault(key[, value])

Set value if key is not present

setraw(key, value)

Method to assign data to an ODS with no processing of the key, and it is thus faster than the ODS.__setitem__(key, value) Effectively behaves like a pure Python dictionary/list __setitem__.

slice_at_time([time, time_index])

method for selecting a time slice from an time-dependent ODS (NOTE: this method operates in place)

time([key, extra_info])

Return the time information for a given ODS location

time_index(time[, key])

Return the index of the closest time-slice for a given ODS location

to_odx([homogeneous])

Generate a ODX from current ODS

update(ods2)

Adds ods2's key-values pairs to the ods

values()

xarray(key)

Returns data of an ODS location and correspondnig coordinates as an xarray dataset Note that the Dataset and the DataArrays have their attributes set with the ODSs structure info

Attributes

active_dynamic

property that point to dynamic_ODS object and says if it is active

cocos

property that tells in what COCOS format the data is stored internally of the ODS

cocosio

property that tells in what COCOS format the data will be input/output

consistency_check

property that returns whether consistency with IMAS schema is enabled or not

coordsio

property that tells in what COCOS format the data will be input/output

dynamic

property that point to dynamic_ODS object

imas_version

Property that returns the imas_version of this ods

location

Property which returns instance of parent ODS

parent

structure

Property which returns structure of current ODS

top

Property which returns instance of top level ODS

ulocation

return

string with location of this object in universal ODS path format

uncertainio

property that if data should be returned with units or not

unitsio

property that if data should be returned with units or not