Changed files
Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
@@ -10,40 +10,61 @@ http://metis.ipfn.tecnico.ulisboa.pt/CODAC/IPFN_Software/SDAS/Access/Python
|
||||
"""
|
||||
|
||||
import argparse
|
||||
# import numpy as np
|
||||
|
||||
from MdsImportSdas import mds_writer, plot_signals
|
||||
|
||||
mdsTreeName = 'isttoksdas'
|
||||
|
||||
|
||||
MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_{}.RAW"
|
||||
# MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_{}.RAW"
|
||||
SDAS_NODEFMT = 'MARTE_NODE_IVO3.DataCollection.Channel_{}'
|
||||
def build_import_table_mag():
|
||||
MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_{}.RAW"
|
||||
SDAS_NODEFMT = 'MARTE_NODE_IVO3.DataCollection.Channel_{}'
|
||||
NUM_PROBES = 12
|
||||
|
||||
NUM_PROBES = 12
|
||||
|
||||
|
||||
def build_import_table():
|
||||
table = []
|
||||
for n in range(NUM_PROBES):
|
||||
sdas_str = SDAS_NODEFMT.format(str(166 + n).zfill(3))
|
||||
# mds_str = MDS_NODEFMT.format(str(n).zfill(2))
|
||||
mds_str = MDS_NODEFMT.format(str(n))
|
||||
# print(sdas_str)
|
||||
nd = {'sdas': sdas_str, 'mds': mds_str,
|
||||
'name': f'Mirnov coil no. {n+1}'}
|
||||
table.append(nd)
|
||||
return table
|
||||
|
||||
|
||||
def build_import_table_langmuir():
|
||||
SDAS_NODEFMT = 'MARTE_NODE_IVO3.DataCollection.Channel_{}'
|
||||
LANGMUIR_OFF = 24
|
||||
MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC_1.CHANNEL_{}.RAW"
|
||||
NUM_PROBES = 4
|
||||
"""
|
||||
ADC_electric_top_near: MARTE_NODE_IVO3.DataCollection.Channel_024
|
||||
ADC_electric_outer_near: MARTE_NODE_IVO3.DataCollection.Channel_025
|
||||
ADC_electric_bottom_near: MARTE_NODE_IVO3.DataCollection.Channel_026
|
||||
ADC_electric_inner_near: MARTE_NODE_IVO3.DataCollection.Channel_027
|
||||
"""
|
||||
table = []
|
||||
for n in range(NUM_PROBES):
|
||||
sdas_str = SDAS_NODEFMT.format(str(LANGMUIR_OFF + n).zfill(3))
|
||||
mds_str = MDS_NODEFMT.format(str(n))
|
||||
nd = {'sdas': sdas_str, 'mds': mds_str,
|
||||
'name': f'Langmuir Probe no. {n+1}'}
|
||||
table.append(nd)
|
||||
return table
|
||||
|
||||
|
||||
def get_arguments():
|
||||
parser = argparse.ArgumentParser(description='Mirnov coils')
|
||||
parser.add_argument('-p', '--pulse',
|
||||
help='pulse (shot) number', default='46241', type=int)
|
||||
#parser.add_argument('-s', '--shot',
|
||||
# parser.add_argument('-s', '--shot',
|
||||
# type=int, help='Mds+ pulse Number ([1, ...])',
|
||||
# default=100)
|
||||
parser.add_argument('-e', '--exportData',
|
||||
action='store_true', help='Export to MDSPlus')
|
||||
parser.add_argument('-m', '--mirnov',
|
||||
action='store_true', help='Import Mirnov')
|
||||
parser.add_argument('-l', '--langmuir',
|
||||
action='store_true', help='Import Langmuir')
|
||||
parser.add_argument('-t', '--ploT',
|
||||
action='store_true', help='Plot Signals')
|
||||
parser.add_argument('-n', '--names',
|
||||
@@ -51,11 +72,11 @@ def get_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if (__name__ == "__main__"):
|
||||
args = get_arguments()
|
||||
pulseNo = args.pulse
|
||||
# mdsPulseNumber = args.shotpulseNo
|
||||
nodeTable = build_import_table()
|
||||
def mds_import(args, pulseNo, nodeTable):
|
||||
if args.exportData:
|
||||
mds_writer(pulseNo, nodeTable)
|
||||
if args.ploT:
|
||||
plot_signals(pulseNo, nodeTable)
|
||||
if args.names:
|
||||
print('Probe \t SDAS \t MDS+')
|
||||
for nd in nodeTable:
|
||||
@@ -63,7 +84,16 @@ if (__name__ == "__main__"):
|
||||
print(f"\t {nd['sdas']}")
|
||||
print(f"\t {nd['mds']}")
|
||||
|
||||
if args.ploT:
|
||||
plot_signals(pulseNo, nodeTable)
|
||||
else:
|
||||
mds_writer(pulseNo, nodeTable)
|
||||
|
||||
if (__name__ == "__main__"):
|
||||
args = get_arguments()
|
||||
pulseNo = args.pulse
|
||||
|
||||
if args.mirnov:
|
||||
print('Getting Mirnov Probe signals')
|
||||
nodeTable = build_import_table_mag()
|
||||
mds_import(args, pulseNo, nodeTable)
|
||||
if args.langmuir:
|
||||
print('Getting Langmuir Probe signals')
|
||||
nodeTable = build_import_table_langmuir()
|
||||
mds_import(args, pulseNo, nodeTable)
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
"""
|
||||
Thin client configuration
|
||||
https://www.mdsplus.org/index.php?title=Documentation:Tutorial:RemoteAccess&open=101601206494234739185&page=Documentation%2FTutorials%2FRemote+RemoteAccess
|
||||
"""
|
||||
from MDSplus import Connection
|
||||
conn = Connection('epics.ipfn.tecnico.ulisboa.pt')
|
||||
conn.openTree('rtappisttok', 131)
|
||||
result = conn.get("ATCAIOP1.ADC0RAW")
|
||||
result.data()
|
||||
https://github.com/MDSplus/mdsthin
|
||||
"""
|
||||
import mdsthin
|
||||
c = mdsthin.Connection('localhost')
|
||||
c.get('whoami()').data()
|
||||
c.openTree('isttokoutput', 1)
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ app = pg.mkQApp("Plotting MARTe2 AtcaIop Data")
|
||||
# mw.resize(800,800)
|
||||
|
||||
# MAX_SAMPLES = 50000
|
||||
ADC_CHANNELS = 14 # channels stored in ISTTOK
|
||||
# ADC_CHANNELS = 14 # channels stored in ISTTOK
|
||||
MAG_OFFSET = 6 # channels stored in ISTTOK
|
||||
ADC_DECIM_RATE = 200
|
||||
|
||||
parser = argparse.ArgumentParser(description=
|
||||
@@ -85,24 +86,49 @@ p1.showGrid(x=True, y=True, alpha=0.5)
|
||||
|
||||
win.nextRow()
|
||||
|
||||
p2 = win.addPlot(title="MARTE2 output data")
|
||||
p2 = win.addPlot(title="MARTE2 output Langmuir data")
|
||||
dataOut = np.genfromtxt('../Startup/IsttokOutput.csv', delimiter=',')
|
||||
p2.addLegend()
|
||||
x = dataOut[:args.maxpoints, 0] / 1e3 # us -> ms
|
||||
y = dataOut[:args.maxpoints, 1]
|
||||
#y = dataOut[:args.maxpoints, 1]
|
||||
# for i in range(1, 5):
|
||||
lineName = ['Time', 'OutMdsW0', 'OutMdsW1', 'OutMdsW2', 'OutMdsW3']
|
||||
lineName = ['Time', 'OutLang0', 'OutLang1', 'OutLangR', 'OutLangZ']
|
||||
for i in [1, 2, 3, 4,]:
|
||||
y = dataOut[:args.maxpoints, i]
|
||||
p2.plot(y, pen=pg.mkPen(i, width=2), name=lineName[i])
|
||||
|
||||
p2.showGrid(x=True, y=True, alpha=0.5)
|
||||
# p2.plot(x, y) # , pen=pg.mkPen(i, width=2)) # , name=f"Ch {i+1}")
|
||||
|
||||
p2.setLabel('bottom', "Time", units='ms')
|
||||
# p2.setLabel('bottom', "Time", units='ms')
|
||||
# print("WO: ", end='')
|
||||
# updatePlot()
|
||||
|
||||
win.nextRow()
|
||||
p3 = win.addPlot(title="SDAS Mag Probe data")
|
||||
lineName = ['Time', 'Trigger',
|
||||
'ElectricTop', 'ElectricInner', 'ElectricOuter', 'ElectricBottom']
|
||||
for i in [0, 1, 2, 3]:
|
||||
y = dataSdas[:args.maxpoints, i + MAG_OFFSET]
|
||||
p3.plot(y, pen=pg.mkPen(i, width=2), name=lineName[i])
|
||||
|
||||
p3.showGrid(x=True, y=True, alpha=0.5)
|
||||
|
||||
win.nextRow()
|
||||
|
||||
p4 = win.addPlot(title="MARTE2 output Magnetic data")
|
||||
# dataOut = np.genfromtxt('../Startup/IsttokOutput.csv', delimiter=',')
|
||||
p4.addLegend()
|
||||
x = dataOut[:args.maxpoints, 0] / 1e3 # us -> ms
|
||||
lineName = ['Time', 'OutLang0', 'OutLang1', 'OutLangR', 'OutLangZ',
|
||||
'MagOutR', 'MagOutZ']
|
||||
for i in [5]:
|
||||
y = dataOut[:args.maxpoints, i]
|
||||
p4.plot(y, pen=pg.mkPen(i, width=2), name=lineName[i])
|
||||
|
||||
p4.showGrid(x=True, y=True, alpha=0.5)
|
||||
|
||||
p4.setLabel('bottom', "Sample") # , units='ms')
|
||||
|
||||
if __name__ == '__main__':
|
||||
# import sys
|
||||
# if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
|
||||
|
||||
@@ -467,13 +467,14 @@ $MdsLoopApp = {
|
||||
}
|
||||
}
|
||||
}
|
||||
+GAMSSM = {
|
||||
// A generic State Space model with constant matrices and float64.
|
||||
+GAMSSMConstant = {
|
||||
Class = SSMGAM
|
||||
StateMatrix = {{1.0 0}{0 1.0}} //Compulsory
|
||||
InputMatrix = {{0 0 0 0}{0 0 0 0}} //Compulsory
|
||||
StateMatrix = {{1.0 0}{0 1.0}} //Compulsory. This SSM is constant
|
||||
InputMatrix = {{0 0 0 0 0 0 0 0 0 0 0 0}{0 0 0 0 0 0 0 0 0 0 0 0}} //Compulsory
|
||||
OutputMatrix = {{0 0}} //Compulsory
|
||||
FeedthroughMatrix = {{1 1 1 1}} //Optional
|
||||
ResetInEachState = 1//Compulsory. 1–> reset in each state, 0–> reset if the previous state is different from the next state
|
||||
FeedthroughMatrix = {{0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08}} //Optional
|
||||
ResetInEachState = 1 //Compulsory. 1–> reset in each state, 0–> reset if the previous state is different from the next state
|
||||
SampleFrequency = 0.0001 // Currently optional and not used.
|
||||
InputSignals = {
|
||||
MirnovD0 = { //input of the SS
|
||||
@@ -485,22 +486,78 @@ $MdsLoopApp = {
|
||||
}
|
||||
MirnovD1 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64 //Only supported type.
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD2 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64 //Only supported type.
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD3 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD4 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64 //Only supported type.
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1 // or 0
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD5 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD6 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD7 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD8 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64 //Only supported type.
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1 // or 0
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD9 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD10 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
MirnovD11 = {
|
||||
DataSource = "DDB1"
|
||||
Type = float64
|
||||
NumberOfElements = 1
|
||||
NumberOfDimensions = 1
|
||||
Samples = 1
|
||||
}
|
||||
@@ -667,7 +724,7 @@ $MdsLoopApp = {
|
||||
+Thread1 = {
|
||||
Class = RealTimeThread
|
||||
CPUs = 0x1
|
||||
Functions = {GAMTimer GAMFileReader GAMConvert2Double GAMMagSigs GAMSSM GAMLangSigs GAMElectricProbes GAMFileWriter }
|
||||
Functions = {GAMTimer GAMFileReader GAMConvert2Double GAMMagSigs GAMSSMConstant GAMLangSigs GAMElectricProbes GAMFileWriter }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,11 @@ export MDSPLUS_DIR=/usr/local/mdsplus
|
||||
export default_tree_path=$MARTe2_HOME/mdsplus-trees
|
||||
export rtappdemo_path=~/git-repos/MARTe2-isttok/Trees
|
||||
export rtappwriter_path=~/git-repos/MARTe2-isttok/Trees
|
||||
export isttoksdas_path=~/git-repos/MARTe2-isttok/Trees
|
||||
export isttokoutput_path=~/git-repos/MARTe2-isttok/Trees
|
||||
# export isttoksdas_path=~/git-repos/MARTe2-isttok/Trees
|
||||
export isttoksdas_path=/home/mdsplus/Trees
|
||||
# export isttokoutput_path=~/git-repos/MARTe2-isttok/Trees
|
||||
export isttokoutput_path=/home/mdsplus/Trees
|
||||
export isttokmarte_path=/home/mdsplus/Trees
|
||||
# export rtappisttok_path=$MARTe2_HOME/mdsplus-trees
|
||||
|
||||
export PATH=$MDSPLUS_DIR/bin:$EPICS_BASE/bin/$EPICS_HOST_ARCH:$PATH
|
||||
|
||||
Reference in New Issue
Block a user