Commit 777609b5 authored by Guillaume Blanchy's avatar Guillaume Blanchy
Browse files

Rename constant -> safe and full_constant -> fixed

No related merge requests found
Showing with 20 additions and 22 deletions
+20 -22
...@@ -33,10 +33,10 @@ print('---------- vmax ----------') ...@@ -33,10 +33,10 @@ print('---------- vmax ----------')
k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=0.5, strategy='vmax') k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=0.5, strategy='vmax')
print('---------- vmin ----------') 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) 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('---------- constant ----------') print('---------- safe ----------')
k.run_measurement([1, 4, 2, 3], nb_stack=1, injection_duration=0.2, duty_cycle=0.7, strategy='constant', vab_req=40) k.run_measurement([1, 4, 2, 3], nb_stack=1, injection_duration=0.2, duty_cycle=0.7, strategy='safe', vab_req=40)
print('---------- full_constant ----------') print('---------- fixed ----------')
k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=1, strategy='full_constant', vab_req=7.3) 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 ----------') 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) k.run_measurement([1, 4, 2, 3], nb_stack=2, injection_duration=0.2, duty_cycle=1, strategy='flex', pab_req=0.3)
#k.plot_last_fw() #k.plot_last_fw()
......
...@@ -2,5 +2,5 @@ v2024.1.0 ...@@ -2,5 +2,5 @@ v2024.1.0
- Add OhmPi.test() (#261) - Add OhmPi.test() (#261)
- Add checklist for field installation (doc/_static/ohmpi-checklist.pdf) - Add checklist for field installation (doc/_static/ohmpi-checklist.pdf)
- Add coverage.sh that runs .dev/test_all.py integration test (#263) - Add coverage.sh that runs .dev/test_all.py integration test (#263)
- Rename strategies: "constant" -> "safe", "full_constant" -> "fixed" (#216)
...@@ -615,9 +615,7 @@ class OhmPiHardware: ...@@ -615,9 +615,7 @@ class OhmPiHardware:
pulse_duration : float, optional pulse_duration : float, optional
Time in seconds for the pulse used to compute optimal Vab. Time in seconds for the pulse used to compute optimal Vab.
vab_init : float, optional vab_init : float, optional
Voltage to apply for guessing the best voltage. 5 V applied Initial voltage to search for best vab.
by default. If strategy "constant" is chosen, constant voltage
to applied is "vab".
vab_max : float, optional vab_max : float, optional
Maximum injection voltage to apply to tx (used by all strategies). Maximum injection voltage to apply to tx (used by all strategies).
vmn_max : float, optional vmn_max : float, optional
......
...@@ -68,7 +68,7 @@ class OhmPi(object): ...@@ -68,7 +68,7 @@ class OhmPi(object):
Dictionary of parameters. Possible parameters with some suggested values: Dictionary of parameters. Possible parameters with some suggested values:
{'injection_duration': 0.2, 'nb_meas': 1, 'sequence_delay': 1, {'injection_duration': 0.2, 'nb_meas': 1, 'sequence_delay': 1,
'nb_stack': 1, 'sampling_interval': 2, 'vab_init': 5.0, 'vab_req': 5.0, 'duty_cycle': 0.5, 'nb_stack': 1, 'sampling_interval': 2, 'vab_init': 5.0, 'vab_req': 5.0, 'duty_cycle': 0.5,
'strategy': 'constant', 'export_path': None} 'strategy': 'safe', 'export_path': None}
sequence : str, optional sequence : str, optional
Path of the .csv or .txt file with A, B, M and N electrodes. Path of the .csv or .txt file with A, B, M and N electrodes.
Electrode index starts at 1. See `OhmPi.load_sequence()` for full docstring. Electrode index starts at 1. See `OhmPi.load_sequence()` for full docstring.
...@@ -318,7 +318,7 @@ class OhmPi(object): ...@@ -318,7 +318,7 @@ class OhmPi(object):
---------- ----------
which : str which : str
Which vab to keep, either "min", "max", "mean" (or other similar numpy method e.g. median) Which vab to keep, either "min", "max", "mean" (or other similar numpy method e.g. median)
If applying strategy "full_constant" based on vab_opt, safer to chose "min" If applying strategy "fixed" based on vab_opt, safer to chose "min"
n_samples: int n_samples: int
Number of samples to keep within loaded sequence. Number of samples to keep within loaded sequence.
kwargs : dict, optional kwargs : dict, optional
...@@ -722,13 +722,13 @@ class OhmPi(object): ...@@ -722,13 +722,13 @@ class OhmPi(object):
Injection time in seconds. Injection time in seconds.
duty_cycle : float, optional duty_cycle : float, optional
Duty cycle (default=0.5) of injection square wave. Duty cycle (default=0.5) of injection square wave.
strategy : str, optional, default: constant strategy : str, optional, default: safe
Define injection strategy (if power is adjustable, otherwise constant vab, generally 12V battery is used). Define injection strategy (if power is adjustable, otherwise safe vab, generally 12V battery is used).
Either: Either:
- vmax : compute Vab to reach a maximum Vmn_max and Iab without exceeding vab_max - vmax : compute Vab to reach a maximum Vmn_max and Iab without exceeding vab_max
- vmin : compute Vab to reach at least Vmn_min - vmin : compute Vab to reach at least Vmn_min
- constant : apply given Vab but checks if expected readings not out-of-range - safe : apply given Vab but checks if expected readings not out-of-range
- full_constant: apply given Vab with no out-of-range checks for optimising duration at the risk of out-of-range readings - fixed: apply given Vab with no out-of-range checks for optimising duration at the risk of out-of-range readings
Safety check (i.e. short voltage pulses) performed prior to injection to ensure 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. 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) To bypass safety check before injection, vab should be set equal to vab_max (not recommended)
...@@ -811,7 +811,7 @@ class OhmPi(object): ...@@ -811,7 +811,7 @@ class OhmPi(object):
vab_init = tx_volt vab_init = tx_volt
# if vab_req is None: # if vab_req is None:
# vab_req = vab_init # vab_req = vab_init
if strategy == 'constant' and vab_req is None: if strategy == 'safe' and vab_req is None:
vab_req = tx_volt vab_req = tx_volt
if vab_init is None and vab is not None: if vab_init is None and vab is not None:
...@@ -820,7 +820,7 @@ class OhmPi(object): ...@@ -820,7 +820,7 @@ class OhmPi(object):
vab_init = vab vab_init = vab
# if vab_req is None: # if vab_req is None:
# vab_req = vab_init # vab_req = vab_init
if strategy == 'constant' and vab_req is None: if strategy == 'safe' and vab_req is None:
vab_req = vab vab_req = vab
if vab_init is None and 'vab_init' in self.settings: if vab_init is None and 'vab_init' in self.settings:
vab_init = self.settings['vab_init'] vab_init = self.settings['vab_init']
...@@ -856,7 +856,7 @@ class OhmPi(object): ...@@ -856,7 +856,7 @@ class OhmPi(object):
else: else:
min_agg = False min_agg = False
if strategy == 'constant': if strategy == 'safe':
if vab_req is not None: if vab_req is not None:
vab_init = 0.9 * vab_req vab_init = 0.9 * vab_req
...@@ -864,7 +864,7 @@ class OhmPi(object): ...@@ -864,7 +864,7 @@ class OhmPi(object):
d = {} d = {}
if self.switch_mux_on(quad, bypass_check=bypass_check, cmd_id=cmd_id): if self.switch_mux_on(quad, bypass_check=bypass_check, cmd_id=cmd_id):
if strategy == 'constant': if strategy == 'safe':
kwargs_compute_vab = kwargs.get('compute_vab', {}) kwargs_compute_vab = kwargs.get('compute_vab', {})
kwargs_compute_vab['vab_init'] = vab_init kwargs_compute_vab['vab_init'] = vab_init
kwargs_compute_vab['vab_min'] = vab_min kwargs_compute_vab['vab_min'] = vab_min
...@@ -932,7 +932,7 @@ class OhmPi(object): ...@@ -932,7 +932,7 @@ class OhmPi(object):
kwargs_compute_vab['pab_max'] = pab_max kwargs_compute_vab['pab_max'] = pab_max
kwargs_compute_vab['min_agg'] = min_agg kwargs_compute_vab['min_agg'] = min_agg
if strategy == 'full_constant': if strategy == 'fixed':
vab = vab_init vab = vab_init
else: else:
vab = self._hw.compute_vab(**kwargs_compute_vab) vab = self._hw.compute_vab(**kwargs_compute_vab)
...@@ -1003,7 +1003,7 @@ class OhmPi(object): ...@@ -1003,7 +1003,7 @@ class OhmPi(object):
print('\r') print('\r')
self.data_logger.info(dd) self.data_logger.info(dd)
# if strategy not constant, then switch dps off (button) in case following measurement within sequence # if strategy not safe, then switch dps off (button) in case following measurement within sequence
# TODO: check if this is the right strategy to handle DPS pwr state on/off after measurement # TODO: check if this is the right strategy to handle DPS pwr state on/off after measurement
if (strategy == 'vmax' or strategy == 'vmin' or strategy == 'flex') and vab > vab_init : # if starting vab was higher actual vab, then turn pwr off if (strategy == 'vmax' or strategy == 'vmin' or strategy == 'flex') and vab > vab_init : # if starting vab was higher actual vab, then turn pwr off
self._hw.tx.pwr.pwr_state = 'off' self._hw.tx.pwr.pwr_state = 'off'
...@@ -1741,7 +1741,7 @@ class OhmPi(object): ...@@ -1741,7 +1741,7 @@ class OhmPi(object):
- nb_meas (total number of times the sequence will be run) - nb_meas (total number of times the sequence will be run)
- sequence_delay (delay in second between each sequence run) - sequence_delay (delay in second between each sequence run)
- nb_stack (number of stack for each quadrupole measurement) - nb_stack (number of stack for each quadrupole measurement)
- strategy (injection strategy: constant, vmax, vmin) - strategy (injection strategy: safe, vmax, vmin)
- duty_cycle (injection duty cycle comprised between 0.5 - 1) - duty_cycle (injection duty cycle comprised between 0.5 - 1)
- export_path (path where to export the data, timestamp will be added to filename) - export_path (path where to export the data, timestamp will be added to filename)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"vab_init": 5.0, "vab_init": 5.0,
"vab_req": 5.0, "vab_req": 5.0,
"duty_cycle": 0.5, "duty_cycle": 0.5,
"strategy": "constant", "strategy": "safe",
"fw_in_csv": false, "fw_in_csv": false,
"fw_in_zip": true, "fw_in_zip": true,
"export_path": "data/measurements.csv" "export_path": "data/measurements.csv"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment