Commit eb65af5d authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch 'gridsearch_sft_check' into 'master'

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

See merge request !4
parents cf64207e a6a067be
......@@ -174,7 +174,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(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment