Skip to content

Commit

Permalink
Several small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Aug 15, 2024
1 parent 296c1ad commit 82acb9a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/toast/ops/noise_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,6 @@ def process_noise_estimate(
extended_flags,
my_psds1,
my_cov1,
comm,
lagmax,
)

Expand Down
4 changes: 1 addition & 3 deletions src/toast/tests/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,7 @@ def fake_hwpss_data(ang, scale):
sincoeff = scale * np.array([0.7, 0.9, 0.1, 0.002, 0.0005])
out = np.zeros_like(ang)
for h in range(n_harmonic):
out[:] += coscoeff[h] * np.cos((h + 1) * ang) + sincoeff[h] * np.sin(
(h + 1) * ang
)
out[:] += coscoeff[h] * np.cos(h * ang) + sincoeff[h] * np.sin(h * ang)
return out, coscoeff, sincoeff


Expand Down
11 changes: 6 additions & 5 deletions src/toast/tests/ops_hwpfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_hwpfilter(self):
ops.Copy(detdata=[(defaults.det_data, "input")]).apply(data)

# Make fake flags
fake_flags(data)
# fake_flags(data)

# Filter
hwpfilter = ops.HWPFilter(
Expand Down Expand Up @@ -151,9 +151,10 @@ def test_hwpfilter(self):
# Check that the flagged samples were also cleaned and not,
# for example, set to zero. Use np.diff() to remove any
# residual trend
self.assertTrue(
np.std(np.diff(output) - np.diff(original))
< 0.1 * np.std(np.diff(output))
)
residual_std = np.std(np.diff(output) - np.diff(original))
output_std = np.std(np.diff(output))
if residual_std > 0.1 * output_std:
print(f"residual ({residual_std}) > 0.1 * ({output_std})")
self.assertTrue(False)

close_data(data)
14 changes: 10 additions & 4 deletions src/toast/tests/template_hwpss.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
from .. import ops
from ..accelerator import ImplementationType, accel_enabled
from ..atm import available_atm
from ..hwp_utils import (
hwpss_sincos_buffer,
hwpss_compute_coeff_covariance,
hwpss_compute_coeff,
hwpss_build_model,
)
from ..observation import default_values as defaults
from ..pixels_io_healpix import write_healpix_fits
from ..pixels_io_wcs import write_wcs_fits
Expand Down Expand Up @@ -63,11 +69,11 @@ def test_algorithm(self):
dc_level = np.mean(hwpss)
n_harmonics = len(ccos)
# Estimate coefficients
sincos = Hwpss.sincos_buffer(hwp_ang, flags, n_harmonics)
cov_lu, cov_piv = Hwpss.compute_coeff_covariance(times, flags, sincos)
coeff = Hwpss.compute_coeff(hwpss, flags, times, sincos, cov_lu, cov_piv)
sincos = hwpss_sincos_buffer(hwp_ang, flags, n_harmonics)
cov_lu, cov_piv = hwpss_compute_coeff_covariance(times, flags, sincos)
coeff = hwpss_compute_coeff(hwpss, flags, times, sincos, cov_lu, cov_piv)
# Build model
model = Hwpss.build_model(times, flags, sincos, coeff) + dc_level
model = hwpss_build_model(times, flags, sincos, coeff) + dc_level
# Plot
if self.comm is None or self.comm.rank == 0:
import matplotlib.pyplot as plt
Expand Down

0 comments on commit 82acb9a

Please sign in to comment.