Skip to content

Instantly share code, notes, and snippets.

@zonca
Last active June 24, 2019 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zonca/56ff738c3d163ee17e3378c34e17a0c3 to your computer and use it in GitHub Desktop.
Save zonca/56ff738c3d163ee17e3378c34e17a0c3 to your computer and use it in GitHub Desktop.
Script to generate the expected outputs for TOAST unit tests, requires PySM 2
import pysm
import numpy as np
for smoothing in [False, True]:
nside = 64 if smoothing else 8
config = {}
config["synchrotron"] = pysm.nominal.s1(nside=nside)
config["freefree"] = pysm.nominal.f1(nside=nside)
config["ame"] = pysm.nominal.a1(nside=nside)
bandpasses = {
"1a": (np.linspace(20, 25, 10), np.ones(10)),
"1b": (np.linspace(21, 26, 10), np.ones(10)),
"2a": (np.linspace(18, 23, 10), np.ones(10)),
"2b": (np.linspace(19, 24, 10), np.ones(10)),
}
sky = pysm.Sky(config)
pysm_instrument_config = {
"beams": np.ones(4)*600.,
"nside": nside,
"use_bandpass": True,
"channels": list(bandpasses.values()),
"channel_names": list(bandpasses.keys()),
"add_noise": False,
"output_units": "uK_RJ",
"use_smoothing": smoothing,
"pixel_indices": None,
}
inst = pysm.Instrument(pysm_instrument_config)
m, m_noise = inst.observe(sky, write_outputs=False)
print(m[0, :, :3])
@zonca
Copy link
Author

zonca commented Jun 24, 2019

Current output is:

Channel name | sigma_I (uK_CMB amin) | sigma_P (uK_CMB amin) | FWHM (arcmin) |
1a | 00.00 | 00.00 | 00.00 
1b | 00.00 | 00.00 | 00.00 
2a | 00.00 | 00.00 | 00.00 
2b | 00.00 | 00.00 | 00.00 
[[95.15288056 76.09502754 87.41419261]
 [-7.59180159  1.30317198 -5.93620791]
 [-6.31112965  7.90560375 -6.61861061]]
Channel name | sigma_I (uK_CMB amin) | sigma_P (uK_CMB amin) | FWHM (arcmin) |
1a | 00.00 | 00.00 | 600.00 
1b | 00.00 | 00.00 | 600.00 
2a | 00.00 | 00.00 | 600.00 
2b | 00.00 | 00.00 | 600.00 
[[90.15807463 88.68902424 89.27413783]
 [-5.08794779  4.77494585 -4.68392748]
 [-8.96212276  8.80648313 -8.76468294]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment