Example #1
0
    def continuous_acquisition(self, offset, active_interval, passive_interval,
                               repetitions, integ_time):
        """Executes measurement running the TGGeneration and Acquisition actions
        according the test parameters. Checks the lengths of the acquired data.
        """
        # obtaining elements created in the BasePoolTestCase.setUp
        tg_1_1 = self.tgs['_test_tg_1_1']
        tg_ctrl_1 = tg_1_1.get_controller()
        ct_1_1 = self.cts['_test_ct_1_1']  # hw synchronized
        ct_2_1 = self.cts['_test_ct_2_1']  # sw synchronized
        ct_ctrl_1 = ct_1_1.get_controller()
        ct_ctrl_1.set_ctrl_par("synchronization", AcqSynch.HardwareTrigger)
        ct_ctrl_2 = ct_2_1.get_controller()
        self.channel_names.append('_test_ct_1_1')
        self.channel_names.append('_test_ct_2_1')

        conf_ct_ctrl_1 = createTimerableControllerConfiguration(ct_ctrl_1,
                                                                [ct_1_1])
        conf_ct_ctrl_2 = createTimerableControllerConfiguration(ct_ctrl_2,
                                                                [ct_2_1])
        hw_ctrls = get_timerable_ctrls([conf_ct_ctrl_1],
                                       acq_mode=AcqMode.Timer)
        sw_ctrls = get_timerable_ctrls([conf_ct_ctrl_2],
                                       acq_mode=AcqMode.Timer)
        sw_master = sw_ctrls[0].master
        conf_tg_ctrl_1 = createControllerConfiguration(tg_ctrl_1, [tg_1_1])
        synch_ctrls = get_acq_ctrls([conf_tg_ctrl_1])
        # creating synchronization action
        self.synchronization = self.create_action(PoolSynchronization,
                                                  [tg_1_1])
        self.synchronization.add_listener(self)
        # add_listeners
        self.add_listeners([ct_1_1, ct_2_1])
        # creating acquisition actions
        self.hw_acq = self.create_action(PoolAcquisitionHardware, [ct_1_1])
        self.sw_acq = self.create_action(PoolAcquisitionSoftware, [ct_2_1])
        self.sw_acq_args = (sw_ctrls, integ_time, sw_master)
        self.sw_acq_kwargs = dict(synch=True)

        total_interval = active_interval + passive_interval
        group = {
            SynchParam.Delay: {SynchDomain.Time: offset},
            SynchParam.Active: {SynchDomain.Time: active_interval},
            SynchParam.Total: {SynchDomain.Time: total_interval},
            SynchParam.Repeats: repetitions
        }
        synch_description = [group]
        # get the current number of jobs
        jobs_before = get_thread_pool().qsize
        self.hw_acq.run(hw_ctrls, integ_time, repetitions, 0)
        self.synchronization.run(synch_ctrls, synch_description)
        # waiting for acquisition and synchronization to finish
        while (self.hw_acq.is_running()
               or self.sw_acq._is_busy()
               or self.synchronization.is_running()):
            time.sleep(.1)
        self.do_asserts(repetitions, jobs_before)
Example #2
0
 def acquire(self, integ_time, repetitions, latency_time):
     """Acquire with a dummy C/T synchronized by a hardware start
     trigger from a dummy T/G."""
     self.prepare(integ_time, repetitions, latency_time, 1)
     conf_ct_ctrl_1 = createTimerableControllerConfiguration(
         self.channel_ctrl, [self.channel])
     ctrls = get_timerable_ctrls([conf_ct_ctrl_1], AcqMode.Timer)
     conf_tg_ctrl_1 = createControllerConfiguration(self.tg_ctrl,
                                                    [self.tg])
     synch_ctrls = get_acq_ctrls([conf_tg_ctrl_1])
     self.synchronization = self.create_action(PoolSynchronization,
                                               [self.tg])
     # add data listeners
     self.add_listeners([self.channel])
     # creating acquisition actions
     self.acquisition = self.create_action(PoolAcquisitionHardware,
                                           [self.channel])
     self.acq_args = ([conf_ct_ctrl_1], integ_time, repetitions)
     # prepare synchronization description
     total_interval = integ_time + latency_time
     group = {
         SynchParam.Delay: {SynchDomain.Time: 0},
         SynchParam.Active: {SynchDomain.Time: integ_time},
         SynchParam.Total: {SynchDomain.Time: total_interval},
         SynchParam.Repeats: repetitions
     }
     synch_description = [group]
     # get the current number of jobs
     jobs_before = get_thread_pool().qsize
     self.acquisition.run(ctrls, integ_time, repetitions, 0)
     self.synchronization.run(synch_ctrls, synch_description)
     self.wait_finish()
     self.do_asserts(repetitions, jobs_before)
