Polarized observations

This tutorial covers working with polarized instrument and maps, and recovering polarized maps from observations.

We start with a normal instrument, and create two orthogonally polarized copies of each detector by setting polarized: True in the Array config:

[1]:
import maria
from maria.instrument import Band

f090 = Band(
    center=90e9,  # in Hz
    width=20e9,  # in Hz
    NET_RJ=40e-6,  # in K sqrt(s)
    knee=1e0,    # in Hz
    gain_error=5e-2)

f150 = Band(
    center=150e9,
    width=30e9,
    NET_RJ=60e-6,
    knee=1e0,
    gain_error=5e-2)

array = {"field_of_view": 0.5,
         "shape": "circle",
         "beam_spacing": 1.5,
         "primary_size": 10,
         "polarized": True,
         "bands": [f090, f150]}

instrument = maria.get_instrument(array=array)

print(instrument.arrays)
          n     FOV baseline        bands polarized
array1  652  0.478°      0 m  [f090,f150]      True

We can see the resulting polarization footprint in the instrument plot:

[2]:
print(instrument)
instrument.plot()
Instrument(1 array)
├ arrays:
│            n     FOV baseline        bands polarized
│  array1  652  0.478°      0 m  [f090,f150]      True
│
└ bands:
      name   center   width    η         NEP      NET_RJ         NET_CMB     FWHM
   0  f090   90 GHz  20 GHz  0.5  5.445 aW√s  40 uK_RJ√s  49.13 uK_CMB√s   1.458’
   1  f150  150 GHz  30 GHz  0.5  12.25 aW√s  60 uK_RJ√s    104 uK_CMB√s  0.8748’
../_images/tutorials_polarized-observations_4_1.png

Let’s observe the use the Einstein map, which has a faint polarization signature underneath the unpolarized signal of Einstein’s face. Remember that all maps are five dimensional (stokes, frequency, time, y, x); this map has four channels in the stokes dimensions (the I, Q, U, and V Stokes parameters). We can plot all the channels by giving plot a shaped set of stokes parameters.

[3]:
from maria.io import fetch

input_map = maria.map.load(fetch("maps/einstein.h5"))
input_map.plot(stokes=[["I", "Q"],
                       ["U", "V"]])
2025-11-21 01:58:46.020 INFO: Fetching https://github.com/thomaswmorris/maria-data/raw/master/maps/einstein.h5
Downloading: 100%|████████████████| 931k/931k [00:00<00:00, 20.3MB/s]
../_images/tutorials_polarized-observations_6_1.png
[4]:
from maria import Planner

planner = Planner(target=input_map, site="llano_de_chajnantor", constraints={"el": (60, 90)})
plans = planner.generate_plans(total_duration=900,  # in seconds
                               sample_rate=50)  # in Hz

plans[0].plot()
print(plans)
PlanList(1 plans, 900 s):
                           start_time duration   target(ra,dec)     center(az,el)
chunk
0      2025-11-21 01:58:49.620 +00:00    900 s  (0.3288’, -23°)  (265.7°, 68.08°)
../_images/tutorials_polarized-observations_7_1.png
[5]:
sim = maria.Simulation(
    instrument,
    plans=plans,
    site="llano_de_chajnantor",
    atmosphere="2d",
    atmosphere_kwargs={"weather": {"pwv": 0.5}},
    map=input_map
)

print(sim)
Simulation
├ Instrument(1 array)
│ ├ arrays:
│ │            n     FOV baseline        bands polarized
│ │  array1  652  0.478°      0 m  [f090,f150]      True
│ │
│ └ bands:
│       name   center   width    η         NEP      NET_RJ         NET_CMB     FWHM
│    0  f090   90 GHz  20 GHz  0.5  5.445 aW√s  40 uK_RJ√s  49.13 uK_CMB√s   1.458’
│    1  f150  150 GHz  30 GHz  0.5  12.25 aW√s  60 uK_RJ√s    104 uK_CMB√s  0.8748’
├ Site:
│   region: chajnantor
│   timezone: America/Santiago
│   location:
│     longitude: 67°45’17.28” W
│     latitude:  23°01’45.84” S
│     altitude: 5064 m
│   seasonal: True
│   diurnal: True
├ PlanList(1 plans, 900 s):
│                            start_time duration   target(ra,dec)     center(az,el)
│ chunk
│ 0      2025-11-21 01:58:49.620 +00:00    900 s  (0.3288’, -23°)  (265.7°, 68.08°)
├ '2d'
└ ProjectedMap:
    shape(stokes, nu, y, x): (4, 1, 685, 685)
    stokes: IQUV
    nu: [90.] GHz
    t: naive
    z: naive
    quantity: rayleigh_jeans_temperature
    units: K_RJ
      min: -1.000e-02
      max: 2.540e-01
      rms: 5.754e-02
    center:
      ra: 00ʰ00ᵐ0.00ˢ
      dec: -23°00’0.00”
    size(y, x): (1°, 1°)
    resolution(y, x): (5.255”, 5.255”)
    beam(maj, min, rot): [[0. 0. 0.]] rad
    memory: 30.03 MB
