Create Simulated Catalog
This module provides functionality to create a simulated catalog using data from the Roman Space Telescope. It leverages the LePhare photometric redshift estimation tool and other utilities to generate simulated data, process it, and save it in a structured format.
Module API
- class roman_photoz.create_simulated_catalog.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.create_simulated_catalog.main()
Command-Line Usage
Once roman-photoz is installed, you can create a simulated catalog using
the CLI command roman-photoz-create-simulated-catalog. For example, to
create a Roman multiband catalog with 1000 simulated objects and have it saved
in the current directory under the name simulated_catalog.parquet, run the
following command:
$ roman-photoz-create-simulated-catalog \
--output-path ./ \
--output-filename simulated_catalog.parquet \
--nobj=1000
Usage Examples
Another way to create a simulated catalog is to use the
SimulatedCatalog class directly in your Python code. For example:
from roman_photoz.create_simulated_catalog import SimulatedCatalog
# simulate 1000 objects and add a gaussian noise with sigma=0.15 mag
simulated_catalog1 = SimulatedCatalog(1000, mag_noise=0.15)
# simulate 5000 objects and add a gaussian noise with sigma=0.05 mag
simulated_catalog2 = SimulatedCatalog(5000, mag_noise=0.05)
# create the simulated catalogs and save them in the current directory
simulated_catalog1.process(output_filename="roman_simulated_catalog1.parquet")
simulated_catalog2.process(output_filename="roman_simulated_catalog2.parquet")