From: W. Trevor King Date: Fri, 19 Apr 2013 15:07:51 +0000 (-0400) Subject: gyang_curve.py: Allow auxiliary files in the curve directory X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=537d8d26e645fc441e196b6b10f7560025d431b1;p=blog.git 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. --- 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: