ETC

class pyetc.etc.ETC(log=20)

Bases: object

Generic class for Exposure Time Computation (ETC)

Methods Summary

adaptative_circular_aperture(ins, ima, kfwhm)

truncate the image with a window size relative to the image FWHM

fixed_circular_aperture(ins, ima, radius[, cut])

truncate the image with a fixed size aperture

flux_from_source(ins, snr, ima, spec[, ...])

compute the flux needed to achieve a given S/N

fun(flux, snr0, ins, ima, spec, krange)

minimizing function used by flux_from_source

get_ima(ins, dima[, oversamp, uneven])

compute source image from the model parameters

get_image_psf(ins, wave[, oversamp])

compute PSF image

get_image_quality(ins[, spec])

compute image quality evolution with wavelength

get_psf_frac_ima(ins, flux, spec[, lrange, ...])

compute the flux fraction evolution with seeing for a point source

get_sky(ins, moon)

return sky emission and tranmission spectra

get_spec(ins, dspec[, oversamp, lsfconv])

compute source spectrum from the model parameters

get_spectral_resolution(ins)

return spectral resolving power

optimum_circular_aperture(ins, flux, ima, spec)

compute the optimum aperture which maximize the S/N

optimum_spectral_range(ins, flux, ima, spec)

compute the optimum window range which maximize the S/N

print_aper(res, names)

pretty print the apertures results for a set of results

set_logging(log)

Change logging value

set_obs(obs)

save obs dictionary to self

snr_from_cube(ins, cube)

compute S/N from a data cube

snr_from_ima(ins, ima, wave)

compute S/N from an image

snr_from_ps_spec(ins, spec, frac_ima, nspaxels)

compute S/N for a point source define by a spectrum in flux/spectel

snr_from_source(ins, flux, ima, spec[, ...])

main routine to perform the S/N computation for a given source

snr_from_spec(ins, spec)

compute S/N from a spectrum in flux/spectel

square_aperture(ins, ima, nsp)

truncate an image on a squared aperture

truncate_spec_adaptative(ins, spec, kfwhm)

truncate an emission line spectrum as function of the line FWHM

truncate_spec_fixed(ins, spec, nsp)

truncate the spectrum to a fixed spectral window size

Methods Documentation

adaptative_circular_aperture(ins, ima, kfwhm)

truncate the image with a window size relative to the image FWHM

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

imaMPDAF image

source image

kfwhmfloat

factor relative to FWHM to define the truncation aperture

Returns:
tuple

tima truncated MPDAF image nspaxels (int) number of spaxels size (float) aperture size (diameter, arcsec) frac_flux (float) fraction flux kept after truncation+

fixed_circular_aperture(ins, ima, radius, cut=0.0625)

truncate the image with a fixed size aperture

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

imaMPDAF image

source image

radiusfloat

aperture radius in arcsec

cutfloat

spaxels with flux below cut will not be counted (Default value = 1/16)

Returns:
tuple

tima truncated MPDAF image nspaxels (int) number of spaxels size (float) aperture size (diameter, arcsec) frac_flux (float) fraction flux kept after truncation

flux_from_source(ins, snr, ima, spec, snrcomp=None, flux=None, bracket=(0.1, 100000))

compute the flux needed to achieve a given S/N

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

fluxfloat

flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)

imaMPDAF image

source image, can be None for surface brightness source or point source

specMPDAF spectrum

source spectrum

snrcompdict

method and parameters to derive the S/N target value from the cont spectrum (Default value = None)

flux

starting value of the flux (Default value = None)

brackettuple of float

interval of flux*1.e-20 for the zero finding routine (Default value = (0.1,100000) :

Returns:
dict

result dictionary (see documentation)

fun(flux, snr0, ins, ima, spec, krange)

minimizing function used by flux_from_source

Parameters:
fluxfloat

flux value * 1.e-20

snr0float

target S/N

insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

imaMPDAF image

source image, can be None for surface brightness source or point source

specMPDAF spectrum

source spectrum

krangetuple of int

wavelength range in spectel to compute the S/N

Returns:
float

S/N - target S/N

get_ima(ins, dima, oversamp=10, uneven=1)

compute source image from the model parameters

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

dimadict

dictionary of parameters describing the source spectrum

oversampint

oversampling factor (Default value = 10)

unevenint

if 1 the size of the image will be uneven (Default value = 1)

Returns:
MPDAF image

image of the source

get_image_psf(ins, wave, oversamp=10)

compute PSF image

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

wavefloat

wavelength in A

oversampint

oversampling factor (Default value = 10)

Returns:
MPDAF image

PSF image

get_image_quality(ins, spec=None)

compute image quality evolution with wavelength

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

specMPDAF spectrum

use wavelengths from spec, if None use all instrument wavelengths

Returns:
numpy array of float

image quality

get_psf_frac_ima(ins, flux, spec, lrange=None, oversamp=10, lbin=1)

compute the flux fraction evolution with seeing for a point source

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

fluxfloat

flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)

imaMPDAF image

source image

specMPDAF spectrum

source spectrum

lrangetuple

wavelength range to compute S/N for cont spectrum (Default value = None)

oversampint

