Quickstart

etc2d

  • Creating a default configuration dictionaray and editing the configuration:

from ifs_etc.etc2d.ifs_etc import build_input_para
config = build_input_para()

######################################################
#          IFS Exposure Time Calculator              #
# (Use default value when press enter and no input)  #
######################################################
#
# 1. Spectral Resolution: 3.5 Angstrom per 2 pixels (fixed)
#    Spectral coverage: 3500-10000 A
#
# 2. CCD parameters:
#     1. Dispersion axis binning: 1 pixel
#     2. Spatial axis binning: 1 pixel
#     3. Gain: 1 e-/ADU
#     4. Dark: 0.017 e-/s/pixel
Reset the parameters or use the default value? (r|d): d
# Use the default CCD parameters.
#
# 3. Specify the calculation mode:
#     1. How many visits needed to obtain a certain SNR.
#     2. SNR reached in certain visits.
#     (Set the exposure time = 300 seconds per visit.)
which calculation mode (default = 1): 1
The target SNR is (default = 20): 20
# Calculate the visits to obtain SNR = 20.0.
#
# 4. Define the source (position, shape, spectrum, brightness).
How many sources to be considered (default = 1): 1
# Set the parameters for each source.
# 4. (1/5) Select the source type for source-1:
#    1. point source
#    2. extended source
Enter the index (default = 1): 1
# 4. (2/5) Set the center position for source-1:
Enter the x-offset [arcsec] (default = 0.0): 0.2
Enter the y-offset [arcsec] (default = 0.0): 0.2
# 4. (3/5) Point source is set to have PSF shape with FWHM = 0.2".
# 4. (4/5) Choose a spectrum for the source-1:
#    1. Elliptical galaxy (bc03_FeH0_tau1_Ewd)
#    2. Spiral galaxy (bc03_FeH0_tau5_Ew5)
#    3. Starburst galaxy (bc03_FeH-2_tau10_Ew50)
#    4. AGN (FeH0_tau5_Ew10_AGN)
#    5. upload spectrum file [text format only, with two-columns: wavelength in A and flux in erg/s/cm^2/A]
Enter the choise (default = 1): 1
Enter the redshift (default = 0.0): 0.0
Enter the E(B-V) (default = 0.0): 0.1
# 4. (5/5) Select the normalization type for source-1:
#    1. Normalized at certain wavelength.
#    2. Normalized at certain filter.
Select the normalization type (default = 2): 2
# Filters: 1. sdss-u, 2. sdss-g, 3. sdss-r, 4. sdss-i, 5. sdss-z.
Select the normalized filter (default = 2): 2
# Normalization unit: [add arcsec^-2 for extended source].
#    1. AB magnitude
#    2. erg/s/cm^2/A
#    3. erg/s/cm^2/Hz
Select the normalization unit (default = 1): 1
Enter the normalization value (default = 17.7): 17.7
#
# 5. Specify the background level:
# Zodiacal level: 1. low, 2. median, 3. high.
Enter the choice (default = 2): 2
# Earth shine level: 1. low, 2. median, 3. high.
Enter the choice (default = 2): 2
  • Performing the calculation:

from ifs_etc.etc2d.perform_calculation import perform_calculation
report = perform_calculation(config)

etc1d

  • Creating a default configuration dictionaray:

from ifs_etc.etc1d.config import build_default_calc
config = build_default_calc()
  • Editing the configuration:

# changing the spectrum of the source
config['source']['spectrum']['name'] = 'SFgal_texp_FeH0_tau5_Ew10_AGN1.fits'

# changing the surface brightness of the source
config['source']['normalization']['value'] = 17.7
  • Running the code:

from ifs_etc.etc1d.perform_calculation import perform_calculation
report = perform_calculation(calculation)
  • The output results:

    • report.__dict__ lists all the information in the result

    • report['snr'] contains the signal-to-noise ratio generated by the calculation

    • report['readnoise], report['darknoise'], report['sourcenoise'] contain different types of noise.

    • report['mockwave'], report['mockflux'], report['mockerror'] provide the mock spectrum of the observation


Examples

  • S/N ratio reached in a exposure time of 900 seconds for an extended source with sdss g-band surface brightness of 18 mag/arcsec2 and AGN spectrum

from ifs_etc.etc1d.config import build_default_calc
from ifs_etc.etc1d.perform_calculation import perform_calculation

config = build_default_calc()
config['obst'] = 300
config['repn'] = 3
config['source']['normalization']['value'] = 18.0
config['source']['spectrum']['name'] = 'SFgal_texp_FeH0_tau5_Ew10_AGN1.fits'
report = perform_calculation(config)
print(report.snr)
  • Exposure time needed to obtain a S/N ratio of 10 for an elliptical galaxy with SDSS r-band surface brightness of 18 mag/arcsec2

from ifs_etc.etc1d.config import build_default_calc
from ifs_etc.etc1d.perform_calculation import perform_calculation

config = build_default_calc()
config['targetsnr'] = 10
config['obst'] = 300
config['source']['normalization']['value'] = 18.0
config['source']['spectrum']['name'] = 'SFgal_texp_FeH0_tau1_Ewd.fits'
report = perform_calculation(config, calculation_mode='snr2exptime')
print(report.exptime)