コード例 #1
0
    def _update_int_delay(instr, value, **kwargs):
        """
        Function to validate value for int_delay before setting parameter
        value and update instr attributes.

        Args:
            value to be validated and used for instrument attribute update

        Checks:
            0 <= value <= 0.1 seconds
            number of samples discarded >= numtaps

        Sets:
            sample_rate attr of acq controller to be that of alazar
            samples_per_record of acq controller
            acquisition_kwarg['samples_per_record'] of acquisition param
        """
        if (value is None) or not (0 <= value <= 0.1):
            raise ValueError('int_delay must be 0 <= value <= 1')
        alazar = instr._get_alazar()
        instr.sample_rate = alazar.get_sample_rate()
        samples_delay_min = (instr.filter_settings['numtaps'] - 1)
        int_delay_min = samples_delay_min / instr.sample_rate
        if value < int_delay_min:
            logging.warning(
                'delay is less than recommended for filter choice: '
                '(expect delay >= {})'.format(int_delay_min))

        # update acquision kwargs and acq controller value
        total_time = value + (instr.int_time() or 0)
        samples_needed = total_time * instr.sample_rate
        instr.samples_per_record = helpers.roundup(samples_needed,
                                                   instr.samples_divisor)
        instr.acquisition.acquisition_kwargs.update(
            samples_per_record=instr.samples_per_record)
コード例 #2
0
 def _update_samples_per_record(self, sample_rate, int_time, int_delay):
     """
     Keeps non settable samples_per_record up to date with int_time int_delay
     and updates setpoints as needed.
     """
     total_time = (int_time or 0) + (int_delay or 0)
     samples_needed = total_time * sample_rate
     samples_per_record = helpers.roundup(samples_needed,
                                          self.samples_divisor)
     self.samples_per_record._save_val(samples_per_record)
     self.acquisition.set_setpoints_and_labels()
コード例 #3
0
    def _update_int_time(instr, value, **kwargs):
        """
        Function to validate value for int_time before setting parameter
        value and update instr attributes.

        Args:
            value to be validated and used for instrument attribute update

        Checks:
            0 <= value <= 0.1 seconds
            number of oscilation measured in this time
            oversampling rate

        Sets:
            sample_rate attr of acq controller to be that of alazar
            samples_per_record of acq controller
            acquisition_kwarg['samples_per_record'] of acquisition param
            setpoints of acquisiton param
            shape of acquisition param
        """
        if (value is None) or not (0 <= value <= 0.1):
            raise ValueError('int_time must be 0 <= value <= 1')

        alazar = instr._get_alazar()
        instr.sample_rate = alazar.get_sample_rate()
        if instr.get_max_demod_freq() is not None:
            min_oscilations_measured = value * instr.get_max_demod_freq()
            oversampling = instr.sample_rate / (2 * instr.get_max_demod_freq())
            if min_oscilations_measured < 10:
                logging.warning('{} oscilations measured for largest '
                                'demod freq, recommend at least 10: '
                                'decrease sampling rate, take '
                                'more samples or increase demodulation '
                                'freq'.format(min_oscilations_measured))
            elif oversampling < 1:
                logging.warning('oversampling rate is {}, recommend > 1: '
                                'increase sampling rate or decrease '
                                'demodulation frequency'.format(oversampling))
        if instr.int_delay() is None:
            instr.int_delay.to_default()

        # update acquisition parameter shapes
        start = instr.int_delay()
        stop = start + value
        npts = int(value * instr.sample_rate)
        instr.acquisition.update_sweep(start, stop, npts)

        # update acquision kwargs and acq controller value
        total_time = value + instr.int_delay()
        samples_needed = total_time * instr.sample_rate
        instr.samples_per_record = helpers.roundup(samples_needed,
                                                   instr.samples_divisor)
        instr.acquisition.acquisition_kwargs.update(
            samples_per_record=instr.samples_per_record)