Skip to content

Commit

Permalink
formated code
Browse files Browse the repository at this point in the history
  • Loading branch information
nestor committed Dec 13, 2023
1 parent 2510d80 commit 3186861
Show file tree
Hide file tree
Showing 14 changed files with 622 additions and 326 deletions.
14 changes: 8 additions & 6 deletions src/libtoast/src/toast_tod_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ void toast::filter_polynomial(int64_t order, size_t n, uint8_t * flags,
}
}

int rank, info=0;
double rcond_limit = -1; // Use machine precision
int rank, info = 0;
double rcond_limit = -1; // Use machine precision
toast::AlignedVector <double> singular_values(norder);

int LWORK = toast::LinearAlgebra::gelss_buffersize(ngood, norder, nsignal,
ngood, ngood, rcond_limit);
toast::AlignedVector <double> WORK(LWORK);
toast::LinearAlgebra::gelss(ngood, norder, nsignal, masked_templates.data(), ngood,
masked_signals.data(), ngood, singular_values.data(), rcond_limit,
toast::LinearAlgebra::gelss(ngood, norder, nsignal,
masked_templates.data(), ngood,
masked_signals.data(), ngood,
singular_values.data(), rcond_limit,
&rank, WORK.data(), LWORK, &info);

for (int iorder = 0; iorder < norder; ++iorder) {
Expand All @@ -145,12 +147,12 @@ void toast::filter_polynomial(int64_t order, size_t n, uint8_t * flags,
if (info != 0) {
auto log = toast::Logger::get();
std::ostringstream o;
o << "DGELLS: " << ngood << "/" << scanlen << " good samples, order " << norder;
o << "DGELLS: " << ngood << "/" << scanlen << " good samples, order " <<
norder;
o << " failed with info " << info;
log.error(o.str().c_str(), TOAST_HERE());
throw std::runtime_error(o.str().c_str());
}

}
}

Expand Down
9 changes: 7 additions & 2 deletions src/toast/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ def optical_loading(self, det, T):
def _get_unit_conversion_coefficients(self, det):
"""Compute and cache the unit conversion coefficients for one detector"""

if det not in self._kcmb2jysr or det not in self._kcmb2krj or det not in self._kcmb2w:
if (
det not in self._kcmb2jysr
or det not in self._kcmb2krj
or det not in self._kcmb2w
):
# The calculation is a copy from the Hildebrandt and Macias-Perez IDL module for Planck

nu_cmb = k * TCMB / h
Expand All @@ -424,7 +428,8 @@ def _get_unit_conversion_coefficients(self, det):
# K_CMB->W conversion is from the BoloCalc paper, arXiv:1806.04316
bandpass = bandpass / np.amax(bandpass)
self._kcmb2w[det] = integrate_simpson(
freqs, k * (x / (np.exp(x) - 1))**2 * np.exp(x) * bandpass,
freqs,
k * (x / (np.exp(x) - 1)) ** 2 * np.exp(x) * bandpass,
)

return
Expand Down
Loading

0 comments on commit 3186861

Please sign in to comment.