EAZY

Module to faciliate scripting of EAZY analysis

frb.galaxies.eazy.eazy_filenames(input_dir, name)[source]

Generate names for EAZY files

Parameters:
  • input_dir (str) – Path to eazy inputs/ folder (can be relative) This is where eazy will be run

  • name (str) – Name of the source being analzyed

Returns:

catalog_filename, parameter_filename, translate_file

Return type:

tuple

frb.galaxies.eazy.eazy_setup(input_dir, template_dir=None)[source]

Setup for EAZY

Parameters:
  • input_dir (str) – Path to personal eazy inputs/ folder (can be relative)

  • template_dir (str, optional) – Path to templates/ folder in EAZY software package. If not given, it looks for the folder of eazy, the executable and navigates from there.

Returns:

frb.galaxies.eazy.eazy_input_files(photom, input_dir, name, out_dir, id_col='id', prior_filter=None, templates='eazy_v1.3', combo='a', cosmo=FlatLambdaCDM(name='Planck18', H0=<Quantity 67.66 km / (Mpc s)>, Om0=0.30966, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.04897), magnitudes=False, prior='prior_R_zmax7', zmin=0.05, zmax=7.0, zstep=0.001, prior_ABZP=23.9, n_min_col=5, write_full_table=False)[source]
Write to disk a series of files needed to run EAZY
  • catalog file

  • translation file

  • param file

