Skip to content

Commit

Permalink
Merge pull request #1062 from cta-observatory/calibration_bug_fixes
Browse files Browse the repository at this point in the history
Calibration bug fixes
  • Loading branch information
rlopezcoto authored Dec 14, 2022
2 parents 3a04678 + d9cdf8c commit 7dc71a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lstchain/calib/camera/pedestals.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def calculate_pedestal_results(self, trace_integral, masked_pixels_of_sample):
)

# mask pixels with NaN mean, due to missing statistics
pixels_without_stat = np.where(np.isnan(pixel_mean)==True)[0]
pixels_without_stat = np.where(np.isnan(pixel_mean)==True)
charge_median_outliers[pixels_without_stat] = True
charge_std_outliers[pixels_without_stat] = True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def main():
"onsite_create_calibration_file",
f"-r {run}",
f"-v {prod_id}",
f"--r0-dir {r0_dir}",
f"--sub_run={sub_run}",
f"-b {base_dir}",
f"-s {stat_events}",
Expand Down
21 changes: 13 additions & 8 deletions lstchain/visualization/plot_calib.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ def plot_all(ped_data, ff_data, calib_data, run=0, plot_file=None):
pad = 420
image = ff_data.charge_median
mask = ff_data.charge_median_outliers

for chan in np.arange(2):
pad += 1
plt.subplot(pad)
plt.tight_layout()
select = np.logical_not(mask[chan])
disp = CameraDisplay(camera)
mymin = np.median(image[chan]) - 2 * np.std(image[chan])
mymax = np.median(image[chan]) + 2 * np.std(image[chan])
mymin = np.median(image[chan][select]) - 2 * np.std(image[chan][select])
mymax = np.median(image[chan][select]) + 2 * np.std(image[chan][select])
disp.set_limits_minmax(mymin, mymax)
disp.highlight_pixels(mask[chan], linewidth=2)
disp.image = image[chan]
Expand All @@ -104,9 +106,10 @@ def plot_all(ped_data, ff_data, calib_data, run=0, plot_file=None):
pad += 1
plt.subplot(pad)
plt.tight_layout()
select = np.logical_not(mask[chan])
disp = CameraDisplay(camera)
mymin = np.median(image[chan]) - 2 * np.std(image[chan])
mymax = np.median(image[chan]) + 2 * np.std(image[chan])
mymin = np.median(image[chan][select]) - 2 * np.std(image[chan][select])
mymax = np.median(image[chan][select]) + 2 * np.std(image[chan][select])
disp.set_limits_minmax(mymin, mymax)
disp.highlight_pixels(mask[chan], linewidth=2)
disp.image = image[chan]
Expand All @@ -121,9 +124,10 @@ def plot_all(ped_data, ff_data, calib_data, run=0, plot_file=None):
pad += 1
plt.subplot(pad)
plt.tight_layout()
select = np.logical_not(mask[chan])
disp = CameraDisplay(camera)
mymin = np.median(image[chan]) - 2 * np.std(image[chan])
mymax = np.median(image[chan]) + 2 * np.std(image[chan])
mymin = np.median(image[chan][select]) - 2 * np.std(image[chan][select])
mymax = np.median(image[chan][select]) + 2 * np.std(image[chan][select])
disp.set_limits_minmax(mymin, mymax)
disp.highlight_pixels(mask[chan], linewidth=2)
disp.image = image[chan]
Expand All @@ -138,9 +142,10 @@ def plot_all(ped_data, ff_data, calib_data, run=0, plot_file=None):
pad += 1
plt.subplot(pad)
plt.tight_layout()
select = np.logical_not(mask[chan])
disp = CameraDisplay(camera)
mymin = np.median(image[chan]) - 2 * np.std(image[chan])
mymax = np.median(image[chan]) + 2 * np.std(image[chan])
mymin = np.median(image[chan][select]) - 2 * np.std(image[chan][select])
mymax = np.median(image[chan][select]) + 2 * np.std(image[chan][select])
disp.set_limits_minmax(mymin, mymax)
disp.highlight_pixels(mask[chan], linewidth=2)
disp.image = image[chan]
Expand Down

0 comments on commit 7dc71a6

Please sign in to comment.