ETC
- class pyetc.etc.ETC(log=20)
Bases:
objectGeneric 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
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:
- Returns:
tupletima 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:
- Returns:
tupletima 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:
- ins
dict instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])
- flux
float flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)
- ima
MPDAFimage source image, can be None for surface brightness source or point source
- spec
MPDAFspectrum source spectrum
- snrcomp
dict 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)
- bracket
tupleoffloat interval of flux*1.e-20 for the zero finding routine (Default value = (0.1,100000) :
- ins
- Returns:
dictresult dictionary (see documentation)
- fun(flux, snr0, ins, ima, spec, krange)
minimizing function used by flux_from_source
- Parameters:
- Returns:
floatS/N - target S/N
- get_ima(ins, dima, oversamp=10, uneven=1)
compute source image from the model parameters
- get_image_psf(ins, wave, oversamp=10)
compute PSF image
- get_image_quality(ins, spec=None)
compute image quality evolution with wavelength
- 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:
- ins
dict instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])
- flux
float flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)
- ima
MPDAFimage source image
- spec
MPDAFspectrum source spectrum
- lrange
tuple wavelength range to compute S/N for cont spectrum (Default value = None)
- oversamp
int oversampling factor (Default value = 10)
- lbin
int step in wavelength (Default value = 1)
- ins
- Returns:
tuplefrac_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
- get_spec(ins, dspec, oversamp=10, lsfconv=True)
compute source spectrum from the model parameters
- get_spectral_resolution(ins)
return spectral resolving power
- optimum_circular_aperture(ins, flux, ima, spec, bracket=[1, 5], lrange=None)
compute the optimum aperture which maximize the S/N
- Parameters:
- ins
dict instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])
- flux
float flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)
- ima
MPDAFimage source image
- spec
MPDAFspectrum source spectrum
- bracket
tuple (Default value = [1,5]) :
- lrange
tuple wavelength range to compute S/N for cont spectrum (Default value = None)
- ins
- Returns:
floatfactor 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:
- Returns:
floatfactor 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
- set_logging(log)
Change logging value
- Parameters:
- log
str desired log mode “DEBUG”,”INFO”,”WARNING”,”ERROR”
- log
- 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
- Parameters:
- Returns:
dictresult 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:
- ins
dict instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])
- flux
float flux value in erg/s/cm2 (for line), in erg/s/cm2/A (for cont), / arcsec2 (for sb)
- ima
MPDAFimage source image, can be None for surface brightness source or point source
- spec
MPDAFspectrum 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)
- ins
- Returns:
dictresult dictionary (see documentation)
- 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
- Parameters:
- Returns:
tupletima 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:
- ins
dict instrument (eg self.ifs[‘blue’] or self.moslr[‘red’])
- spec
MPFAFspectrum source spectrum
- kfwhm
float 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
- ins
- truncate_spec_fixed(ins, spec, nsp)
truncate the spectrum to a fixed spectral window size
- Parameters:
- Returns:
tupletspec 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