Zero point in the output of singleFrameDriver.py


(Ying-Tung Chen) #1

Hi,

I were using the FLUXMAG0 in the header of CORR-*fits to calculate the zero point (and magnitude) for the data processed with hscPipe 5. But this information is no longer in the data processed with hscPipe 7.9.1.

I wonder if anyone can give me a hint for how to calculate/obtain the apparent magnitude from the output of hscPipe 7.9.1, which has T_MAGZER =0 in the header and only has many *instFlux in the SRC-*.fits.

Charles


(Lauren MacArthur) #2

I believe the plan is to add this header back, but in the meantime you can get it from the photoCalib() associated with the calexp, e.g.
fluxMag0 = calexp.getPhotoCalib().getInstFluxAtZeroMagnitude()


(Ying-Tung Chen) #3

Just write piece of code according this reference.
Is this a right way to get magnitude?

import numpy as np
import lsst.daf.persistence as dafPersist

butler = dafPersist.Butler("~/HSC/rerun/[rerun]")
dataId = {'visit':175198, 'ccd':73}
ce = butler.get('calexp', dataId)
src = butler.get('src', dataId)
tmag = -2.5*np.log10( src.columns.getPsfInstFlux() / ce.getPhotoCalib().getInstFluxAtZeroMagnitude())

(Natelust) #4

I think you can just use the ce.instFluxToMagnitude method. There are a few different overloads. You can see the documentation (in c++ but it mostly carries through to the python) here


(John Parejko) #5

If you have an exposure and the source catalog derived from it and want to compute the fluxes and magnitudes for all of the fields in that catalog, you are best off using calexp.getPhotoCalib().calibrateCatalog().


(Paul Price) #6

If you don’t need the actual calexp image, don’t bother reading the whole thing in. Instead:

photoCalib = butler.get("calexp_photoCalib", visit=175198, ccd=73)

(Ying-Tung Chen) #7

Thanks for your replies. Paul, do you mean that to replace ce = butler.get('calexp', dataId) with following line, right?


(John Parejko) #8

Yes, that should be the best way to get the PhotoCalib associated with that exposure.

Note that we strongly recommend using the built-in PhotoCalib methods (e.g. instFluxToNanojansky, instFluxToMagnitude, calibrateCatalog, and calibrateImage) instead of doing your own math with an exposure-averaged flux magnitude zero point, because the calibration factor may vary across the image.