hpmoc.io.ligo module

Strategies for loading LIGO/Virgo/KAGRA skymaps into PartialUniqSkymap instances.

class hpmoc.io.ligo.LigoIo

Bases: hpmoc.io.abstract.IoStrategy

Read/write files in the format used by LIGO/Virgo for their skymaps.

static read(mask: Optional[Union[hpmoc.partial.PartialUniqSkymap, nptyping.types._ndarray.NDArray]], file: Union[IO, str], *args, name: str = 'PROBDENSITY', coarsen: Optional[int] = None, **kwargs)

Read a file saved in the format used by LIGO/Virgo for their skymaps.

Parameters
  • mask (PartialUniqSkymap or array, optional) – Only read in pixels overlapping with mask.

  • file (file or str) – The file object or filename to read from. Can be a stream as no seeking will be performed.

  • name (str, optional) – The column-name of the pixel data.

  • coarsen (int, optional) – If provided, coarsen the mask by up to this many HEALPix orders (up to order 0) to speed up read times. This will select a superset of the sky region defined in mask.

  • *args – Arguments to pass on to hpmoc.fits.load_ligo.

  • **kwargs – Arguments to pass on to hpmoc.fits.load_ligo.

write(file: Union[IO, str], name: Optional[str] = None, *args, **kwargs)

Write a skymap to file in the format used by LIGO/Virgo for their skymaps. A thin wrapper around BasicIo.write.