[6]:
tods = sim.run()

print(tods)
tods[0].plot()
2025-11-21 01:58:56.625 INFO: Simulating observation 1 of 1
Constructing atmosphere: 100%|████████████████| 8/8 [00:21<00:00,  2.68s/it]
Generating turbulence: 100%|████████████████| 8/8 [00:01<00:00,  4.46it/s]
Sampling turbulence: 100%|████████████████| 8/8 [00:07<00:00,  1.00it/s]
Computing atmospheric emission: 100%|████████████████| 2/2 [00:02<00:00,  1.17s/it, band=f150]
Sampling map: 100%|████████████████| 2/2 [00:13<00:00,  6.86s/it, band=f150, channel=(0 Hz, inf Hz), stokes=V]
Generating noise: 100%|████████████████| 2/2 [00:01<00:00,  1.52it/s, band=f150]
2025-11-21 02:00:05.340 INFO: Simulated observation 1 of 1 in 68.7 s
[TOD(shape=(652, 45000), fields=['atmosphere', 'map', 'noise'], units='K_RJ', start=2025-11-21 02:13:49.599 +00:00, duration=900.0s, sample_rate=50.0Hz, metadata={'atmosphere': True, 'sim_time': <Arrow [2025-11-21T01:59:48.135594+00:00]>, 'altitude': 5064.0, 'region': 'chajnantor', 'pwv': 0.5, 'base_temperature': 275.078})]
../_images/tutorials_polarized-observations_9_2.png
[7]:
from maria.mappers import BinMapper

mapper = BinMapper(
    stokes="IQUV",
    frame="ra/dec",
    resolution=0.25 / 60,
    tod_preprocessing={
        "window": {"name": "tukey", "kwargs": {"alpha": 0.1}},
        "remove_spline": {"knot_spacing": 60, "remove_el_gradient": True},
        "remove_modes": {"modes_to_remove": [0]},
    },
    map_postprocessing={
        "gaussian_filter": {"sigma": 1},
    },
    units="mK_RJ",
    tods=tods,
)

output_map = mapper.run()

print(output_map)
2025-11-21 02:00:14.986 INFO: Inferring center {'ra': '00ʰ00ᵐ1.32ˢ', 'dec': '-23°00’3.43”'} for mapper.
2025-11-21 02:00:14.999 INFO: Inferring mapper width 1.464° for mapper from observation patch.
2025-11-21 02:00:15.000 INFO: Inferring mapper height 1.464° to match supplied width.
Preprocessing TODs: 100%|████████████████| 1/1 [00:02<00:00,  2.18s/it]
Mapping band f090: 100%|██████████| 1/1 [00:03<00:00,  3.23s/it, stokes=V, tod=1/1]
2025-11-21 02:00:20.484 INFO: Ran mapper for band f090 in 3.239 s.
Mapping band f150: 100%|██████████| 1/1 [00:02<00:00,  2.98s/it, stokes=V, tod=1/1]
2025-11-21 02:00:23.487 INFO: Ran mapper for band f150 in 2.989 s.
2025-11-21 02:00:23.550 WARNING: No counts for map (stokes=V, nu=90 GHz)
2025-11-21 02:00:23.558 WARNING: No counts for map (stokes=V, nu=150 GHz)
ProjectedMap:
  shape(stokes, nu, t, y, x): (4, 2, 1, 351, 351)
  stokes: IQUV
  nu: [ 90. 150.] GHz
  t: [1.76369078e+09]
  z: naive
  quantity: rayleigh_jeans_temperature
  units: mK_RJ
    min: -2.304e+02
    max: 2.672e+02
    rms: nan
  center:
    ra: 00ʰ00ᵐ1.32ˢ
    dec: -23°00’3.43”
  size(y, x): (1.462°, 1.462°)
  resolution(y, x): (15”, 15”)
  beam(maj, min, rot): [[[1.45801568 1.45801568 0.        ]]

 [[0.87480941 0.87480941 0.        ]]]’
  memory: 15.77 MB

Note that we can’t see any of the circular polarization, since our instrument isn’t sensitive to it.

[8]:
output_map.plot(stokes=["I", "Q", "U"], nu_index=[[0], [1]])
../_images/tutorials_polarized-observations_12_0.png