Skip to content

Commit 8f8ab74

Browse files
committed
remove List and Tuple
1 parent 2303c01 commit 8f8ab74

15 files changed

+43
-43
lines changed

litebird_sim/detectors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@ class FreqChannelInfo:
401401
number_of_detectors (int): Number of detectors in the channel. If 0, inferred from
402402
`detector_names` or `detector_objs`. Default is 0.
403403
404-
detector_names (List[str]): List of detector names. If not provided, generated automatically.
404+
detector_names (list[str]): List of detector names. If not provided, generated automatically.
405405
Default is an empty list.
406406
407-
detector_objs (List[UUID]): List of UUIDs (or strings convertible to UUIDs) identifying
407+
detector_objs (list[UUID]): List of UUIDs (or strings convertible to UUIDs) identifying
408408
detector entries in the IMO. Default is an empty list.
409409
"""
410410

@@ -555,12 +555,12 @@ class InstrumentInfo:
555555
556556
number_of_channels (int): Number of frequency channels in the instrument. Default is 0.
557557
558-
channel_names (List[str]): List of frequency channel names. Default is an empty list.
558+
channel_names (list[str]): List of frequency channel names. Default is an empty list.
559559
560-
channel_objs (List[UUID]): List of references to channel definitions (UUIDs or convertible strings).
560+
channel_objs (list[UUID]): List of references to channel definitions (UUIDs or convertible strings).
561561
Automatically converted to UUIDs. Default is an empty list.
562562
563-
wafer_names (List[str]): List of wafer names used in the instrument. Default is an empty list.
563+
wafer_names (list[str]): List of wafer names used in the instrument. Default is an empty list.
564564
565565
wafer_space_cm (float): Spacing between wafers, in centimeters. Default is 0.0.
566566

litebird_sim/distribute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def distribute_optimally(elements, num_of_groups, weight_fn=None) -> list[Span]:
226226

227227
max_weight = _partition(elements, len(elements), num_of_groups, weight_fn)
228228

229-
result = [] # type: List[Span]
229+
result = [] # type: list[Span]
230230
start_idx = 0
231231
weight = 0
232232
cur_num = 0

litebird_sim/imo/imo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(
5757
else:
5858
raise ValueError("You must either provide flatfile_location= or url=")
5959

60-
self.queried_objects = set() # type: Set[Tuple[type, UUID]]
60+
self.queried_objects = set() # type: set[tuple[type, UUID]]
6161

6262
def query_entity(self, identifier: UUID, track=True) -> Entity:
6363
"""Return a :class:`.Entity` object from an UUID.

