예제 #1
0
파일: PTS.py 프로젝트: avelo/Pythics
 def __init__(self, loc, **kwargs):
     self.board, self.address = loc.split('::')
     self.address_chr = chr(int(self.address)+32)
     session = vpp43.open_default_resource_manager()
     resource_name = vpp43.find_resources(session, self.board)[2]
     vpp43.open(session, resource_name)
     self.board_n = int(self.board.split('B')[1])
     gpib = visa.Gpib(self.board_n)
     vpp43.gpib_send_ifc(gpib.vi)
     vpp43.gpib_control_ren(gpib.vi, 1)
     self._frequency = None
     self._amplitude = None
예제 #2
0
파일: PTS.py 프로젝트: eunjongkim/Pythics
 def __init__(self, loc, **kwargs):
     self.board, self.address = loc.split('::')
     self.address_chr = chr(int(self.address) + 32)
     session = vpp43.open_default_resource_manager()
     resource_name = vpp43.find_resources(session, self.board)[2]
     vpp43.open(session, resource_name)
     self.board_n = int(self.board.split('B')[1])
     gpib = visa.Gpib(self.board_n)
     vpp43.gpib_send_ifc(gpib.vi)
     vpp43.gpib_control_ren(gpib.vi, 1)
     self._frequency = None
     self._amplitude = None
예제 #3
0
파일: Optodac.py 프로젝트: dicky98/qtlab
 def _open_serial_connection(self):
     logging.debug(__name__ + ":Opening serial connection")
     self._session = vpp43.open_default_resource_manager()
     self._vi = vpp43.open(self._session, self._address)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 115200)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS, vpp43.VI_ASRL_STOP_ONE)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY, vpp43.VI_ASRL_PAR_ODD)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN, vpp43.VI_ASRL_END_NONE)
예제 #4
0
 def _open_serial_connection(self):
     logging.debug(__name__ + ':Opening serial connection')
     self._session = vpp43.open_default_resource_manager()
     self._vi = vpp43.open(self._session, self._address)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 115200)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS,
                         vpp43.VI_ASRL_STOP_ONE)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY,
                         vpp43.VI_ASRL_PAR_ODD)
     vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN,
                         vpp43.VI_ASRL_END_NONE)
예제 #5
0
    def open(self):
        # Open instrument
        self._vi = vpp43.open(visa.resource_manager.session,
            self._resource_name)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_TMO_VALUE, self._timeout)
        # Timeout value should always be higher than integration time

        # Assign endpoint
        vpp43.set_attribute(self._vi, VI_ATTR_USB_BULK_IN_PIPE, self._in_pipe)
        vpp43.set_attribute(self._vi, VI_ATTR_USB_BULK_OUT_PIPE, self._out_pipe)

        # Initialize
        vpp43.write(self._vi, '\x01')  # Reset command
예제 #6
0
    def open(self):
        # Open instrument
        self._vi = vpp43.open(visa.resource_manager.session,
                              self._resource_name)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_TMO_VALUE, self._timeout)
        # Timeout value should always be higher than integration time

        # Assign endpoint
        vpp43.set_attribute(self._vi, VI_ATTR_USB_BULK_IN_PIPE, self._in_pipe)
        vpp43.set_attribute(self._vi, VI_ATTR_USB_BULK_OUT_PIPE,
                            self._out_pipe)

        # Initialize
        vpp43.write(self._vi, '\x01')  # Reset command
예제 #7
0
def initPSU():
    IPaddr = "192.168.6.6"
    defaultRm = vpp43.open_default_resource_manager()
    if defaultRm < VI_SUCCESS:
        print "status < VI_SUCCESS, quitting"
        quit()
    rsc = []
    rsc.extend([] * 256)
    rsc = "TCPIP::192.168.6.6::2268::SOCKET"
    accessMode = VI_NO_LOCK
    timeout = 0
    vi = vpp43.open(defaultRm, rsc, accessMode, timeout)
    vpp43.set_attribute(vi, VI_ATTR_TMO_VALUE, 10000)
    vpp43.set_attribute(vi, VI_ATTR_TERMCHAR_EN, VI_TRUE)
    setPSU(vi, 0, 0)
    return vi
예제 #8
0
    def __init__(self, resource_name, timeout=10000):
        """
        @timeout in milliseconds
        """
        self._resource_name = resource_name
        self._timeout = timeout

        # Check model code to make sure we are using the right command language
        vi = vpp43.open(visa.resource_manager.session, resource_name)
        model_code = vpp43.get_attribute(vi, vpp43.VI_ATTR_MODEL_CODE)
        vpp43.close(vi)
        if model_code != self._model_code:
            raise OceanOpticsError('The spectrometer reported a different '
                'model code ({}) than the driver expected '
                '({}).'.format(model_code, self._model_code))

        self._vi = None  # connection not currently open
예제 #9
0
    def __init__(self, resource_name, timeout=10000):
        """
        @timeout in milliseconds
        """
        self._resource_name = resource_name
        self._timeout = timeout

        # Check model code to make sure we are using the right command language
        vi = vpp43.open(visa.resource_manager.session, resource_name)
        model_code = vpp43.get_attribute(vi, vpp43.VI_ATTR_MODEL_CODE)
        vpp43.close(vi)
        if model_code != self._model_code:
            raise OceanOpticsError('The spectrometer reported a different '
                                   'model code ({}) than the driver expected '
                                   '({}).'.format(model_code,
                                                  self._model_code))

        self._vi = None  # connection not currently open
예제 #10
0
    def _open_serial_connection(self):
        '''
        Opens the ASRL connection using vpp43
        baud=115200, databits=8, stop=one, parity=odd, no end char for reads

        Input:
            None

        Output:
            None
        '''
        logging.debug(__name__ + ' : Opening serial connection')
        self._session = vpp43.open_default_resource_manager()
        self._vi = vpp43.open(self._session, self._address)

        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 115200)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS,
                            vpp43.VI_ASRL_STOP_ONE)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY,
                            vpp43.VI_ASRL_PAR_ODD)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN,
                            vpp43.VI_ASRL_END_NONE)
예제 #11
0
파일: IVVI.py 프로젝트: CaoXiPitt/Qtlab
    def _open_serial_connection(self):
        '''
        Opens the ASRL connection using vpp43
        baud=115200, databits=8, stop=one, parity=odd, no end char for reads

        Input:
            None

        Output:
            None
        '''
        logging.debug('Opening serial connection')
        self._session = vpp43.open_default_resource_manager()
        self._vi = vpp43.open(self._session, self._address)

        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 115200)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS,
            vpp43.VI_ASRL_STOP_ONE)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY,
            vpp43.VI_ASRL_PAR_ODD)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN,
            vpp43.VI_ASRL_END_NONE)
예제 #12
0
def autodetect_spectrometer(resource_name, *args, **kwargs):
    """
    Factory method which creates an appropriate instrument object, depending
    on the model code that the unit identifies itself with.
    """
    vi = vpp43.open(visa.resource_manager.session, resource_name)
    model_code = vpp43.get_attribute(vi, vpp43.VI_ATTR_MODEL_CODE)
    vpp43.close(vi)

    if model_code == 4098:
        return USB2000(resource_name, *args, **kwargs)
    if model_code == 4100:
        return ADC1000(resource_name, *args, **kwargs)
    if model_code == 4106:
        return HR2000(resource_name, *args, **kwargs)
    if model_code == 4114:
        return HR4000(resource_name, *args, **kwargs)
    if model_code == 4118:
        return HR2000Plus(resource_name, *args, **kwargs)
    if model_code == 4120:
        return QE65000(resource_name, *args, **kwargs)
    if model_code == 4126:
        return USB2000Plus(resource_name, *args, **kwargs)
    if model_code == 4130:
        return USB4000(resource_name, *args, **kwargs)
    if model_code == 4134:
        return NIRQuest512(resource_name, *args, **kwargs)
    if model_code == 4136:
        return NIRQuest256(resource_name, *args, **kwargs)
    if model_code == 4138:
        return MayaPro(resource_name, *args, **kwargs)
    if model_code == 4140:
        return Maya(resource_name, *args, **kwargs)
    if model_code == 4160:
        return Torus(resource_name, *args, **kwargs)

    raise visa.VisaIOError(OO_ERROR_MODEL_NOT_FOUND)
예제 #13
0
def autodetect_spectrometer(resource_name, *args, **kwargs):
    """
    Factory method which creates an appropriate instrument object, depending
    on the model code that the unit identifies itself with.
    """
    vi = vpp43.open(visa.resource_manager.session, resource_name)
    model_code = vpp43.get_attribute(vi, vpp43.VI_ATTR_MODEL_CODE)
    vpp43.close(vi)

    if model_code == 4098:
        return USB2000(resource_name, *args, **kwargs)
    if model_code == 4100:
        return ADC1000(resource_name, *args, **kwargs)
    if model_code == 4106:
        return HR2000(resource_name, *args, **kwargs)
    if model_code == 4114:
        return HR4000(resource_name, *args, **kwargs)
    if model_code == 4118:
        return HR2000Plus(resource_name, *args, **kwargs)
    if model_code == 4120:
        return QE65000(resource_name, *args, **kwargs)
    if model_code == 4126:
        return USB2000Plus(resource_name, *args, **kwargs)
    if model_code == 4130:
        return USB4000(resource_name, *args, **kwargs)
    if model_code == 4134:
        return NIRQuest512(resource_name, *args, **kwargs)
    if model_code == 4136:
        return NIRQuest256(resource_name, *args, **kwargs)
    if model_code == 4138:
        return MayaPro(resource_name, *args, **kwargs)
    if model_code == 4140:
        return Maya(resource_name, *args, **kwargs)
    if model_code == 4160:
        return Torus(resource_name, *args, **kwargs)

    raise visa.VisaIOError(OO_ERROR_MODEL_NOT_FOUND)