def __init__(self, driver_name='polaris', verbose=True, setup_file=None): # initialize self._verbose = verbose self._driver_name = driver_name self._driver = None # run purpose dict self._run_purpose_dict = { 1: 'Test', 2: 'LowBg', 3: 'Calibration', 4: 'Noise', 100: 'Rp', 101: 'Rn', 102: 'IV Sweep', 103: 'dIdV Sweep' } # Configuration self._config = settings.Config(setup_file=setup_file) # instantiate driver self._instantiate_driver()
# ======================== # file name setup_file = None if args.setup_file: setup_file = args.setup_file else: this_dir = os.path.dirname(os.path.realpath(__file__)) setup_file = this_dir + '/../pytesdaq/config/setup.ini' if not os.path.isfile(setup_file): print('ERROR: Setup file "' + setup_file + '" not found!') exit() # read config = settings.Config(setup_file=setup_file) # ======================== # Channels # ======================== is_signal_gen = False if (args.signal_gen_on or args.signal_gen_off or args.signal_gen_voltage is not None or args.signal_gen_frequency is not None): is_signal_gen = True # check if channels selected if args.tes_channels is None and args.detector_channels is None and not is_signal_gen: print( 'Please select TES or detector channel(s)! Type --help for channel arguments.'
import pytesdaq.config.settings as settings import pytesdaq.instruments.control as instrument import pytesdaq.instruments.magnicon as magnicon from pytesdaq.utils import connection_utils import pprint as pprint import pandas as pd if __name__ == "__main__": # config config = settings.Config() myconnections = config.get_adc_connections() # instantiate myinstrument = instrument.Control(dummy_mode=False, verbose=True) # -------------- # Sig gen # -------------- myinstrument.set_signal_gen_params(tes_channel=2, source='feedback', shape='triangle', frequency=110, amplitude=150) data = myinstrument.get_signal_gen_params(tes_channel=2) myinstrument.set_signal_gen_onoff('off',tes_channel=2) #data = myinstrument.get_signal_gen_onoff(tes_channel=2) print(data) #print(bias)
def __init__(self, measurement_name, measurement_list=None, detector_channels=None, tc_channels=None, sequencer_file=None, setup_file=None, sequencer_pickle_file=None, dummy_mode=False, verbose=True): # measurement name and list self._measurement_name = measurement_name self._measurement_list = measurement_list if self._measurement_list is None: self._measurement_list = [self._measurement_name] self._measurement_config = None # initialize some parameters # can be overwritten by config and class property self._verbose = verbose self._online_analysis = False self._enable_redis = False self._daq_driver = 'polaris' self._dummy_mode = dummy_mode self._facility = 1 self._save_raw_data = True # default data path self._raw_data_path = './' self._automation_data_path = './' # automation data self._automation_data = dict() self._automation_data['info'] = None self._automation_data['data'] = None # setup files self._setup_file = setup_file self._sequencer_pickle_file = sequencer_pickle_file self._sequencer_file = sequencer_file # channels (can also be set in sequencer file) self._detector_channels = detector_channels self._tc_channels = tc_channels self._is_tc_channel_number = False # channel tables self._detector_connection_table = None self._tc_connection_table = None # Instantiate config try: self._config = settings.Config(sequencer_file=self._sequencer_file, setup_file=self._setup_file) except Exception as e: print('ERROR reading configuration files!') print(str(e)) exit(1) # Read measurement(s) configuration self._read_measurement_config() # redis (can be enable in sequncer.ini file) if self._enable_redis: self._redis_db = redis.RedisCore() self._redis_db.connect() # Initialize daq / instrument self._daq = None self._instrument = None
def configure(self, data_source, adc_name='adc1', channel_list=[], sample_rate=[], trace_length=[], voltage_min=[], voltage_max=[], trigger_type=4, file_list=[]): # check if running if self._is_running: print('WARNING: Need to stop display first') return False # data source self._data_source = data_source # adc name self._adc_name = adc_name # read configuration file self._config = settings.Config(setup_file=self._setup_file) self._adc_config = dict() # initialize self._daq = None self._redis = None self._hdf5 = None # NI ADC source if self._data_source == 'niadc': # check if not channel_list or not adc_name: error_msg = 'ERROR: Missing channel list or adc name!' return error_msg # instantiate daq self._daq = daq.DAQ(driver_name='pydaqmx', verbose=False) self._daq.lock_daq = True # adc name list adc_list = self._config.get_adc_list() if adc_name not in adc_list: self._daq.clear() error_msg = 'ERROR: ADC name "' + adc_name + '" unrecognized!' return error_msg # ADC setup self._adc_config = self._config.get_adc_setup(adc_name) # convert connection dataframe to dict connections = self._adc_config['connection_table'].to_dict( orient='list') self._adc_config['connection_map'] = dict() self._adc_config['connection_map']['adc_chans'] = [ int(x) for x in connections['adc_channel'] ] self._adc_config['connection_map']['detector_chans'] = connections[ 'detector_channel'] self._adc_config['connection_map']['tes_chans'] = connections[ 'tes_channel'] self._adc_config['connection_map']['controller_chans'] = list() for ichan in range(len(connections['controller_channel'])): self._adc_config['connection_map']['controller_chans'].append( connections['controller_id'][ichan] + '_' + connections['controller_channel'][ichan]) self._adc_config['channel_list'] = channel_list if sample_rate: self._adc_config['sample_rate'] = int(sample_rate) if trace_length: nb_samples = round(self._adc_config['sample_rate'] * trace_length / 1000) self._adc_config['nb_samples'] = int(nb_samples) if voltage_min: self._adc_config['voltage_min'] = float(voltage_min) if voltage_max: self._adc_config['voltage_max'] = float(voltage_max) self._adc_config['trigger_type'] = int(trigger_type) adc_config = dict() adc_config[adc_name] = self._adc_config self._daq.set_adc_config_from_dict(adc_config) # Redis elif self._data_source == 'redis': self._redis = redis.RedisCore() self._redis.connect() # hdf5 elif self._data_source == 'hdf5': if not file_list: error_msg = 'ERROR from readout: No files provided' return error_msg self._hdf5 = hdf5.H5Reader() self._hdf5.set_files(file_list) return True