Esempio n. 1
0
    def setup_daq(self):
        """ Setup everything necessary to run the daq. """
        # It isn't safe to fork multithreaded processes
        # However you can't spawn if threads are already created
        # Apparently forking a multithreaded process can cause deadlock because a process can get a lock and then die with it...
        # If the code starts freezing when instruments are disconnected - this might be the problem
        #mp.set_start_method('spawn')

        # Set the save path for the data
        file.PATH = file.get_file_path()
        file.check_log()  # Make sure the log exists, if it doesn't, create it

        # Create the print queue to make stdout multiprocessing safe
        self.p_queue = mp.JoinableQueue(self.max_print_queue_size)
        if self.debug == False and self.print_normal == False:
            sys.stdout = WriteStream(self.p_queue)

        # Setup an initial dataset number
        self.adv_dataset(self.desc)
Esempio n. 2
0
"""
Created on Fri Jan 25 11:16:10 2019

@author: cu-pwfa
"""

import sys
sys.path.append('../')
import file as f
import matplotlib.pyplot as plt
import functions as fun

from matplotlib import rc
rc('mathtext', default='regular')

f.PATH = f.get_file_path()
path = f.PATH+'TRACE/year_2019/month_01/day_21/'

dataset = ['1901210020',
           '1901210022']

amp = 1000
for num in dataset:
    tracePATH = f.get_dirName_from_dataset('TRACE', num)
    traceFILES = sorted(fun.list_files(tracePATH, 'npy'))
    for fil in range(len(traceFILES)):
        trace = f.load_TRACE(tracePATH+traceFILES[int(fil)])
        chan = trace['meta']['Channel']
        for key in chan:
            if chan[key][0]:
                if key == 'CH1':