To read MDSplus signals, your account will need read-access (usually the default for anyone coming from within the pppl.gov domain). However, to load MDSplus signals, your account will need write-access to the files used by the MDSplus tree identified in the MDSOPEN call. If you get errors reading or writing, send email to nstx_sw_dev@pppl.gov ) and ask to have your account (and computer name, if off-site) added to the mdsip.hosts file.
On the PPPL Unix/Linux cluster:
% module load nstx
(NOTE that Linux paths at PPPL are different than earlier Solaris
systems -- see the
Beowulf Cluster page for more information.)
Specific examples follow. Additional IDL routines of interest may be found by searching http://nstx.pppl.gov/nstx/Software/Programming/idl_routines.html in your browser.
To use on Linux at PPPL: module load nstx
PRO mycode
shot_num = 100602
MDSOPEN, 'engineering', shot_num, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = '\PC_OH_TOT_CUR'
f = MDSGetSig(signal, stat = ystat, SIGUNITS = fLabel, $
XAXIS = time, XUNITS = timeLabel)
PLOT, time, f/1000., XTITLE = timeLabel, YTITLE = 'milli'+fLabel
ENDELSE
END
You may also wish to use
OpenMDSshot and
MDSGetSig.
; read data from a Private MDSplus tree defined by username$DATA
ID = 10
MDSOPEN, 'username', ID, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'onedim'
data = MDSGETSIG( signal, SIGUNITS=fUnits, XAXIS=time, $
XUNITS=timeUnits)
PLOT, time, data, XTITLE = timeUnits, YTITLE = fUnits, $
TITLE = signal + ' - shot ' + STRTRIM( ID, 2 )
ENDELSE
; read data from a Private MDSplus tree defined by username$DATA
MDSOPEN, 'username', 10, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'twodim'
f2d = MDSGETSIG( signal, SIGUNITS=fUnits, XAXIS=time, $
XUNITS=timeUnits, YAXIS=rad, YUNITS=radUnits )
CONTOUR, f2d, time, rad, XTITLE=timeUnits, YTITLE=radUnits, $
TITLE=fUnits
ENDELSE
(On VMS, you will have had to do this in DCL:
$ setup mdsplus
$ setup tftr
)
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'tftr', 89725, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = '.waveforms:mb_ip_sl'
f = MDSVALUE( signal )
time = MDSUNITS( signal, /TIME )
flabel = MDSUNITS( signal, /UNITS )
timelabel = MDSUNITS( signal, /TIME, /UNITS )
PLOT, time, f/1000., XTITLE = timelabel, YTITLE = 'milli'+flabel
ENDELSE
(On VMS, you will have had to do this in DCL:
$ setup mdsplus
$ setup tftr
)
IF (!VERSION.OS NE 'vms') THEN MDSCONNECT, 'EUROPA'
MDSOPEN, 'transp',76778, STATUS=stat ; note ID is not just shot number
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = '\transp::top.pro:cur'
f2d = MDSGETSIG( signal, SIGUNITS=sigUnits, XAXIS=xAxis, $
XUNITS=xUnits, YAXIS=yAxis, YUNITS=yUnits )
CONTOUR, f2d, xAxis, yAxis, XTITLE=xUnits, YTITLE=yUnits, $
TITLE=sigUnits
ENDELSE
; load data into a Private MDSplus tree defined by username_path
MDSOPEN, 'username', 10, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'onedim'
x = FINDGEN(100)
y = sin( x/N_ELEMENTS( x ) * 3 * 2 * !PI )
myXunits = 'X Units'
myYunits = 'Y Units'
MDSLOADSIG, signal, y, SIGUNITS=myYunits, XAXIS=x, $
XUNITS=myXunits, STATUS=stat
ENDELSE
; load data into a Private MDSplus tree defined by username_path
MDSOPEN, 'username', 10, STATUS=stat
IF NOT stat THEN PRINT,'MDS Tree not opened' ELSE BEGIN
signal = 'twodim'
x = FINDGEN(100)/5.
y = FINDGEN(150)/3.
z = DIST( N_ELEMENTS(x), N_ELEMENTS(y) ) ; this makes a 2-D array
myXunits = 'X units'
myYunits = 'Y units'
myZunits = 'Signal Strength'
MDSLOADSIG, signal, z, SIGUNITS = myZunits, XAXIS = x, $
XUNITS = myXunits, YAXIS = y, YUNITS = myYunits
ENDELSE
For an example of accessing MDSplus data from an IDL widget program,
see
http://NSTX.pppl.gov/nstx/Software/IDL/idl_class2.html#MDSW.
Please mail comments to nstx_sw_dev.