Zero point in the output of singleFrameDriver.py

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

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()

1 Like

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())
1 Like

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

1 Like

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().

1 Like

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)
1 Like

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

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.

2 Likes

I got an additional question: how can I get the zero point of single warp image (e.g.: warp-HSC-G-0-14,11-34490.fits) and stacked image (e.g.:calexp-HSC-G-0-14,11.fits).

I can get a value from following code, but I don’t sure what is I obtained:

dataId = {'filter': 'HSC-G', 'patch': '14,11', 'tract': 0}
exp = butler.get('deepCoadd_calexp', dataId)
exp.getPhotoCalib().getInstFluxAtZeroMagnitude()

or, where has a list of possible input for bulter.get? (I only found this)

The dataset name for a warp is deepCoadd_directWarp.

The code you pasted retrieves a particular coadd and determines the zero-point flux (without saving it).