Phot Utils API¶
- class rubin_sim.phot_utils.Bandpass(wavelen=None, sb=None, sampling_warning=0.2)[source]¶
Bases:
object
Hold and use telescope throughput curves.
- Parameters:
wavelen (
np.ndarray
, (N,)) – Wavelength array in nm.sb (
np.ndarray
, (N,)) – Throughput array (fraction, 0-1).sampling_warning (
float
) – If wavelength sampling lower than this, throw a warning because it might provide accurate magnitudes due to how magnitudes are calculated in Sed (nm).
- calc_zp_t(photometric_parameters)[source]¶
Calculate the instrumental zeropoint for a bandpass.
- Parameters:
photometric_parameters (
PhotometricParameters
) – Details about the photometric response of the telescope. Defaults to LSST values.
- check_use_self(wavelen, sb)[source]¶
Simple utility to check if should be using self.wavelen/sb or passed arrays.
Useful for other methods in this class. Also does data integrity check on wavelen/sb if not self.
- imsim_bandpass(imsimwavelen=500.0, wavelen_min=300, wavelen_max=1150, wavelen_step=0.1)[source]¶
Populate bandpass data with sb=0 everywhere except at imsimwavelen.
Sets wavelen/sb, with grid min/max/step as Parameters.
- multiply_throughputs(wavelen_other, sb_other)[source]¶
Multiply self.sb by another wavelen/sb pair, return wavelen/sb arrays.
The returned arrays will be gridded like this bandpass. This method does not affect self.
- read_throughput(filename)[source]¶
Populate bandpass data with data (wavelen/sb) read from file.
Sets wavelen/sb. Does NOT set phi.
- read_throughput_list(component_list=('detector.dat', 'lens1.dat', 'lens2.dat', 'lens3.dat', 'm1.dat', 'm2.dat', 'm3.dat', 'atmos_std.dat'), root_dir='.', wavelen_min=300, wavelen_max=1150, wavelen_step=0.1)[source]¶
Populate bandpass data by reading from a series of files containing wavelen/Sb data.
Multiplies throughputs (sb) from each file to give a final bandpass throughput. Sets wavelen/sb, with grid min/max/step as Parameters. Does NOT set phi.
- resample_bandpass(wavelen=None, sb=None, wavelen_min=300, wavelen_max=1150, wavelen_step=0.1)[source]¶
Resamples wavelen/sb (or self.wavelen/sb) onto grid defined by min/max/step.
Either returns wavelen/sb (if given those arrays) or updates wavelen / Sb in self. If updating self, resets phi to None.
- sb_tophi()[source]¶
Calculate and set phi - the normalized system response.
This function only updates self.phi.
- class rubin_sim.phot_utils.DustValues(r_v=3.1, bandpass_dict=None, ref_ebv=1.0)[source]¶
Bases:
object
Calculate extinction values
- Parameters:
R_v (
float
) – Extinction law parameter (3.1).bandpassDict (
dict
) – A dict with keys of filtername and values of rubin_sim.phot_utils.Bandpass objects. Default of None will load the standard ugrizy bandpasses.ref_ev (
float
) – The reference E(B-V) value to use. Things in MAF assume 1.
Note
The value that dust_values calls “ax1” is equivalent to r_x in any filter. And r_x * ebv = A_x (the extinction due to dust in any bandpass). DustValues.r_x is also provided as a copy of DustValues.ax1 .. eventually ax1 may be deprecated in favor of r_x.
- class rubin_sim.phot_utils.PhysicalParameters[source]¶
Bases:
object
Stores physical constants and other immutable parameters used by the sims_phot_utils code.
- property ergsetc2jansky¶
Conversion factor to go from ergs/sec/cm^2 to Janskys.
- property lightspeed¶
Speed of light in meters per second.
- property nm2m¶
Conversion factor to go from nm to m.
- property planck¶
Planck’s constant in ergs*seconds.
- class rubin_sim.phot_utils.Sed(wavelen=None, flambda=None, fnu=None, badval=nan, name=None)[source]¶
Bases:
object
“Hold and use spectral energy distributions (SEDs)
- add_ccm_dust(a_x, b_x, a_v=None, ebv=None, r_v=3.1, wavelen=None, flambda=None)[source]¶
Add dust model extinction to the SED, modifying flambda and fnu.
Get a_x and b_x either from setupCCMab or setupODonnell_ab
Specify any two of A_V, E(B-V) or R_V (=3.1 default).
- add_dust(a_x, b_x, a_v=None, ebv=None, r_v=3.1, wavelen=None, flambda=None)[source]¶
Add dust model extinction to the SED, modifying flambda and fnu.
Get a_x and b_x either from setupCCMab or setupODonnell_ab
Specify any two of A_V, E(B-V) or R_V (=3.1 default).
- calc_adu(bandpass, phot_params, wavelen=None, fnu=None)[source]¶
Calculate the number of adu from camera, using sb and fnu.
Given wavelen/fnu arrays or use self. Self or passed wavelen/fnu arrays will be unchanged. Calculating the AB mag requires the wavelen/fnu pair to be on the same grid as bandpass; (temporary values of these are used).
- Parameters:
bandpass (
rubin_sim.phot_utils.Bandpass
)phot_params (
rubin_sim.phot_utils.PhotometricParameters
)wavelen (
np.ndarray
, optional) – wavelength grid in nmfnu (
np.ndarray
, optional) – flux in Janskysspecified (If wavelen and fnu are not)
self.wavelen (this will just use)
self.fnu (and)
- calc_ergs(bandpass)[source]¶
Integrate the SED over a bandpass directly. If self.flambda is in ergs/s/cm^2/nm and bandpass.sb is the unitless probability that a photon of a given wavelength will pass through the system, this method will return the ergs/s/cm^2 of the source observed through that bandpass (i.e. it will return the integral
int self.flambda(lambda) * bandpass.sb(lambda) * dlambda
This is to be contrasted with self.calc_flux(), which returns the integral of the source’s specific flux density over the normalized response function of bandpass, giving a flux in Janskys (10^-23 erg/cm^2/s/Hz), which should be though of as a weighted average of the specific flux density of the source over the normalized response function, as detailed in Section 4.1 of the LSST design document LSE-180.
- Parameters:
class (bandpass is an instantiation of the Bandpass)
- Return type:
The flux of the current SED through the bandpass in ergs/s/cm^2
- calc_flux(bandpass, wavelen=None, fnu=None)[source]¶
Integrate the specific flux density of the object over the normalized response curve of a bandpass, giving a flux in Janskys (10^-23 ergs/s/cm^2/Hz) through the normalized response curve, as detailed in Section 4.1 of the LSST design document LSE-180 and Section 2.6 of the LSST Science Book (http://ww.lsst.org/scientists/scibook). This flux in Janskys (which is usually thought of as a unit of specific flux density), should be considered a weighted average of the specific flux density over the normalized response curve of the bandpass. Because we are using the normalized response curve (phi in LSE-180), this quantity will depend only on the shape of the response curve, not its absolute normalization.
Note: the way that the normalized response curve has been defined (see equation 5 of LSE-180) is appropriate for photon-counting detectors, not calorimeters.
Passed wavelen/fnu arrays will be unchanged, but if uses self will check if fnu is set.
Calculating the AB mag requires the wavelen/fnu pair to be on the same grid as bandpass; (temporary values of these are used).
- calc_flux_norm(magmatch, bandpass, wavelen=None, fnu=None)[source]¶
Calculate the fluxNorm (SED normalization value for a given mag) for a sed.
Equivalent to adjusting a particular f_nu to Jansky’s appropriate for the desired mag. Can pass wavelen/fnu or apply to self.
- calc_mag(bandpass, wavelen=None, fnu=None)[source]¶
Calculate the AB magnitude of an object using the normalized system response (phi from Section 4.1 of the LSST design document LSE-180).
Can pass wavelen/fnu arrays or use self. Self or passed wavelen/fnu arrays will be unchanged. Calculating the AB mag requires the wavelen/fnu pair to be on the same grid as bandpass; (but only temporary values of these are used).
- flambda_tofnu(wavelen=None, flambda=None)[source]¶
Convert flambda into fnu.
This routine assumes that flambda is in ergs/cm^s/s/nm and produces fnu in Jansky. Can act on self or user can provide wavelen/flambda and get back wavelen/fnu.
- flux_from_mag(mag)[source]¶
Convert a magnitude back into a flux (implies knowledge of the zeropoint, which is stored in this class)
- fnu_toflambda(wavelen=None, fnu=None)[source]¶
Convert fnu into flambda.
Assumes fnu in units of Jansky and flambda in ergs/cm^s/s/nm. Can act on self or user can give wavelen/fnu and get wavelen/flambda returned.
- mag_from_flux(flux)[source]¶
Convert a flux into a magnitude (implies knowledge of the zeropoint, which is stored in this class)
- many_flux_calc(phiarray, wavelen_step, observed_bandpass_ind=None)[source]¶
Calculate fluxes of a single sed for which fnu has been evaluated in a set of bandpasses for which phiarray has been set up to have the same wavelength grid as the SED in units of ergs/cm^2/sec. It is assumed that
self.fnu
is set before calling this method, and that phiArray has the same wavelength grid as the Sed.- Parameters:
phiarray (
np.ndarray
) – phiarray corresponding to the list of bandpasses in which the band fluxes need to be calculated, in the same wavelength grid as Sedwavelen_step (
float
) – the uniform grid size of the SEDobserved_bandpass_ind (
list
[int
], optional) – list of indices of phiarray corresponding to observed bandpasses, if None, the original phiarray is returned
- Returns:
np.ndarray
with size equal to number of bandpass filters band fluxvalues in units of ergs/cm^2/sec
.. note (Sed.many_flux_calc
assumes
phiArray has the same wavelength)grid as the Sed and that
sed.fnu
has been calculated for the sed,perhaps using
sed.flambda_tofnu()
. This requires callingsed.setupPhiArray()
first. These assumptions are to avoid errorchecking within this function (for speed), but could lead to errors if
method is used incorrectly.
Note on units (Fluxes calculated this way will be the flux density)
integrated over the weighted response curve of the bandpass.
See equaiton 2.1 of the LSST Science Book
http (//www.lsst.org/scientists/scibook)
- many_mag_calc(phiarray, wavelen_step, observed_bandpass_ind=None)[source]¶
Calculate many magnitudes for many bandpasses using a single sed.
This method assumes that there will be flux within a particular bandpass (could return ‘-Inf’ for a magnitude if there is none). Use setupPhiArray first, and note that Sed.many_mag_calc assumes phiArray has the same wavelength grid as the Sed, and that fnu has already been calculated for Sed. These assumptions are to avoid error checking within this function (for speed), but could lead to errors if method is used incorrectly.
- Parameters:
phiarray (
np.ndarray
, mandatory) – phiarray corresponding to the list of bandpasses in which the band fluxes need to be calculated, in the same wavelength grid as SEDwavelen_step (
float
, mandatory) – the uniform grid size of the SEDobserved_bandpass_ind (
list
[int
], optional) – list of indices of phiarray corresponding to observed bandpasses, if None, the original phiarray is returned
- multiply_flux_norm(flux_norm, wavelen=None, fnu=None)[source]¶
Multiply wavelen/fnu (or self.wavelen/fnu) by fluxnorm.
Returns wavelen/fnu arrays (or updates self). Note that multiply_flux_norm does not regrid self.wavelen/flambda/fnu at all.
- multiply_sed(other_sed, wavelen_step=None)[source]¶
Multiply two SEDs together - flambda * flambda - and return a new sed object.
Unless the two wavelength arrays are equal, returns a SED gridded with stepsize wavelen_step over intersecting wavelength region. Does not alter self or other_sed.
- read_sed_flambda(filename, name=None, cache_sed=True)[source]¶
Read a file containing [lambda Flambda] (lambda in nm) (Flambda erg/cm^2/s/nm).
Does not resample wavelen/flambda onto grid; leave fnu=None.
- read_sed_fnu(filename, name=None)[source]¶
Read a file containing [lambda Fnu] (lambda in nm) (Fnu in Jansky).
Does not resample wavelen/fnu/flambda onto a grid; leaves fnu set.
- redshift_sed(redshift, dimming=False, wavelen=None, flambda=None)[source]¶
Redshift an SED, optionally adding cosmological dimming.
Pass wavelen/flambda or redshift/update self.wavelen/flambda (unsets fnu).
- renormalize_sed(wavelen=None, flambda=None, fnu=None, lambdanorm=500, normvalue=1, gap=0, normflux='flambda', wavelen_step=None)[source]¶
Renormalize sed in flambda to have normflux=normvalue @ lambdanorm averaged over gap.
Can normalized in flambda or fnu values. wavelen_step specifies the wavelength spacing when using ‘gap’.
Either returns wavelen/flambda values or updates self.
- resample_sed(wavelen=None, flux=None, wavelen_match=None, wavelen_min=None, wavelen_max=None, wavelen_step=None, force=False)[source]¶
Resample flux onto grid defined by min/max/step OR another wavelength array.
Give method wavelen/flux OR default to self.wavelen/self.flambda. Method either returns wavelen/flambda (if given those arrays) or
updates wavelen/flambda in self.
If updating self, resets fnu to None. Method will first check if resampling needs to be done or not, unless ‘force’ is True.
- set_flat_sed(wavelen_min=300.0, wavelen_max=1150.0, wavelen_step=0.1, name='Flat')[source]¶
Populate the wavelength/flambda/fnu fields in sed according to a flat fnu source.
- set_sed(wavelen, flambda=None, fnu=None, name='FromArray')[source]¶
Populate wavelen/flambda fields in sed by giving lambda/flambda or lambda/fnu array.
If flambda present, this overrides fnu. Method sets fnu=None unless only fnu is given.
- setup_cc_mab(wavelen=None)[source]¶
Calculate a(x) and b(x) for CCM dust model. (x=1/wavelen).
If wavelen not specified, calculates a and b on the own object’s wavelength grid. Returns a(x) and b(x) can be common to many seds, wavelen is the same.
This method sets up extinction due to the model of Cardelli, Clayton and Mathis 1989 (ApJ 345, 245)
- setup_ccm_ab(wavelen=None)[source]¶
Calculate a(x) and b(x) for CCM dust model. (x=1/wavelen).
If wavelen not specified, calculates a and b on the own object’s wavelength grid. Returns a(x) and b(x) can be common to many seds, wavelen is the same.
This method sets up extinction due to the model of Cardelli, Clayton and Mathis 1989 (ApJ 345, 245)
- setup_o_donnell_ab(wavelen=None)[source]¶
Calculate a(x) and b(x) for O’Donnell dust model. (x=1/wavelen).
If wavelen not specified, calculates a and b on the own object’s wavelength grid. Returns a(x) and b(x) can be common to many seds, wavelen is the same.
This method sets up the extinction parameters from the model of O’Donnel 1994 (ApJ 422, 158)
- setup_phi_array(bandpasslist)[source]¶
Sets up a 2-d numpy phi array from bandpasslist suitable for input to Sed’s many_mag_calc.
This is intended to be used once, most likely before using Sed’s many_mag_calc many times on many SEDs. Returns 2-d phi array and the wavelen_step (dlambda) appropriate for that array.
- synchronize_sed(wavelen_min=None, wavelen_max=None, wavelen_step=None)[source]¶
Set all wavelen/flambda/fnu values, potentially on min/max/step grid.
Uses flambda to recalculate fnu. If wavelen min/max/step are given, resamples wavelength/flambda/fnu onto an even grid with these values.
- write_sed(filename, print_header=None, print_fnu=False, wavelen_min=None, wavelen_max=None, wavelen_step=None)[source]¶
Write SED (wavelen, flambda, optional fnu) out to file.
Option of adding a header line (such as version info) to output file. Does not alter self, regardless of grid or presence/absence of fnu.
- rubin_sim.phot_utils.cache_lsst_seds(wavelen_min=None, wavelen_max=None, cache_dir=None)[source]¶
Read all of the SEDs in sims_sed_library into a dict. Pickle the dict and store it in phot_utils/cacheDir/lsst_sed_cache.p for future use.
After the file has initially been created, the next time you run this script, it will just use the pickle.
Once the dict is loaded, Sed.read_sed_flambda() will be able to read any LSST-shipped SED directly from memory, rather than using I/O to read it from an ASCII file stored on disk.
Note: the dict of cached SEDs will take up about 5GB on disk. Once loaded, the cache will take up about 1.5GB of memory.
- Parameters:
wavelen_min (
float
) – Wavelength minimum value to store for each Sed.wavelen_max (
float
) – Wavelength maximum value to store for each Sed.cache_dir (
str
) – The directory to place the cache pickle.None (If either of wavelen_min or wavelen_max are not)
:param : :param then every SED in the cache will be: :param truncated to only include the wavelength range (in nm) between: :param wavelen_min and wavelen_max:
- rubin_sim.phot_utils.calc_astrometric_error(mag, m5, fwhm_geom=0.7, nvisit=1, systematic_floor=10)[source]¶
Calculate an expected astrometric error.
The astrometric error can be estimated for catalog purposes by using the typical FWHM and n_visit = total number of visits, or can be used for a single visit by using the actual FWHM and n_visit =1.
- Parameters:
mag (
float
) – Magnitude of the sourcem5 (
float
) – Point source five sigma limiting magnitude of the image (or typical depth per image).fwhm_geom (
float
, optional) – The geometric (physical) FWHM of the image, in arcseconds.nvisit (
int
, optional) – The number of visits/measurement. Default 1. If this is >1, the random error contribution is reduced by sqrt(nvisits).systematic_floor (
float
, optional) – The systematic noise floor for the astrometric measurements, in mas. Default 10mas.
- Returns:
astrom_err – Astrometric error for a given SNR, in mas.
- Return type:
float
- rubin_sim.phot_utils.calc_gamma(bandpass, m5, phot_params)[source]¶
Calculate gamma parameter.
Calculate the gamma parameter used for determining photometric signal to noise in equation 5 of the LSST overview paper (arXiv:0805.2366)
- Parameters:
bandpass (
Bandpass
) – Bandpass for which you desire to calculate the gamma parameter.m5 (
float
) – The magnitude of a 5-sigma point source detection.phot_params (
PhotometricParameters
) – The PhotometricParameters class that carries details about the photometric response of the telescope.
- Returns:
gamma – The gamma value for this bandpass.
- Return type:
float
- rubin_sim.phot_utils.calc_instr_noise_sq(phot_params)[source]¶
Combine all of the noise due to intrumentation into one value
- Parameters:
phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – A PhotometricParameters object that carries details about the photometric response of the telescope.- Returns:
inst_noise_sq – The noise due to all of these sources added in quadrature in ADU counts
- Return type:
float
- rubin_sim.phot_utils.calc_m5(skysed, total_bandpass, hardware, phot_params, fwhm_eff=0.83)[source]¶
Calculate the AB magnitude of a 5-sigma source above sky background.
- Parameters:
skysed (
rubin_sim.phot_utils.Sed
) – An SED representing the sky background emission, normalized such that skysed.calc_mag(Bandpass) returns the expected sky brightness in magnitudes per sq arcsecond.total_bandpass (
rubin_sim.phot_utils.Bandpass
) – The Bandpass representing the total throughput of the telescope (instrument plus atmosphere).hardware (
rubin_sim.phot_utils.Bandpass
) – The Bandpass representing the throughput of the telescope instrument only (no atmosphere).phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – The PhotometricParameters class that carries details about the photometric response of the telescope.fwhm_eff (
float
) – FWHM in arcseconds.
- Returns:
mag_5sigma – The value of m5 for the given bandpass and sky SED
- Return type:
float
Notes
The 5-sigma limiting magnitude (m5) for an observation is determined by a combination of the telescope and camera parameters (such as diameter of the mirrors and the readnoise) together with the sky background. This method (calc_m5) calculates the expected m5 value for an observation given a sky background Sed and hardware parameters.
This comes from equation 45 of the SNR document (v1.2, May 2010) https://docushare.lsstcorp.org/docushare/dsweb/ImageStoreViewer/LSE-40
- rubin_sim.phot_utils.calc_mag_error_m5(magnitude, bandpass, m5, phot_params, gamma=None)[source]¶
Calculate magnitude error using the model from equation (5) of arXiv:0805.2366
- Parameters:
magnitude (
float
) – Magnitude of the source.bandpass (
rubin_sim.phot_utils.Bandpass
) – The Bandpass in which to calculate the magnitude error (total instrument + atmosphere).m5 (
float
) – The 5-sigma point source limiting magnitude.phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – The PhotometricParameters class that carries details about the photometric response of the telescope.gamma (
float
, optional) – The gamma parameter from equation(5) of arXiv:0805.2366. If not provided, this method will calculate it.
- Returns:
mag_error (
float
ornp.ndarray
, (N,)) – The magnitude error of the input magnitude.gamma (
float
) – The gamma parameter for the Bandpass.
- rubin_sim.phot_utils.calc_mag_error_sed(source_sed, total_bandpass, sky_sed, hardware_bandpass, phot_params, fwhm_eff, verbose=False)[source]¶
Calculate the magnitudeError for a source, given the bandpass(es) and sky SED.
For a given source, sky sed, total bandpass and hardware bandpass, and fwhm_eff / exptime, calculates the SNR with optimal PSF extraction assuming a double-gaussian PSF.
- Parameters:
source_sed (
rubin_sim.phot_utils.Sed
) – A SED representing the source, normalized such that source_sed.calc_mag gives the desired magnitude.total_bandpass (
rubin_sim.phot_utils.Bandpass
) – The Bandpass representing the total throughput of the telescope (instrument plus atmosphere).sky_sed (
rubin_sim.phot_utils.Sed
) – A SED representing the sky background emission, normalized such that skysed.calc_mag(Bandpass) returns the expected sky brightness in magnitudes per sq arcsecond.hardware_bandpass (
rubin_sim.phot_utils.Bandpass
) – The Bandpass representing the throughput of the telescope instrument only (no atmosphere).phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – The PhotometricParameters class that carries details about the photometric response of the telescope.fwhm_eff (
float
) – FWHM in arcseconds.verbose (
bool
, optional) – Flag as to whether to print output about SNR.
- Returns:
mag_err – Magnitude error in expected magnitude.
- Return type:
float
- rubin_sim.phot_utils.calc_neff(fwhm_eff, platescale)[source]¶
Calculate the effective number of pixels in a single gaussian PSF.
This equation comes from LSE-40, equation 27. https://docushare.lsstcorp.org/docushare/dsweb/ImageStoreViewer/LSE-40
- Parameters:
fwhm_eff (
float
) – The width of a single-gaussian that produces correct Neff for typical PSF profile.platescale (
float
) – The platescale in arcseconds per pixel (0.2 for LSST)
- Returns:
nEff – The effective number of pixels contained in the PSF
- Return type:
float
Notes
The fwhm_eff is a way to represent the equivalent seeing value, if the atmosphere could be simply represented as a single gaussian (instead of a more complicated von Karman profile for the atmosphere, convolved properly with the telescope hardware additional blurring of 0.4”). A translation from the geometric FWHM to the fwhm_eff is provided in fwhm_geom2_fwhm_eff.
- rubin_sim.phot_utils.calc_sky_counts_per_pixel_for_m5(m5target, total_bandpass, phot_params, fwhm_eff=0.83)[source]¶
Calculate the skycounts per pixel.
Calculate the number of sky counts per pixel expected for a given value of the 5-sigma limiting magnitude (m5)
- Parameters:
m5target (
float
) – The desired value of m5.total_bandpass (
rubin_sim.phot_utils.Bandpass
) – A bandpass object representing the total throughput of the telescope (instrumentation plus atmosphere).phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – A photometric parameters object containing the photometric response information for Rubin.fwhm_eff (
float
) – fwhm_eff in arcseconds. Default 0.83
- Returns:
sky_counts_target – The expected number of sky counts per pixel (ADU/pixel).
- Return type:
float
Notes
The 5-sigma limiting magnitude (m5) for an observation is determined by a combination of the telescope and camera parameters (such as diameter of the mirrors and the readnoise) together with the sky background.
- rubin_sim.phot_utils.calc_snr_m5(magnitude, bandpass, m5, phot_params, gamma=None)[source]¶
Calculate the SNR of a source based on the 5-sigma limit for an observation.
Calculate signal to noise in flux using the model from equation (5) of arXiv:0805.2366
- Parameters:
magnitude (
float
ornp.ndarray
, (N,)) – Magnitudes of the sources whose signal to noise you are calculating.bandpass (
rubin_sim.phot_utils.Bandpass
) – The Bandpass in which the magnitude was calculated (total instrument + atmosphere).m5 (
float
) – The 5-sigma point source limiting magnitude of the exposure.phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – The PhotometricParameters class that carries details about the photometric response of the telescope.gamma (
float
, opt) – The gamma parameter from equation(5) of arXiv:0805.2366. If not provided, this method will calculate it.
- Returns:
snr (
float
ornp.ndarray
, (N,)) – The SNR of the input magnitude.gamma (
float
) – The gamma parameter for the Bandpass.
- rubin_sim.phot_utils.calc_snr_sed(source_sed, total_bandpass, sky_sed, hardwarebandpass, phot_params, fwhm_eff, verbose=False)[source]¶
Calculate the signal to noise ratio for a source, based on the SED.
For a given source, sky sed, total bandpass and hardware bandpass, as well af fwhm_eff / exptime, calculates the SNR with optimal PSF extraction assuming a double-gaussian PSF.
- Parameters:
source_sed (
rubin_sim.phot_utils.Sed
) – A SED representing the source, normalized such that source_sed.calc_mag gives the desired magnitude.total_bandpass (
rubin_sim.phot_utils.Bandpass
) – The Bandpass representing the total throughput of the telescope (instrument plus atmosphere).sky_sed (
rubin_sim.phot_utils.Sed
) – A SED representing the sky background emission, normalized such that skysed.calc_mag(Bandpass) returns the expected sky brightness in magnitudes per sq arcsecond.hardware (
rubin_sim.phot_utils.Bandpass
) – The Bandpass representing the throughput of the telescope instrument only (no atmosphere).phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – The PhotometricParameters class that carries details about the photometric response of the telescope.fwhm_eff (
float
) – FWHM in arcseconds.verbose (
bool
) – Flag as to whether to print output about SNR.
- Returns:
snr – Calculated SNR.
- Return type:
float
- rubin_sim.phot_utils.calc_total_non_source_noise_sq(sky_sed, hardwarebandpass, phot_params, fwhm_eff)[source]¶
Calculate the noise due to instrumentation and sky background.
- Parameters:
sky_sed (
rubin_sim.phot_utils.Sed
) – A Sed object representing the sky (normalized so that sky_sed.calc_mag() gives the sky brightness in magnitudes per square arcsecond)hardwarebandpass (
rubin_sim.phot_utils.Bandpass
) – A Bandpass object containing just the instrumentation throughputs (no atmosphere)phot_params (
rubin_sim.phot_utils.PhotometricParameters
) – A PhotometricParameters object containing information about the photometric properties of the telescope.fwhm_eff (
float
) – fwhm_eff in arcseconds
- Returns:
total_noise_sq – total non-source noise squared (in ADU counts) (this is simga^2_tot * neff in equation 41 of the SNR document https://ls.st/LSE-40 )
- Return type:
float
- rubin_sim.phot_utils.fwhm_eff2_fwhm_geom(fwhm_eff)[source]¶
Convert fwhm_eff to fwhm_geom.
This conversion was calculated by Bo Xin and Zeljko Ivezic (and will be in an update on the LSE-40 and overview papers).
- Parameters:
fwhm_eff (
float
) – the single-gaussian equivalent FWHM value, appropriate for calc_neff, in arcseconds- Returns:
fwhm_geom – FWHM geom, the geometric FWHM value as measured from a typical PSF profile in arcseconds.
- Return type:
float
- rubin_sim.phot_utils.fwhm_geom2_fwhm_eff(fwhm_geom)[source]¶
Convert fwhm_geom to fwhm_eff.
This conversion was calculated by Bo Xin and Zeljko Ivezic (and will be in an update on the LSE-40 and overview papers).
- Parameters:
fwhm_geom (
float
) –- The geometric FWHM value, as measured from a typical PSF profile,
in arcseconds.
- Returns:
fwhm_eff – FWHM effective, the single-gaussian equivalent FWHM value, appropriate for calc_neff, in arcseconds.
- Return type:
float
- rubin_sim.phot_utils.mag_error_from_snr(snr)[source]¶
Convert flux signal to noise ratio to an error in magnitude.
- Parameters:
snr (
float
) – The signal to noise ratio (a flux-related measurement).- Returns:
mag_error – Corresponding error in magnitude.
- Return type:
float
- rubin_sim.phot_utils.read_close__kurucz(teff, fe_h, logg)[source]¶
Check the cached Kurucz models and load the model closest to the input stellar parameters. Parameters are matched in order of Teff, fe_h, and logg.
- Parameters:
teff (
float
) – Effective temperature of the stellar template. Reasonable range is 3830-11,100 K.fe_h (
float
) – Metallicity [Fe/H] of stellar template. Values in range -5 to 1.logg (
float
) – Log of the surface gravity for the stellar template. Values in range 0. to 50.
- Returns:
sed (
rubin_sim.phot_utils.Sed
) – The SED of the closest matching stellar templateparamDict (
dict
) – Dictionary of the teff, fe_h, logg that were actually loaded
- rubin_sim.phot_utils.rubin_bandpasses()[source]¶
Return the standard expected Rubin filter bandpasses.
- rubin_sim.phot_utils.scale_sky_m5(m5target, skysed, total_bandpass, hardware, phot_params, fwhm_eff=0.83)[source]¶
Take an SED representing the sky and normalize it so that m5 (the magnitude at which an object is detected in this bandpass at 5-sigma) is set to some specified value.
The 5-sigma limiting magnitude (m5) for an observation is determined by a combination of the telescope and camera parameters (such as diameter of the mirrors and the readnoise) together with the sky background. This method (set_m5) scales a provided sky background Sed so that an observation would have a target m5 value, for the provided hardware parameters. Using the resulting Sed in the ‘calcM5’ method will return this target value for m5.
Note that the returned SED will be renormalized such that calling the method self.calcADU(hardwareBandpass) on it will yield the number of counts per square arcsecond in a given bandpass.