Skip to content

Commit

Permalink
Remove loop over detector for errors in baselines
Browse files Browse the repository at this point in the history
Now, the errors on baselines are not looped over detectors when saved, since they do not depend on them (they are summed over deterctors). The same is done for loading a `DestriperResult` from file.

See also #310 for more details.
  • Loading branch information
ggalloni committed Mar 27, 2024
1 parent 4605afe commit 16f6309
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions litebird_sim/mapmaking/destriper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1997,15 +1997,13 @@ def _save_baselines(results: DestriperResult, output_file: Path) -> None:
error_hdu = fits.BinTableHDU.from_columns(
[
fits.Column(
name=f"ERR{det_idx:05d}",
array=cur_error[det_idx, :],
name=f"ERR{idx:05d}",
array=cur_error,
format="1E",
unit="K",
)
for det_idx in range(cur_baseline.shape[0])
),
]
)
error_hdu.header["NUMDETS"] = (cur_error.shape[0], "Number of detectors")

length_hdu = fits.BinTableHDU.from_columns(
[fits.Column(name="LENGTH", array=cur_lengths, unit="", format="1J")]
Expand Down Expand Up @@ -2212,12 +2210,7 @@ def load_destriper_results(
),
)
result.baseline_errors.append(
np.array(
[
inpf[f"ERR{obs_idx:05d}"].data.field(f"ERR{det_idx:05d}")
for det_idx in range(num_of_detectors)
]
),
np.array(inpf[f"ERR{obs_idx:05d}"].data.field(f"ERR{obs_idx:05d}")),
)
result.baseline_lengths.append(
inpf[f"LEN{obs_idx:05d}"].data.field("LENGTH")
Expand Down

0 comments on commit 16f6309

Please sign in to comment.