hats.catalog.partition_info#

Container class to hold per-partition metadata

Classes#

PartitionInfo

Container class for per-partition info.

Module Contents#

class PartitionInfo(pixel_list: list[hats.pixel_math.healpix_pixel.HealpixPixel], catalog_base_dir: str = None)[source]#

Container class for per-partition info.

METADATA_ORDER_COLUMN_NAME = 'Norder'[source]#
METADATA_PIXEL_COLUMN_NAME = 'Npix'[source]#
pixel_list[source]#
catalog_base_dir = None[source]#
get_healpix_pixels() list[hats.pixel_math.healpix_pixel.HealpixPixel][source]#

Get healpix pixel objects for all pixels represented as partitions.

Returns:

List of HealpixPixel

get_highest_order() int[source]#

Get the highest healpix order for the dataset.

Returns:

int representing highest order.

write_to_file(partition_info_file: str | pathlib.Path | upath.UPath | None = None, catalog_path: str | pathlib.Path | upath.UPath | None = None)[source]#

Write all partition data to CSV file.

If no paths are provided, the catalog base directory from the read_from_dir call is used.

Parameters:
  • partition_info_file – path to where the partition_info.csv file will be written.

  • catalog_path – base directory for a catalog where the partition_info.csv file will be written.

Raises:

ValueError – if no path is provided, and could not be inferred.

classmethod read_from_dir(catalog_base_dir: str | pathlib.Path | upath.UPath | None) PartitionInfo[source]#

Read partition info from a file within a hats directory.

This will look for a partition_info.csv file, and if not found, will look for a _metadata file. The second approach is typically slower for large catalogs therefore a warning is issued to the user. In internal testing with large catalogs, the first approach takes less than a second, while the second can take 10-20 seconds.

Parameters:

catalog_base_dir – path to the root directory of the catalog

Returns:

A PartitionInfo object with the data from the file

Raises:

FileNotFoundError – if neither desired file is found in the catalog_base_dir

classmethod read_from_file(metadata_file: str | pathlib.Path | upath.UPath) PartitionInfo[source]#

Read partition info from a _metadata file to create an object

Parameters:

metadata_file (UPath) – path to the _metadata file

Returns:

A PartitionInfo object with the data from the file

classmethod _read_from_metadata_file(metadata_file: str | pathlib.Path | upath.UPath) list[hats.pixel_math.healpix_pixel.HealpixPixel][source]#

Read partition info list from a _metadata file.

Parameters:

metadata_file (UPath) – path to the _metadata file

Returns:

The list of HealpixPixel extracted from the data in the metadata file

classmethod read_from_csv(partition_info_file: str | pathlib.Path | upath.UPath) PartitionInfo[source]#

Read partition info from a partition_info.csv file to create an object

Parameters:

partition_info_file (UPath) – path to the partition_info.csv file

Returns:

A PartitionInfo object with the data from the file

classmethod _read_from_csv(partition_info_file: str | pathlib.Path | upath.UPath) PartitionInfo[source]#

Read partition info from a partition_info.csv file to create an object

Parameters:

partition_info_file (UPath) – path to the partition_info.csv file

Returns:

A PartitionInfo object with the data from the file

as_dataframe()[source]#

Construct a pandas dataframe for the partition info pixels.

Returns:

Dataframe with order, directory, and pixel info.

classmethod from_healpix(healpix_pixels: list[hats.pixel_math.healpix_pixel.HealpixPixel]) PartitionInfo[source]#

Create a partition info object from a list of constituent healpix pixels.

Parameters:

healpix_pixels – list of healpix pixels

Returns:

A PartitionInfo object with the same healpix pixels

calculate_fractional_coverage()[source]#

Calculate what fraction of the sky is covered by partition tiles.