W7X Package

W7X Package

W7-X acquisition module

acq Module

W7-X acquisition module.

class pyfusion.acquisition.W7X.acq.W7XAcquisition(*args, **kwargs)[source]

Bases: pyfusion.acquisition.base.BaseAcquisition

Acquisition class for W7X data system.

fetch Module

W7-X data fetchers.

Since December 8th 2016, cached npz files include the raw utcs (differenced) at very little additional cost in space. - see examples/read_W7X_json.py

Example of data reaching over a break in time run pyfusion/examples/plot_signals.py dev_name=’W7X’ diag_name=W7X_L53_LP1 shot_number=[1457015819400000000,1457015821000000000] hold=1 sharey=2 best to limit nSamples to ~ 10k - see pyfusion.cfg

Test method: Clumsy uncomment file:// in pyfusion.cfg from pyfusion.acquisition.W7X import fetch ff=fetch.W7XDataFetcher(“W7X_L53_LP7_I”,[20160302,26]) ff.fmt=’file:///data/databases/W7X/cache/archive-webapi.ipp-hgw.mpg.de/ArchiveDB/codac/W7X/CoDaStationDesc.{CDS}/DataModuleDesc.{DMD}_DATASTREAM/{ch}/Channel_{ch}/scaled/_signal.json?from={shot_f}&upto={shot_t}’ ff.params=’CDS=82,DMD=190,ch=2’ ff.do_fetch() ff.repair=1 # or 0,2

Would be better to have an example with non-trivial units

class pyfusion.acquisition.W7X.fetch.W7XDataFetcher(acq, shot, config_name=None, **kwargs)[source]

Bases: pyfusion.acquisition.base.BaseDataFetcher

Fetch the W7X data using urls

do_fetch()[source]
setup()[source]

record some details of the forthcoming fetch so that the calling routine in base can give useful error messages The is info may not be available in full if the fetch fails. This was not the original purpose of setup, it was more general than this. (as part of a 3 step process: setup, do_fetch, pulldown

pyfusion.acquisition.W7X.fetch.myhist(X)[source]

use a dict method to do a bincount on large or negative numbers Unwise to use this alone on W7-X because there are easily 1e9 instances We use bincount for the smaller numbers

pyfusion.acquisition.W7X.fetch.regenerate_dim(x)[source]

assume x in ns since epoch from the current time

get_shot_info Module

pyfusion.acquisition.W7X.get_shot_info.get_shot_info(date, shot, item='comment', quiet=False)[source]

return utc values for a given shot and date get_shot_info(date=20160310, shot=10)

pyfusion.acquisition.W7X.get_shot_info.get_shot_utc(date, shot, quiet=False)[source]

convenience routine to obtain shot utc values

get_shot_list Module

By extracting all progId, comments and dates, in ProjectDesc, create a table to connect shots, dates and times.

Would be nice to have scenId and segId, but the relationship is not 1:1 To find segment 1 in scenario 2, shot xx need to find the utc range of shot xx, find the scenarios in that utc, select 2, then find the segments within the UTC range of the scenario, and identify segId 1. Tricky.

This version reads both pickles and json versions of shotDA. Will probably make the transition to json only in the next version.

‘rb’ in load and dump works for both py2 and 3, but the files written by either can’t be read by the other. versions created in August are >1M due to the comments? # ‘rb’ causes a problem with winpy - maybe using protocol 2 will fix? # wrong ?? -> under proto 2, need ,encoding=’ascii’ in python3 if file written by python2 # See test code at end

pyfusion.acquisition.W7X.get_shot_list.get_shotDA(fname='/home/bdb112/pyfusion/working/pyfusion/pyfusion/acquisition/W7X/shotDA')[source]
pyfusion.acquisition.W7X.get_shot_list.json_save_shot_list(shotDA, new_name='/tmp/shotDA.json')[source]
pyfusion.acquisition.W7X.get_shot_list.test_pickles(from_file='/pyfusion/acquisition/W7X/shotDA.pickle', to_file='/tmp/x{v}.pickle')[source]

aim to test compatibility of shotDA.pickle between python versions not yet implemented - may discard if we use json files.

mag_config Module

Return configuration information as ratios or currents

pyfusion.acquisition.W7X.mag_config.get_mag_config(shot, from_db=True, ratios=True)[source]
pyfusion.acquisition.W7X.mag_config.plot_trim(ax, mag_dict=None, offset=[1.08, 0.88], size=0.06, aspect=1, **pltkwargs)[source]

puff_db Module

a crude ‘database’ of off-the-books puffing - i.e. not in the data system

pyfusion.acquisition.W7X.puff_db.get_puff(shot, t_range=None, numpoints=500, debug=0)[source]
pyfusion.acquisition.W7X.puff_db.puffadd(self, key, **kwargs)[source]

scrape_archive Module