1
- # -*- encoding: utf-8 -*-
2
-
3
1
import logging
4
2
import os
5
3
from dataclasses import dataclass
6
- from typing import Union , List , Dict , Optional
7
4
8
5
import numpy as np
9
6
import numpy .typing as npt
@@ -57,8 +54,8 @@ def add_convolved_sky_to_one_detector(
57
54
pointings_det ,
58
55
mueller_matrix ,
59
56
hwp_angle ,
60
- convolution_params : Optional [ BeamConvolutionParameters ] = None ,
61
- nside_centering : Union [ int , None ] = None ,
57
+ convolution_params : BeamConvolutionParameters | None = None ,
58
+ nside_centering : int | None = None ,
62
59
nthreads : int = 0 ,
63
60
):
64
61
"""
@@ -206,16 +203,16 @@ def add_convolved_sky_to_one_detector(
206
203
def add_convolved_sky (
207
204
tod ,
208
205
pointings ,
209
- sky_alms : Union [ SphericalHarmonics , Dict [str , SphericalHarmonics ] ],
210
- beam_alms : Union [ SphericalHarmonics , Dict [str , SphericalHarmonics ] ],
211
- hwp_angle : Union [ np .ndarray , None ] = None ,
212
- mueller_hwp : Union [ np .ndarray , None ] = None ,
213
- input_sky_names : Union [ str , None ] = None ,
214
- input_beam_names : Union [ str , None ] = None ,
215
- convolution_params : Optional [ BeamConvolutionParameters ] = None ,
206
+ sky_alms : SphericalHarmonics | dict [str , SphericalHarmonics ],
207
+ beam_alms : SphericalHarmonics | dict [str , SphericalHarmonics ],
208
+ hwp_angle : np .ndarray | None = None ,
209
+ mueller_hwp : np .ndarray | None = None ,
210
+ input_sky_names : str | None = None ,
211
+ input_beam_names : str | None = None ,
212
+ convolution_params : BeamConvolutionParameters | None = None ,
216
213
input_sky_alms_in_galactic : bool = True ,
217
214
pointings_dtype = np .float64 ,
218
- nside_centering : Union [ int , None ] = None ,
215
+ nside_centering : int | None = None ,
219
216
nthreads : int = 0 ,
220
217
):
221
218
"""
@@ -230,10 +227,10 @@ def add_convolved_sky(
230
227
Pointing information for each detector. If an array, it should have shape
231
228
(n_detectors, n_samples, 3). If a callable, it should return pointing data when
232
229
passed a detector index.
233
- sky_alms : Union[ SphericalHarmonics, Dict[str, SphericalHarmonics] ]
230
+ sky_alms : SphericalHarmonics | Dict[str, SphericalHarmonics]
234
231
Spherical harmonic coefficients representing the sky maps. If a dictionary, keys should
235
232
correspond to detector or channel names.
236
- beam_alms : Union[ SphericalHarmonics, Dict[str, SphericalHarmonics] ]
233
+ beam_alms : SphericalHarmonics | Dict[str, SphericalHarmonics]
237
234
Spherical harmonic coefficients representing the beam functions. If a dictionary,
238
235
keys should correspond to detector or channel names.
239
236
hwp_angle : np.ndarray or None, default=None
@@ -332,21 +329,21 @@ def add_convolved_sky(
332
329
333
330
334
331
def add_convolved_sky_to_observations (
335
- observations : Union [ Observation , List [Observation ] ],
336
- sky_alms : Union [
337
- SphericalHarmonics , Dict [str , SphericalHarmonics ]
338
- ] , # at some point optional, taken from the obs
339
- beam_alms : Union [
340
- SphericalHarmonics , Dict [str , SphericalHarmonics ]
341
- ] , # at some point optional, taken from the obs
342
- pointings : Union [ npt .ArrayLike , List [npt .ArrayLike ], None ] = None ,
343
- hwp : Optional [ HWP ] = None ,
332
+ observations : Observation | list [Observation ],
333
+ sky_alms : (
334
+ SphericalHarmonics | dict [str , SphericalHarmonics ]
335
+ ) , # at some point optional, taken from the obs
336
+ beam_alms : (
337
+ SphericalHarmonics | dict [str , SphericalHarmonics ]
338
+ ) , # at some point optional, taken from the obs
339
+ pointings : npt .ArrayLike | list [npt .ArrayLike ] | None = None ,
340
+ hwp : HWP | None = None ,
344
341
input_sky_alms_in_galactic : bool = True ,
345
- convolution_params : Optional [ BeamConvolutionParameters ] = None ,
342
+ convolution_params : BeamConvolutionParameters | None = None ,
346
343
component : str = "tod" ,
347
344
pointings_dtype = np .float64 ,
348
- nside_centering : Union [ int , None ] = None ,
349
- nthreads : Union [ int , None ] = None ,
345
+ nside_centering : int | None = None ,
346
+ nthreads : int | None = None ,
350
347
):
351
348
"""
352
349
Applies beam convolution to sky maps and adds the resulting signal to the TOD of one or more observations.
@@ -366,12 +363,12 @@ def add_convolved_sky_to_observations(
366
363
keyed by detector/channel names.
367
364
pointings : np.ndarray, list of np.ndarray, or None, default=None
368
365
Detector pointing matrices. If None, the function extracts pointings from the `Observation` objects.
369
- hwp : Optional[ HWP] , default=None
366
+ hwp : HWP | None , default=None
370
367
Half-Wave Plate (HWP) parameters. If None, the function either assumes the information stored in the
371
368
`Observation` objects, or, if they are absent, assumes no HWP.
372
369
input_sky_alms_in_galactic : bool, default=True
373
370
Whether the input sky alms are in Galactic coordinates.
374
- convolution_params : Optional[ BeamConvolutionParameters] , default=None
371
+ convolution_params : BeamConvolutionParameters | None , default=None
375
372
Parameters controlling the beam convolution, including resolution limits and numerical precision.
376
373
component : str, default="tod"
377
374
The name of the TOD component to which the computed data is added.
0 commit comments