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

roman_photoz.create_roman_filters.create_files(data: DataFrame, filepath: str = '') 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.

  • filepath (str, optional) – The path where the filter files will be saved. If not provided, the current directory will be used.

roman_photoz.create_roman_filters.create_path(filepath: str = '') Path

Create the directory structure for saving filter files.

Parameters:

filepath (str, optional) – The path where the filter files will be saved. If not provided, the current directory will be used.

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 = '', input_path: 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.

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

roman_photoz.create_roman_filters.run_filter_command(config_file_path: str = '') 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 create_roman_filters.py <output_path> <input_filename>
  • <output_path>: The directory where the results will be saved.

  • <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.