Skip to content

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

Open
bpartridge wants to merge 1 commit intodstndstn:mainfrom
bpartridge:features/counts
Open

Expose data numbers and electron counts in info dict when loading SDSS images#24
bpartridge wants to merge 1 commit intodstndstn:mainfrom
bpartridge:features/counts

Conversation

@bpartridge
Copy link
Collaborator

[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
Copy link
Owner

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

Copy link

@pyloolex pyloolex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

meancalib = np.mean(calibvec)
skysig = sqrt((meansky / gain) + darkvar) * meancalib

# Calculate the Poisson-distributed number of electrons detected by the instrument

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a better practice to end a sentence with the period.

Base automatically changed from master to main March 22, 2021 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants