hpmoc.io package
Read/Write methods for hpmoc.partial.PartialUniqSkymap
.
- class hpmoc.io.BasicIo
Bases:
hpmoc.io.abstract.IoStrategy
Read/write files saved in the default format used by
PartialUniqSkymap
.- static read(_skymap: Optional[hpmoc.partial.PartialUniqSkymap], file: Union[IO, str], *args, name: Optional[str] = None, uname: str = 'UNIQ', empty=None, **kwargs) hpmoc.partial.PartialUniqSkymap
Read a file saved in the default format used by
PartialUniqSkymap
.- Parameters
mask (PartialUniqSkymap) – Only read in pixels overlapping with
mask
.file (file or str) – The file object or filename to read from.
name (str, optional) – The column-name of the pixel data. If not specified and if reading from a file with only one non-index column, that column will be chosen automatically.
uname (str, optional) – The column-name of the HEALPix NUNIQ pixel data, if different from the default value.
empty (scalar, optional) –
empty
argument to pass toPartialUniqSkymap
initializer. Not used when writing.*args – Arguments to pass on to
astropy.table.Table.read
.**kwargs – Arguments to pass on to
astropy.table.Table.read
.
- Returns
m – A new
PartialUniqSkymap
instance with the specified data.- Return type
- static write(skymap: hpmoc.partial.PartialUniqSkymap, file: Union[IO, str], name: Optional[str] = None, uname: Optional[str] = 'UNIQ', *args, **kwargs)
Read a file saved in the default format used by
PartialUniqSkymap
.- Parameters
skymap (PartialUniqSkymap) – The skymap to save.
file (file or str) – The file object or filename to write to.
name (str, optional) – The column-name of the pixel data in the saved file, if different from that specified by the skymap.
uname (str, optional) – The column-name of the HEALPix NUNIQ pixel data in the saved file, if different from the default value.
*args – Arguments to pass on to
astropy.table.Table.write
.**kwargs – Arguments to pass on to
astropy.table.Table.write
.
- class hpmoc.io.IoRegistry
Bases:
object
Handle IO for
PartialUniqSkymap
instances.- astroquery
alias of
hpmoc.io.astroquery.AstroqueryIo
- basic
alias of
hpmoc.io.BasicIo
- gracedb
alias of
hpmoc.io.gracedb.GracedbIo
- ligo
alias of
hpmoc.io.ligo.LigoIo
- ligo_old
alias of
hpmoc.io.OldLigoIo
- class hpmoc.io.OldLigoIo
Bases:
hpmoc.io.abstract.IoStrategy
Read/write files in the format used by LIGO/Virgo for their skymaps using the old method (pre 0.3.0).
- static read(mask: Optional[hpmoc.partial.PartialUniqSkymap], file: Union[IO, str], *args, name: str = 'PROBDENSITY', memmap: bool = True, coarsen: int = 0, **kwargs)
Read a file saved in the format used by LIGO/Virgo for their skymaps.
- Parameters
mask (PartialUniqSkymap) – Only read in pixels overlapping with
mask
.file (file or str) – The file object or filename to read from.
name (str, optional) – The column-name of the pixel data.
memmap (bool, optional) – Whether to memory-map the input file during read. Useful when reading small sky areas from large files to conserve memory. The returned skymap will be stored as a copy in memory.
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 inmask
.*args – Arguments to pass on to
astropy.table.Table.read
.**kwargs – Arguments to pass on to
astropy.table.Table.read
.
- 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
.
Submodules