Skip to content

Commit

Permalink
Merge pull request #72 from cta-observatory/coma-aberration
Browse files Browse the repository at this point in the history
Coma aberration
  • Loading branch information
aleberti authored Jun 20, 2022
2 parents 5c3d98a + 96137c9 commit d636084
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions magicctapipe/scripts/lst1_magic/lst1_magic_event_coincidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from astropy.time import Time
from ctapipe.containers import EventType
from ctapipe.instrument import SubarrayDescription
from ctapipe.coordinates import CameraFrame
from lstchain.reco.utils import add_delta_t_key
from magicctapipe.utils import (
check_tel_combination,
Expand All @@ -57,6 +58,9 @@

accuracy_time = 1e-7 # final digit of a timestamp, unit: [sec]

nominal_foclen_lst = 28 # unit: [m]
effective_foclen_lst = 29.30565 # unit: [m]

tel_names = {
1: 'LST-1',
2: 'MAGIC-I',
Expand Down Expand Up @@ -98,10 +102,10 @@ def load_lst_data_file(input_file):

try:
# Try to load DL2 data at first:
event_data = pd.read_hdf(input_file, key=f'dl2/event/telescope/parameters/LST_LSTCam')
event_data = pd.read_hdf(input_file, key='dl2/event/telescope/parameters/LST_LSTCam')
except:
# Load DL1 data:
event_data = pd.read_hdf(input_file, key=f'dl1/event/telescope/parameters/LST_LSTCam')
event_data = pd.read_hdf(input_file, key='dl1/event/telescope/parameters/LST_LSTCam')

event_data.set_index(['obs_id', 'event_id', 'tel_id'], inplace=True)
event_data.sort_index(inplace=True)
Expand Down Expand Up @@ -156,6 +160,11 @@ def load_lst_data_file(input_file):
# Read the subarray description:
subarray = SubarrayDescription.from_hdf(input_file)

if focal_length == nominal_foclen_lst:
# Set the effective focal length to the subarray:
subarray.tel[1].optics.equivalent_focal_length = u.Quantity(effective_foclen_lst, u.m)
subarray.tel[1].camera.geometry.frame = CameraFrame(focal_length=u.Quantity(effective_foclen_lst, u.m))

return event_data, subarray


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def mc_dl0_to_dl1(input_file, output_dir, config, muons_analysis):
logger.info('\nLoading the input file:')
logger.info(input_file)

event_source = EventSource(input_file)
event_source = EventSource(input_file, focal_length_choice='effective')

obs_id = event_source.obs_ids[0]
subarray = event_source.subarray
Expand Down

0 comments on commit d636084

Please sign in to comment.