From 1ce43a567b098ab3ab1f91bc4d46092f315f5bc5 Mon Sep 17 00:00:00 2001 From: l_samenv Date: Wed, 10 May 2023 16:36:32 +0200 Subject: [PATCH] fixes in sea cfg files - json_file must be a string, not a list - rel_path is no longer to be converted to a list --- cfg/stick/hvolt_long_cfg.py | 2 +- cfg/stick/ill1stick_cfg.py | 2 +- cfg/stick/ill3stick_cfg.py | 2 +- cfg/stick/ill4stick_cfg.py | 2 +- cfg/stick/ill5p_cfg.py | 2 +- cfg/stick/ill5stick_cfg.py | 2 +- cfg/stick/ma02stick_cfg.py | 2 +- cfg/stick/ma10stick_cfg.py | 2 +- cfg/stick/ma11stick_cfg.py | 2 +- cfg/stick/ma6stick_cfg.py | 2 +- cfg/stick/ma7stick_cfg.py | 2 +- cfg/stick/ori1stick_cfg.py | 2 +- cfg/stick/ori3stick_cfg.py | 2 +- cfg/stick/ori4stick_cfg.py | 2 +- cfg/stick/ori6stick_cfg.py | 2 +- cfg/stick/ovenstick_cfg.py | 2 +- cfg/stick/sch5_cfg.py | 2 +- cfg/stick/sch_cfg.py | 2 +- cfg/stick/varioxstick_cfg.py | 2 +- frappy_psi/phytron.py | 20 ++++++++++---------- frappy_psi/sea.py | 2 +- 21 files changed, 30 insertions(+), 30 deletions(-) diff --git a/cfg/stick/hvolt_long_cfg.py b/cfg/stick/hvolt_long_cfg.py index 5a3d8d6..8801ce4 100644 --- a/cfg/stick/hvolt_long_cfg.py +++ b/cfg/stick/hvolt_long_cfg.py @@ -15,7 +15,7 @@ Mod('ts', 'secop_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma6.config.json'], + json_file='ma6.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ill1stick_cfg.py b/cfg/stick/ill1stick_cfg.py index e28dfff..593cea6 100644 --- a/cfg/stick/ill1stick_cfg.py +++ b/cfg/stick/ill1stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ill1.config.json'], + json_file='ill1.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ill3stick_cfg.py b/cfg/stick/ill3stick_cfg.py index 60c3bbf..3a69ce7 100644 --- a/cfg/stick/ill3stick_cfg.py +++ b/cfg/stick/ill3stick_cfg.py @@ -15,6 +15,6 @@ Mod('ts', 'secop_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ill3.config.json'], + json_file='ill3.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ill4stick_cfg.py b/cfg/stick/ill4stick_cfg.py index a7af504..5c4e8e1 100644 --- a/cfg/stick/ill4stick_cfg.py +++ b/cfg/stick/ill4stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ill4.config.json'], + json_file='ill4.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ill5p_cfg.py b/cfg/stick/ill5p_cfg.py index 939742d..97f3160 100644 --- a/cfg/stick/ill5p_cfg.py +++ b/cfg/stick/ill5p_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ill5.config.json'], + json_file='ill5.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ill5stick_cfg.py b/cfg/stick/ill5stick_cfg.py index 98df8ac..db46e28 100644 --- a/cfg/stick/ill5stick_cfg.py +++ b/cfg/stick/ill5stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ill5.config.json'], + json_file='ill5.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ma02stick_cfg.py b/cfg/stick/ma02stick_cfg.py index 1da6939..416477e 100644 --- a/cfg/stick/ma02stick_cfg.py +++ b/cfg/stick/ma02stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma02.config.json'], + json_file='ma02.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ma10stick_cfg.py b/cfg/stick/ma10stick_cfg.py index dec2802..dd64e71 100644 --- a/cfg/stick/ma10stick_cfg.py +++ b/cfg/stick/ma10stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma10.config.json'], + json_file='ma10.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ma11stick_cfg.py b/cfg/stick/ma11stick_cfg.py index e0cc0e0..964180b 100644 --- a/cfg/stick/ma11stick_cfg.py +++ b/cfg/stick/ma11stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma11.config.json'], + json_file='ma11.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ma6stick_cfg.py b/cfg/stick/ma6stick_cfg.py index 7b983ef..a638de9 100644 --- a/cfg/stick/ma6stick_cfg.py +++ b/cfg/stick/ma6stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma6.config.json'], + json_file='ma6.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ma7stick_cfg.py b/cfg/stick/ma7stick_cfg.py index a6960d6..875921c 100644 --- a/cfg/stick/ma7stick_cfg.py +++ b/cfg/stick/ma7stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma7.config.json'], + json_file='ma7.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ori1stick_cfg.py b/cfg/stick/ori1stick_cfg.py index e5ba39b..a3c1a57 100644 --- a/cfg/stick/ori1stick_cfg.py +++ b/cfg/stick/ori1stick_cfg.py @@ -15,6 +15,6 @@ Mod('ts', 'secop_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ill1.config.json'], + json_file='ill1.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ori3stick_cfg.py b/cfg/stick/ori3stick_cfg.py index 4927ce5..edd96e9 100644 --- a/cfg/stick/ori3stick_cfg.py +++ b/cfg/stick/ori3stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ori3.config.json'], + json_file='ori3.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ori4stick_cfg.py b/cfg/stick/ori4stick_cfg.py index 7c3c568..8b1248c 100644 --- a/cfg/stick/ori4stick_cfg.py +++ b/cfg/stick/ori4stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ori4.config.json'], + json_file='ori4.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ori6stick_cfg.py b/cfg/stick/ori6stick_cfg.py index ad8a5ac..31f7852 100644 --- a/cfg/stick/ori6stick_cfg.py +++ b/cfg/stick/ori6stick_cfg.py @@ -13,6 +13,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ori6.config.json'], + json_file='ori6.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/ovenstick_cfg.py b/cfg/stick/ovenstick_cfg.py index 779e8c0..d76954b 100644 --- a/cfg/stick/ovenstick_cfg.py +++ b/cfg/stick/ovenstick_cfg.py @@ -15,6 +15,6 @@ Mod('ts', 'secop_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ma7.config.json'], + json_file='ma7.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/sch5_cfg.py b/cfg/stick/sch5_cfg.py index 651cc6a..0856d15 100644 --- a/cfg/stick/sch5_cfg.py +++ b/cfg/stick/sch5_cfg.py @@ -19,6 +19,6 @@ Mod('ts', 'frappy_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['ori4.config.json'], + json_file='ori4.config.json', rel_paths=['ts'], ) diff --git a/cfg/stick/sch_cfg.py b/cfg/stick/sch_cfg.py index 6d126fa..027d85b 100644 --- a/cfg/stick/sch_cfg.py +++ b/cfg/stick/sch_cfg.py @@ -21,7 +21,7 @@ Mod('warmup', Mod('ts', 'secop_psi.sea.SeaReadable', '', sea_object='tt', - json_file=['ori4.config.json'], + json_file='ori4.config.json', rel_paths=['ts'], io='sea_stick', ) diff --git a/cfg/stick/varioxstick_cfg.py b/cfg/stick/varioxstick_cfg.py index df37179..c653d0b 100644 --- a/cfg/stick/varioxstick_cfg.py +++ b/cfg/stick/varioxstick_cfg.py @@ -15,6 +15,6 @@ Mod('ts', 'secop_psi.sea.SeaReadable', '', io='sea_stick', sea_object='tt', - json_file=['variox.config.json'], + json_file='variox.config.json', rel_paths=['ts'], ) diff --git a/frappy_psi/phytron.py b/frappy_psi/phytron.py index ca43725..e4a6174 100644 --- a/frappy_psi/phytron.py +++ b/frappy_psi/phytron.py @@ -43,8 +43,7 @@ class PhytronIO(StringIO): _, _, reply = super().communicate('\x02' + command).partition('\x02') if reply[0] == '\x06': # ACK break - raise CommunicationFailedError('missing ACK %r (cmd: %r)' - % (reply, command)) + raise CommunicationFailedError(f'missing ACK {reply!r} (cmd: {command!r})') except Exception as e: if itry < ntry - 1: warn = e @@ -76,7 +75,7 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable): target_min = Limit() target_max = Limit() alive_time = PersistentParam('alive time for detecting restarts', - FloatRange(), default=0) # export=False + FloatRange(), default=0, export=False) ioClass = PhytronIO fast_poll = 0.1 @@ -86,19 +85,19 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable): _reset_needed = False def get(self, cmd): - return self.communicate('%x%s%s' % (self.address, self.axis, cmd)) + return self.communicate(f'{self.address:x}{self.axis}{cmd}') def set(self, cmd, value): # make sure e format is not used, max 8 characters - strvalue = '%.6g' % value + strvalue = f'{value:.6g}' if 'e' in strvalue: if abs(value) <= 1: # very small number - strvalue = '%.7f' % value + strvalue = f'{value:.7f}' elif abs(value) < 99999999: # big number - strvalue = '%.0f' % value + strvalue = f'{value:.0f}' else: - raise ValueError('number (%g) must not have more than 8 digits' % value) - self.communicate('%x%s%s%s' % (self.address, self.axis, cmd, strvalue)) + raise ValueError(f'number ({value}) must not have more than 8 digits') + self.communicate(f'{self.address:x}{self.axis}{cmd}{strvalue}') def set_get(self, cmd, value, query): self.set(cmd, value) @@ -126,7 +125,7 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable): enc = self.read_encoder() else: enc = pos - status = self.communicate('%xSE' % self.address) + status = self.communicate(f'{self.address:x}SE') status = status[0:4] if self.axis == 'X' else status[4:8] self.log.debug('run %s enc %s end %s', status[1], status[2], status[3]) status = self.get('=H') @@ -163,6 +162,7 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable): self._mismatch_count = 0 self.status = IDLE, '' self.value = pos + self.read_encoder() # let encoder quickly match value self.saveParameters() self.setFastPoll(False) return pos diff --git a/frappy_psi/sea.py b/frappy_psi/sea.py index c78b6f0..8bb60f4 100644 --- a/frappy_psi/sea.py +++ b/frappy_psi/sea.py @@ -451,7 +451,7 @@ class SeaModule(Module): descr['params'].pop(0) else: # filter by relative paths - rel_paths = rel_paths.split() + # rel_paths = rel_paths.split() result = [] is_running = None for rpath in rel_paths: