diff --git a/.dev/test_all.py b/.dev/test_all.py index 2f7d81a6394c5ae0f0ba574253198b23a92becff..94851138ade42c30c06aaca9faf75b70aeee9c35 100644 --- a/.dev/test_all.py +++ b/.dev/test_all.py @@ -11,7 +11,7 @@ t0 = time.time() from ohmpi.ohmpi import OhmPi k = OhmPi() print('---------- test ----------') -#k.test(remote=True) +k.test(remote=True) #k.test_mux(activation_time=0.1)) # already tested in k.test() > k._test_mux_ABMN() print('---------- sequence generation ----------') k.create_sequence(16, params=[('dpdp', 1, 8)]) @@ -30,15 +30,26 @@ k._process_commands('{"cmd_id": "102392038", "cmd": "rs_check", "kwargs": {}}') #k.interrupt() #print('interrupting!!') print('---------- vmax ----------') -k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=0.5, strategy='vmax') +vmax = k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=0.5, strategy='vmax') print('---------- vmin ----------') -k.run_measurement([1, 4, 2, 3], nb_stack=1, injection_duration=0.2, duty_cycle=0.3, strategy='vmin', vmn_req=0.02) +vmin = k.run_measurement([1, 4, 2, 3], nb_stack=1, injection_duration=0.2, duty_cycle=0.3, strategy='vmin', vmn_req=0.02) print('---------- safe ----------') -k.run_measurement([1, 4, 2, 3], nb_stack=1, injection_duration=0.2, duty_cycle=0.7, strategy='safe', vab_req=40) +safe = k.run_measurement([1, 4, 2, 3], nb_stack=1, injection_duration=0.2, duty_cycle=0.7, strategy='safe', vab_req=40) print('---------- fixed ----------') -k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=1, strategy='fixed', vab_req=7.3) +fixed = k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=1, strategy='fixed', vab_req=7.3) print('---------- flex ----------') -k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=1, strategy='flex', pab_req=0.3) +flex = k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=1, strategy='flex', pab_req=0.3) +dic = { + 'vmin': vmin, + 'vmax': vmax, + 'safe': safe, + 'fixed': fixed, + 'flex': flex +} +for key in dic: + q = dic[key] + print('{:8s} >>> vab: {:10.2f} V, vmn: {:10.2f} mV, r: {:10.2f} Ohm'.format( + key, q['vab_[V]'], q['vmn_[mV]'], q['r_[Ohm]'])) #k.plot_last_fw() print('---------- multiple sequences ----------') k.run_multiple_sequences(sequence_delay=60, nb_meas=2) @@ -47,7 +58,7 @@ k.interrupt() print('---------- inversion ----------') k.remove_data() k.create_sequence(8, params=[('wenner', 3)]) -k.run_sequence(vab_req=5., duty_cycle=1, injection_duration=0.1, strategy='full_constant', fw_in_zip=True) +k.run_sequence(vab_req=5., duty_cycle=1, injection_duration=0.1, strategy='fixed', fw_in_zip=True) datadir = os.path.join(os.path.dirname(__file__), '../data/') fnames = sorted([f for f in os.listdir(datadir) if f[-4:] == '.csv']) survey_names = [os.path.join(datadir, fnames[-1])] @@ -63,4 +74,4 @@ print('---------- find optimal vab ----------') k.create_sequence(8, params=[('wenner', 3)]) k.find_optimal_vab_for_sequence(n_samples=3) -print('TOTAL time running: {:.1f}s'.format(time.time() - t0)) \ No newline at end of file +print('TOTAL time running: {:.1f}s'.format(time.time() - t0)) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 935b5363f46301106fc62cbf2f1bf35129e630a0..6d022d292e92e6c71464097a844f61f0dcbb463a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,4 +4,4 @@ v2024.1.0 - Add coverage.sh that runs .dev/test_all.py integration test (#263) - Rename headers (#239) - Rename strategies: "constant" -> "safe", "full_constant" -> "fixed" (#216) - +- Remove tx_volt and vab from run_measurement() diff --git a/ohmpi/ohmpi.py b/ohmpi/ohmpi.py index 293a0c4cac4235433e44fa69152559519e6980d0..1954c5bc26409af583a900cd204b71caf88e556b 100644 --- a/ohmpi/ohmpi.py +++ b/ohmpi/ohmpi.py @@ -688,13 +688,11 @@ class OhmPi(object): self._hw._plot_readings(save_fig=save_fig, filename=filename) def run_measurement(self, quad=None, nb_stack=None, injection_duration=None, duty_cycle=None, - strategy=None, tx_volt=None, vab=None, vab_init=None, vab_min=None, vab_req=None, vab_max=None, + strategy=None, vab_init=None, vab_min=None, vab_req=None, vab_max=None, iab_min=None, iab_req=None, min_agg=None, iab_max=None, vmn_min=None, vmn_req=None, vmn_max=None, pab_min=None, pab_req=None, pab_max=None, cmd_id=None, **kwargs): # TODO: add sampling_interval -> impact on _hw.rx.sampling_rate (store the current value, # change the _hw.rx.sampling_rate, do the measurement, reset the sampling_rate to the previous value) - # TODO: default value of tx_volt and other parameters set to None should be given in config.py and used - # in function definition -> (GB) default values are in self.settings. """Measures on a quadrupole and returns a dictionary with the transfer resistance. Parameters @@ -719,7 +717,6 @@ class OhmPi(object): Safety check (i.e. short voltage pulses) performed prior to injection to ensure injection within bounds defined in vab_max, iab_max, vmn_max or vmn_min. This can adapt Vab. To bypass safety check before injection, vab should be set equal to vab_max (not recommended) - vab_init : float, optional Initial injection voltage [V] Default value set by settings or system specs @@ -761,10 +758,6 @@ class OhmPi(object): Default value set by config or boards specs min_agg : bool, optional, default: False when set to True, requested values are aggregated with the 'or' operator, when False with the 'and' operator - tx_volt : float, optional # deprecated - For power adjustable only. If specified, voltage will be imposed. - vab : float, optional - For power adjustable only. If specified, voltage will be imposed. cmd_id : str, optional Unique command identifier. """ @@ -789,26 +782,6 @@ class OhmPi(object): duty_cycle = self.settings['duty_cycle'] if strategy is None and 'strategy' in self.settings: strategy = self.settings['strategy'] - if tx_volt is None and 'tx_volt' in self.settings: - tx_volt = self.settings['tx_volt'] - if vab is None and 'vab' in self.settings: - vab = self.settings['vab'] - if vab_init is None and tx_volt is not None: - warnings.warn('"tx_volt" argument is deprecated and will be removed in future version. Use "vab_init" and "vab_req" instead to set the transmitter voltage in volts.', DeprecationWarning) - vab_init = tx_volt - # if vab_req is None: - # vab_req = vab_init - if strategy == 'safe' and vab_req is None: - vab_req = tx_volt - - if vab_init is None and vab is not None: - warnings.warn( - '"vab" argument is deprecated and will be removed in future version. Use "vab_init" and "vab_req" instead to set the transmitter voltage in volts.', DeprecationWarning) - vab_init = vab - # if vab_req is None: - # vab_req = vab_init - if strategy == 'safe' and vab_req is None: - vab_req = vab if vab_init is None and 'vab_init' in self.settings: vab_init = self.settings['vab_init'] if vab_min is None and 'vab_min' in self.settings: @@ -842,6 +815,12 @@ class OhmPi(object): min_agg = self.settings['min_agg'] else: min_agg = False + + if self._hw.tx.pwr.voltage_adjustable is False: + if strategy != 'fixed': + strategy = 'fixed' + vab_req = 12.0 + self.exec_logger.warning('Power is not adjustable, using the "fixed" strategy') if strategy == 'safe': if vab_req is not None: @@ -920,7 +899,7 @@ class OhmPi(object): kwargs_compute_vab['min_agg'] = min_agg if strategy == 'fixed': - vab = vab_init + vab = vab_req else: vab = self._hw.compute_vab(**kwargs_compute_vab)