예제 #1
0
 def initialize_devices(self):
     """ Initializes the devices first by loading the driver,
     then by applying the default values if they are present.
     :return:
     """
     for k in self.devices:
         dev = self.devices[k]
         print('Starting %s' % dev.properties['name'])
         dev.initialize_driver()
         #    print('Error initializing %s' % dev.properties['name'])
         if 'defaults' in dev.properties:
             defaults_file = dev.properties['defaults']
             defaults = from_yaml_to_dict(defaults_file)[dev.properties['name']]
             dev.apply_values(defaults)
         if dev.properties['type'] == 'daq':
             self.daqs[dev.properties['name']] = {'input': [],
                                                  'output': [],
                                                  'monitor': [], }  # Creates an entry for every different DAQ.
예제 #2
0
    def resume_continuous_scans(self):
        monitor = self.monitor
        laser = self.devices[monitor['laser']['name']].driver
        laser.resume_sweep()

    def open_shutter(self):
        shutter = self.scan['shutter']
        ni_daq = self.devices['NI-DAQ']
        ni_daq.driver.digital_output(shutter['port'], True)
        
    def close_shutter(self):
        shutter = self.scan['shutter']
        ni_daq = self.devices['NI-DAQ']
        ni_daq.driver.digital_output(shutter['port'], False)

    ### added by Karindra
    def open_fiber_switch(self):
        switch = self.scan['switch']
        ni_daq = self.devices['NI-DAQ']
        ni_daq.driver.digital_output(switch['port'], True)
 
    def close_fiber_switch(self):
        switch = self.scan['switch']
        ni_daq = self.devices['NI-DAQ']
        ni_daq.driver.digital_output(switch['port'], False) 
        
if __name__ == "__main__":
    config_experiment = "config/measurement.yml"
    experiment_dict = from_yaml_to_dict(config_experiment)
    experiment = Measurement(experiment_dict)