Skip to content

Commit

Permalink
flatfielding factor instead of absolute & relative
Browse files Browse the repository at this point in the history
  • Loading branch information
StFroese committed Oct 27, 2023
1 parent 6817199 commit d86b064
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ctapipe/calib/camera/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _calibrate_dl1(self, event, tel_id):
dl1.peak_time -= remaining_shift

# Calibrate extracted charge
dl1.image *= dl1_calib.relative_factor / dl1_calib.absolute_factor
dl1.image *= dl1_calib.flatfielding_factor

# handle invalid pixels
if self.invalid_pixel_handler is not None:
Expand Down
6 changes: 4 additions & 2 deletions ctapipe/calib/camera/tests/test_calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def test_dl1_charge_calib(example_subarray):
relative = random.normal(1, 0.01, n_pixels)
y /= relative[:, np.newaxis]

# Define flatfielding coefficients
flatfielding = relative / absolute

# Define pedestal
pedestal = random.uniform(-4, 4, n_pixels)
y += pedestal[:, np.newaxis]
Expand All @@ -191,8 +194,7 @@ def test_dl1_charge_calib(example_subarray):
np.testing.assert_allclose(event.dl1.tel[tel_id].image, y.sum(1), rtol=1e-4)

event.calibration.tel[tel_id].dl1.pedestal_offset = pedestal
event.calibration.tel[tel_id].dl1.absolute_factor = absolute
event.calibration.tel[tel_id].dl1.relative_factor = relative
event.calibration.tel[tel_id].dl1.flatfielding_factor = flatfielding

# Test without timing corrections
calibrator(event)
Expand Down
13 changes: 4 additions & 9 deletions ctapipe/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,16 +523,11 @@ class DL1CameraCalibrationContainer(Container):
" This value is subtracted from the waveforms of each pixel before"
" the pulse extraction.",
)
absolute_factor = Field(
flatfielding_factor = Field(
1,
"Multiplicative coefficients for the absolute calibration of extracted charge into "
"physical units (e.g. photoelectrons or photons) for each pixel",
)
relative_factor = Field(
1,
"Multiplicative Coefficients for the relative correction between pixels to achieve a "
"uniform charge response (post absolute calibration) from a "
"uniform illumination.",
"Multiplicative coefficients for the relative correction between "
"pixels to achieve a uniform charge response "
"(post absolute calibration) from a uniform illumination.",
)
time_shift = Field(
None,
Expand Down
3 changes: 3 additions & 0 deletions docs/changes/2433.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Change DL1 charge calibration in event to be a single, relative coefficient
per channel / pixel instead of having an absolute factor for conversion to
p.e. and a relative factor for achieving a uniform charge distrubtion.

0 comments on commit d86b064

Please sign in to comment.