Example #3
0
 def acquire(self, integ_time, repetitions, latency_time):
     """Acquire with a dummy C/T synchronized by a hardware start
     trigger from a dummy T/G."""
     self.ct_ctrl_1.set_ctrl_par("synchronization", AcqSynch.HardwareStart)
     conf_ct_ctrl_1 = createTimerableControllerConfiguration(
         self.ct_ctrl_1, [self.ct_1_1])
     ctrls = get_timerable_ctrls([conf_ct_ctrl_1], AcqMode.Timer)
     conf_tg_ctrl_1 = createControllerConfiguration(self.tg_ctrl_1,
                                                    [self.tg_1_1])
     synch_ctrls = get_acq_ctrls([conf_tg_ctrl_1])
     self.synchronization = self.create_action(PoolSynchronization,
                                               [self.tg_1_1])
     # add data listeners
     self.add_listeners([self.ct_1_1])
     # creating acquisition actions
     self.acquisition = self.create_action(PoolAcquisitionHardware,
                                           [self.ct_1_1])
     self.acq_args = ([conf_ct_ctrl_1], integ_time, repetitions)
     # prepare synchronization description
     total_interval = integ_time + latency_time
     group = {
         SynchParam.Delay: {SynchDomain.Time: 0},
         SynchParam.Active: {SynchDomain.Time: integ_time},
         SynchParam.Total: {SynchDomain.Time: total_interval},
         SynchParam.Repeats: repetitions
     }
     synchronization = [group]
     # get the current number of jobs
     jobs_before = get_thread_pool().qsize
     self.acquisition.run(ctrls, integ_time, repetitions, 0)
     self.synchronization.run(synch_ctrls, synchronization)
     self.wait_finish()
     self.do_asserts(repetitions, jobs_before)
Example #4
0
    def acquire(self, integ_time, repetitions, latency_time):
        """Acquire with a dummy C/T synchronized by a hardware start
        trigger from a dummy T/G."""
        self.prepare(integ_time, repetitions, latency_time, 1)
        conf_ct_ctrl_1 = createTimerableControllerConfiguration(
            self.channel_ctrl, [self.channel])
        ctrls = get_timerable_ctrls([conf_ct_ctrl_1], AcqMode.Timer)
        master = ctrls[0].master
        # creating synchronization action
        self.synchronization = self.create_action(PoolSynchronization,
                                                  [self.tg])
        self.synchronization.add_listener(self)
        # add_listeners
        self.add_listeners([self.channel])
        # creating acquisition actions
        self.acquisition = self.create_action(PoolAcquisitionSoftware,
                                              [self.channel])
        # Since we deposit the software acquisition action on the PoolThread's
        # queue we can not rely on the action's state - one may still wait
        # in the queue (its state has not changed to running yet) and we would
        # be depositing another one. This way we may be starting multiple
        # times the same action (with the same elements involved), what results
        # in "already involved in operation" errors.
        # Use an external Event flag to mark if we have any software
        # acquisition action pending.
        self.acq_busy = threading.Event()
        self.acquisition.add_finish_hook(self.acq_busy.clear)
        self.acq_args = (ctrls, integ_time, master, None)
        self.acq_kwargs = {}

        total_interval = integ_time + latency_time
        group = {
            SynchParam.Delay: {
                SynchDomain.Time: 0
            },
            SynchParam.Active: {
                SynchDomain.Time: integ_time
            },
            SynchParam.Total: {
                SynchDomain.Time: total_interval
            },
            SynchParam.Repeats: repetitions
        }
        synchronization = [group]
        # get the current number of jobs
        jobs_before = get_thread_pool().qsize
        self.synchronization.run([], synchronization)
        self.wait_finish()
        self.do_asserts(repetitions, jobs_before, strict=False)
