spacetelescope / hstcal

Calibration for HST/WFC3, HST/ACS, and HST/STIS
BSD 3-Clause "New" or "Revised" License
11 stars 29 forks source link

wfc3cte - possible incorrect conversion from DN to electrons #72

Open jamienoss opened 7 years ago

jamienoss commented 7 years ago

The following code:

 gain=wf3->ccdgain;

    /*REFORMAT TO RAZ*/
    makeRAZ(cd,ab,raz);

    /*SUBTRACT THE EXTRA BIAS CALCULATED, AND MULTIPLY BY THE GAIN
      Note that for user subarray the image is in only 1 quad, and only
      has prescan bias pixels so the regions are different for full and subarrays
    */
    if (wf3->subarray){
        findPreScanBias(raz, bias_pre, bsig_pre);
        for (k=0;k<4;k++){
            for (i=0; i<subcol;i++){
                for (j=0;j<RAZ_ROWS; j++){
                    if(Pix(raz->dq.data,i+k*subcol,j))
                        Pix(raz->sci.data,i+k*subcol,j) -= bias_pre[k];
                        Pix(raz->sci.data,i+k*subcol,j) *= gain;
                }
            }
        }
    } else {
        findPostScanBias(raz, bias_post, bsig_post);
        for (k=0;k<4;k++){
            for (i=0; i<subcol;i++){
                for (j=0;j<RAZ_ROWS; j++){
                    Pix(raz->sci.data,i+k*subcol,j) -= bias_post[k];
                    Pix(raz->sci.data,i+k*subcol,j) *= gain;
                }
            }
        }
    }

    return(status);

Here this uses the command gain WF3Info::ccdgain rather than the actual amp gain WF3Info::atodgain[].

jamienoss commented 7 years ago

@sosey, @stsci-hack, @JayVB FYI

sosey commented 7 years ago

yah, I believe the fortran code was doing the same. I can ask the science team if they want to change it to the atodgain instead. There's a similar thing in the calwf3 code somewhere else. If they agree we can update this for 2017.2

jamienoss commented 7 years ago

@sosey Just to clarify and not leave anything hanging, I take it that this isn't being shipped in 2017.2?

sosey commented 7 years ago

No, the team is not changing this. Please do not tag it.

jamienoss commented 7 years ago

Copy that.