diff --git a/pyfstat/core.py b/pyfstat/core.py index 7ee28da37258a559b7e04b910e5a21ba00de3b93..0809f68afd21623683dd3813f97a8419e11a07cd 100755 --- a/pyfstat/core.py +++ b/pyfstat/core.py @@ -165,7 +165,10 @@ class BaseSearchClass(object): return thetas def _get_list_of_matching_sfts(self): - matches = [glob.glob(p) for p in self.sftfilepath] + # first make sure we have a list of paths, to avoid + # list comprehension trying to glob each single character + sftfilepathlist = np.atleast_1d(self.sftfilepath) + matches = [glob.glob(p) for p in sftfilepathlist] matches = [item for sublist in matches for item in sublist] if len(matches) > 0: return matches diff --git a/pyfstat/grid_based_searches.py b/pyfstat/grid_based_searches.py index 000d8add9e0ebc46fc0d3fd13df830d53b1a7b2a..f33f720a3be99f97ec81c6f0edcf2163675a26b0 100644 --- a/pyfstat/grid_based_searches.py +++ b/pyfstat/grid_based_searches.py @@ -106,6 +106,13 @@ class GridSearch(BaseSearchClass): if os.path.isfile(self.out_file) is False: logging.info('No old data found, continuing with grid search') return False + if self.sftfilepath is not None: + oldest_sft = min([os.path.getmtime(f) for f in + self._get_list_of_matching_sfts()]) + if os.path.getmtime(self.out_file) < oldest_sft: + logging.info('Search output data outdates sft files,' + + ' continuing with grid search') + return False data = np.atleast_2d(np.genfromtxt(self.out_file, delimiter=' ')) if np.all(data[:, 0:-1] == self.input_data): logging.info(