Example #5
0
    def acquire(self, integ_time, repetitions, latency_time):
        """Acquire with a dummy C/T synchronized by a hardware start
        trigger from a dummy T/G."""
        self.ct_ctrl_1.set_ctrl_par("synchronization", AcqSynch.SoftwareStart)

        conf_ct_ctrl_1 = createTimerableControllerConfiguration(
            self.ct_ctrl_1, [self.ct_1_1])
        ctrls = get_timerable_ctrls([conf_ct_ctrl_1], AcqMode.Timer)
        master = ctrls[0].master
        # creating synchronization action
        self.synchronization = self.create_action(PoolSynchronization,
                                                  [self.tg_1_1])
        self.synchronization.add_listener(self)
        # add_listeners
        self.add_listeners([self.ct_1_1])
        # creating acquisition actions
        self.acquisition = self.create_action(PoolAcquisitionSoftwareStart,
                                              [self.ct_1_1])

        self.acq_args = (ctrls, integ_time, master, repetitions, 0)
        self.acq_kwargs = {}

        total_interval = integ_time + latency_time
        group = {
            SynchParam.Delay: {
                SynchDomain.Time: 0
            },
            SynchParam.Active: {
                SynchDomain.Time: integ_time
            },
            SynchParam.Total: {
                SynchDomain.Time: total_interval
            },
            SynchParam.Repeats: repetitions
        }
        synchronization = [group]
        # get the current number of jobs
        jobs_before = get_thread_pool().qsize
        self.synchronization.run([], synchronization)
        self.wait_finish()
        self.do_asserts(repetitions, jobs_before)
Example #6
0
    def continuous_acquisition(self, offset, active_interval, passive_interval,
                               repetitions, integ_time):
        """Executes measurement running the TGGeneration and Acquisition actions
        according the test parameters. Checks the lengths of the acquired data.
        """
        # obtaining elements created in the BasePoolTestCase.setUp
        tg_1_1 = self.tgs['_test_tg_1_1']
        tg_ctrl_1 = tg_1_1.get_controller()
        ct_1_1 = self.cts['_test_ct_1_1']  # hw synchronized
        ct_2_1 = self.cts['_test_ct_2_1']  # sw synchronized
        ct_ctrl_1 = ct_1_1.get_controller()
        ct_ctrl_1.set_ctrl_par("synchronization", AcqSynch.HardwareTrigger)
        ct_ctrl_2 = ct_2_1.get_controller()
        self.channel_names.append('_test_ct_1_1')
        self.channel_names.append('_test_ct_2_1')

        conf_ct_ctrl_1 = createTimerableControllerConfiguration(
            ct_ctrl_1, [ct_1_1])
        conf_ct_ctrl_2 = createTimerableControllerConfiguration(
            ct_ctrl_2, [ct_2_1])
        hw_ctrls = get_timerable_ctrls([conf_ct_ctrl_1],
                                       acq_mode=AcqMode.Timer)
        sw_ctrls = get_timerable_ctrls([conf_ct_ctrl_2],
                                       acq_mode=AcqMode.Timer)
        sw_master = sw_ctrls[0].master
        conf_tg_ctrl_1 = createControllerConfiguration(tg_ctrl_1, [tg_1_1])
        synch_ctrls = get_acq_ctrls([conf_tg_ctrl_1])
        # creating synchronization action
        self.synchronization = self.create_action(PoolSynchronization,
                                                  [tg_1_1])
        self.synchronization.add_listener(self)
        # add_listeners
        self.add_listeners([ct_1_1, ct_2_1])
        # creating acquisition actions
        self.hw_acq = self.create_action(PoolAcquisitionHardware, [ct_1_1])
        self.sw_acq = self.create_action(PoolAcquisitionSoftware, [ct_2_1])
        # Since we deposit the software acquisition action on the PoolThread's
        # queue we can not rely on the action's state - one may still wait
        # in the queue (its state has not changed to running yet) and we would
        # be depositing another one. This way we may be starting multiple
        # times the same action (with the same elements involved), what results
        # in "already involved in operation" errors.
        # Use an external Event flag to mark if we have any software
        # acquisition action pending.
        self.sw_acq_busy = threading.Event()
        self.sw_acq.add_finish_hook(self.sw_acq_busy.clear)
        self.sw_acq_args = (sw_ctrls, integ_time, sw_master)
        self.sw_acq_kwargs = {}

        total_interval = active_interval + passive_interval
        group = {
            SynchParam.Delay: {
                SynchDomain.Time: offset
            },
            SynchParam.Active: {
                SynchDomain.Time: active_interval
            },
            SynchParam.Total: {
                SynchDomain.Time: total_interval
            },
            SynchParam.Repeats: repetitions
        }
        synchronization = [group]
        # get the current number of jobs
        jobs_before = get_thread_pool().qsize
        self.hw_acq.run(hw_ctrls, integ_time, repetitions, 0)
        self.synchronization.run(synch_ctrls, synchronization)
        # waiting for acquisition and synchronization to finish
        while (self.hw_acq.is_running() or self.sw_acq.is_running()
               or self.synchronization.is_running()):
            time.sleep(.1)
        self.do_asserts(repetitions, jobs_before)
