def readRun(self, runNumber, path=defaultPath):
        # Import the dataset
        dldPosXName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:0/dset"
        dldPosYName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:1/dset"
        dldTimeName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:3/dset"
        
        dldMicrobunchIdName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:2/dset"
        dldAuxName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:4/dset"
        #delayStageName = "/Experiment/Pump probe laser/laser delay"
        #ENC.DELAY seems to be the wrong channel! Values appear in groups of exactly the same value 
        #delayStageName = "/Experiment/Pump probe laser/delay line IK220.0/ENC.DELAY"
        #Proper channel is column with index 1 of ENC
        delayStageName = "/Experiment/Pump probe laser/delay line IK220.0/ENC"

        bamName = '/Electron Diagnostic/BAM/4DBC3/electron bunch arrival time (low charge)'
        bunchChargeName = '/Electron Diagnostic/Bunch charge/after undulator'
        macroBunchPulseIdName = '/Timing/Bunch train info/index 1.sts'
        opticalDiodeName ='/Experiment/PG/SIS8300 100MHz ADC/CH9/pulse energy/TD'
        gmdTunnelName ='/Photon Diagnostic/GMD/Pulse resolved energy/energy tunnel'
        
        #adc1Name = '/Experiment/PG/SIS8300 100MHz ADC/CH6/TD'
        #adc2Name = '/Experiment/PG/SIS8300 100MHz ADC/CH7/TD'
        
        daqAccess= BeamtimeDaqAccess.create(path)
        
        print('reading DAQ data')
        #~ print("reading dldPosX")
        self.dldPosX, otherStuff = daqAccess.allValuesOfRun(dldPosXName, runNumber)
        print('run contains macrobunchID from ',otherStuff[0],' to ',otherStuff[1])
        #~ print("reading dldPosY") 
        self.dldPosY, otherStuff = daqAccess.allValuesOfRun(dldPosYName, runNumber)
        #~ print("reading dldTime")
        self.dldTime, otherStuff = daqAccess.allValuesOfRun(dldTimeName, runNumber)
        #~ print("reading dldMicrobunchId")
        self.dldMicrobunchId, otherStuff = daqAccess.allValuesOfRun(dldMicrobunchIdName, runNumber)
        #~ print("reading dldAux")
        self.dldAux, otherStuff = daqAccess.allValuesOfRun(dldAuxName, runNumber)
        
        #~ print("reading delayStage")
        self.delaystage, otherStuff = daqAccess.allValuesOfRun(delayStageName, runNumber)
        self.delaystage = self.delaystage[:,1]
        
        #~ print("reading BAM")
        self.bam, otherStuff = daqAccess.allValuesOfRun(bamName, runNumber)
        self.opticalDiode, otherStuff = daqAccess.allValuesOfRun(opticalDiodeName, runNumber)
        #~ print("reading bunchCharge")
        self.bunchCharge, otherStuff = daqAccess.allValuesOfRun(bunchChargeName, runNumber)
        self.macroBunchPulseId, otherStuff = daqAccess.allValuesOfRun(macroBunchPulseIdName, runNumber)
        self.macroBunchPulseId -= otherStuff[0]
        self.gmdTunnel, otherStuff = daqAccess.allValuesOfRun(gmdTunnelName, runNumber)
        electronsToCount = self.dldPosX.copy().flatten()
        electronsToCount =numpy.nan_to_num(electronsToCount)
        electronsToCount = electronsToCount[electronsToCount > 0]
        electronsToCount = electronsToCount[electronsToCount < 10000]
        numOfElectrons = len(electronsToCount)
        print("Number of electrons: " + str(numOfElectrons))
        print("Creating data frame: Please wait...")
        self.createDataframePerElectron()
        self.createDataframePerMicrobunch()
        print('dataframe created')
示例#2
0
def main():
    settings = configparser.ConfigParser()
    settings.read('SETTINGS.ini')
    path = settings['paths']['DATA_RAW_DIR']
    daqAccess = BeamtimeDaqAccess.create(path)
    dldPosXName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:0/dset"
    dldPosY, otherStuff = daqAccess.allValuesOfRun(dldPosXName, 19135)
示例#3
0
    def create(rootDirectoryOfH5Files):
        """ Creates a BeamtimeDaqAccess object for the given root directory - API

        **Parameter**
            rootDirectoryOfH5Files (str): The root directory of the HDF files. The root
                    directory contains sub directories for different FLASH DAQ streams.

        **Return**
            BeamtimeDaqAccess: The ready to use beamtime DAQ access object.

        **Raise**
            AssertionError: If the given rootDirectoryOfH5Files does not exist.
        """
        
        fileAccess = H5FileDataAccess(H5FileManager(rootDirectoryOfH5Files))
        return BeamtimeDaqAccess(fileAccess)
示例#4
0
#!/usr/bin/env python
import sys
sys.path.append("/home/tekeberg/Source/pah/")
import numpy
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot
from camp.pah.beamtimedaqaccess import BeamtimeDaqAccess
from scipy.ndimage.filters import gaussian_filter1d

#root_directory_of_h5_files = "/asap3/flash/gpfs/bl1/2017/data/11001733/raw/hdf/block-03"
root_directory_of_h5_files = "/data/beamline/current/raw/hdf/block-03"
daq= BeamtimeDaqAccess.create(root_directory_of_h5_files)

