Skip to content
Snippets Groups Projects
Commit a6a067be authored by David Keitel's avatar David Keitel
Browse files

add SFT-vs-output timestamp check to gridsearch, and fix bug in _get_list_of_matching_sfts

 -ported check from MCMC search
 -bug: for single-str SFT path, glob list comprehension
  was trying every single character
parent 720f57fa
No related branches found
No related tags found
1 merge request!4add SFT-vs-output timestamp check to gridsearch, and fix bug in _get_list_of_matching_sfts
......@@ -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
......
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment