Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatfielding factor instead of absolute & relative factor for amplitude correction #2433

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.