Skip to content

Commit

Permalink
Create an all-inclusive example unit test for ground-based data. (#796)
Browse files Browse the repository at this point in the history
* Create an all-inclusive example unit test for ground-based data.

This work aims to solve two problems:

- Lack of an example unit test for ground telescope data which
  can be used as a starting point (by removing various things)
  for future unit tests.

- Inconsistent techniques for "scanning from a map" across many
  unit tests.  Basically I have removed ad-hoc code for generating
  fake sky signal and scanning into timestreams and centralized
  that in several unit test helper functions.

* Fix modified unit tests.

* Fix monopole subtraction when plotting wcs maps

* Remove stale, commented code
  • Loading branch information
tskisner authored Nov 15, 2024
1 parent defcf34 commit 1985fff
Show file tree
Hide file tree
Showing 25 changed files with 1,457 additions and 413 deletions.
5 changes: 4 additions & 1 deletion src/toast/templates/offset/offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,10 @@ def plot(amp_file, compare=dict(), out=None):
fig = plt.figure(dpi=fig_dpi, figsize=(fig_width, fig_height))
ax = fig.add_subplot(1, 1, 1)
if det in compare:
ax.plot(x_samples, compare[det], color="black", label=f"{det} Data")
dc = np.mean(compare[det])
ax.plot(
x_samples, compare[det] - dc, color="black", label=f"{det} Data"
)
ax.step(
amp_first[:],
hamps[idet],
Expand Down
8 changes: 5 additions & 3 deletions src/toast/templates/periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,12 @@ def plot(amp_file, out_root=None):
amp_max = list(ast.literal_eval(obgrp.attrs["max"]))
amp_incr = list(ast.literal_eval(obgrp.attrs["incr"]))

hamps = obgrp["amplitudes"]
hhits = obgrp["hits"]
hflags = obgrp["flags"]
hamps = np.array(obgrp["amplitudes"])
hhits = np.array(obgrp["hits"])
hflags = np.array(obgrp["flags"])
n_bin = hamps.shape[1]
bad = hflags != 0
hamps[bad] = np.nan

for idet, det in enumerate(det_list):
outfile = f"{out_root}_{obname}_{det}.pdf"
Expand Down
1 change: 1 addition & 0 deletions src/toast/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ install(FILES
ops_signal_diff_noise.py
ops_loader.py
accelerator.py
ops_example_ground.py
DESTINATION ${PYTHON_SITE}/toast/tests
)
Loading

0 comments on commit 1985fff

Please sign in to comment.