Skip to content

Commit

Permalink
Merge pull request #711 from cta-observatory/interp_irfs
Browse files Browse the repository at this point in the history
Update DL3 Tool to to use pyirf IRF interpolation functions
  • Loading branch information
rlopezcoto authored May 4, 2023
2 parents b3335ae + ec65c04 commit e41d81d
Show file tree
Hide file tree
Showing 14 changed files with 1,511 additions and 138 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ dependencies:
- pip:
- ctapipe_io_lst~=0.18.2
- ctaplot~=0.6.2
- pyirf~=0.6.0
- pyirf==0.7
20 changes: 17 additions & 3 deletions lstchain/high_level/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,30 @@
get_timing_params,
set_expected_pos_to_reco_altaz,
)
from .interpolate import (
check_in_delaunay_triangle,
compare_irfs,
get_nearest_az_node,
interp_params,
interpolate_irf,
load_irf_grid,
)

__all__ = [
"add_icrs_position_params",
'analyze_on_off',
'analyze_wobble',
"analyze_on_off",
"analyze_wobble",
"check_in_delaunay_triangle",
"compare_irfs",
"create_event_list",
"create_hdu_index_hdu",
"create_obs_index_hdu",
"get_nearest_az_node",
"get_pointing_params",
"get_timing_params",
"interp_params",
"interpolate_irf",
"load_irf_grid",
"set_expected_pos_to_reco_altaz",
'setup_logging',
"setup_logging",
]
22 changes: 13 additions & 9 deletions lstchain/high_level/hdu_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@

import astropy.units as u
import numpy as np
from astropy.coordinates import SkyCoord, AltAz
from astropy.coordinates import AltAz, SkyCoord
from astropy.coordinates.erfa_astrom import ErfaAstromInterpolator, erfa_astrom
from astropy.io import fits
from astropy.table import Table, QTable
from astropy.table import QTable, Table
from astropy.time import Time

from lstchain.__init__ import __version__
from lstchain.reco.utils import location, camera_to_altaz
from lstchain.reco.utils import camera_to_altaz, location

__all__ = [
"add_icrs_position_params",
"create_event_list",
"create_hdu_index_hdu",
"create_obs_index_hdu",
"get_pointing_params",
"get_timing_params",
"set_expected_pos_to_reco_altaz",
"get_pointing_params",
"get_timing_params",
]

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -235,9 +236,8 @@ def create_hdu_index_hdu(

def get_timing_params(data, epoch=LST_EPOCH):
"""
Get event lists and retrieve some timing parameters for the DL3 event list
as a dict
Retrieve some timing parameters for the DL3 event list
as a dict.
"""
time_utc = Time(data["dragon_time"], format="unix", scale="utc")
t_start_iso = time_utc[0].to_value("iso", "date_hms")
Expand Down Expand Up @@ -342,8 +342,8 @@ def set_expected_pos_to_reco_altaz(data):


def create_event_list(
data, run_number, source_name, source_pos, effective_time, elapsed_time,
epoch=LST_EPOCH,
data, run_number, source_name, source_pos,
effective_time, elapsed_time, data_pars, epoch=LST_EPOCH,
):
"""
Create the event_list BinTableHDUs from the given data
Expand All @@ -362,6 +362,7 @@ def create_event_list(
Float
elapsed_time: Total elapsed time of triggered events of the run
Float
data_pars:
Returns
-------
Expand Down Expand Up @@ -491,6 +492,9 @@ def create_event_list(
)

pnt_header["TIMEREF"] = ev_header["TIMEREF"]
pnt_header["MEAN_ZEN"] = str(data_pars["ZEN_PNT"])
pnt_header["MEAN_AZ"] = str(data_pars["AZ_PNT"])
pnt_header["B_DELTA"] = str(data_pars["B_DELTA"])

# Create HDUs
event = fits.BinTableHDU(event_table, header=ev_header, name="EVENTS")
Expand Down
Loading

0 comments on commit e41d81d

Please sign in to comment.