Skip to content

Commit ead7af8

Browse files
committed
make sure stackers get run on data in recarray, not DataFrame, format
1 parent 699798e commit ead7af8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

rubin_sim/maf/utils/opsim_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,16 @@ def _local_get_sim_data(
107107

108108
if len(sim_data) == 0:
109109
raise UserWarning("No data found matching sqlconstraint %s" % (sqlconstraint))
110+
110111
# Now add the stacker columns.
112+
# This fails for pandas.DataFrames, so convert to recarray
113+
# if necessary.
111114
if stackers is not None:
115+
if not isinstance(sim_data, np.recarray):
116+
assert isinstance(sim_data, pd.DataFrame)
117+
sim_data = sim_data.to_records(index=False)
112118
for s in stackers:
113-
sim_data = s.run(sim_data)
119+
sim_data = s.run(sim_data).view(np.recarray)
114120

115121
if return_class is np.recarray:
116122
if isinstance(sim_data, pd.DataFrame):

0 commit comments

Comments
 (0)