コード例 #1
0
ファイル: tektro_awg.py プロジェクト: zoulianmp/HQCMeas
 def run_mode(self, value):
     """Run mode setter method
     """
     if value in ('CONT', 'CONTINUOUS', 'continuous'):
         self.write('AWGControl:RMODe CONT')
         if self.ask('AWGControl:RMODe?') != 'CONT':
             raise InstrIOError(
                 cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     elif value in ('TRIG', 'TRIGGERED', 'triggered'):
         self.write('AWGControl:RMODe TRIG')
         if self.ask('AWGControl:RMODe?') != 'TRIG':
             raise InstrIOError(
                 cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     elif value in ('GAT', 'GATED', 'gated'):
         self.write('AWGControl:RMODe GAT')
         if self.ask('AWGControl:RMODe?') != 'GAT':
             raise InstrIOError(
                 cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     elif value in ('SEQ', 'SEQUENCE', 'sequence'):
         self.write('AWGControl:RMODe SEQ')
         if self.ask('AWGControl:RMODe?') != 'SEQ':
             raise InstrIOError(
                 cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     else:
         mess = fill(
             cleandoc('''The invalid value {} was sent to
                              run mode method''').format(value), 80)
         raise VisaTypeError(mess)
コード例 #2
0
ファイル: tektro_awg.py プロジェクト: zoulianmp/HQCMeas
    def output_state(self, value):
        """ Output setter method. 'ON', 'OFF'

        """
        with self.secure():
            on = re.compile('on', re.IGNORECASE)
            off = re.compile('off', re.IGNORECASE)
            if on.match(value) or value == 1:

                self._AWG.write('OUTP{}:STAT ON'.format(self._channel))
                if self._AWG.ask_for_values('OUTP{}:STAT?'.format(
                        self._channel))[0] != 1:
                    raise InstrIOError(
                        cleandoc('''Instrument did not set
                                                correctly the output'''))
            elif off.match(value) or value == 0:
                self._AWG.write('OUTP{}:STAT OFF'.format(self._channel))
                if self._AWG.ask_for_values('OUTP{}:STAT?'.format(
                        self._channel))[0] != 0:
                    raise InstrIOError(
                        cleandoc('''Instrument did not set
                                                correctly the output'''))
            else:
                mess = fill(
                    cleandoc('''The invalid value {} was sent to
                            switch_on_off method''').format(value), 80)
                raise VisaTypeError(mess)
コード例 #3
0
 def run_mode(self, value):
     """Run mode setter method
     """
     if value in ('CONT', 'CONTINUOUS', 'continuous'):
         self.write('INIT:CONT ON')
         if self.ask('INIT:CONT?') != 'ON':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     elif value in ('TRIG', 'TRIGGERED', 'triggered'):
         self.write('INIT:CONT OFF')
         self.write('INIT:GATE OFF')
         if self.ask('INIT:CONT?') != 'OFF':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the run mode'''))
         elif self.ask('INIT:GATE?') != 'OFF':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     elif value in ('GAT', 'GATED', 'gated'):
         self.write('INIT:CONT OFF')
         self.write('INIT:GATE ON')
         if self.ask('INIT:CONT?') != 'OFF':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the run mode'''))
         elif self.ask('INIT:GATE?') != 'ON':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the run mode'''))
     else:
         mess = fill(cleandoc('''The invalid value {} was sent to
                              run mode method''').format(value), 80)
         raise VisaTypeError(mess)
コード例 #4
0
ファイル: tabor_awg.py プロジェクト: freempi/ecpy_qcircuits
    def output_state(self, value):
        """ Output setter method. 'ON', 'OFF'

        """
        with self.secure():
            on = re.compile('on', re.IGNORECASE)
            off = re.compile('off', re.IGNORECASE)
            if on.match(value) or value == 1:

                self._AWG.write('INST {}'.format(self._channel))
                self._AWG.write('SOUR:FUNC:MODE USER')
                self._AWG.write('OUTP ON')
                if self._AWG.ask('OUTP?') != 'ON':
                    raise InstrIOError(
                        cleandoc('''Instrument did not set
                                                correctly the output'''))
            elif off.match(value) or value == 0:
                self._AWG.write('INST {}'.format(self._channel))
                self._AWG.write('SOUR:FUNC:MODE USER')
                self._AWG.write('OUTP OFF')
                if self._AWG.ask('OUTP?') != 'OFF':
                    raise InstrIOError(
                        cleandoc('''Instrument did not set
                                                correctly the output'''))
            else:
                mess = fill(
                    cleandoc('''The invalid value {} was sent to
                            switch_on_off method''').format(value), 80)
                raise VisaTypeError(mess)
コード例 #5
0
    def pm_state(self, value):
        """Pulse modulation setter method.

        """
        # TODO: write checks
        self.write('SOURce:PULM:SOURce EXT')
        self.write('SOURce:PULM:POLarity NORMal')
        self.write('SOURce:PULM:TRIGger:EXTernal:IMPedance G50')
        on = re.compile('on', re.IGNORECASE)
        off = re.compile('off', re.IGNORECASE)
        if on.match(value) or value == 1:
            self.write('SOURce:PULM:STATE ON')
            if self.ask('SOURce:PULM:STATE?') != '1':
                raise InstrIOError(
                    cleandoc('''Instrument did not set correctly
                                        the pulse modulation state'''))
        elif off.match(value) or value == 0:
            self.write('SOURce:PULM:STATE OFF')
            if self.ask('SOURce:PULM:STATE?') != '0':
                raise InstrIOError(
                    cleandoc('''Instrument did not set correctly
                                        the pulse modulation state'''))
        else:
            mess = fill(
                cleandoc('''The invalid value {} was sent to
                        switch_on_off method''').format(value), 80)
            raise VisaTypeError(mess)
コード例 #6
0
ファイル: yokogawa.py プロジェクト: pheidmann/HQCMeas
 def function(self, mode):
     """Function setter method
     """
     volt = re.compile('VOLT', re.IGNORECASE)
     curr = re.compile('CURR', re.IGNORECASE)
     if volt.match(mode):
         self.write('OS')
         self.read()
         current_range = self.read()[2:4]
         self.read()
         self.read()
         self.read()
         self.write('F1{}E'.format(current_range))
         value = self.ask('OD')
         if value[3] != 'V':
             raise InstrIOError('Instrument did not set correctly the mode')
     elif curr.match(mode):
         self.write('F5E')
         value = self.ask('OD')
         if value[3] != 'A':
             raise InstrIOError('Instrument did not set correctly the mode')
     else:
         mess = fill(
             '''The invalid value {} was sent to set_function
                     method of the Yokogawa driver'''.format(value), 80)
         raise VisaTypeError(mess)
コード例 #7
0
    def internal_trigger(self, value):
        """Setter for internal trigger enable

        """
        if value in ('INT', 1, 'True'):
            self.write('TRIGGER:SEQUENCE:SOURCE INT')
        elif value in ('EXT', 0, 'False'):
            self.write('TRIGGER:SEQUENCE:SOURCE EXT')
        else:
            mess = fill(
                cleandoc('''The invalid value {} was sent to
                                 internal_trigger method''').format(value), 80)
            raise VisaTypeError(mess)
コード例 #8
0
 def clock_source(self, value):
     """clock source setter method
     """
     if value in ('EXT', 1, 'True'):
         self.write(':FREQ:RAST:SOUR EXT')
         if self.ask(':FREQ:RAST:SOUR?') != 'EXT':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the clock source'''))
     elif value in ('INT', 0, 'False'):
         self.write(':FREQ:RAST:SOUR INT')
         if self.ask(':FREQ:RAST:SOUR?') != 'INT':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the clock source'''))
     else:
         mess = fill(cleandoc('''The invalid value {} was sent to
                              clock_source_external
                              method''').format(value), 80)
         raise VisaTypeError(mess)
コード例 #9
0
 def output(self, value):
     """Output setter method
     """
     on = re.compile('on', re.IGNORECASE)
     off = re.compile('off', re.IGNORECASE)
     if on.match(value) or value == 1:
         self.write(':OUTPUT ON')
         if self.ask(':OUTPUT?')!= '1':
             raise InstrIOError(cleandoc('''Instrument did not set correctly
                                     the output'''))
     elif off.match(value) or value == 0:
         self.write(':OUTPUT OFF')
         if self.ask(':OUTPUT?')!= '0':
             raise InstrIOError(cleandoc('''Instrument did not set correctly
                                     the output'''))
     else:
         mess = fill(cleandoc('''The invalid value {} was sent to
                     switch_on_off method''').format(value), 80)
         raise VisaTypeError(mess)
コード例 #10
0
ファイル: tektro_awg.py プロジェクト: zoulianmp/HQCMeas
 def running(self, value):
     """Run state setter method
     """
     if value in ('RUN', 1, 'True'):
         self.write('AWGC:RUN:IMM')
         if self.ask_for_values('AWGC:RST?')[0] not in (1, 2):
             raise InstrIOError(
                 cleandoc('''Instrument did not set
                                         correctly the run state'''))
     elif value in ('STOP', 0, 'False'):
         self.write('AWGC:STOP:IMM')
         if self.ask_for_values('AWGC:RST?')[0] != 0:
             raise InstrIOError(
                 cleandoc('''Instrument did not set
                                         correctly the run state'''))
     else:
         mess = fill(
             cleandoc('''The invalid value {} was sent to
                              running method''').format(value), 80)
         raise VisaTypeError(mess)
コード例 #11
0
 def output(self, value):
     """Output setter method. 'ON', 'OFF'
     """
     with self.secure():
         on = re.compile('on', re.IGNORECASE)
         off = re.compile('off', re.IGNORECASE)
         if value == 1 or on.match(str(value)):
             self._TB.write(self._header + 'OUTP1')
             if self._TB.query(self._header + 'OUTP?') != '1':
                 raise InstrIOError(cleandoc('''Instrument did not set
                                             correctly the output'''))
         elif value == 0 or off.match(str(value)):
             self._TB.write(self._header + 'OUTP0')
             if self._TB.query(self._header + 'OUTP?') != '0':
                 raise InstrIOError(cleandoc('''Instrument did not set
                                             correctly the output'''))
         else:
             mess = fill(cleandoc('''The invalid value {} was sent to
                         switch_on_off method''').format(value), 80)
             raise VisaTypeError(mess)
コード例 #12
0
 def oscillator_reference_external(self, value):
     """oscillator reference external setter method
     """
     if value in ('EXT', 1, 'True'):
         self.write('SOUR:ROSC:SOUR EXT')
         if self.ask('SOUR:ROSC:SOUR?') != 'EXT':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the oscillator
                                         reference'''))
     elif value in ('INT', 0, 'False'):
         self.write('SOUR:ROSC:SOUR INT')
         if self.ask('SOUR:ROSC:SOUR?') != 'INT':
             raise InstrIOError(cleandoc('''Instrument did not set
                                         correctly the oscillator
                                         reference'''))
     else:
         mess = fill(cleandoc('''The invalid value {} was sent to
                              oscillator_reference_external
                              method''').format(value), 80)
         raise VisaTypeError(mess)
