Roman Catalog Handler
The roman_catalog_handler module provides functionality for handling catalog data from the Roman Space Telescope.
Module API
- class roman_photoz.roman_catalog_handler.RomanCatalogHandler(catname: str = '', fit_colname: str = 'segment_{}_flux', fit_err_colname: str = 'segment_{}_flux_err')
Bases:
objectA class to handle Roman catalog operations including reading and formatting it in a suitable way for roman_photoz.
- format_catalog()
Format the catalog by appending necessary fields and columns.
- process()
Process the catalog by reading and formatting it.
- Returns:
The formatted catalog.
- Return type:
np.ndarray
- read_catalog()
Read the catalog file and convert it to a numpy structured array.
Usage Examples
The following example demonstrates how to use the RomanCatalogHandler class to read and process a catalog file.
import os
from pathlib import Path
from roman_photoz.roman_catalog_handler import RomanCatalogHandler
# Ensure the TEST_BIGDATA environment variable is set
test_bigdata = os.getenv("TEST_BIGDATA")
if test_bigdata is None:
raise ValueError("Environment variable TEST_BIGDATA is not set")
reg_test_data = Path(test_bigdata)
# Specify the catalog file
test_cat = reg_test_data / "r0000101001001001001_0001_wfi01_cat.parquet"
# Create an instance of RomanCatalogHandler
catalog_handler = RomanCatalogHandler(test_cat.as_posix())
# Process the catalog
formatted_catalog = catalog_handler.process()
print("Catalog processing complete.")