Example #7
0
    def continuous_acquisition(self, offset, active_interval, passive_interval,
                               repetitions, integ_time):
        """Executes measurement running the TGGeneration and Acquisition actions
        according the test parameters. Checks the lengths of the acquired data.
        """
        # obtaining elements created in the BasePoolTestCase.setUp
        tg_1_1 = self.tgs['_test_tg_1_1']
        tg_ctrl_1 = tg_1_1.get_controller()
        ct_1_1 = self.cts['_test_ct_1_1']  # hw synchronized
        ct_2_1 = self.cts['_test_ct_2_1']  # sw synchronized
        ct_ctrl_1 = ct_1_1.get_controller()
        ct_ctrl_1.set_ctrl_par("synchronization", AcqSynch.HardwareTrigger)
        ct_ctrl_2 = ct_2_1.get_controller()
        self.channel_names.append('_test_ct_1_1')
        self.channel_names.append('_test_ct_2_1')

        conf_ct_ctrl_1 = createTimerableControllerConfiguration(ct_ctrl_1,
                                                                [ct_1_1])
        conf_ct_ctrl_2 = createTimerableControllerConfiguration(ct_ctrl_2,
                                                                [ct_2_1])
        hw_ctrls = get_timerable_ctrls([conf_ct_ctrl_1],
                                       acq_mode=AcqMode.Timer)
        sw_ctrls = get_timerable_ctrls([conf_ct_ctrl_2],
                                       acq_mode=AcqMode.Timer)
        sw_master = sw_ctrls[0].master
        conf_tg_ctrl_1 = createControllerConfiguration(tg_ctrl_1, [tg_1_1])
        synch_ctrls = get_acq_ctrls([conf_tg_ctrl_1])
        # creating synchronization action
        self.synchronization = self.create_action(PoolSynchronization,
                                                  [tg_1_1])
        self.synchronization.add_listener(self)
        # add_listeners
        self.add_listeners([ct_1_1, ct_2_1])
        # creating acquisition actions
        self.hw_acq = self.create_action(PoolAcquisitionHardware, [ct_1_1])
        self.sw_acq = self.create_action(PoolAcquisitionSoftware, [ct_2_1])
        # Since we deposit the software acquisition action on the PoolThread's
        # queue we can not rely on the action's state - one may still wait
        # in the queue (its state has not changed to running yet) and we would
        # be depositing another one. This way we may be starting multiple
        # times the same action (with the same elements involved), what results
        # in "already involved in operation" errors.
        # Use an external Event flag to mark if we have any software
        # acquisition action pending.
        self.sw_acq_busy = threading.Event()
        self.sw_acq.add_finish_hook(self.sw_acq_busy.clear)
        self.sw_acq_args = (sw_ctrls, integ_time, sw_master)
        self.sw_acq_kwargs = {}

        total_interval = active_interval + passive_interval
        group = {
            SynchParam.Delay: {SynchDomain.Time: offset},
            SynchParam.Active: {SynchDomain.Time: active_interval},
            SynchParam.Total: {SynchDomain.Time: total_interval},
            SynchParam.Repeats: repetitions
        }
        synchronization = [group]
        # get the current number of jobs
        jobs_before = get_thread_pool().qsize
        self.hw_acq.run(hw_ctrls, integ_time, repetitions, 0)
        self.synchronization.run(synch_ctrls, synchronization)
        # waiting for acquisition and synchronization to finish
        while (self.hw_acq.is_running()
               or self.sw_acq.is_running()
               or self.synchronization.is_running()):
            time.sleep(.1)
        self.do_asserts(repetitions, jobs_before)