Changed files
Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
@@ -10,33 +10,48 @@ http://metis.ipfn.tecnico.ulisboa.pt/CODAC/IPFN_Software/SDAS/Access/Python
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
# import numpy as np
|
|
||||||
|
|
||||||
from MdsImportSdas import mds_writer, plot_signals
|
from MdsImportSdas import mds_writer, plot_signals
|
||||||
|
|
||||||
mdsTreeName = 'isttoksdas'
|
mdsTreeName = 'isttoksdas'
|
||||||
|
|
||||||
|
|
||||||
|
def build_import_table_mag():
|
||||||
MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_{}.RAW"
|
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_{}'
|
SDAS_NODEFMT = 'MARTE_NODE_IVO3.DataCollection.Channel_{}'
|
||||||
|
|
||||||
NUM_PROBES = 12
|
NUM_PROBES = 12
|
||||||
|
|
||||||
|
|
||||||
def build_import_table():
|
|
||||||
table = []
|
table = []
|
||||||
for n in range(NUM_PROBES):
|
for n in range(NUM_PROBES):
|
||||||
sdas_str = SDAS_NODEFMT.format(str(166 + n).zfill(3))
|
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))
|
mds_str = MDS_NODEFMT.format(str(n))
|
||||||
# print(sdas_str)
|
|
||||||
nd = {'sdas': sdas_str, 'mds': mds_str,
|
nd = {'sdas': sdas_str, 'mds': mds_str,
|
||||||
'name': f'Mirnov coil no. {n+1}'}
|
'name': f'Mirnov coil no. {n+1}'}
|
||||||
table.append(nd)
|
table.append(nd)
|
||||||
return table
|
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():
|
def get_arguments():
|
||||||
parser = argparse.ArgumentParser(description='Mirnov coils')
|
parser = argparse.ArgumentParser(description='Mirnov coils')
|
||||||
parser.add_argument('-p', '--pulse',
|
parser.add_argument('-p', '--pulse',
|
||||||
@@ -44,6 +59,12 @@ def get_arguments():
|
|||||||
# parser.add_argument('-s', '--shot',
|
# parser.add_argument('-s', '--shot',
|
||||||
# type=int, help='Mds+ pulse Number ([1, ...])',
|
# type=int, help='Mds+ pulse Number ([1, ...])',
|
||||||
# default=100)
|
# 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',
|
parser.add_argument('-t', '--ploT',
|
||||||
action='store_true', help='Plot Signals')
|
action='store_true', help='Plot Signals')
|
||||||
parser.add_argument('-n', '--names',
|
parser.add_argument('-n', '--names',
|
||||||
@@ -51,11 +72,11 @@ def get_arguments():
|
|||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
if (__name__ == "__main__"):
|
def mds_import(args, pulseNo, nodeTable):
|
||||||
args = get_arguments()
|
if args.exportData:
|
||||||
pulseNo = args.pulse
|
mds_writer(pulseNo, nodeTable)
|
||||||
# mdsPulseNumber = args.shotpulseNo
|
if args.ploT:
|
||||||
nodeTable = build_import_table()
|
plot_signals(pulseNo, nodeTable)
|
||||||
if args.names:
|
if args.names:
|
||||||
print('Probe \t SDAS \t MDS+')
|
print('Probe \t SDAS \t MDS+')
|
||||||
for nd in nodeTable:
|
for nd in nodeTable:
|
||||||
@@ -63,7 +84,16 @@ if (__name__ == "__main__"):
|
|||||||
print(f"\t {nd['sdas']}")
|
print(f"\t {nd['sdas']}")
|
||||||
print(f"\t {nd['mds']}")
|
print(f"\t {nd['mds']}")
|
||||||
|
|
||||||
if args.ploT:
|
|
||||||
plot_signals(pulseNo, nodeTable)
|
if (__name__ == "__main__"):
|
||||||
else:
|
args = get_arguments()
|
||||||
mds_writer(pulseNo, nodeTable)
|
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
|
Thin client configuration
|
||||||
https://www.mdsplus.org/index.php?title=Documentation:Tutorial:RemoteAccess&open=101601206494234739185&page=Documentation%2FTutorials%2FRemote+RemoteAccess
|
https://www.mdsplus.org/index.php?title=Documentation:Tutorial:RemoteAccess&open=101601206494234739185&page=Documentation%2FTutorials%2FRemote+RemoteAccess
|
||||||
"""
|
|
||||||
from MDSplus import Connection
|
from MDSplus import Connection
|
||||||
conn = Connection('epics.ipfn.tecnico.ulisboa.pt')
|
conn = Connection('epics.ipfn.tecnico.ulisboa.pt')
|
||||||
conn.openTree('rtappisttok', 131)
|
conn.openTree('rtappisttok', 131)
|
||||||
result = conn.get("ATCAIOP1.ADC0RAW")
|
result = conn.get("ATCAIOP1.ADC0RAW")
|
||||||
result.data()
|
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)
|
# mw.resize(800,800)
|
||||||
|
|
||||||
# MAX_SAMPLES = 50000
|
# 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
|
ADC_DECIM_RATE = 200
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=
|
parser = argparse.ArgumentParser(description=
|
||||||
@@ -85,24 +86,49 @@ p1.showGrid(x=True, y=True, alpha=0.5)
|
|||||||
|
|
||||||
win.nextRow()
|
win.nextRow()
|
||||||
|
|
||||||
p2 = win.addPlot(title="MARTE2 output data")
|
p2 = win.addPlot(title="MARTE2 output Langmuir data")
|
||||||
dataOut = np.genfromtxt('../Startup/IsttokOutput.csv', delimiter=',')
|
dataOut = np.genfromtxt('../Startup/IsttokOutput.csv', delimiter=',')
|
||||||
p2.addLegend()
|
p2.addLegend()
|
||||||
x = dataOut[:args.maxpoints, 0] / 1e3 # us -> ms
|
x = dataOut[:args.maxpoints, 0] / 1e3 # us -> ms
|
||||||
y = dataOut[:args.maxpoints, 1]
|
#y = dataOut[:args.maxpoints, 1]
|
||||||
# for i in range(1, 5):
|
# 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,]:
|
for i in [1, 2, 3, 4,]:
|
||||||
y = dataOut[:args.maxpoints, i]
|
y = dataOut[:args.maxpoints, i]
|
||||||
p2.plot(y, pen=pg.mkPen(i, width=2), name=lineName[i])
|
p2.plot(y, pen=pg.mkPen(i, width=2), name=lineName[i])
|
||||||
|
|
||||||
p2.showGrid(x=True, y=True, alpha=0.5)
|
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='')
|
# print("WO: ", end='')
|
||||||
# updatePlot()
|
# 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__':
|
if __name__ == '__main__':
|
||||||
# import sys
|
# import sys
|
||||||
# if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
|
# if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
|
||||||
|
|||||||
@@ -467,12 +467,13 @@ $MdsLoopApp = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+GAMSSM = {
|
// A generic State Space model with constant matrices and float64.
|
||||||
|
+GAMSSMConstant = {
|
||||||
Class = SSMGAM
|
Class = SSMGAM
|
||||||
StateMatrix = {{1.0 0}{0 1.0}} //Compulsory
|
StateMatrix = {{1.0 0}{0 1.0}} //Compulsory. This SSM is constant
|
||||||
InputMatrix = {{0 0 0 0}{0 0 0 0}} //Compulsory
|
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
|
OutputMatrix = {{0 0}} //Compulsory
|
||||||
FeedthroughMatrix = {{1 1 1 1}} //Optional
|
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
|
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.
|
SampleFrequency = 0.0001 // Currently optional and not used.
|
||||||
InputSignals = {
|
InputSignals = {
|
||||||
@@ -485,22 +486,78 @@ $MdsLoopApp = {
|
|||||||
}
|
}
|
||||||
MirnovD1 = {
|
MirnovD1 = {
|
||||||
DataSource = "DDB1"
|
DataSource = "DDB1"
|
||||||
Type = float64 //Only supported type.
|
Type = float64
|
||||||
NumberOfElements = 1
|
NumberOfElements = 1
|
||||||
NumberOfDimensions = 1
|
NumberOfDimensions = 1
|
||||||
Samples = 1
|
Samples = 1
|
||||||
}
|
}
|
||||||
MirnovD2 = {
|
MirnovD2 = {
|
||||||
DataSource = "DDB1"
|
DataSource = "DDB1"
|
||||||
Type = float64 //Only supported type.
|
Type = float64
|
||||||
NumberOfElements = 1
|
NumberOfElements = 1
|
||||||
NumberOfDimensions = 1
|
NumberOfDimensions = 1
|
||||||
Samples = 1
|
Samples = 1
|
||||||
}
|
}
|
||||||
MirnovD3 = {
|
MirnovD3 = {
|
||||||
|
DataSource = "DDB1"
|
||||||
|
Type = float64
|
||||||
|
NumberOfElements = 1
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
Samples = 1
|
||||||
|
}
|
||||||
|
MirnovD4 = {
|
||||||
DataSource = "DDB1"
|
DataSource = "DDB1"
|
||||||
Type = float64 //Only supported type.
|
Type = float64 //Only supported type.
|
||||||
NumberOfElements = 1
|
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
|
NumberOfDimensions = 1
|
||||||
Samples = 1
|
Samples = 1
|
||||||
}
|
}
|
||||||
@@ -667,7 +724,7 @@ $MdsLoopApp = {
|
|||||||
+Thread1 = {
|
+Thread1 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
CPUs = 0x1
|
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 default_tree_path=$MARTe2_HOME/mdsplus-trees
|
||||||
export rtappdemo_path=~/git-repos/MARTe2-isttok/Trees
|
export rtappdemo_path=~/git-repos/MARTe2-isttok/Trees
|
||||||
export rtappwriter_path=~/git-repos/MARTe2-isttok/Trees
|
export rtappwriter_path=~/git-repos/MARTe2-isttok/Trees
|
||||||
export isttoksdas_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=/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 rtappisttok_path=$MARTe2_HOME/mdsplus-trees
|
||||||
|
|
||||||
export PATH=$MDSPLUS_DIR/bin:$EPICS_BASE/bin/$EPICS_HOST_ARCH:$PATH
|
export PATH=$MDSPLUS_DIR/bin:$EPICS_BASE/bin/$EPICS_HOST_ARCH:$PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user