Installation
To install roman_photoz, simply use pip:
pip install roman_photoz
Development
To install the development version of roman_photoz, you can clone the repository and install it in editable mode:
Clone the repository:
git clone https://github.com/spacetelescope/roman_photoz.git
Navigate to the project directory:
cd roman_photoz
Install package in editable mode. For example, on macOS:
pip install -e ".[dev]"
Bootstrap data/model setup
Run roman-photoz --setup to download the LePhare auxiliary data required
by the Roman config, create a simulated catalog and Roman filter files,
build the model (informer stage), trim LEPHAREDIR to the files needed by
the estimator, and verify that the required artifacts are present:
Set the environment variables (recommended).
roman-photozusesLEPHAREDIRandLEPHAREWORKto determine where to store the LePhare data and work directories:export LEPHAREDIR=/path/to/lephare_data export LEPHAREWORK=/path/to/lephare_work
If you don’t set them,
lepharefalls back to its own default cache directories (typically under~/Library/Caches/lephareon macOS, or the platform equivalent elsewhere) and prints a notice showing the full paths it chose. Setting the variables yourself gives you control over where these (potentially large) files are stored.roman-photozalso looks for anINFORMER_MODEL_PATHenvironment variable to determine where the informer model file (roman_model.pklby default) is read from/written to. It defaults toLEPHAREWORKif not set, so you only need to set it explicitly if you want to read/store the model somewhere else:export INFORMER_MODEL_PATH=/path/to/model_dir
Run:
roman-photoz --setupOptions:
--nobj N– number of objects in the simulated catalog (default: 1000).--simulated-catalog-filename FILE– simulated catalog filename (default:roman_photoz_simulated_catalog.parquet).
This leaves a catalog behind at
$LEPHAREWORK/roman_photoz_simulated_catalog.parquet(it already has redshift estimates added by setup’s own model-building pass). This catalog isn’t meant to be your real input data – it’s a fallback you can use in step 3 below if you don’t have your own catalog yet (see “Creating a fresh simulated catalog” below for another option).Note
roman-photoz --setuponly needs to be run once perLEPHAREDIR/LEPHAREWORKlocation – it downloads the auxiliary data and builds the informer model, which are then reused for all subsequentroman-photozruns. There’s no need to run it again unless you delete/change those directories.Run
roman-photoz. Assuming there is a folder namedOUTPUTin the current working directory where the updated catalog containing the redshift results will be saved to:roman-photoz \ --input-filename <path/to/your_catalog.parquet> \ --output-filename ./OUTPUT/<path/to/your_catalog.parquet>
--input-filenameshould point to your own input catalog. If you don’t have one, you can pass in the catalog created in step 2 instead:$LEPHAREWORK/roman_photoz_simulated_catalog.parquet.Creating a fresh simulated catalog (optional)
If you’d rather not reuse the catalog from step 2 – for example, you want a different number of objects or different physical parameters – generate a fresh one:
roman-photoz-create-simulated-catalog \ --output-filename roman_photoz_simulated_catalog.parquet \ --refresh-lib-mag
To change the physical parameters used to generate the simulated catalog (e.g. redshift range/step), edit
roman_photoz/default_config_file.py.