Simulating observations with MUSTANG-2¶
MUSTANG-2 is a bolometric array on the Green Bank Telescope. In this notebook we simulate an observation of the Crab Nebula (M1).
[1]:
import maria
input_map = maria.map.get("maps/m1.h5")
input_map.plot(nu_index=[0, 1, 2])
print(input_map)
2026-03-20 19:41:56.133 INFO: Fetching https://github.com/thomaswmorris/maria-data/raw/master/maps/m1.h5
Downloading: 100%|████████████████| 4.54M/4.54M [00:00<00:00, 80.7MB/s]
ProjectionMap:
shape(stokes, nu, y, x): (1, 3, 805, 787)
stokes: I
nu: [149.8962 214.1375 272.5386] GHz
t: naive
z: naive
quantity: rayleigh_jeans_temperature
units: K_RJ
min: -2.429e-02
max: 3.824e-01
rms: 3.907e-02
center:
ra: 05ʰ34ᵐ31.95ˢ
dec: 22°00’52.16”
size(y, x): (13.42’, 13.12’)
resolution(y, x): (1”, 1”)
beam(maj, min, rot): (0 rad, 0 rad, 0 rad)
memory: 30.41 MB
[2]:
from maria import Planner
planner = Planner(target=input_map, site="green_bank", constraints={"el": (60, 90)})
plans = planner.generate_plans(total_duration=900, sample_rate=100)
plans[0].plot()
print(plans)
PlanList(1 plans, 900 s):
start_time duration target(ra,dec) center(az,el)
chunk
0 2026-03-20 21:04:30.006 +00:00 900 s (83.63°, 22.01°) (117°, 61.35°)
[3]:
instrument = maria.get_instrument("MUSTANG-2")
print(instrument)
instrument.plot()
Instrument(1 array)
├ arrays:
│ n FOV baseline bands polarized
│ array1 217 4.2’ 0 m [m2/f093] False
│
└ bands:
name center width η NEP NET_RJ NET_CMB FWHM
0 m2/f093 86.21 GHz 20.98 GHz 0.1 15 aW√s 571.1 uK_RJ√s 690.5 uK_CMB√s 9.133”
[4]:
sim = maria.Simulation(
instrument,
plans=plans,
site="green_bank",
map=input_map,
atmosphere="2d",
)
print(sim)
2026-03-20 19:42:08.774 INFO: Fetching https://github.com/thomaswmorris/maria-data/raw/master/atmosphere/spectra/am/v3/green_bank.h5
Downloading: 100%|████████████████| 22.0M/22.0M [00:00<00:00, 153MB/s]
2026-03-20 19:42:09.538 INFO: Fetching https://github.com/thomaswmorris/maria-data/raw/master/atmosphere/weather/era5/green_bank.h5
Downloading: 100%|████████████████| 12.0M/12.0M [00:00<00:00, 148MB/s]
Simulation
├ Instrument(1 array)
│ ├ arrays:
│ │ n FOV baseline bands polarized
│ │ array1 217 4.2’ 0 m [m2/f093] False
│ │
│ └ bands:
│ name center width η NEP NET_RJ NET_CMB FWHM
│ 0 m2/f093 86.21 GHz 20.98 GHz 0.1 15 aW√s 571.1 uK_RJ√s 690.5 uK_CMB√s 9.133”
├ Site:
│ region: green_bank
│ timezone: America/New_York
│ location:
│ longitude: 79°50’23.28” W
│ latitude: 38°25’59.16” N
│ altitude: 825 m
│ seasonal: True
│ diurnal: True
├ PlanList(1 plans, 900 s):
│ start_time duration target(ra,dec) center(az,el)
│ chunk
│ 0 2026-03-20 21:04:30.006 +00:00 900 s (83.63°, 22.01°) (117°, 61.35°)
├ '2d'
└ ProjectionMap:
shape(stokes, nu, t, y, x): (1, 3, 1, 805, 787)
stokes: I
nu: [149.8962 214.1375 272.5386] GHz
t: [1.77403572e+09]
z: naive
quantity: rayleigh_jeans_temperature
units: K_RJ
min: -2.429e-02
max: 3.824e-01
rms: 3.907e-02
center:
ra: 05ʰ34ᵐ31.95ˢ
dec: 22°00’52.16”
size(y, x): (13.42’, 13.12’)
resolution(y, x): (1”, 1”)
beam(maj, min, rot): (0 rad, 0 rad, 0 rad)
memory: 30.41 MB
[5]:
tods = sim.run()
tods[0].plot()
2026-03-20 19:42:10.545 INFO: Simulating observation 1 of 1
Constructing atmosphere: 100%|████████████████| 8/8 [00:01<00:00, 6.86it/s]
Generating turbulence: 100%|████████████████| 8/8 [00:00<00:00, 20.50it/s]
Sampling turbulence: 100%|████████████████| 8/8 [00:04<00:00, 1.96it/s]
Computing atmospheric emission: 100%|████████████████| 1/1 [00:00<00:00, 1.20it/s, band=m2/f093]
Sampling map: 0%| | 0/1 [00:04<?, ?it/s, band=m2/f093, channel=(0 Hz, 182 GHz)]/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/numpy/lib/_function_base_impl.py:4596: RuntimeWarning: invalid value encountered in scalar subtract
diff_b_a = b - a
Sampling map: 100%|████████████████| 1/1 [00:08<00:00, 8.85s/it, band=m2/f093, channel=(0 Hz, 182 GHz)]
Generating noise: 100%|████████████████| 1/1 [00:00<00:00, 1.09it/s, band=m2/f093]
2026-03-20 19:42:39.594 INFO: Simulated observation 1 of 1 in 29.03 s
[6]:
from maria.mappers import BinMapper
mapper = BinMapper(
tod_preprocessing={
# "remove_modes": {"modes_to_remove": 1},
"remove_spline": {"knot_spacing": 10, "remove_el_gradient": True},
},
units="uK_RJ",
tods=tods,
resolution=2 * input_map.resolution,
)
output_map = mapper.run()
2026-03-20 19:42:47.522 INFO: Inferring center {'ra': '05ʰ34ᵐ32.07ˢ', 'dec': '22°00’51.81”'} for mapper.
2026-03-20 19:42:47.540 INFO: Inferring mapper width 17.18’ for mapper from observation patch.
2026-03-20 19:42:47.541 INFO: Inferring mapper height 17.18’ to match supplied width.
2026-03-20 19:42:47.545 INFO: Inferring mapper stokes parameters 'I' for mapper.
Preprocessing TODs: 100%|████████████████| 1/1 [00:01<00:00, 1.61s/it]
Mapping: 100%|██████████| 1/1 [00:02<00:00, 2.09s/it, tod=1/1]
[7]:
output_map.plot()