MDSPlus Package

MDSPlus Package

Interface for MDSplus data acquisition and storage.

This package depends on the MDSplus python package, available from http://www.mdsplus.org/binaries/python/

Pyfusion supports four modes for accessing MDSplus data:

  1. local
  2. thick client
  3. thin client
  4. HTTP via a H1DS MDSplus web service

The data access mode used is determined by the mds path and server variables in the configuration file (or supplied to the acquisition class via keyword arguments):

[Acquisition:my_data]
acq_class = pyfusion.acquisition.MDSPlus.acq.MDSPlusAcquisition
mydata_path = ...
server = my.mdsdataserver.net

The full MDSplus node path is stored in a diagnostic configuration section:

[Diagnostic:my_probe]
data_fetcher = pyfusion.acquisition.MDSPlus.fetch.MDSPlusDataFetcher
mds_node_path = \mydata::top.probe_signal
  # Note that changing data sources (fetchers) is easier with :ref:`substitutions`

Local data access

The ‘local’ mode is used when a tree path definition refers to the local file system rather than an MDSplus server on the network. The mydata_path entry in the above example would look something like:

mydata_path = /path/to/my/data

Thick client access

The ‘thick client’ mode uses an MDSplus data server to retieve the raw data files, but the client is responsible for evaluating expressions and decompressing the data. The server tree definitions are used, and the server for a given mds tree is specified by the tree path in the format:

mydata_path = my.mdsdataserver.net::

or, if a port other than the default (8000) is used:

mydata_path = my.mdsdataserver.net:port_number::

Thin client access

The ‘thin client’ mode maintains a connection to an MDSplus data server. Expressions are evaluated and data decompressed on the server, requiring greater amounts of data to be transferred over the network. Because the thin client mode uses the tree paths defined on the server, no path variable is required. Instead, the server entry is used:

server = my.mdsdataserver.net

or, if a port other than the default (8000) is used:

server = my.mdsdataserver.net:port_number

HTTP web service access

The HTTP web service mode uses standard HTTP queries via the H1DS RESTful API to access the MDSplus data. The server is responsible for evaluating the data and transmits quantisation-compressed data to the client over port 80. This is especially useful if the MDSplus data is behind a firewall. The server attribute will be used for web service access if it begins with http://, for example:

server = http://h1svr.anu.edu.au/mdsplus/

The server attribute must be the URL component up to the MDSplus tree name. In this example, the URL for mds path:attr:\h1data::top.operations.mirnov:a14_14:input_1 and shot 58063 corresponds to http://h1svr.anu.edu.au/mdsplus/h1data/58063/top/operations/mirnov/a14_14/input_1/

How Pyfusion chooses the access mode