# Define DAQ channel names
tunnelEnergyChannelName = "/Photon Diagnostic/GMD/Average energy/energy tunnel (raw)"
bda_energy_channel_name = "/Photon Diagnostic/GMD/Pulse resolved energy/energy BDA"
gmdChannel = tunnelEnergyChannelName

# All TOF values of a run
tofChannelName= "/Experiment/BL1/ADQ412 GHz ADC/CH00/TD"

# Flag for switching the gmd gating
gmd_gating = False

#runNumber = [16174,16175,16176,16177,16178,16179,16180,16181,16182]
#runNumber = [16197,16196,16195,16199,16194,16198,16192,16191,16190] + range(16183,16190)
runNumber = range(16236,16242) + range(16243,16252)
#scan_distance = [-1900,-1700,-1500,-1400,-1300,-1200,-1100,-900,-700,-500,-300,-100,0,100,300,500]
scan_distance = [13.6, 13.5, 13.4, 13.3, 13.2, 13.1, 12.9, 12.8, 12.7, 12.6, 12.5, 12.4, 12.3, 12.2, 12.1]
print len(runNumber), len(scan_distance)
示例#5
0
 def __init__(self, experiment_dir):
     self._dir = experiment_dir
     self._daq = BeamtimeDaqAccess.create(experiment_dir)
    def readInterval(self, pulseIdInterval, path=defaultPath):
        """
        Access to data by macrobunch pulseID intervall. Usefull for scans that would otherwise hit the machine's
        memory limit.
        """
        # Import the dataset
        dldPosXName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:0/dset"
        dldPosYName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:1/dset"
        dldTimeName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:3/dset"
        
        dldMicrobunchIdName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:2/dset"
        dldAuxName = "/uncategorised/FLASH1_USER2/FLASH.FEL/HEXTOF.DAQ/DLD1:4/dset"
        #delayStageName = "/Experiment/Pump probe laser/laser delay"
        #ENC.DELAY seems to be the wrong channel! Values appear in groups of ~10 identical values
        #-> ENC.DELAY is read out with 1 Hz
        #delayStageName = "/Experiment/Pump probe laser/delay line IK220.0/ENC.DELAY"
        #Proper channel is culumn with index 1 of ENC
        delayStageName = "/Experiment/Pump probe laser/delay line IK220.0/ENC"

        bamName = '/Electron Diagnostic/BAM/4DBC3/electron bunch arrival time (low charge)'
        bunchChargeName = '/Electron Diagnostic/Bunch charge/after undulator'
        macroBunchPulseIdName = '/Timing/Bunch train info/index 1.sts'
        opticalDiodeName ='/Experiment/PG/SIS8300 100MHz ADC/CH9/pulse energy/TD'
        gmdTunnelName ='/Photon Diagnostic/GMD/Pulse resolved energy/energy tunnel'
        
        #adc1Name = '/Experiment/PG/SIS8300 100MHz ADC/CH6/TD'
        #adc2Name = '/Experiment/PG/SIS8300 100MHz ADC/CH7/TD'
        
        
        daqAccess= BeamtimeDaqAccess.create(path)
        
        print('reading DAQ data')
        #~ print("reading dldPosX")
        self.dldPosX= daqAccess.valuesOfInterval(dldPosXName, pulseIdInterval)
        #~ print("reading dldPosY") 
        self.dldPosY = daqAccess.valuesOfInterval(dldPosYName, pulseIdInterval)
        #~ print("reading dldTime")
        self.dldTime= daqAccess.valuesOfInterval(dldTimeName, pulseIdInterval)
        #~ print("reading dldMicrobunchId")
        self.dldMicrobunchId= daqAccess.valuesOfInterval(dldMicrobunchIdName, pulseIdInterval)
        #~ print("reading dldAux")
        self.dldAux= daqAccess.valuesOfInterval(dldAuxName, pulseIdInterval)
        
        #~ print("reading delayStage")
        self.delaystage= daqAccess.valuesOfInterval(delayStageName, pulseIdInterval)
        self.delaystage = self.delaystage[:,1]
        
        #~ print("reading BAM")
        self.bam= daqAccess.valuesOfInterval(bamName, pulseIdInterval)
        self.opticalDiode= daqAccess.valuesOfInterval(opticalDiodeName, pulseIdInterval)
        #~ print("reading bunchCharge")
        self.bunchCharge= daqAccess.valuesOfInterval(bunchChargeName, pulseIdInterval)
        self.macroBunchPulseId = daqAccess.valuesOfInterval(macroBunchPulseIdName, pulseIdInterval)
        #self.macroBunchPulseId -= self.macroBunchPulseId[self.macroBunchPulseId > 0].min()
        self.macroBunchPulseId -= pulseIdInterval[0]
        self.gmdTunnel= daqAccess.valuesOfInterval(gmdTunnelName, pulseIdInterval)
        electronsToCount = self.dldPosX.copy().flatten()
        electronsToCount =numpy.nan_to_num(electronsToCount)
        electronsToCount = electronsToCount[electronsToCount > 0]
        electronsToCount = electronsToCount[electronsToCount < 10000]
        numOfElectrons = len(electronsToCount)
        print("Number of electrons: " + str(numOfElectrons))
        print("Creating data frame: Please wait...")
        self.createDataframePerElectron()
        self.createDataframePerMicrobunch()
        print('dataframe created')