oversampling factor (Default value = 10)

lbinint

step in wavelength (Default value = 1)

Returns:
tuple

frac_ima (MPDAF spectrum) fraction of flux as function of wavelength size_ima (MPDAF spectrum) diameter in arcsec of the aperture nspaxels (numpy array of int) corresponding number of spaxels within the aperture

get_sky(ins, moon)

return sky emission and tranmission spectra

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

moonstr

moon observing condition (e.g “darksky”)

Returns:
tuple of MPDAF spectra

emission and absorption sky spectra

get_spec(ins, dspec, oversamp=10, lsfconv=True)

compute source spectrum from the model parameters

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

dspecdict

dictionary of parameters describing the source spectrum

oversampint

oversampling factor (Default value = 10)

lsfconvbool

apply LSF convolution (Default value = True)

Returns:
MPDAF spectrum

resulting source spectrum

get_spectral_resolution(ins)

return spectral resolving power

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

Returns:
numpy array

spectral resoving power (lbda/dlbda)

optimum_circular_aperture(ins, flux, ima, spec, bracket=[1, 5], lrange=None)

compute the optimum aperture which maximize the S/N

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

fluxfloat

flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)

imaMPDAF image

source image

specMPDAF spectrum

source spectrum

brackettuple

(Default value = [1,5]) :

lrangetuple

wavelength range to compute S/N for cont spectrum (Default value = None)

Returns:
float

factor relative to FWHM (kfwhm)

the kfwhm value is also updated into the obs dictionary

optimum_spectral_range(ins, flux, ima, spec)

compute the optimum window range which maximize the S/N

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

fluxfloat

flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)

imaMPDAF image

source image

specMPDAF spectrum

source spectrum

Returns:
float

factor relative to FWHM (kfwhm)

the kfwhm value is also updated into the obs dictionary

print_aper(res, names)

pretty print the apertures results for a set of results

Parameters:
resdict or list of dict

result dictionaries deliver by snr_from_source or flux_from_source

namesstr or list of str

name to identify the result

Returns:
astropy table

table with one column by result

set_logging(log)

Change logging value

Parameters:
logstr

desired log mode “DEBUG”,”INFO”,”WARNING”,”ERROR”

set_obs(obs)

save obs dictionary to self

Parameters:
obsdict

dictionary of observation parameters

snr_from_cube(ins, cube)

compute S/N from a data cube

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

cubeMPDAF cube

source data cube in flux/voxels

Returns:
dict

result dictionary

this routine is called by snr_from_source

snr_from_ima(ins, ima, wave)

compute S/N from an image

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

imaMPDAF image

source image in flux/spaxels

wavefloat

wavelength in A

Returns:
dict

result dictionary

this routine is called by snr_from_source

snr_from_ps_spec(ins, spec, frac_ima, nspaxels)

compute S/N for a point source define by a spectrum in flux/spectel

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

specMPDAF spectrum

point source spectrul in flux/spectel

frac_imaMPDAF spectrum

flux fraction recovered in the aperture as function of wavelength

nspaxelsnumpy array of int

corresponding number of spaxels in the aperture

Returns:
dict

result dictionary

this routine is called by snr_from_source

snr_from_source(ins, flux, ima, spec, loop=False, debug=True)

main routine to perform the S/N computation for a given source

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

fluxfloat

flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)

imaMPDAF image

source image, can be None for surface brightness source or point source

specMPDAF spectrum

source spectrum

loopbool

set to True for multiple call (used only in ps and cont, Default value = False)

debug

if True print some info in logger.debug mode (Default value = True)

Returns:
dict

result dictionary (see documentation)

snr_from_spec(ins, spec)

compute S/N from a spectrum in flux/spectel

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

specMPDAF spectrum

source spectrum in flux/spectel

Returns:
dict

result dictionary

this routine is called by snr_from_source

square_aperture(ins, ima, nsp)

truncate an image on a squared aperture

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

imaMPDAF image

source image

nspint

the number of spaxels to use is 2 * nsp +1

Returns:
tuple

tima truncated MPDAF image nspaxels (int) number of spaxels size (float) aperture size (diameter, arcsec) frac_flux (float) fraction flux kept after truncation

truncate_spec_adaptative(ins, spec, kfwhm)
truncate an emission line spectrum as function of the line FWHM

the window size is compute as center +/- kfwhm*fwhm

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

specMPFAF spectrum

source spectrum

kfwhmfloat

factor relative to the line FWHM,

Returns
——-
tuple

tspec truncated MPDAF spectrum waves numpy array of corresponding wavelengths (A) nspectels (int) number of spectels kept size (float) wavelength range (A) frac_flux (float) fraction flux kept after truncation

truncate_spec_fixed(ins, spec, nsp)

truncate the spectrum to a fixed spectral window size

Parameters:
insdict

instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])

specMPDAF spectrum

source spectrum

nspint

half number of spectels to use (size is 2 * nsp + 1)

Returns:
tuple

tspec truncated MPDAF spectrum waves numpy array of corresponding wavelengths (A) nspectels (int) number of spectels kept size (float) wavelength range (A) frac_flux (float) fraction flux kept after truncation