Parameters:
  • photom (dict or Table) – Held by an FRBGalaxy object

  • input_dir (str) – Path to eazy inputs/ folder (can be relative) This is where eazy will be run

  • name (str) – Name of the source being analzyed

  • out_dir (str) – Path to eazy OUTPUT folder relative to the input_dir

  • id_col (str, optional) – Column name to be used as the ID. Looks for a column with “id” in its name by default.

  • prior_filter (str, optional) – If provided, use the flux in this filter for EAZY’s prior

  • templates (str, optional) – Template set name to be used. Should be one of ‘br07_deafult’,’br07_goods’,’cww+kin’,’eazy_v1.0’, ‘eazy_v1.1_lines’,’eazy_v1.2_dusty’,’eazy_v1.3’,’pegase’, ‘pegase13’.

  • combo (int or str, optional) – Combinations of templates to be used for analysis. Can be one of 1,2,99,-1 and ‘a’. Read EAZY’s zphot.param.default file for details

  • cosmo (astropy.cosmology, optional) – Defaults to Repo cosmology

  • prior (str, optional) – Name of the prior file found in the EAZY templates folder. Default value is ‘prior_R_zmax7’.

  • magnitudes (bool, optional) – True if catalog contains magnitudes as opposed to F_nu values.

  • zmin (float, optional) – Minimum search redshift for EAZY. Default value is 0.05.

  • zmax (float, optional) – Maximum search redshift for EAZY. Be careful about the prior file not having information beyond a redshift less than zmax.

  • zstep (float, optional) – Step size of the redshift grid. (z_{i+1} = z_i+zstep*(1+z_i)). Default value is 0.001.

  • prior_ABZP (float, optional) – Zero point redshift for the band on which prior will be applied. Default value is for DECam r (https://cdcvs.fnal.gov/redmine/projects/des-sci-verification/wiki/Photometry)

  • write_full_table (bool, optional) – Are you trying to use this function for a table of objects instead of a single object? If so, set this to True.

frb.galaxies.eazy.run_eazy(input_dir, name, logfile)[source]

Find and run the EAZY executable on the files

Parameters:
  • input_dir (str) – Path to eazy inputs/ folder (can be relative) This is where eazy will be run

  • name (str) – Name of the source being analzyed

  • logfile (str)

frb.galaxies.eazy.eazy_stats(zgrid, pzi)[source]

Calculate the ‘best’ zphot and error

Parameters:
  • zgrid (np.ndarray)

  • pzi (np.ndarray)

Returns:

frb.galaxies.eazy.readEazyBinary(MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY='./OUTPUT', CACHE_FILE='Same')[source]

tempfilt, coeffs, temp_sed, pz = readEazyBinary(MAIN_OUTPUT_FILE=’photz’, OUTPUT_DIRECTORY=’./OUTPUT’, CACHE_FILE = ‘Same’)

Read Eazy BINARY_OUTPUTS files into structure data.

If the BINARY_OUTPUTS files are not in ‘./OUTPUT’, provide either a relative or absolute path in the OUTPUT_DIRECTORY keyword.

By default assumes that CACHE_FILE is MAIN_OUTPUT_FILE+’.tempfilt’. Specify the full filename if otherwise.

frb.galaxies.eazy.getEazyPz(idx, MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY='./OUTPUT', CACHE_FILE='Same', binaries=None, get_prior=False, get_chi2=False)[source]

zgrid, pz = getEazyPz(idx, MAIN_OUTPUT_FILE=’photz’, OUTPUT_DIRECTORY=’./OUTPUT’, CACHE_FILE=’Same’, binaries=None)

Get Eazy p(z) for object #idx.

To avoid re-reading the binary files, supply binaries = (tempfilt, pz)

Overview

This module facilitates scripting of EAZY (Easy and Accurate Z from Yale) photometric redshift analysis. It provides tools to set up EAZY runs, generate input files, and process photometric redshift estimates.

Note

This module requires EAZY to be installed and the EAZYDIR environment variable to be properly set.

Constants and Configuration

Filter Mapping

frb.galaxies.eazy.frb_to_eazy_filters = {'DECaL_g': 294, 'DECaL_r': 295, 'DECaL_z': 296, 'DECam_Y': 356, 'DECam_g': 352, 'DECam_i': 354, 'DECam_r': 353, 'DECam_u': 351, 'DECam_z': 355, 'DES_g': 352, 'DES_i': 354, 'DES_r': 353, 'DES_u': 351, 'DES_y': 356, 'DES_z': 355, 'GMOS_S_r': 349, 'HSC_Y': 318, 'HSC_g': 314, 'HSC_i': 316, 'HSC_r': 315, 'HSC_z': 317, 'LRISb_V': 346, 'LRISr_I': 345, 'NIRI_J': 257, 'NOT_z': 348, 'NSC_Y': 356, 'NSC_g': 352, 'NSC_i': 354, 'NSC_r': 353, 'NSC_u': 351, 'NSC_z': 355, 'Pan-STARRS_g': 334, 'Pan-STARRS_i': 336, 'Pan-STARRS_r': 335, 'Pan-STARRS_y': 338, 'Pan-STARRS_z': 337, 'SDSS_g': 157, 'SDSS_i': 159, 'SDSS_r': 158, 'SDSS_u': 156, 'SDSS_z': 160, 'SOAR_bessell_B': 358, 'SOAR_bessell_V': 359, 'SOAR_cousins_R': 357, 'SOAR_g': 363, 'SOAR_i': 365, 'SOAR_r': 364, 'SOAR_stromgren_b': 360, 'SOAR_stromgren_v': 361, 'SOAR_stromgren_y': 362, 'SOAR_z': 366, 'VISTA_H': 258, 'VISTA_J': 257, 'VISTA_Ks': 259, 'VISTA_Y': 256, 'WISE_W1': 244, 'WISE_W2': 245, 'WISE_W3': 246, 'WISE_W4': 247}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

Dictionary mapping FRB filter names to EAZY filter indices. Includes filters from:

  • DECaLS/Legacy Survey (g, r, z)

  • DES (u, g, r, i, z, Y)

  • SDSS (u, g, r, i, z)

  • WISE (W1, W2, W3, W4)

  • Pan-STARRS (g, r, i, z, y)

  • VISTA (Y, J, H, Ks)

  • Various ground-based instruments

Template Sets

frb.galaxies.eazy._template_list = ['br07_default', 'br07_goods', 'cww+kin', 'eazy_v1.0', 'eazy_v1.1_lines', 'eazy_v1.2_dusty', 'eazy_v1.3', 'pegase', 'pegase13']

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

Available EAZY template sets: (‘br07_default’, ‘br07_goods’, ‘cww+kin’, ‘eazy_v1.0’, ‘eazy_v1.1_lines’,

‘eazy_v1.2_dusty’, ‘eazy_v1.3’, ‘pegase’, ‘pegase13’)

Prior Options

frb.galaxies.eazy._acceptable_priors = ['prior_R_zmax7', 'prior_K_zmax7', 'prior_R_extend', 'prior_K_extend']

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

Available redshift priors: (‘prior_R_zmax7’, ‘prior_K_zmax7’, ‘prior_R_extend’, ‘prior_K_extend’)

Functions

Setup Functions

frb.galaxies.eazy.eazy_setup(input_dir, template_dir=None)[source]

Setup for EAZY

Parameters:
  • input_dir (str) – Path to personal eazy inputs/ folder (can be relative)

  • template_dir (str, optional) – Path to templates/ folder in EAZY software package. If not given, it looks for the folder of eazy, the executable and navigates from there.

Returns:

Set up EAZY input directory with required templates and filter files.

frb.galaxies.eazy.eazy_filenames(input_dir, name)[source]

Generate names for EAZY files

Parameters:
  • input_dir (str) – Path to eazy inputs/ folder (can be relative) This is where eazy will be run

  • name (str) – Name of the source being analzyed

Returns:

catalog_filename, parameter_filename, translate_file

Return type:

tuple

Generate standardized filenames for EAZY input files.

Input File Generation

frb.galaxies.eazy.eazy_input_files(photom, input_dir, name, out_dir, id_col='id', prior_filter=None, templates='eazy_v1.3', combo='a', cosmo=FlatLambdaCDM(name='Planck18', H0=<Quantity 67.66 km / (Mpc s)>, Om0=0.30966, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.04897), magnitudes=False, prior='prior_R_zmax7', zmin=0.05, zmax=7.0, zstep=0.001, prior_ABZP=23.9, n_min_col=5, write_full_table=False)[source]
Write to disk a series of files needed to run EAZY
  • catalog file

  • translation file

  • param file

Parameters:
  • photom (dict or Table) – Held by an FRBGalaxy object

  • input_dir (str) – Path to eazy inputs/ folder (can be relative) This is where eazy will be run

  • name (str) – Name of the source being analzyed

  • out_dir (str) – Path to eazy OUTPUT folder relative to the input_dir

  • id_col (str, optional) – Column name to be used as the ID. Looks for a column with “id” in its name by default.

  • prior_filter (str, optional) – If provided, use the flux in this filter for EAZY’s prior

  • templates (str, optional) – Template set name to be used. Should be one of ‘br07_deafult’,’br07_goods’,’cww+kin’,’eazy_v1.0’, ‘eazy_v1.1_lines’,’eazy_v1.2_dusty’,’eazy_v1.3’,’pegase’, ‘pegase13’.

  • combo (int or str, optional) – Combinations of templates to be used for analysis. Can be one of 1,2,99,-1 and ‘a’. Read EAZY’s zphot.param.default file for details

  • cosmo (astropy.cosmology, optional) – Defaults to Repo cosmology

  • prior (str, optional) – Name of the prior file found in the EAZY templates folder. Default value is ‘prior_R_zmax7’.

  • magnitudes (bool, optional) – True if catalog contains magnitudes as opposed to F_nu values.

  • zmin (float, optional) – Minimum search redshift for EAZY. Default value is 0.05.

  • zmax (float, optional) – Maximum search redshift for EAZY. Be careful about the prior file not having information beyond a redshift less than zmax.

  • zstep (float, optional) – Step size of the redshift grid. (z_{i+1} = z_i+zstep*(1+z_i)). Default value is 0.001.

  • prior_ABZP (float, optional) – Zero point redshift for the band on which prior will be applied. Default value is for DECam r (https://cdcvs.fnal.gov/redmine/projects/des-sci-verification/wiki/Photometry)

  • write_full_table (bool, optional) – Are you trying to use this function for a table of objects instead of a single object? If so, set this to True.

Write complete set of input files needed to run EAZY analysis.

This function creates:

  • Catalog file with photometric measurements

  • Translation file mapping columns to EAZY format

  • Parameter file with analysis configuration

Analysis Functions

File I/O Functions

Configuration Parameters

Key parameters for EAZY analysis include:

Redshift Grid
  • zmin: Minimum redshift (default: 0.050)

  • zmax: Maximum redshift (default: 7.000)

  • zstep: Redshift step size (default: 0.001)

Template Settings
  • templates: Template set to use (default: ‘eazy_v1.3’)

  • combo: Template combination mode (1, 2, 99, -1, ‘a’)

Prior Configuration
  • prior: Prior file name (default: ‘prior_R_zmax7’)

  • prior_filter: Filter to use for magnitude prior

  • prior_ABZP: AB magnitude zero-point for prior (default: 23.9)

Quality Control
  • n_min_col: Minimum number of filter detections required

  • magnitudes: Use magnitudes instead of fluxes as input

Examples

Basic EAZY setup and analysis:

from frb.galaxies import eazy
from frb.galaxies.frbgalaxy import FRBGalaxy

# Set up EAZY working directory
eazy.eazy_setup('eazy_work/')

# Generate input files from galaxy photometry
eazy.eazy_input_files(
    galaxy.photom,
    input_dir='eazy_work/',
    name='FRB180924_host',
    out_dir='output/',
    templates='eazy_v1.3',
    zmax=4.0
)

Running photometric redshift analysis:

# Run complete EAZY analysis
results = eazy.eazy_photoz(
    'galaxy_catalog.fits',
    input_dir='eazy_work/',
    name='survey_field',
    zmax=6.0,
    templates='eazy_v1.2_dusty',
    prior='prior_K_zmax7'
)

Custom configuration:

# Advanced configuration with custom parameters
eazy.eazy_input_files(
    photom_dict,
    input_dir='analysis/',
    name='high_z_candidate',
    out_dir='results/',
    templates='eazy_v1.1_lines',  # Line emission templates
    combo='a',  # All template combinations
    zmin=0.1,
    zmax=8.0,
    zstep=0.002,
    prior_filter='i',  # Use i-band for prior
    n_min_col=4  # Require 4+ band detections
)

Integration with FRBGalaxy:

from frb.frb import FRB
from frb.galaxies.frbgalaxy import FRBGalaxy

# Create galaxy object with photometry
frb = FRB.by_name('FRB121102')
galaxy = FRBGalaxy(ra=82.998, dec=33.148, frb=frb)

# Populate with photometric measurements
galaxy.parse_photom(photom_table)

# Run EAZY analysis
eazy_results = eazy.eazy_photoz(
    galaxy.photom,
    input_dir='frb121102_eazy/',
    name='host_galaxy'
)

Output Processing:

# Read EAZY results
zout = eazy.eazy_getpz('OUTPUT/photz.zout.fits')

# Extract best redshift estimates
zbest = zout['z_peak']
z_err_lo = zout['z_err_lo']
z_err_hi = zout['z_err_hi']

print(f"Photo-z: {zbest[0]:.3f} +{z_err_hi[0]:.3f} -{z_err_lo[0]:.3f}")