from MDSplus import * import sys #For getting command line arguments import numpy import myTools from scipy.fftpack import hilbert from scipy.interpolate import interp1d import re from calcTransFun import * from calcCenterFreq import * from myTools import smooth, myDownsampleWithSmooth, getYX from sigProc import cohere #Credit to John D. Hunter for this library import pdb #Parse shot information, contained in first command-line argument sList=myTools.parseList(sys.argv[1]) #List of nodes in remaining command line arguments stringArgs=sys.argv[2:] #Loop through shots in list for s in sList : print("Shot {0:d}".format(s)) #Open magnetics tree to get Shoelace antenna signal. magTree=Tree('magnetics',s, 'edit') if(s>1110500000) : fRange=numpy.array([40.0,250.0])*1.0E3 else :
#3. Turn off BP20_ABK (not actually connected to ACQ_216_3:INPUT_15 - BP28_GHK is) for 2014 and 2015 and 2016 campaigns #4. Turn off BP28_GHK for 2016 campaign (not actually connected to ACQ_216_3:INPUT_15 = BP26_GHK is) #5. Turn off BP11_ABK (broken) for 2014 and 2015 and 2016 campaigns #6. Change digitizer references for BP09,11,12_ABK to ACQ_216_3 (from ACQ_216_2 to ACQ_216_3) # #Created on: 28 September 2017, T. Golfinopoulos from myTools import getShotRange, parseList import datetime import sys import subprocess from MDSplus import * import re #sList=getShotRange(int(sys.argv[1])) sList = parseList(sys.argv[1]) print(sList) #Dictionary mapping expression for raw data for corresponding Mirnov coil. This folds in correct node reference for digitizer, as well as sign. bp123tghkRawExpr = { 'bp1t_ghk': 'GETNCI(ACTIVE_MHD.SIGNALS.BP1T_GHK, "ON") ? Build_Signal(Build_With_Units(ACTIVE_MHD.DATA_ACQ.CPCI:ACQ_216_1:INPUT_07 * -1 / (\MAG_RF_COILS:CALIB[59] * 1), "Tesla/s"), *, \MAGNETICS::TOP.ACTIVE_MHD.SIGNALS:TIMEBASE1) : ABORT()', 'bp2t_ghk': 'GETNCI(ACTIVE_MHD.SIGNALS.BP2T_GHK, "ON") ? Build_Signal(Build_With_Units(ACTIVE_MHD.DATA_ACQ.CPCI:ACQ_216_1:INPUT_08 * 1 / (\MAG_RF_COILS:CALIB[60] * 1), "Tesla/s"), *, \MAGNETICS::TOP.ACTIVE_MHD.SIGNALS:TIMEBASE1) : ABORT()', 'bp3t_ghk': 'GETNCI(ACTIVE_MHD.SIGNALS.BP3T_GHK, "ON") ? Build_Signal(Build_With_Units(ACTIVE_MHD.DATA_ACQ.CPCI:ACQ_216_1:INPUT_09 * 1 / (\MAG_RF_COILS:CALIB[61] * 1), "Tesla/s"), *, \MAGNETICS::TOP.ACTIVE_MHD.SIGNALS:TIMEBASE1) : ABORT()' } fixAbkNodes = ['bp09_abk', 'bp11_abk', 'bp12_abk'] #refFixes2016TopNodes={'bp17_abk':'GETNCI(ACTIVE_MHD.SIGNALS.BP17_ABK, "ON") ? Build_Signal(Build_With_Units(ACTIVE_MHD.DATA_ACQ.CPCI:ACQ_216_3:INPUT_10 * 1 / (\MAG_RF_COILS:CALIB[16] * 1), "Tesla/s"), *, \MAGNETICS::TOP.ACTIVE_MHD.SIGNALS:TIMEBASE3) : ABORT()', # 'bp20_ghk':'GETNCI(ACTIVE_MHD.SIGNALS.BP20_GHK, "ON") ? Build_Signal(Build_With_Units(ACTIVE_MHD.DATA_ACQ.CPCI:ACQ_216_3:INPUT_14 * 1 / (\MAG_RF_COILS:CALIB[49] * 1), "Tesla/s"), *, \MAGNETICS::TOP.ACTIVE_MHD.SIGNALS:TIMEBASE3) : ABORT()'}
""" This script creates a deep copy of an MDS tree """ from MDSplus import * import myTools import sys if (len(sys.argv) > 1): #Parse shot information, contained in first command-line argument sInputList = myTools.parseList(sys.argv[1]) else: sInputList = [-1] if (len(sys.argv) > 2): #Parse shot output information, contained in first command-line argument sOutputList = myTools.parseList(sys.argv[2]) else: sOutputList = [1120903900] if (len(sInputList) != len(sOutputList)): raise IOError('Input and output shot lists have same length.') stringArgs = sys.argv[3:] #List of nodes in remaining command line arguments stringArgs = sys.argv[2:] s = 1120831700 sOut = 1120831701
from MDSplus import * import myTools import sys #Add match_v_amp, match_i_amp, match_pwr, match_zr, and match_zi nodes #T. Golfinopoulos, 1 April 2016 (April Fools' Day) sList = myTools.parseList( sys.argv[1]) #Get shot from command line, first argument for s in sList: try: myTree = Tree('magnetics', s, 'edit') myTree.getNode('shoelace').addNode('match_v_amp', 'signal') myTree.getNode('shoelace.match_v_amp').addNode('comment', 'text') myTree.getNode('shoelace.match_v_amp.comment').putData( "Amplitude of voltage looking into matching network, on load-side of transformers." ) myTree.getNode('shoelace').addNode('match_i_amp', 'signal') myTree.getNode('shoelace.match_i_amp').addNode('comment', 'text') myTree.getNode('shoelace.match_i_amp.comment').putData( "Amplitude of current looking into matching network, on load-side of transformers." ) myTree.getNode('shoelace').addNode('match_pwr', 'signal') myTree.getNode('shoelace.match_pwr').addNode('comment', 'text') myTree.getNode('shoelace.match_pwr.comment').putData( "Powering entering into matching network on load-side of transformers." )
if (len(sys.argv) > 1): nodeName = sys.argv[1] if (len(nodeName) == 0): nodeName = '\\magnetics::top.active_mhd.signals.bp1t_ghk' userEmail = [] if (len(sys.argv) > 2): userEmail = sys.argv[2] else: userEmail = '*****@*****.**' #Length threshold - signal array must be longer than this, else alert user. lenThresh = [] if (len(sys.argv) > 3): lenThresh = parseList(sys.argv[3]) if (len(lenThresh) == 0): lenThresh = 1000 sList = [] if (len(sys.argv) > 4): sList = parseList(sys.argv[4]) if (len(sList) == 0): try: sList = [int(Data.compile('current_shot("cmod")').evaluate())] # print(sList) except: time.sleep(60) #Try again after 60 s - if that fails, give up. sList = [int(Data.compile('current_shot("cmod")').evaluate())]