Roman Catalog Process

This module provides functionality for processing a Roman Telescope multiband catalog to obtain photometric redshifts for cataloged galaxies.

Module API

class roman_photoz.roman_catalog_process.RomanCatalogProcess(config_filename: dict | str = '', model_filename: str = 'roman_model.pkl')

Bases: object

A 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.”

roman_photoz.roman_catalog_process.main(argv=None)

Main function to process Roman catalog data.

roman_photoz.roman_catalog_process.run_setup(nobj: int = 1000, simulated_catalog_filename: str = 'roman_photoz_simulated_catalog.parquet')

Bootstrap the LePhare data/model needed to run roman-photoz.

Uses the LEPHAREDIR and LEPHAREWORK environment variables to determine where to store the LePhare data and work directories. If they are not set, lephare falls back to its own default cache directories under ~/Library/Caches/lephare (or the platform equivalent) and prints a notice to that effect; set these variables explicitly beforehand if you want to control where the LePhare data/model files are stored. It then:

  1. Downloads the LePhare auxiliary data required by the Roman config.

  2. Creates a simulated catalog and the Roman filter files (kept afterward so it can be reused directly as an input catalog; it will already contain the redshift-estimate columns added by step 3 below).

  3. Builds the informer model (removing any stale model/run directory first).

  4. Trims LEPHAREDIR down to the files needed by the estimator.

  5. Verifies that the required artifacts are present.

Parameters:
  • nobj (int, optional) – Number of objects in the simulated catalog (default: 1000).

  • simulated_catalog_filename (str, optional) – Filename for the simulated catalog (default: roman_photoz_simulated_catalog.parquet).

Raises:

RuntimeError – If the required artifacts are missing after setup completes.

Examples

For a quick start, we can use the roman-photoz CLI to create a Roman multiband catalog containing 2000 simulated objects through the roman-photoz-create-simulated-catalog command:

$ roman-photoz-create-simulated-catalog \
   --output-path ./ \
   --output-filename roman_photoz_simulated_catalog.parquet \
   --nobj 2000

Then, use the RomanCatalogProcess class to process the catalog and estimate the redshifts through the roman-photoz command:

$ roman-photoz \
  --input-filename roman_photoz_simulated_catalog.parquet \
  --output-filename roman_photoz_results.parquet \
  --fit-colname segment_{}_flux \
  --fit-err-colname segment_{}_flux_err

Note that if no output filename is provided, as in the following example, the input file will be updated with the results instead:

# run roman-photoz and update the input file with the results
$ roman-photoz \
  --input-filename roman_photoz_simulated_catalog.parquet \
  --fit-colname segment_{}_flux \
  --fit-err-colname segment_{}_flux_err

Additional examples of how to use this module can be found in the Usage section.