roman_photoz
The roman_photoz package provides tools for processing multiband catalogs
produced by the Roman Space Telescope Calibration Pipeline (romancal) to
estimate photometric redshifts.
Overview
The Roman Space Telescope will produce large catalogs of astronomical objects. This package provides utilities for:
Processing Roman catalog data in parquet and ASDF formats;
Translating filter definitions into the format expected by LePhare;
Generating simulated images and catalogs for development and testing;
Estimating photometric redshifts using rail/LePhare.
Getting Started
Developer Guide
API Reference
- class roman_photoz.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.
- process(input_filename: str | None = None) ndarray
Process the catalog by reading and formatting it.
- Returns:
The formatted catalog.
- Return type:
np.ndarray
- class roman_photoz.RomanCatalogProcess(config_filename: dict | str = '', model_filename: str = 'roman_model.pkl')
Bases:
objectA class to process a Roman Telescope multiband catalog data using rail and lephare.
- data
Dictionary to store the processed data.
- Type:
dict
- flux_cols
List of flux column names.
- Type:
list
- flux_err_cols
List of flux error column names.
- Type:
list
- inform_stage
Informer stage for creating the library of SEDs.
- Type:
RailStage
- estimated
Estimator stage for finding the best fits from the library.
- Type:
RailStage
- model_filename
Name of the pickle model file to use.
- Type:
str
- property informer_model_exists
Check if the informer model file exists.
- Returns:
True if the model file exists, False otherwise.
- Return type:
bool
- property informer_model_path
Get the path to the informer model file used.
The path is determined by checking the INFORMER_MODEL_PATH environment variable first, falling back to LEPHAREWORK if not set.
- Returns:
The path to the informer model file.
- Return type:
str
- process(input_filename, output_filename: str | None = None, output_format: str = 'parquet', fit_colname: str = 'segment_{}_flux', fit_err_colname: str = 'segment_{}_flux_err')
Process the Roman catalog data.
- Parameters:
input_filename (str) – Name of the input file.
output_filename (str, optional) – Name of the output file. If none is provided (default), the input file will be updated in place.
output_format (str, optional) – Format to save the results. Supported formats are “parquet” (default) and “asdf.”
flux_type (str, optional) – The type of flux to use for fitting. Options are “psf” (default), “kron”, “segment”, or “aperture.”
- class roman_photoz.SimulatedCatalog(nobj: int = 1000, mag_noise: float = 0.1, seed=None)
Bases:
objectA class to create a simulated catalog using the Roman telescope data.
- data
A dictionary to store the data.
- Type:
OrderedDict
- lephare_config
Configuration for LePhare.
- Type:
dict
- flux_cols
List of flux column names.
- Type:
list
- flux_err_cols
List of flux error column names.
- Type:
list
- inform_stage
Placeholder for inform stage.
- Type:
None
- estimated
Holds all the results from roman_photoz.
- Type:
None
- filter_lib
Placeholder for filter library.
- Type:
None
- simulated_data_filename
Filename for the simulated data.
- Type:
str
- simulated_data
Placeholder for simulated data.
- Type:
None
- process(output_path: str = '', output_filename: str = 'roman_simulated_catalog.parquet', return_catalog: bool = False, refresh_lib_mag: bool = False)
Run the process to create the simulated catalog.
- Parameters:
output_path (str, optional) – Path to save the output catalog (default: “”).
output_filename (str, optional) – Filename for the output catalog.
return_catalog (bool, optional) – If True, return the catalog in memory instead of saving to file. Default is False to maintain backward compatibility.
- Returns:
The simulated catalog if return_catalog is True, otherwise None.
- Return type:
Table or None
- roman_photoz.setup_logging(level=20, log_file='roman_photoz.log')
Set up logging configuration for roman_photoz module