If an acquisition configuration section contains a server entry (which does not start with http://), then MDSPlusAcquisition will set up a connection to the mdsip server when it is instantiated. Additionally, any tree path definitions (local and thick client) are loaded into the runtime environment at this time. When a call to the data fetcher is made (via getdata()), the data fetcher uses the full node path (including tree name) from the configuration file. If a matching (tree name) _path variable is defined for the acquisition module, then the corresponding local or thick client mode will be used. If no tree path is defined then, if the server variable is defined, pyfusion will attempt to use either the web services mode (if server begins with http://) or the thin client mode (if server does not begin with http://).

acq Module

MDSPlus acquisition.

class pyfusion.acquisition.MDSPlus.acq.MDSPlusAcquisition(*args, **kwargs)[source]

Bases: pyfusion.acquisition.base.BaseAcquisition

Acquisition class for MDSplus data systems.

If a ‘server’ configuration parameter (not starting with ‘http’) is provided, a connection for thin client access will be set up. Also, any configuration parameters which end with ‘_path’ will be loaded into the environment.

fetch Module

h1ds Module

Python module for the H1 data system.

This code works with python2 and python3.

It is assumed most users will be using python2, so the general design pattern is try:

python2 code
except (ImportError, etc):
python3 code

Dependencies: numpy Optional: matplotlib (for plotting)

class pyfusion.acquisition.MDSPlus.h1ds.H1MDSData(shot, shottime, tree, path, data)[source]
class pyfusion.acquisition.MDSPlus.h1ds.Signal(signal, dim, signal_units, dim_units)[source]
plot()[source]
pyfusion.acquisition.MDSPlus.h1ds.add_query_to_url(url, query)[source]
pyfusion.acquisition.MDSPlus.h1ds.data_from_mds(mds_tree, mds_path, shot_number)[source]
pyfusion.acquisition.MDSPlus.h1ds.data_from_url(url)[source]

Retrieve data object from H1DS URL.

pyfusion.acquisition.MDSPlus.h1ds.do_test()[source]
pyfusion.acquisition.MDSPlus.h1ds.signal_from_binary_url(url)[source]
pyfusion.acquisition.MDSPlus.h1ds.simple_xml_value(doc, tag)

tests Module

Test code for MDSPlus data acquisition.

class pyfusion.acquisition.MDSPlus.tests.CheckH1ConfigSection(*args)[source]

Bases: pyfusion.acquisition.MDSPlus.tests.MDSAcqTestCase

make sure H1 section in config file works

h1 = True
mds = True
net = True
slow = True
testH1Config()[source]
testH1Multichannel()[source]
class pyfusion.acquisition.MDSPlus.tests.CheckMDSPlusDataAcquisition[source]

Bases: pyfusion.test.tests.PfTestBase

h1 = True
mds = True
net = True
slow = True
testBaseClasses()[source]
testHaveMDSPlusDataObject()[source]
class pyfusion.acquisition.MDSPlus.tests.CheckMDSPlusDataFetchers[source]

Bases: pyfusion.test.tests.PfTestBase

h1 = True
mds = True
net = True
slow = True
testDataFetcherBaseClass()[source]
class pyfusion.acquisition.MDSPlus.tests.CheckMDSPlusH1Connection[source]

Bases: pyfusion.test.tests.PfTestBase

tests which require access to h1data.anu.edu.au

h1 = True
mds = True
net = True
slow = True
testH1TimeseriesData()[source]
class pyfusion.acquisition.MDSPlus.tests.DummyMDSData(*args, **kwargs)[source]

Bases: pyfusion.data.base.BaseData

class pyfusion.acquisition.MDSPlus.tests.DummyMDSDataFetcher(*args, **kwargs)[source]

Bases: pyfusion.data.base.BaseData

Check that we have a mds data object passed though

do_fetch()[source]
class pyfusion.acquisition.MDSPlus.tests.MDSAcqTestCase(*args)[source]

Bases: pyfusion.test.tests.BasePyfusionTestCase

setUp()[source]
class pyfusion.acquisition.MDSPlus.tests.TestRefactoredMDSLocal(*args)[source]

Bases: pyfusion.acquisition.MDSPlus.tests.MDSAcqTestCase

Test local data access with the refactored MDS interface.

The refactored MDSplus package uses the same acquisition and fetcher classes for the different MDSplus access modes (local, thin client and thick client).

The local data access test is in a separate class so we can flag it with net=False, with the other access modes being flagged with net=True.

test_local_access()[source]
class pyfusion.acquisition.MDSPlus.tests.TestRefactoredMDSThick(*args)[source]

Bases: pyfusion.acquisition.MDSPlus.tests.MDSAcqTestCase

Test thick client data access with the refactored MDS interface.

The refactored MDSplus package uses the same acquisition and fetcher classes for the different MDSplus access modes (local, thin client and thick client).

net = True
test_thick_client_access()[source]
class pyfusion.acquisition.MDSPlus.tests.TestRefactoredMDSThin(*args)[source]

Bases: pyfusion.acquisition.MDSPlus.tests.MDSAcqTestCase

Test thin client data access with the refactored MDS interface.

The refactored MDSplus package uses the same acquisition and fetcher classes for the different MDSplus access modes (local, thin client and thick client).

net = True
test_thin_client_access()[source]
class pyfusion.acquisition.MDSPlus.tests.TestWebDataAcq(*args)[source]

Bases: pyfusion.acquisition.MDSPlus.tests.WebTestCase

dev = False
net = False
test_acq()[source]
class pyfusion.acquisition.MDSPlus.tests.WebTestCase(*args)[source]

Bases: pyfusion.test.tests.BasePyfusionTestCase

setUp()[source]