Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys

# Add the project directory to sys.path
sys.path.insert(0, os.path.abspath('../roman_photoz'))
sys.path.insert(0, os.path.abspath(".."))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
Expand All @@ -22,6 +22,7 @@
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxarg.ext", # For automatic documentation of argparse arguments
]

templates_path = ["_templates"]
Expand Down
13 changes: 6 additions & 7 deletions docs/create_roman_filters.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
====================
=====================
Create Roman Filters
====================
=====================

This module provides functionality to process Roman Space Telescope filter data, create individual filter files, and generate a configuration file for use with `rail+lephare`.

Module API
----------

.. automodule:: create_roman_filters
.. automodule:: roman_photoz.create_roman_filters
:members:
:undoc-members:
:show-inheritance:

Usage Example
-------------
Command-line Interface
----------------------

To use this module, run it as a script with the following command:
This module can be run as a command-line tool to generate filter definitions:

.. code-block:: bash

Expand All @@ -25,4 +25,3 @@ To use this module, run it as a script with the following command:
- `<input_filename>`: The filename containing the monochromatic effective area of each filter per column.

The script will generate individual filter files and a configuration file (`roman_phot.par`) for use with `rail+lephare`.

40 changes: 26 additions & 14 deletions docs/create_simulated_catalog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This module provides functionality to create a simulated catalog using data from
Module API
----------

.. automodule:: create_simulated_catalog
.. automodule:: roman_photoz.create_simulated_catalog
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -19,26 +19,38 @@ The module can also be executed as a standalone script to create a simulated cat

**Arguments**

- ``--output_path`` (:class:`str`)
- ``--output_path`` (:class:`str`)
Path to save the output catalog (default: ``LEPHAREWORK``).

- ``--output_filename`` (:class:`str`)
- ``--output_filename`` (:class:`str`)
Filename for the output catalog (default: ``roman_simulated_catalog.asdf``).

**Example**

.. code-block:: bash

python create_simulated_catalog.py --output_path /path/to/output --output_filename my_catalog.asdf
python -m roman_photoz.create_simulated_catalog --output_path=/path/to/output/ --output_filename=simulated_catalog.asdf

Dependencies
------------
Usage Examples
--------------

- ``argparse``
- ``os``
- ``collections.OrderedDict``
- ``pathlib.Path``
- ``lephare``
- ``numpy``
- ``rail.core.stage``
- ``roman_datamodels``
The following example demonstrates how to programmatically create a simulated catalog:

.. code-block:: python

from roman_photoz.create_simulated_catalog import CreateSimulatedCatalog

# Initialize the catalog creator with default parameters
creator = CreateSimulatedCatalog()

# Create a simulated catalog with 100 sources
catalog = creator.create_catalog(n_sources=100)

# Save the catalog to a file
creator.save_catalog(
catalog,
output_path="/path/to/output/",
output_filename="simulated_catalog.asdf"
)

print(f"Simulated catalog with {len(catalog)} sources created successfully")
12 changes: 12 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ The ``roman_photoz`` package provides tools for processing catalogs
produced by the Roman Space Telescope Calibration Pipeline (``romancal``)
to estimate photometric redshift.

Overview
--------

The Roman Space Telescope will produce large catalogs of astronomical objects.
This package provides tools for processing these catalogs to estimate photometric
redshifts using rail/LePhare. Key features include:

* Processing Roman catalog data in ASDF format
* Creating filter definitions based on Roman Space Telescope specifications
* Generating simulated catalogs for development and testing
* Estimating photometric redshifts using rail/LePhare

.. toctree::
:maxdepth: 2
:caption: Contents
Expand Down
4 changes: 2 additions & 2 deletions docs/roman_catalog_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The ``roman_catalog_handler`` module provides functionality for handling catalog
Module API
----------

.. automodule:: roman_catalog_handler
.. automodule:: roman_photoz.roman_catalog_handler
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -20,7 +20,7 @@ The following example demonstrates how to use the `RomanCatalogHandler` class to

import os
from pathlib import Path
from roman_catalog_handler import RomanCatalogHandler
from roman_photoz.roman_catalog_handler import RomanCatalogHandler

# Ensure the TEST_BIGDATA environment variable is set
test_bigdata = os.getenv("TEST_BIGDATA")
Expand Down
4 changes: 2 additions & 2 deletions docs/roman_catalog_process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This module provides functionality for processing catalog data related to the Ro
Module API
----------

.. automodule:: roman_catalog_process
.. automodule:: roman_photoz.roman_catalog_process
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -17,7 +17,7 @@ Examples

Basic usage::

from roman_catalog_process import process_catalog
from roman_photoz.roman_catalog_process import process_catalog

process_catalog('input_catalog.fits', 'processed_catalog.fits')

Expand Down
43 changes: 15 additions & 28 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,20 @@ To use `roman_photoz`, follow these steps:
import numpy as np
from roman_photoz.roman_catalog_process import RomanCatalogProcess

argv = [
"--input_path",
"/path/to/input/file/",
"--input_filename",
"roman_simulated_catalog.asdf",
"--output_path",
"/path/to/output/file/",
"--output_filename",
"output_filename.asdf",
"--save_results",
"True",
]

####
# this approach will process the catalog
# and save the results to a file
# and will return an instance of RomanCatalogProcess
# that contains the results

# create a RomanCatalogProcess object
rcp = RomanCatalogProcess(config_filename=argv[1])
# create a RomanCatalogProcess object with default configuration
# and custom model filename
rcp = RomanCatalogProcess(
config_filename="", # use default config
model_filename="custom_model.pkl" # specify custom model filename
)

# and process the catalog
# process the catalog
rcp.process(
input_path=argv[3],
input_filename=argv[5],
output_path=argv[7],
output_filename=argv[9],
save_results=argv[11],
input_path="/path/to/input/file/",
input_filename="roman_simulated_catalog.asdf",
output_path="/path/to/output/file/",
output_filename="output_filename.asdf",
save_results=True,
)

# examples of visualization
Expand All @@ -62,6 +47,8 @@ To use `roman_photoz`, follow these steps:
from roman_photoz import roman_catalog_process

argv = [
"--model_filename",
"custom_model.pkl",
"--input_path",
"/path/to/input/file/",
"--input_filename",
Expand All @@ -80,4 +67,4 @@ To use `roman_photoz`, follow these steps:

.. code-block:: bash

python -m roman_photoz --input_path=/path/to/input/file/ --input_filename=roman_simulated_catalog.asdf --output_path=/path/to/output/file/ --output_filename=output_filename.asdf --save_results=True
python -m roman_photoz --model_filename=custom_model.pkl --input_path=/path/to/input/file/ --input_filename=roman_simulated_catalog.asdf --output_path=/path/to/output/file/ --output_filename=output_filename.asdf --save_results=True
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ docs = [
"stsci-rtd-theme",
"sphinx-autobuild",
"tomli; python_version <=\"3.11\"",
"sphinx-argparse",
]
test = [
"ci-watson >=0.5.0",
Expand Down
Loading