Пример #1
0
    def __init__(self, n=0, rate=250, dt=500, config_file='monitor\\daqconfig.dat', port=8622):
        super().__init__()
        self.types = OrderedDict([('n', int), ('config_file', str), ('trace_file', str), ('graph_file', str),
            ('save_dir', str), ('Sample Rate (kS/s)',float), 
            ('Duration (ms)', float), ('Trigger Channel', str), ('Trigger Level (V)', float), 
            ('Trigger Edge', str), ('channels',channel_stats)])
        self.stats = OrderedDict([('n', n), ('config_file', config_file), ('trace_file', 'DAQtrace.csv'), 
            ('graph_file', 'DAQgraph.csv'),('save_dir', '.'), ('Sample Rate (kS/s)', rate), 
            ('Duration (ms)', dt), ('Trigger Channel', 'Dev2/ai1'), # /Dev2/PFI0
            ('Trigger Level (V)', 1.0), ('Trigger Edge', 'rising'), 
            ('channels', channel_stats("[['Dev2/ai0', '0', '1.0', '0.0', '5', '1', '1']]"))])
        self.trigger_toggle = True       # whether to trigger acquisition or just take a measurement
        self.slave = worker(rate*1e3, dt/1e3, self.stats['Trigger Channel'], 
                self.stats['Trigger Level (V)'], self.stats['Trigger Edge'], list(self.stats['channels'].keys()), 
                [ch['range'] for ch in self.stats['channels'].values()]) # this controls the DAQ
        self.dc = daqCollection(param=[], channels=list(self.stats['channels'].keys()))
        self.init_UI()
        self.load_config(config_file)    # load default settings          
        self.n_samples = int(self.stats['Duration (ms)'] * self.stats['Sample Rate (kS/s)']) # number of samples per acquisition
        self.last_path = './'

        self.x = [] # run numbers for graphing collections of acquired data
        self.y = [] # average voltages in slice of acquired trace 

        self.slave.acquired.connect(self.update_graph) # take average of slices
        self.slave.acquired.connect(self.update_trace) # plot new data when it arrives
        self.tcp = PyClient(port=port)
        remove_slot(self.tcp.dxnum, self.set_n, True)
        remove_slot(self.tcp.textin, self.respond, True)
        self.tcp.start()
Пример #2
0
 def __init__(
         self,
         config_file='.\\state',
         AWG_channels=[0],
         default_seq=r'Z:\Tweezer\Code\Python 3.5\PyDex\awg\AWG template sequences\single_static.txt',
         rearr_base_path=r'Z:\Tweezer\Code\Python 3.5\PyDex\awg\AWG template sequences\rearr_base.txt',
         server_port=8626,
         clientIP='129.234.190.164',
         client_port=8623):
     super().__init__()
     # self.types = OrderedDict([('FileName',str), ('segment',int)])
     self.stats = OrderedDict([('FileName', 0), ('segment', 0)])
     self.rearr_base_path = rearr_base_path
     self.t_load = 0  # time taken to transfer data onto card
     self.init_UI()
     self.server = PyServer(host='',
                            port=server_port)  # TCP server to message PyDex
     self.server.start()
     self.client = PyClient(host=clientIP,
                            port=client_port)  # TCP client to message PyDex
     self.client.textin[str].connect(
         self.respond)  # carry out the command in the msg
     self.client.start()
     self.rr = rearrHandler.rearrange(
         AWG_channels)  # opens AWG card via rearr class and initiates
     self.rr.awg.load(default_seq)  # load basic data
     self.auto_plot = False  # whether to automatically display the new sequence
     self.idle_state()
Пример #3
0
    def __init__(self):
        super().__init__()
        self.tcp_client = PyClient(port=8620, name='DExTer', pause=1)
        self.tcp_client.start()

        self.setWindowTitle("Fake DExTer")
        self.setFixedWidth(400)
        self.setFixedHeight(100)

        self.text = QLabel()
        self.text.setWordWrap(True)
        self.setCentralWidget(self.text)

        self.tcp_client.textin.connect(self.display_msg)
        self.display_msg()