litebird_sim/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def write_list_of_observations(
470470
# Empty list
471471
# We do not want to return here, as we still need to participate to
472472
# the call to _compute_global_start_index below
473-
observations = [] # type: List[Observation]
473+
observations = [] # type: list[Observation]
474474

475475
if not isinstance(path, Path):
476476
path = Path(path)
@@ -695,7 +695,7 @@ def read_one_observation(
695695

696696

697697
def _build_file_entry_table(file_name_list: list[str | Path]) -> list[_FileEntry]:
698-
file_entries = [] # type: List[_FileEntry]
698+
file_entries = [] # type: list[_FileEntry]
699699
for cur_file_name in file_name_list:
700700
with h5py.File(cur_file_name, "r") as inpf:
701701
try:

litebird_sim/madam.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ def save_simulation_for_madam(
297297

298298
# Build a dictionary containing the characteristics of each detector
299299
# to be written in the simulation file for Madam
300-
madam_detectors = [] # type:List[Dict[str, Any]]
301-
sorted_obs_per_det = [] # type: List[List[_ObsInMpiProcess]]
300+
madam_detectors = [] # type:list[Dict[str, Any]]
301+
sorted_obs_per_det = [] # type: list[list[_ObsInMpiProcess]]
302302
for det_idx, det in enumerate(detectors):
303303
det_id = det_idx + 1
304304
madam_detectors.append(

litebird_sim/mapmaking/destriper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ def _run_destriper(
13131313

13141314
old_r_dot = _mpi_dot(z, r)
13151315

1316-
history_of_stopping_factors = [_get_stopping_factor(r)] # type: List[float]
1316+
history_of_stopping_factors = [_get_stopping_factor(r)] # type: list[float]
13171317
if callback:
13181318
callback(
13191319
stopping_factor=history_of_stopping_factors[-1],

litebird_sim/observations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def _make_detector_blocks(self, detectors, comm):
354354
and return `n_blocks_det = 3`
355355
356356
Args:
357-
detectors (List[dict]): List of detectors
357+
detectors (list[dict]): List of detectors
358358
359359
comm: The MPI communicator
360360

litebird_sim/pointing_sys.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ def left_multiply_syst_quats(
206206
class FocalplaneCoord:
207207
"""This class create an instance of focal plane to add offset and disturbance to the detectors.
208208
209-
Methods in this class multiply systematic quaternions to :attr:`.Observation.quat` (List[:class:`.RotQuaternion`]).
209+
Methods in this class multiply systematic quaternions to :attr:`.Observation.quat` (list[:class:`.RotQuaternion`]).
210210
211211
Args:
212212
sim (`Simulation`): :class:`.Simulation` instance.
213213
214214
obs (`Observation`): :class:`.Observation` instance whose :attr:`.Observation.quat` is injected with the systematics.
215215
216-
detectors (`List[DetectorInfo]`): List of :class:`.DetectorInfo` instances.
216+
detectors (`list[DetectorInfo]`): List of :class:`.DetectorInfo` instances.
217217
"""
218218

219219
def __init__(
@@ -228,7 +228,7 @@ def __init__(
228228
def add_offset(self, offset_rad, axis: str):
229229
"""Add a rotational offset to the detectors in the focal plane by the specified axis.
230230
231-
This method multiplies systematic quaternions to :attr:`.Observation.quat` (List[:class:`.RotQuaternion`]).
231+
This method multiplies systematic quaternions to :attr:`.Observation.quat` (list[:class:`.RotQuaternion`]).
232232
233233
If the `offset_rad` is a scalar, it will be added to all the detectors in the focal plane.
234234
If the `offset_rad` is an array with same length of the list of detectors,
@@ -276,7 +276,7 @@ def add_offset(self, offset_rad, axis: str):
276276
def add_disturb(self, noise_rad_matrix: np.ndarray, axis: str):
277277
"""Add a rotational disturbance to the detectors in the focal plane by the specified axis.
278278
279-
This method multiplies systematic quaternions to :attr:`.Observation.quat` (List[:class:`.RotQuaternion`]).
279+
This method multiplies systematic quaternions to :attr:`.Observation.quat` (list[:class:`.RotQuaternion`]).
280280
281281
If the `noise_rad_matrix` has the shape [`N`, `t`] where `N` is the number of detectors,
282282
`t` is the number of timestamps, the disturbance will be added to the detectors
@@ -339,7 +339,7 @@ class SpacecraftCoord:
339339
340340
obs (`Observation`): :class:`.Observation` instance whose :attr:`.Observation.quat` is injected with the systematics.
341341
342-
detectors (`List[DetectorInfo]`): List of :class:`.DetectorInfo` instances.
342+
detectors (`list[DetectorInfo]`): List of :class:`.DetectorInfo` instances.
343343
"""
344344

345345
def __init__(
@@ -398,7 +398,7 @@ class HWPCoord:
398398
399399
obs (`Observation`): :class:`.Observation` instance whose :attr:`.Observation.quat` is injected with the systematics.
400400
401-
detectors (`List[DetectorInfo]`): List of :class:`.DetectorInfo` instances.
401+
detectors (`list[DetectorInfo]`): List of :class:`.DetectorInfo` instances.
402402
"""
403403

404404
def __init__(
@@ -411,7 +411,7 @@ def __init__(
411411
412412
sampling_rate_hz (`float`): The sampling rate of the detectors.
413413
414-
detectors (`List[DetectorInfo]`): List of :class:`.DetectorInfo` to which offset and disturbance are to be added.
414+
detectors (`list[DetectorInfo]`): List of :class:`.DetectorInfo` to which offset and disturbance are to be added.
415415
416416
ang_speed_radpsec (`float`): The angular speed of the spinning HWP.
417417
@@ -526,7 +526,7 @@ class PointingSys:
526526
527527
obs (`Observation`): :class:`.Observation` instance whose :attr:`.Observation.quat` is injected with the systematics.
528528
529-
detectors (`List[Detector]`): List of :class:`.DetectorInfo`.
529+
detectors (`list[Detector]`): List of :class:`.DetectorInfo`.
530530
"""
531531

532532
def __init__(

litebird_sim/pointings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def get_pointings(
112112
their data types are preserved.
113113
114114
Returns:
115-
Tuple[np.ndarray, np.ndarray | None]:
115+
tuple[np.ndarray, np.ndarray | None]:
116116
A pair `(pointing_buffer, hwp_buffer)`, containing the computed pointing
117117
angles and (if applicable) HWP angles.
118118

litebird_sim/pointings_in_obs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def prepare_pointings(
3434
model can be passed and automatically propagated to the detectors in each observation.
3535
3636
Args:
37-
observations (Observation or List[Observation]):
37+
observations (Observation or list[Observation]):
3838
A single observation or a list of :class:`.Observation` objects to configure.
3939
4040
instrument (InstrumentInfo):
@@ -83,7 +83,7 @@ def precompute_pointings(
8383
need for on-the-fly computation during scanning or map-making operations.
8484
8585
Args:
86-
observations (Observation or List[Observation]):
86+
observations (Observation or list[Observation]):
8787
A single observation or a list of observations for which pointings should be precomputed.
8888
8989
pointings_dtype (data-type, optional):
@@ -249,7 +249,7 @@ def _get_pointings_array(
249249
250250
Returns
251251
-------
252-
Tuple[np.ndarray, np.ndarray | None]
252+
tuple[np.ndarray, np.ndarray | None]
253253
A tuple `(pointings, hwp_angle)`, where:
254254
- `pointings` is an array of shape (n_samples, 2) with [θ, φ].
255255
- `hwp_angle` is either the provided array or the one computed by the callable.
@@ -325,7 +325,7 @@ def _normalize_observations_and_pointings(
325325
326326
Returns
327327
-------
328-
Tuple[List[Observation], List[npt.NDArray]]
328+
tuple[list[Observation], list[npt.NDArray]]
329329
The tuple of the list of observations and list of pointings
330330
"""
331331

@@ -396,7 +396,7 @@ def _get_pointings_and_pol_angles_det(
396396
397397
Returns
398398
-------
399-
Tuple[np.ndarray, np.ndarray]
399+
tuple[np.ndarray, np.ndarray]
400400
A tuple containing the pointings and polarization angle of the detector
401401
"""
402402

0 commit comments

Comments
 (0)