Coverage for python/lsst/sims/catUtils/matchSED/selectGalaxySED.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" This class provides methods to match galaxy catalog magnitudes to an SED. """
""" This will find the closest match to the magnitudes of a galaxy catalog if those magnitudes are in the rest frame. Objects without magnitudes in at least two adjacent bandpasses will return as none and print out a message.
@param [in] sedList is the set of spectral objects from the models SEDs provided by loadBC03 or other custom loader routine.
@param [in] catMags is an array of the magnitudes of catalog objects to be matched with a model SED. It should be organized so that there is one object's magnitudes along each row.
@param [in] mag_error are provided error values for magnitudes in objectMags. If none provided then this defaults to 1.0. This should be an array of the same size as catMags.
@param [in] bandpassDict is an OrderedDict of bandpass objects with which to calculate magnitudes. If left equal to None it will by default load the SDSS [u,g,r,i,z] bandpasses.
@param [in] makeCopy indicates whether or not to operate on copies of the SED objects in sedList since this method will change the wavelength grid.
@param [out] sedMatches is a list with the name of a model SED that matches most closely to each object in the catalog.
@param [out] magNormMatches are the magnitude normalizations for the given magnitudes and matched SED.
@param [out] matchErrors contains the Mean Squared Error between the colors of each object and the colors of the matched SED. """
#Set up photometry to calculate model Mags galPhot = BandpassDict.loadTotalBandpassesFromFiles(['u','g','r','i','z'], bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'), bandpassRoot = 'sdss_') else:
#Find the colors for all model SEDs
#Match the catalog colors to models
#This is done to handle objects with incomplete magnitude data else: galPhot, mag_error = mag_error, filtRange = filtNums) print('Matched %i of %i catalog objects to SEDs' % (numOn-notMatched, numCatMags))
mag_error = None, bandpassDict = None, dzAcc = 2, reddening = True, extCoeffs = (4.239, 3.303, 2.285, 1.698, 1.263)):
""" This will find the closest match to the magnitudes of a galaxy catalog if those magnitudes are in the observed frame and can correct for reddening from within the milky way as well if needed. In order to make things faster it first calculates colors for all model SEDs at redshifts between the minimum and maximum redshifts of the catalog objects provided with a grid spacing in redshift defined by the parameter dzAcc. Objects without magnitudes in at least two adjacent bandpasses will return as none and print out a message.
@param [in] sedList is the set of spectral objects from the models SEDs provided by loadBC03 or other custom loader routine.
@param [in] catMags is an array of the magnitudes of catalog objects to be matched with a model SED. It should be organized so that there is one object's magnitudes along each row.
@param [in] catRedshifts is an array of the redshifts of each catalog object.
@param [in] catRA is an array of the RA positions for each catalog object.
@param [in] catDec is an array of the Dec position for each catalog object.
@param [in] mag_error are provided error values for magnitudes in objectMags. If none provided then this defaults to 1.0. This should be an array of the same size as catMags.
@param [in] bandpassDict is a BandpassDict with which to calculate magnitudes. If left equal to None it will by default load the SDSS [u,g,r,i,z] bandpasses and therefore agree with default extCoeffs.
@param [in] dzAcc is the number of decimal places you want to use when building the redshift grid. For example, dzAcc = 2 will create a grid between the minimum and maximum redshifts with colors calculated at every 0.01 change in redshift.
@param [in] reddening is a boolean that determines whether to correct catalog magnitudes for dust in the milky way. By default, it is True. If true, this uses calculateEBV from EBV.py to find an EBV value for the object's ra and dec coordinates and then uses the coefficients provided by extCoeffs which should come from Schlafly and Finkbeiner (2011) for the correct filters and in the same order as provided in bandpassDict. If false, this means it will not run the dereddening procedure.
@param [in] extCoeffs are the Schlafly and Finkbeiner (2011) (ApJ, 737, 103) coefficients for the given filters from bandpassDict and need to be in the same order as bandpassDict. The default given are the SDSS [u,g,r,i,z] values.
@param [out] sedMatches is a list with the name of a model SED that matches most closely to each object in the catalog.
@param [out] magNormMatches are the magnitude normalizations for the given magnitudes and matched SED.
@param [out] matchErrors contains the Mean Squared Error between the colors of each object and the colors of the matched SED. """
#Set up photometry to calculate model Mags bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'), bandpassRoot = 'sdss_') else:
#Calculate ebv from ra, dec coordinates if needed #Check that catRA and catDec are included #If only matching one object need to reshape for calculateEbv raDec = raDec.reshape((2,1)) else:
#This is done to handle objects with incomplete magnitude data % (currentIndex)) #Don't need to assign 'None' here in result array, b/c 'None' is default value else: galPhot, mag_error = mag_error, redshift = catRedshifts[currentIndex], filtRange = filtNums) else:
len(catMags)))
|