Skymap
- class erwans3.Astro_tools.Skymap(map: ~typing.Union[~erwans3.Astro_tools.PixList, ~erwans3.Astro_tools.SHCoeff, ~astropy.units.quantity.Quantity], frame: ~astropy.coordinates.baseframe.BaseCoordinateFrame = <ICRS Frame>, time: ~typing.Optional[~astropy.time.core.Time] = None, freq: ~typing.Optional[~astropy.units.quantity.Quantity] = None, spectral_index: ~typing.Optional[~typing.Union[float, ~erwans3.Astro_tools.PixList, ~erwans3.Astro_tools.SHCoeff]] = None, spectral_range_validity: ~typing.Optional[tuple[astropy.units.quantity.Quantity, astropy.units.quantity.Quantity]] = None, polar: str = 'I')
Bases:
objectRepresents a map of the sky with contextual information such as time, frequency, polarization, and frame.
A spectral index can be associated as well (either as a scalar or as a map)
- Parameters:
map (
PixListorSHCoefforQuantity) – The map data represented as a PixList subclass or SHCoeff. If map is a Quantity, it is assumed to be a HEALPix map.frame (
BaseCoordinateFrame, optional) – The coordinate frame associated with the map. Defaults toICRS.time (
TimeorNone, optional) – The time associated with the map. Defaults to None.freq (
Quantity[Hz],None, optional) – The frequency associated with the map. Defaults to None.spectral_index (
floatorPixListorSHCoefforNone, optional) – The spectral index associated with the map. Defaults to None.spectral_range_validity (
tuple[Quantity[Hz],Quantity[Hz]], optional) – The validity range of the spectral index. Defaults to (0, inf).polar (
str, optional) – The polarization information. Defaults to ‘I’.
- frame
The coordinate frame associated with the map.
- Type:
- spectral_index
The spectral index associated with the map.
- spectral_range_validity
The validity range of the spectral index.
Notes
If the input map is already a Skymap instance, the new instance will be a copy of that Skymap.
If frame is not provided, it defaults to the ICRS coordinate frame.
If time is not provided but can be inferred from frame.obstime, it is automatically set.
The spectral_index can be a scalar value, a PixList, SHCoeff, or HpxMap depending on the map type.
The spectral_range_validity tuple defines the validity range for the spectral index.
The default polarization mode is ‘I’ (total intensity).
Attributes Summary
Return the type of map data (SHCoeff or Pixmap).
Return the simulation type based on the map style.
Return the unit of the skymap data.
Methods Summary
b2t([copy, rj])Convert brightness to temperature using the associated frequency of the skymap.
change_freq(new_freq[, copy])Change the frequency of the Skymap by applying a power law with the provided spectral index.
change_map_style(new_class[, copy])Change the class of the stored map and spectral index.
get_skymap([freq, frame, simu])Return a new Skymap object with the desired frequency, frame, and map style.
match_other(other)Compares this Skymap object with another Skymap and returns a tuple of boolean values indicating which criteria match between the two Skymap objects.
plot(**kwargs)Plot the skymap using the plot method of the underlying map object.
t2b([copy, rj])Convert temperature to brightness per steradian using the associated frequency of the skymap.
to_extensive([copy])Convert the skymap to an extensive representation.
to_intensive([copy])Convert the skymap to an intensive representation.
transform_to(new_frame[, copy])Change Frame / Orientation (equivalent to rotate for maps)
ud_grade(nside_out[, copy])Upgrade or downgrade the resolution of the skymap to the specified nside value.
Attributes Documentation
- map_style
Return the type of map data (SHCoeff or Pixmap).
- Returns:
The type of map data.
- Return type:
- simu_type
Return the simulation type based on the map style.
- Returns:
The simulation type, either ‘SH’ for SHCoeff or ‘pixmap’ for Pixmap.
- Return type:
- unit
Return the unit of the skymap data.
- Returns:
The unit of the skymap data.
- Return type:
Methods Documentation
- b2t(copy: bool = True, rj: bool = False) Skymap
Convert brightness to temperature using the associated frequency of the skymap.
If Rayleigh-Jeans is assumed, the spectral index is changed as well. otherwise, the returned skymap will not have a spectral index
- Parameters:
copy (
bool, optional) – If True, return a new Skymap object with brightness converted to temperature. If False, modify the current Skymap object in place. Default is True.rj (
bool, optional) – If True, assume Rayleigh-Jeans approximation (spectral index is changed accordingly). If False, the returned Skymap will not have a spectral index. Default is False.
- Returns:
If copy is True, returns a new Skymap object with brightness converted to temperature. If copy is False, modifies in place.
- Return type:
- change_freq(new_freq: Quantity, copy: bool = True) Skymap
Change the frequency of the Skymap by applying a power law with the provided spectral index.
- Parameters:
- Returns:
If copy is True, returns a new Skymap object with the updated frequency. If copy is False, modifies and returns the existing Skymap object with the updated frequency.
- Return type:
- Raises:
ValueError – If the new frequency is outside the specified spectral range validity.
Notes
If no spectral index is provided, nothing changes in the Skymap.
Upcoming: handle spectra function map
- change_map_style(new_class: type, copy: bool = True, **kwargs) Skymap
Change the class of the stored map and spectral index.
- Parameters:
- Returns:
A new Skymap object with the updated map and spectral index classes if copy=True. Otherwise, modifies and returns the current Skymap in place.
- Return type:
Notes
The method uses the
change_map_style()function internally to convert the map and spectral index.The
is_map()function is used to check if the spectral index is a valid map.
- get_skymap(freq: Optional[Quantity] = None, frame: Optional[Union[BaseCoordinateFrame, SkyCoord]] = None, simu: bool = True) Skymap
Return a new Skymap object with the desired frequency, frame, and map style.
- Parameters:
freq (
Quantity[Hz] orNone, optional) – The desired frequency for the Skymap. If None, the frequency remains unchanged.frame (
BaseCoordinateFrameorSkyCoordNone, optional) – The desired frame or observer for the Skymap. If None, the frame remains unchanged.simu (
bool, optional) – Whether to simulate the Skymap with the desired map style based on the simu_type attribute.
- Returns:
A new Skymap object with the specified frequency, frame, and map style.
- Return type:
Notes
If freq or frame is specified, the returned Skymap will have the updated frequency or frame.
If simu is True, the returned Skymap will be simulated with the desired map style based on simu_type.
- match_other(other: Skymap) tuple[bool]
Compares this Skymap object with another Skymap and returns a tuple of boolean values indicating which criteria match between the two Skymap objects.
return a list of boolean saying which criteria matches between 2 Skymap object
- Parameters:
other (
Skymap) – Another Skymap object to compare with.- Returns:
:obj:`~tuple` [ – A tuple of boolean values indicating the matching criteria: - Unit compatibility. - Time information. - Polarization information. - Frequency information. - Map style compatibility (PixList, SHCoeff).
- Return type:
obj`~:bool`]
Notes
unit_bool: True if the physical unit types of the two Skymaps match, False otherwise.
time_bool: True if both Skymaps have valid time information and it matches, False otherwise.
freq_bool: True if both Skymaps have valid frequency information and it matches, False otherwise.
polar_bool: True if the polarization information of both Skymaps matches, False otherwise.
mapstyle_bool: True if the map style (PixList, SHCoeff) matches between the two Skymaps, False otherwise.
tot_bool: A tuple containing all individual boolean criteria.
- plot(**kwargs)
Plot the skymap using the plot method of the underlying map object.
- Parameters:
**kwargs – Additional keyword arguments to pass to the underlying map’s plot method.
Notes
This method forwards the plotting to the plot method of the underlying map object.
- t2b(copy: bool = True, rj: bool = False) Skymap
Convert temperature to brightness per steradian using the associated frequency of the skymap.
If Rayleigh-Jeans is assumed, the spectral index is changed as well. otherwise, the returned skymap will not have a spectral index
- Parameters:
copy (
bool, optional) – If True, return a new Skymap object with temperature converted to brightness. If False, modify the current Skymap object in place. Default is True.rj (
bool, optional) – If True, assume Rayleigh-Jeans approximation (spectral index is changed accordingly). If False, the returned Skymap will not have a spectral index. Default is False.
- Returns:
If copy is True, returns a new Skymap object with temperature converted to brightness. If copy is False, modifies in place.
- Return type:
- to_extensive(copy: bool = True) Skymap
Convert the skymap to an extensive representation.
- Parameters:
copy (
bool, optional) – If True, return a new Skymap object with an extensive representation of the map. If False, modify the current Skymap object in place. Default is True.- Returns:
If copy is True, returns a new Skymap object with an extensive representation of the map. If copy is False, modifies in place.
- Return type:
- to_intensive(copy: bool = True) Skymap
Convert the skymap to an intensive representation.
- Parameters:
copy (
bool, optional) – If True, return a new Skymap object with an intensive representation of the map. If False, modify the current Skymap object in place. Default is True.- Returns:
If copy is True, returns a new Skymap object with an intensive representation of the map. If copy is False, modifies in place.
- Return type:
- transform_to(new_frame: BaseCoordinateFrame, copy: bool = True) Skymap
Change Frame / Orientation (equivalent to rotate for maps)
- Parameters:
new_frame (
BaseCoordinateFrame) – The new coordinate frame to transform the Skymap to.copy (
bool, optional) – If True, returns a new Skymap object with the transformation applied (default is True).
- Returns:
If copy is True, returns a new Skymap object with the transformation applied. If copy is False, modifies the existing Skymap object in place and returns it.
- Return type:
Notes
If new_frame is a callable, it will be called to generate a new frame. If the new frame has a different obstime than the Skymap’s time, a new frame with the same attributes as the new frame but with the Skymap’s time will be created.
The rotation to transform the Skymap is determined by the composition of transformation matrices between the current frame and the new frame (
comp_matrix_transfo()function is used).The spectral_index attribute, if present and a map, will also be rotated along with the Skymap.
See also
- ud_grade(nside_out: int, copy: bool = True) Skymap
Upgrade or downgrade the resolution of the skymap to the specified nside value.
Can only be used with Healpix maps (
HpxMap,HpxPart)- Parameters:
- Returns:
If copy is True, returns a new Skymap object with the resolution changed. If copy is False, returns None.
- Return type:
Notes
For maps of class HpxMap or HpxPart, this method will change the resolution to nside_out.
If the spectral index is also a map (HpxMap or HpxPart), its resolution will also be changed.
If the map class does not support resolution changes, a TypeError will be raised.