def add_micromanager(self, settings): if len(settings) < 4: raise ValueError( 'No Config file was provided: {}'.format(settings)) self.constructed_object.fields[ settings[1]] = Controllers.MicroManagerController( settings[2], settings[3])
def add_prior(self, settings): self.constructed_object.fields[ settings[1]] = Controllers.PriorController(settings[3])
def add_simulated(self, settings): self.constructed_object.fields[ settings[1]] = Controllers.SimulatedController(settings[3])
def add_lumencor(self, settings): self.constructed_object.fields[ settings[1]] = Controllers.LumencorController(settings[3])
def add_arduino(self, settings): self.constructed_object.fields[ settings[1]] = Controllers.ArduinoController(settings[3])
def add_pycromanager(self, settings): if len(settings) < 4: raise ValueError("No config was provided: {}".format(settings)) self.constructed_object.fields[ settings[1]] = Controllers.PycromanagerController( settings[2], settings[3])
def add_kinesis(self, settings): controller = Controllers.SimulatedController() controller.id = 'kinesis' controller.port = settings[3] self.constructed_object.fields[settings[1]] = controller
weird way of loading a 8 bit dac. :param value: :return: """ bit_0 = bytes([value & int('00001111', 2) << 4]) bit_1 = bytes([int('11110000', 2) | (value >> 4)]) return bit_0, bit_1 class FilterWheelFactory(UtilityFactory): """ Determines the type of xy utility object to return according to the daqcontroller id""" def build_object(self, controller, role, *args): if controller.id == 'micromanager': return MicroManagerFilterWheel(controller, role) elif controller.id == 'pycromanager': return PycromanagerFilter(controller, role) elif controller.id == 'prior': return PriorFilter(controller, role) elif controller.id == 'lumencor' or controller.id == 'simulator': return LumencorFilter(controller, role) else: return None if __name__ == "__main__": from L1 import Controllers ctl = Controllers.LumencorController(port="COM7") ctl.open() fw = LumencorFilter(ctl, 'lol')
class ZControlFactory(UtilityFactory): """ Determines the type of xy utility object to return according to the daqcontroller id""" def build_object(self, controller, role, **kwargs): if controller.id == 'micromanager': return MicroManagerZ(controller, role, **kwargs) elif controller.id == 'prior': return PriorZ(controller, role, **kwargs) elif controller.id == 'arduino': return ArduinoZ(controller, role, **kwargs) elif controller.id == 'kinesis': return KinesisZ(controller, role, **kwargs) elif controller.id == 'simulator': return SimulatedZ(controller, role, **kwargs) elif controller.id == 'pycromanager': return PycromanagerZ(controller, role, **kwargs) else: return None if __name__ == "__main__": from L1 import Controllers ctl = Controllers.ArduinoController('COM7') ctl.open() Z = ArduinoZ(ctl, 'inlet_z') Z.startup() print(Z.read_z()) print(Z.read_z())
""" Sets the shutter to automaticlly open when an image is snapped (micromanager feature) :return: """ self.controller.send_command(self.controller.core.set_auto_shutter, args=(False,)) class ShutterFactory(UtilityFactory): """ Determines the type of xy utility object to return according to the daqcontroller id""" def build_object(self, controller, role, *args): if controller.id == 'micromanager': return MicroManagerShutter(controller, role) elif controller.id == 'pycromanager': return PycromanagerShutter(controller, role) else: return None if __name__ == "__main__": from L1 import Controllers ctl = Controllers.MicroManagerController() ctl.open() sh = ShutterFactory().build_object(ctl) sh.open_shutter() sh.get_shutter() sh.close_shutter() sh.get_shutter() print(sh.get_status())