コード例 #13
0
ファイル: yokogawa.py プロジェクト: pheidmann/HQCMeas
 def function(self, mode):
     """Function setter method
     """
     volt = re.compile('VOLT', re.IGNORECASE)
     curr = re.compile('CURR', re.IGNORECASE)
     if volt.match(mode):
         self.write(':SOURce:FUNCtion VOLT')
         value = self.ask('SOURce:FUNCtion?')
         if value[1:-1] != 'VOLT':
             raise InstrIOError('Instrument did not set correctly the mode')
     elif curr.match(mode):
         self.write(':SOURce:FUNCtion CURR')
         value = self.ask('SOURce:FUNCtion?')
         if value[1:-1] != 'CURR':
             raise InstrIOError('Instrument did not set correctly the mode')
     else:
         mess = fill(
             '''The invalid value {} was sent to set_function
                     method of the Yokogawa driver'''.format(value), 80)
         raise VisaTypeError(mess)
コード例 #14
0
ファイル: yokogawa.py プロジェクト: pheidmann/HQCMeas
 def output(self, value):
     """Output setter method
     """
     on = re.compile('on', re.IGNORECASE)
     off = re.compile('off', re.IGNORECASE)
     if on.match(value) or value == 1:
         self.write('O1E')
         if ('{0:08b}'.format(int(self.ask('OC'))))[3] != '1':
             raise InstrIOError(
                 cleandoc('''Instrument did not set correctly
                                         the output'''))
     elif off.match(value) or value == 0:
         self.write('O0E')
         if ('{0:08b}'.format(int(self.ask('OC'))))[3] != '0':
             raise InstrIOError(
                 cleandoc('''Instrument did not set correctly
                                         the output'''))
     else:
         mess = fill(
             cleandoc('''The invalid value {} was sent to set the
                 output state of the Yokogawa driver''').format(value), 80)
         raise VisaTypeError(mess)
    def output(self, value):
        """Output setter method.

        """
        on = re.compile('on', re.IGNORECASE)
        off = re.compile('off', re.IGNORECASE)
        if on.match(value) or value == 1:
            self.write('E1r1')
            if not self.output:
                raise InstrIOError(
                    cleandoc('''Instrument did not set correctly
                                        the output'''))
        elif off.match(value) or value == 0:
            self.write('E0r0')
            if self.output:
                raise InstrIOError(
                    cleandoc('''Instrument did not set correctly
                                        the output'''))
        else:
            mess = fill(
                cleandoc('''The invalid value {} was sent to
                        switch_on_off method''').format(value), 80)
            raise VisaTypeError(mess)
        self.check_calibration()