dstndstn / tractor

The Tractor: measuring astronomical sources via probabilistic inference
Other
86 stars 24 forks source link

Expose data numbers and electron counts in info dict when loading SDSS images #24

Open bpartridge opened 10 years ago

bpartridge commented 10 years ago

[Low priority feature contribution]

Since we're incorporating sky noise in the model for the Inference project, it's useful to expose in tractor.Image instances the calculations described in http://data.sdss3.org/datamodel/files/BOSS_PHOTOOBJ/frames/RERUN/RUN/CAMCOL/frame.html :

If you have performed the above calculations, you can return the image to very close to the state it was in when input into the photometric pipeline, as follows:

dn= img/cimg+simg

These dn values are in the same units as the "data numbers" stored by the raw data files that come off the instrument. They are related to the detected number nelec of photo-electrons by:

nelec= dn*gain

The number of photo-electrons is the quantity that is statistically Poisson distributed. 

This patch simply returns image-size vectors in get_tractor_image_dr8 (which is also called if DR9 is passed) for the data-numbers and electron-counts. The caller can then do something like img, info = ...; img.counts = np.round(info['dn']).

dstndstn commented 10 years ago

Hi Brenton,

Sorry for leaving this on the back burner for so long! We could instead add a flag to convert the image into photo-electron units, if that would be useful. I'm a little hesitant to carry around extra image-sized arrays -- that code path is traversed in a lot of projects that don't care about Poisson statistics :)

cheers, --dustin