Skip to content

Commit

Permalink
Include directory in missing file errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arahlin committed Oct 18, 2023
1 parent 089adfa commit 7f14e17
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions xfaster/xfaster_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ def _get_data_files(
for f in np.atleast_1d(dset.split(",")):
files = glob.glob(os.path.join(map_root, "{}.fits".format(f)))
if not len(files):
raise OSError("Missing files in data subset {}".format(f))
raise OSError(
"Missing files for data subset {} in {}".format(f, droot)
)
map_files.extend(files)
map_files = sorted(map_files)
map_files = [f for f in map_files if os.path.basename(f).startswith("map_")]
Expand Down Expand Up @@ -814,7 +816,7 @@ def _get_sim_files(
)
nfiles = len(files)
if not nfiles:
raise OSError("Missing {} sims for {}".format(name, f))
raise OSError("Missing {} sims for {} in {}".format(name, f, root1))
if num_files is None:
num_files = out.get("num_{}{}".format(name, suffix), nfiles)
if num_files != nfiles:
Expand Down Expand Up @@ -911,7 +913,9 @@ def _get_template_files(self, name, ctype=None, suffix=""):
nfiles1 = len(tf)
if not nfiles1:
raise OSError(
"Missing temp{} {} files for {}".format(group, name, f)
"Missing temp{} {} files for {} in {}".format(
group, name, f, root1
)
)
if nfiles is None:
nfiles = out.get("num_{}{}".format(name, suffix), nfiles1)
Expand Down Expand Up @@ -987,7 +991,9 @@ def _get_reference_files(self, ctype=None):
files1 = np.asarray([os.path.join(root1, f) for f in map_names])
for f in files1:
if not os.path.exists(f):
raise OSError("Missing ref{} map {}".format(group, f))
raise OSError(
"Missing ref{} map {} in {}".format(group, f, root1)
)

ref_root[group1] = root1
ref_files[group1] = files1
Expand Down

0 comments on commit 7f14e17

Please sign in to comment.