From 537d8d26e645fc441e196b6b10f7560025d431b1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 19 Apr 2013 11:07:51 -0400 Subject: [PATCH] gyang_curve.py: Allow auxiliary files in the curve directory I haven't bothered to trace this down to a particular version of the LabVIEW VIs, but some of my archived experiments have the auxiliary files in a 'params' subdirectory and some do not. With this patch, gyang_curve can successfully read both layouts. --- .../gyang_curve.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/posts/Comparing_velocity_clamp_experiments/gyang_curve.py b/posts/Comparing_velocity_clamp_experiments/gyang_curve.py index 310e514..7dd9b6d 100755 --- a/posts/Comparing_velocity_clamp_experiments/gyang_curve.py +++ b/posts/Comparing_velocity_clamp_experiments/gyang_curve.py @@ -83,12 +83,13 @@ class Curve (object): self.month = time.tm_mon self.day = time.tm_mday self.series = int(series) - self._auxiliary_paths = dict( - (aux, - _os.path.join( - dirname, 'params', '{}{}_{}'.format( - month_day, aux, series))) - for aux in self._auxiliary_files) + self._auxiliary_paths = {} + for aux in self._auxiliary_files: + filename = '{}{}_{}'.format(month_day, aux, series) + aux_path = _os.path.join(dirname, filename) + if not _os.path.isfile(aux_path): + aux_path = _os.path.join(dirname, 'params', filename) + self._auxiliary_paths[aux] = aux_path def _load(self): for aux in self._auxiliary_files: -- 2.26.2