def connect(self):
     paramsets = list_instruments()
     self.ccs = instrument(paramsets[0])
     log.info('CCS200/M Spectrometer CONNECTED')
     time.sleep(0.1)
     self.stage = ThorlabsStageWithStepMotors()
     self.stage.set_stage()
Пример #2
0
    def __init__(self, param_dict):
        [setattr(self, key, val) for key, val in param_dict.items()]
        self.log_ref = param_dict["log_ref"]
        self._inst = None

        if not list_instruments(module="cameras"):
            exc = IOError("No UC480 cameras detected.")
            err_hndlr(exc, sys._getframe(), locals(), dvc=self)
Пример #3
0
    def open_camera(self, serial=False):
        """Connect to a uc480 camera."""
        print 'Attempting to connect to the camera...'
        if serial:
            print "Serial number: %s" % serial
            self.camera = instrument(serial=serial)  # specified camera
        else:
            print "Available instruments:"
            print list_instruments()
            self.camera = instrument('uc480')  # default camera

        # set the camera gui buttons
        self.reset_gui_with_camera()
        print 'Camera connection successful.\n'
        self.find_cameras()

        # set camera window title
        self.image_widget.setWindowTitle(self.camera.serial +
                                         ' = uc480 camera serial no.')

        # set camera width and height labels
        self.CameraWidthLabel.setText(str(self.camera.max_width))
        self.CameraHeightLabel.setText(str(self.camera.max_height))

        # determine which camera parameters can be set
        try:
            self.camera.gamma = int(self.GammaNumberBox.value())
            self.set_gamma = True
        except:
            print "WARNING: Can't set gamma.\n"
            self.set_gamma = False
        try:
            self.camera.auto_whitebalance = self.AutoWhitebalanceCheckBox.checkState(
            )
            self.set_whitebalance = True
        except:
            print "WARNING: Can't set auto_whitebalance.\n"
            self.set_whitebalance = False

        # initialise the attributes dictionary
        self.attributes = dict()

        # take first image
        self.take_image()
Пример #4
0
 def find_cameras(self):
     """Find serial numbers of available cameras."""
     drivers = list_instruments()
     self.SerialComboBox.clear()
     for driver in drivers:
         if driver['classname'] == 'UC480_Camera':
             self.SerialComboBox.addItem(driver['serial'])
     try:
         serial = self.camera.serial
         index = self.SerialComboBox.findText(serial)
         self.SerialComboBox.setCurrentIndex(index)
     except:
         print("No camera is currently open.\n")
Пример #5
0
def test_list_instruments():
    list_instruments()
Пример #6
0
        self.image_array[frame_number, :, :] = image
        self.capture_timestamp_array[frame_number] = capture_time_sec
        self.attributes['capture_time_sec'] = self.capture_timestamp_array


class HighPrecisionWallTime(object):
    def __init__(self, ):
        self._wall_time_0 = time.time()
        self._clock_0 = time.clock()

    def sample(self, ):
        dc = time.clock() - self._clock_0
        return self._wall_time_0 + dc


if __name__ == '__main__':
    drivers = list_instruments()
    if not len(drivers):
        print("No instruments found")

    app = QtWidgets.QApplication([])
    cameras = list()
    for driver in drivers:
        print("Instrument driver:")
        print(driver)
        print()
        if driver['classname'] == 'UC480_Camera':
            cameras.append(uc480(serial=driver['serial']))
            cameras[-1].show()
            cameras[-1].activateWindow()
Пример #7
0
#https://github.com/jrr1984/thorlabs_step_motors_ZST213B/blob/master/spectrometer/ccs200m.ipynb

#code requirements:
#0) Runs on python 3.6.3 (does not work on python 3.7)
#1) install through setup.py https://github.com/mabuchilab/Instrumental
#2) needs pyvisa, cffi (messy installation perhaps depending on OS)
# [email protected]

import visa
rm = visa.ResourceManager()
rm.list_resources()

from instrumental import instrument, list_instruments
from instrumental.drivers.spectrometers.thorlabs_ccs import CCS

paramsets = list_instruments()
paramsets

ccs = instrument(paramsets[0])
ccs

ccs.get_device_info()

ccs.get_integration_time()

ccs.set_integration_time(integration_time='0.01 seconds', stop_scan=True)

ccs.stop_scan()

ccs.stop_and_clear()
Пример #8
0
brightness = 0.75

slm = SLM.SLM(3)
#slm2 = SLM.SLM(2)

fig, ax = plt.subplots()

slm.enable_blazed()

fps_ = 60

pmillis = int(round(time.time() * 1000))

num_of_frames = 0

inst = list_instruments()

print(inst)

cam = instrument(inst[0])

cam.master_gain = 1
cam.gain_boost = False

#cam.start_live_video(framerate = '60 hertz', exposure_time='0.05 millisecond')

current_coeffs = [0, 0, 0, 0, 0, 0,
                  0]  #-0.025, -0.5, 0, -.04, 0.1055, 0.1055, -0.04]
#[0.1338858,  -0.04361271,  0.0405758, -0.54168096, -0.05750595,
# -0.06092065,  0.27694177,  0.06299513, -0.14471439,  0.05366629,  0.09215891,
# -0.34178976,  0.39306562,  0.20678763,  0.08826728,  0.02828799, -0.02992248,
Пример #9
0
 def connect(self):
     paramsets = list_instruments()
     self.ccs = instrument(paramsets[0])
     time.sleep(0.1)
def get_camera():
    list_instruments()
    return drivers.cameras.uc480.UC480_Camera()
    def __init__(self):

        self.insts = list_instruments()
        print(self.insts)