Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply the atmospheric scaling in temperature, not intensity #328

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/toast/pipeline_tools/atm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os

import numpy as np
from scipy.constants import h, k

from ..timing import function_timer, Timer
from ..utils import Logger, Environment
Expand All @@ -23,6 +24,7 @@


XAXIS, YAXIS, ZAXIS = np.eye(3)
TCMB = 2.725


def add_atmosphere_args(parser):
Expand Down Expand Up @@ -283,6 +285,9 @@ def scale_atmosphere_by_frequency(
if not args.simulate_atmosphere:
return

if freq is None:
raise RuntimeError("You must supply the nominal frequency")

log = Logger.get()
if comm.world_rank == 0 and verbose:
log.info("Scaling atmosphere by frequency")
Expand Down Expand Up @@ -357,7 +362,15 @@ def scale_atmosphere_by_frequency(
# Interpolate the absorption coefficient to do a top hat
# integral across the bandpass
det_freqs = np.linspace(center - width / 2, center + width / 2, nstep)
absorption_det = np.mean(np.interp(det_freqs, freqs, absorption))
absorption_det = np.interp(det_freqs, freqs, absorption)
# From brightness to thermodynamic units
x = h * det_freqs * 1e9 / k / TCMB
rj2cmb = (x / (np.exp(x / 2) - np.exp(-x / 2))) ** -2
# Normalize to unity at 150GHz
rj2cmb *= 0.5763279042527544
absorption_det *= rj2cmb
# Average across the bandpass
absorption_det = np.mean(absorption_det)
cachename = "{}_{}".format(cache_name, det)
ref = tod.cache.reference(cachename)
ref *= absorption_det
Expand Down