From 568735c739cdde0befa505d0a52d63dbe9cd8eac Mon Sep 17 00:00:00 2001 From: Christina Willecke Lindberg Date: Thu, 23 May 2024 14:06:17 -0400 Subject: [PATCH] added indexing for simulated obsdata being split --- beast/fitting/fit.py | 5 +++++ beast/tools/split_simulated_catalog.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/beast/fitting/fit.py b/beast/fitting/fit.py index b444046b..8dc36eec 100755 --- a/beast/fitting/fit.py +++ b/beast/fitting/fit.py @@ -902,6 +902,11 @@ def IAU_names_and_extra_info(obsdata, surveyname="PHAT", extraInfo=False): obsfiltname = obsdata.filter_aliases[filtername] r[filtername] = (obsdata.data[obsfiltname] * obsdata.vega_flux[k]).astype(float) + # if running a simulation, propagate beast_idx numbers to resort to input obs file + if "beast_idx" in list(obsdata.data.keys()): + r["beast_idx"] = obsdata.data["beast_idx"] + + return r diff --git a/beast/tools/split_simulated_catalog.py b/beast/tools/split_simulated_catalog.py index 0fe9360f..cc646bd8 100644 --- a/beast/tools/split_simulated_catalog.py +++ b/beast/tools/split_simulated_catalog.py @@ -92,6 +92,10 @@ def split_simulated_catalog( """ cat = Table.read(catfile) + # add index column to help sort merged files later + cat["beast_idx"] = np.arange(len(cat)) + + # write out sub-files, if chosen if (n_per_file is not None) or (min_n_subfile is not None):