Added CAInput Datasource

Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
2024-04-16 09:38:35 +00:00
parent d7bb6a0690
commit ff29fe6bdd
4 changed files with 97 additions and 45 deletions

View File

@@ -6,20 +6,11 @@ import sys
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from MDSplus import Tree from MDSplus import Tree
import argparse
mdsTreeName = 'rtappisttok' mdsTreeName = 'rtappisttok'
if len(sys.argv) > 1:
mdsPulseNumber = int(sys.argv[1])
else:
mdsPulseNumber = 1
#treename = ''
try:
tree = Tree(mdsTreeName, mdsPulseNumber)
except:
print(f'Failed opening {mdsTreeName} for pulse number {mdsPulseNumber:d}')
exit()
""" """
Available Channels Available Channels
@@ -30,6 +21,7 @@ ATCAIOP1.ADC3RAW
ATCAIOP1.ADC4RAW ATCAIOP1.ADC4RAW
ATCAIOP1.ADC5RAW ATCAIOP1.ADC5RAW
ATCAIOP1.ADC6RAW ATCAIOP1.ADC6RAW
#for i in range(args.irange[0], args.irange[1]):
ATCAIOP1.ADC7RAW ATCAIOP1.ADC7RAW
ATCAIOP1.ADC0INT ATCAIOP1.ADC0INT
@@ -38,6 +30,23 @@ ATCAIOP1.ADC1INT
""" """
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description = 'Script to support the QA activities')
#parser.add_argument('-l','--list', nargs='+', help='<Required> Set flag', required=True)
#parser.add_argument('-l','--list', nargs='+')
parser.add_argument('-c', '--crange', nargs='+',type=int, help='Channel plots (1 12)',default=[1, 8])
parser.add_argument('-i', '--irange', nargs='+',type=int,default=[0, 4])
#parser.add_argument('pulse','-', nargs='+', help='<Required> Set flag', required=True)
parser.add_argument('-s', '--shot', type=int, help='Mds+ pulse Number ([1, ...])', default=100)
args = parser.parse_args()
mdsPulseNumber = args.shot
try:
#tree = Tree(mdsTreeName, args.pulse)
tree = Tree(mdsTreeName, mdsPulseNumber)
except:
print(f'Failed opening {mdsTreeName} for pulse number {mdsPulseNumber:d}')
exit()
mdsNode = tree.getNode("ATCAIOP1.ADC0RAW") mdsNode = tree.getNode("ATCAIOP1.ADC0RAW")
mdsNode = tree.getNode("ATCAIOP1.ADC1INT") mdsNode = tree.getNode("ATCAIOP1.ADC1INT")
dataAdc = mdsNode.getData().data() dataAdc = mdsNode.getData().data()

38
Analysis/pyqtPlotMds.py Normal file → Executable file
View File

@@ -1,10 +1,9 @@
#!/usr/bin/env python3
""" """
This example demonstrates many of the 2D plotting capabilities This script plots the MARTe2 ATCAIop samples stored in MDSplus
in pyqtgraph. All of the plots may be panned/scaled by dragging with All of the plots may be panned/scaled by dragging with
the left/right mouse buttons. Right click on any plot to show a context menu. the left/right mouse buttons. Right click on any plot to show a context menu.
""" """
#import sys
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
@@ -24,8 +23,8 @@ parser = argparse.ArgumentParser(description = 'Script to support the QA activit
#parser.add_argument('-l','--list', nargs='+', help='<Required> Set flag', required=True) #parser.add_argument('-l','--list', nargs='+', help='<Required> Set flag', required=True)
#parser.add_argument('-l','--list', nargs='+') #parser.add_argument('-l','--list', nargs='+')
parser.add_argument('-c', '--crange', nargs='+',type=int, help='Channel plots (1 12)',default=[1, 8]) parser.add_argument('-c', '--crange', nargs='+',type=int, help='Channel plots (1 12)',default=[1, 12])
parser.add_argument('-i', '--irange', nargs='+',type=int,default=[1, 8]) parser.add_argument('-i', '--irange', nargs='+',type=int,default=[1, 12])
#parser.add_argument('pulse','-', nargs='+', help='<Required> Set flag', required=True) #parser.add_argument('pulse','-', nargs='+', help='<Required> Set flag', required=True)
parser.add_argument('-s', '--shot', type=int, help='Mds+ pulse Number ([1, ...])', default=100) parser.add_argument('-s', '--shot', type=int, help='Mds+ pulse Number ([1, ...])', default=100)
parser.add_argument('-m', '--maxsamples', type=int, help='Max samples to plot', default=50000) parser.add_argument('-m', '--maxsamples', type=int, help='Max samples to plot', default=50000)
@@ -34,12 +33,6 @@ parser.add_argument('-z', '--zero', action='store_true',help='Zero integral Line
args = parser.parse_args() args = parser.parse_args()
mdsPulseNumber = args.shot mdsPulseNumber = args.shot
#if len(sys.argv) > 1:
# mdsPulseNumber = int(sys.argv[1])
#else:
# mdsPulseNumber = 1
# #treename = ''
mdsTreeName = 'rtappisttok' mdsTreeName = 'rtappisttok'
try: try:
@@ -55,11 +48,11 @@ win.setWindowTitle('pyqtgraph example: Plotting')
# Enable antialiasing for prettier plots # Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True) pg.setConfigOptions(antialias=True)
p1 = win.addPlot(title="ATCA ADC raw decim") p1 = win.addPlot(title="ATCA-IOP ADC raw decimated")
# add plt.addLegend() BEFORE you create the curves. # add plt.addLegend() BEFORE you create the curves.
mdsNode = tree.getNode("ATCAIOP1.ADC0RAW") #mdsNode = tree.getNode("ATCAIOP1.ADC0RAW")
dataAdc = mdsNode.getData().data() #dataAdc = mdsNode.getData().data()
timeData = mdsNode.getDimensionAt(0).data() #timeData = mdsNode.getDimensionAt(0).data()
p1.addLegend() p1.addLegend()
start = args.crange[0] -1; stop = args.crange[1] - 1 start = args.crange[0] -1; stop = args.crange[1] - 1
#for i in range(args.crange[0], args.crange[1]): #for i in range(args.crange[0], args.crange[1]):
@@ -74,21 +67,24 @@ for i in range(start, stop):
#p1.setLabel('bottom', "Y Axis", units='s') #p1.setLabel('bottom', "Y Axis", units='s')
win.nextRow() win.nextRow()
p4 = win.addPlot(title="ATCA Integral Channels") p4 = win.addPlot(title="Channel Integrals")
p4.addLegend() p4.addLegend()
#for i in range(8,12): #for i in range(8,12):
start = args.irange[0] -1; stop = args.irange[1] - 1 start = args.irange[0] -1; stop = args.irange[1] - 1
for i in range(start, stop): for i in range(start, stop):
#for i in range(args.irange[0], args.irange[1]): #mdsNode = tree.getNode(f"ATCAIOP1.ADC8INT")
mdsNode = tree.getNode(f"ATCAIOP1.ADC{i}INT") mdsNode = tree.getNode(f"ATCAIOP1.ADC{i}INT")
dataAdcInt = mdsNode.getData().data() try:
#print(f"ATCAIOP1.ADC{i:d}INT")
dataAdcInt = mdsNode.getData().data() / 2.0e6 # LSB * sec
timeData = mdsNode.getDimensionAt(0).data() timeData = mdsNode.getDimensionAt(0).data()
y = dataAdcInt[ :args.maxsamples, 0] y = dataAdcInt[ :args.maxsamples, 0]
if(args.zero): if(args.zero):
y = y - dataAdcInt[0, 0] y = y - dataAdcInt[0, 0]
#x = DECIM_RATE * np.arange(len(y)) x = DECIM_RATE * np.arange(len(y)) / 2.0e6 # in sec
x = DECIM_RATE * np.arange(len(y)) / 2.0e6
p4.plot(x,y, pen=pg.mkPen(i, width=2), name=f"Ch {i+1}") p4.plot(x,y, pen=pg.mkPen(i, width=2), name=f"Ch {i+1}")
except:
print(f"No data ATCAIOP1.ADC{i:d}INT")
p4.setLabel('bottom', "Time", units='s') p4.setLabel('bottom', "Time", units='s')

View File

@@ -839,6 +839,37 @@ $IsttokApp = {
} }
} }
} }
+GAMCAInput = {
Class = "IOGAM"
InputSignals = {
PVEo = {
DataSource = "EPICSCAInput"
NumberOfDimensions = "1"
NumberOfElements = "16"
Type = "int32"
}
PVWo = {
DataSource = "EPICSCAInput"
NumberOfDimensions = "1"
NumberOfElements = "16"
Type = "float32"
}
}
OutputSignals = {
EoArr = {
DataSource = "DDB1"
NumberOfDimensions = "1"
NumberOfElements = "16"
Type = "int32"
}
WoArr = {
DataSource = "DDB1"
NumberOfDimensions = "1"
NumberOfElements = "16"
Type = "float32"
}
}
}
+GAMCAOutput = { +GAMCAOutput = {
Class = "IOGAM" Class = "IOGAM"
InputSignals = { InputSignals = {
@@ -1391,10 +1422,10 @@ $IsttokApp = {
AutomaticSegmentation = "0" AutomaticSegmentation = "0"
} }
AdcInteg6 = { AdcInteg6 = {
NodeName = "ATCAIOP1.ADC0INT" NodeName = "ATCAIOP1.ADC6INT"
Period = "100e-6" Period = "100e-6"
MakeSegmentAfterNWrites = "200" MakeSegmentAfterNWrites = "200"
DecimatedNodeName = "ATCAIOP1.ADC0INTD" DecimatedNodeName = "ATCAIOP1.ADC6INTD"
MinMaxResampleFactor = "100" MinMaxResampleFactor = "100"
SamplePhase = "0" SamplePhase = "0"
AutomaticSegmentation = "0" AutomaticSegmentation = "0"
@@ -1471,6 +1502,22 @@ $IsttokApp = {
} }
} }
} }
+EPICSCAInput = {
Class = "EPICSCA::EPICSCAInput"
StackSize = "1048576" //Optional the EmbeddedThread stack size. Default value is THREADS_DEFAULT_STACKSIZE * 4u
CPUs = "0xff" //Optional the affinity of the EmbeddedThread (where the EPICS context is attached).
Signals = {
PVEo = { //At least one shall be defined
PVName = "ISTTOK:central:ATCAIOP1-EO" //Compulsory. Name of the PV.
Type = "int32" //Compulsory. Supported types are char8[40], string[40], uint8, int8, uint16, int16, int32, uint32, uint64, int64, float32 and float64
//NumberOfElements = "16" //Arrays also supported
}
PVWo = {
PVName = "ISTTOK:central:ATCAIOP1-WO"
Type = "float32"
}
}
}
+EPICSCAOutputHist = { +EPICSCAOutputHist = {
Class = "EPICSCA::EPICSCAOutput" Class = "EPICSCA::EPICSCAOutput"
StackSize = "1048576" StackSize = "1048576"

View File

@@ -33,8 +33,8 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Componen
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LinuxTimer/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LinuxTimer/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LoggerDataSource/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LoggerDataSource/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/FileDataSource/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/FileDataSource/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LinkDataSource/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LinkDataSource/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/UDP/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/UDP/
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/MDSReader/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/MDSReader/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/MDSWriter/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/MDSWriter/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/RealTimeThreadSynchronisation/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/RealTimeThreadSynchronisation/
@@ -42,15 +42,15 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Componen
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/ConstantGAM/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/ConstantGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/ConversionGAM/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/ConversionGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/IOGAM/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/IOGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/FilterGAM/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/FilterGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/HistogramGAM/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/HistogramGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/SSMGAM/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/SSMGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/TriggerOnChangeGAM/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/TriggerOnChangeGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/WaveformGAM/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/WaveformGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/BaseLib2Wrapper/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/BaseLib2Wrapper/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/EPICS/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/EPICS/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/EPICSPVA/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/EPICSPVA/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/MemoryGate/ #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/MemoryGate/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/SysLogger/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/SysLogger/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EPICS_BASE/lib/$EPICS_HOST_ARCH LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EPICS_BASE/lib/$EPICS_HOST_ARCH