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.

The input must be a machine-readable file with the monochromatic effective area per filter. They can be downloaded from the WFI Performance website.

All the individual filter files generated by this module will be saved where rail/lephare expects them to be

$LEPHAREDIR/data/filt/roman
├── roman_F062.pb
├── roman_F087.pb
├── roman_F106.pb
├── roman_F129.pb
├── roman_F146.pb
├── roman_F158.pb
├── roman_F184.pb
├── roman_F213.pb
├── roman_Grism_0thOrder.pb
├── roman_Grism_1stOrder.pb
├── roman_phot.par
└── roman_SNPrism.pb


$LEPHAREWORK/filt
├── filter_roman_config.yaml
├── filter_roman.dat
└── filter_roman.doc

Module API

roman_photoz.create_roman_filters.create_files(data: DataFrame) None

Create filter files from the provided DataFrame. Each filter file contains wavelength and filter data, with a comment line at the top.

Parameters:

data (pd.DataFrame) – The DataFrame containing the filter data.

roman_photoz.create_roman_filters.create_path() Path

Create the directory structure for saving filter files.

Returns:

The path where the filter files will be saved.

Return type:

Path

roman_photoz.create_roman_filters.create_roman_phot_par_file(filter_list: list, filter_rep: Path) None

Create the roman_phot.par file to be used with the filter command.

Parameters:
  • filter_list (list) – List of filter filenames.

  • filter_rep (Path) – Path to the directory where the filters are stored.

roman_photoz.create_roman_filters.download_file(url: str, dest: str)

Download a file from the specified URL and save it to the destination path.

Parameters:
  • url (str) – The URL of the file to download.

  • dest (str) – The destination path where the file will be saved.

roman_photoz.create_roman_filters.read_effarea_file(filename: str = '', **kwargs) DataFrame

Read the efficiency area file into a pandas DataFrame. If the file does not exist, it will be downloaded from the specified URL.

Parameters:
  • filename (str, optional) – The path to the efficiency area file. If not provided, the default filename will be used.

  • **kwargs – Additional keyword arguments to pass to pd.read_excel.

Returns:

The data from the efficiency area file.

Return type:

pd.DataFrame

roman_photoz.create_roman_filters.run(input_filename: str = '')

Run the process to create filter files and execute the filter command.

Parameters:
  • input_filename (str) – The filename containing the monochromatic effective area of each filter per column.

  • output_data (str) – The path where the results will be saved.

roman_photoz.create_roman_filters.run_filter_command() None

Run the filter command to create the filter file needed by rail+lephare.

Parameters:

config_file_path (str, optional) – The path to the configuration file that contains the information about the filters. This is usually either in the main config file or a separate file containing all the relevant info about the filters (i.e. FILTER_REP, FILTER_LIST, TRANS_TYPE, FILTER_CALIB, FILTER_FILE) The result will be saved to LEPHAREWORK/filt with the name specified by FILTER_FILE and extension ‘dat’.

Command-line Interface

This module can be run as a command-line tool to generate filter definitions:

python -m roman_photoz.create_roman_filters <input_filename>
  • <input_filename>: File with monochromatic effective area per filter.