HpxPart

class erwans3.Astro_tools.HpxPart(value: Quantity, nside: int, indices: Union[int, ndarray])

Bases: PixList

Object representing a subpart of a Healpix map.

It has the attribute nside and indices (ring order is supposed). So that the values can be associated to their pixel.

Parameters:
  • value (Quantity) – Pixel values associated with the subpart.

  • nside (int) – The nside parameter of the parent Healpix map.

  • indices (int or ndarray) – Indices of the subpart pixels in ring order.

Attributes Summary

dir

Return the directional vectors (lmn) of the pixels coordinates.

nside

Return the NSIDE (resolution parameter) of the Healpix map.

pixarea

Return the pixel area of the Healpix map in steradians (sr).

res

Return the pixel resolution of the Healpix map in radians (rad).

Methods Summary

b2t(freq[, copy])

Convert Brightness to Temperature for a given frequency.

plot([mode])

Plot the Healpix map using mollview.

rotate(rot[, copy])

Rotate the HpxPart object by a given rotation.

t2b(freq[, copy])

Convert Temperature to Brightness per steradian for a given frequency

to_extensive([copy])

Convert the HpxPart to an extensive quantity.

to_hpxmap([nside, fill])

Convert the HpxPart object to an HpxMap object.

to_intensive([copy])

Convert the HpxPart to an intensive quantity.

to_pixmap()

Convert the HpxPart object to a PixMap object.

ud_grade(nside_out[, copy])

Perform an upsampling or downsampling of the HpxPart object to a target nside.

Attributes Documentation

dir

Return the directional vectors (lmn) of the pixels coordinates.

Returns:

Array of directional vectors (lmn) with the shape (npix, 3).

Return type:

ndarray

nside

Return the NSIDE (resolution parameter) of the Healpix map.

Returns:

Resolution parameter (NSIDE).

Return type:

int

pixarea

Return the pixel area of the Healpix map in steradians (sr).

Returns:

Pixel area in steradians.

Return type:

Quantity [sr]

res

Return the pixel resolution of the Healpix map in radians (rad).

Returns:

Pixel resolution in radians.

Return type:

Quantity [rad]

Methods Documentation

b2t(freq: Quantity, copy: bool = False) HpxPart

Convert Brightness to Temperature for a given frequency.

If the brightness is in Jy, it is converted to Jy/sr before converting to temperature

Parameters:
  • freq (Quantity) – Frequency of observation.

  • copy (bool, optional) – If True, return a new Hpxpart object; otherwise, modify the current object in-place (default is True).

Returns:

A new HpxPart object representing Temperature.

Return type:

HpxPart

plot(mode: Optional[str] = None, **kwargs)

Plot the Healpix map using mollview.

the map is converted to HpxMap first

Parameters:
  • mode (str, optional) – Plotting mode. If ‘log’, plot the logarithm of the map values (default is None).

  • **kwargs – Additional keyword arguments passed to the underlying plotting function.

rotate(rot: Union[Rotation, Rotator], copy: bool = True) HpxPart

Rotate the HpxPart object by a given rotation.

Parameters:
  • rot (Rotation or Rotator) – The rotation to apply. Can be a scipy or healpy rotation object.

  • copy (bool, optional) – If True, returns a new rotated HpxPart object (default is True).

Returns:

A rotated HpxPart object.

Return type:

HpxPart

Notes

This method first converts the HpxPart object to a PixMap, performs the rotation operation on the PixMap, and then converts it back to an HpxPart object. If copy is set to False, it modifies the current HpxPart object in-place with the rotated values.

t2b(freq: Quantity, copy: bool = False) HpxPart

Convert Temperature to Brightness per steradian for a given frequency

Parameters:
  • freq (Quantity) – Frequency of observation.

  • copy (bool, optional) – If True, return a new HpxPart object; otherwise, modify the current object in-place (default is True).

Returns:

A new HpxPart object representing Brightness per steradian.

Return type:

HpxPart

to_extensive(copy: bool = True) HpxPart

Convert the HpxPart to an extensive quantity.

ie output unit = input unit * sr if the input unit is intensive

Parameters:

copy (bool, optional) – If True, return a new HpxPart object; otherwise, modify the current object in-place (default is True).

Returns:

A new HpxPart object representing an extensive quantity.

Return type:

HpxPart

to_hpxmap(nside: Optional[int] = None, fill: float = 0) HpxMap

Convert the HpxPart object to an HpxMap object.

Parameters:
  • nside (int, optional) – The target nside for the new HpxMap object (default is None).

  • fill (float, optional) – The fill value for pixels not in the indices (default is 0).

Returns:

An HpxMap object representing the Healpix map.

Return type:

HpxMap

Notes

This method constructs an HpxMap object using the pixel values and indices from the current HpxPart object. If a target nside is provided, it performs a grade operation to achieve the desired resolution.

to_intensive(copy: bool = True) HpxPart

Convert the HpxPart to an intensive quantity.

ie output unit = input unit /sr

Parameters:

copy (bool, optional) – If True, return a new HpxPart object; otherwise, modify the current object in-place (default is True).

Returns:

A new HpxPart object representing an intensive quantity.

Return type:

HpxPart

to_pixmap() PixMap

Convert the HpxPart object to a PixMap object.

Returns:

A PixMap object representing the pixel map.

Return type:

PixMap

Notes

This method constructs a PixMap object using the pixel values and coordinates from the current HpxPart object.

ud_grade(nside_out: int, copy: bool = True) HpxPart

Perform an upsampling or downsampling of the HpxPart object to a target nside.

Parameters:
  • nside_out (int) – The target nside for the new HpxPart object.

  • copy (bool, optional) – If True, returns a new HpxPart object with the modified resolution (default is True).

Returns:

An HpxPart object with the specified nside.

Return type:

HpxPart

Notes

This method performs either an upsampling or downsampling operation on the HpxPart object to match the target nside. It adjusts the pixel values and indices accordingly. If copy is set to False, it modifies the current HpxPart object in-place with the new resolution.