Skip to content

Commit

Permalink
Merge pull request #132 from lsst-camera-dh/LSSTTD-1523
Browse files Browse the repository at this point in the history
LSSTTD-1523
  • Loading branch information
jchiang87 authored Jan 31, 2021
2 parents db7f1f2 + 964d739 commit 44c1eb2
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions python/lsst/eotest/sensor/spotTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

from .MaskedCCD import MaskedCCD
from .AmplifierGeometry import parse_geom_kwd
def make_ccd_mosaic(infile, bias_frame=None, dark_frame=None, gains=None):

def make_ccd_mosaic(infile, bias_frame=None, dark_frame=None, gains=None, linearity_correction=None):
"""Create a full CCD image mosaic.
Combine the 16 amplifier arrays into a single array, performing
Expand All @@ -36,7 +36,7 @@ def make_ccd_mosaic(infile, bias_frame=None, dark_frame=None, gains=None):
afwImage object containing CCD mosaic image.
"""

ccd = MaskedCCD(infile, bias_frame=bias_frame, dark_frame=dark_frame)
ccd = MaskedCCD(infile, bias_frame=bias_frame, dark_frame=dark_frame, linearity_correction=None)

## Get amp geometry information
foo = fits.open(infile)
Expand All @@ -45,6 +45,7 @@ def make_ccd_mosaic(infile, bias_frame=None, dark_frame=None, gains=None):
ny_segments = 2
nx = nx_segments*(datasec['xmax'] - datasec['xmin'] + 1)
ny = ny_segments*(datasec['ymax'] - datasec['ymin'] + 1)
raw = np.zeros((ny, nx), dtype=np.float32)
mosaic = np.zeros((ny, nx), dtype=np.float32)

for ypos in range(ny_segments):
Expand All @@ -69,7 +70,9 @@ def make_ccd_mosaic(infile, bias_frame=None, dark_frame=None, gains=None):
subarr *= gains[amp]

## Assign to final array
mosaic[ymin:ymax, xmin:xmax] = subarr
raw[ymin:ymax, xmin:xmax] = subarr

mosaic[:, : ] = raw[:, ::-1]

image = afwImage.ImageF(mosaic)
return image
Expand All @@ -96,7 +99,8 @@ class SpotTask(pipeBase.Task):
_DefaultName = "SpotTask"

@pipeBase.timeMethod
def run(self, sensor_id, infile, gains, bias_frame=None, flat_frame=None, dark_frame=None):
def run(self, sensor_id, infile, gains, bias_frame=None, flat_frame=None, dark_frame=None,
linearity_correction=None, read_noise=6.5):

## Process a CCD image mosaic
if self.config.verbose:
Expand All @@ -111,6 +115,11 @@ def run(self, sensor_id, infile, gains, bias_frame=None, flat_frame=None, dark_f
image = afwImage.ImageF(imarr*np.median(flatarr)/flatarr)
exposure = afwImage.ExposureF(image.getBBox())
exposure.setImage(image)

## Add variance plane
var = exposure.image
var += read_noise**2.
exposure.setVariance(var)

## Set up and run characterize task
char_nsig = self.config.characterize_nsig
Expand Down

0 comments on commit 44c1eb2

Please sign in to comment.