Skip to content

MDSplus Data Access

toksearch.MdsSignal

Bases: Signal

__init__(expression, treename, location=None, dims=('times'), data_order=None, fetch_units=True)

Create a signal object that fetches data from an MDSplus tree

Parameters:

Name Type Description Default
expression str

The tdi expression to fetch data from

required
treename str

The name of the tree to fetch from

required
location Optional[Union[str, MdsTreePath]]

The location of the tree.

  • If None, check if the environment variable TOKSEARCH_MDS_DEFAULT is set and use it, otherwise assume that the tree is on a local disk and that the treepath is available in the environment.

  • If a simple path is given (e.g. /some/path), then that will be used for the treepath. You can also specify a remote server by specifying the location as 'remote://some.server'

  • If an MdsTreePath object is provided, then the signal data is fetched from a local disk according to the path specifications in the MdsTreePath object.

None
dims Iterable[str]

See documentation for the Signal class. Defaults to ('times',)

('times')
data_order Optional[Iterable[str]]

See documentation for the Signal class. Defaults to the same as dims.

None
fetch_units bool

See documentation for the Signal class. Defaults to True.

True

cleanup()

Close all trees or disconnect from the remote server

cleanup_shot(shot)

Close the tree for this shot

Parameters:

Name Type Description Default
shot int

The shot number to close the tree for

required

create_local_or_remote_signal(expression, treename, location, **kwargs) classmethod

Create either an MdsLocalSignal or MdsRemoteSignal object based on the location

See the docs for the MdsSignal class for more information on the arguments

gather(shot)

Gather the data for a shot

Parameters:

Name Type Description Default
shot int

The shot number to gather the data for

required

Returns:

Name Type Description
dict

A dictionary containing the data gathered for the signal. The dictionary will contain a key 'data' with the data, and keys for each dimension of the data, with the values being the values of the dimensions. If the with_units attribute is True, the dictionary will also contain a key 'units' with the units of the data and dimensions.

toksearch.signal.mds.MdsTreePath

Bases: object

__init__(**paths)

Create an object to manage the paths to MDSplus trees

set_env()

Temporarily set mds treepath environment variables

variable_name(treename) classmethod

Return the name of the environment variable for the given treename