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

Update DL3 Tool to to use pyirf IRF interpolation functions #711

Merged
merged 89 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
fe6acc2
Update DL3 Tool to be ready to use pyirf IRF interpolation functions
chaimain May 7, 2021
6dcc7d2
Update interpolation function to start using the test IRFs with diffe…
chaimain May 10, 2021
3091ad7
Clean irf/hdu_table and create a new file for fresh lstchain IRF inte…
chaimain May 12, 2021
a6c0cb4
Update the interpolation function further
chaimain May 18, 2021
fa231ae
Fix a minor test
chaimain May 19, 2021
1cc5413
Add test for IRF interpolation function
chaimain May 26, 2021
e1c50fe
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain May 26, 2021
95006b2
Some cleanup and fix for the interpolation parameter
chaimain Jun 3, 2021
15eeae4
Save the final interpolated IRF with the DL3 files properly
chaimain Jun 9, 2021
20bb180
Add filter for only cosmic events and some fix on the metadata values
chaimain Jul 2, 2021
4a7426c
Add metadata for mean zen and az for real data event list
chaimain Jul 5, 2021
2e07488
Add interpolation parameter of B_delta and using it instead of azimut…
chaimain Jul 16, 2021
6dd2f64
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Sep 21, 2021
817f2d1
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Sep 25, 2021
cf92187
Update interpolation parameter with the angle between geomagnetic fie…
chaimain Sep 28, 2021
1a59a83
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Sep 28, 2021
bad38a8
Update geomagnetic parameters as per average annual predicted change
chaimain Oct 7, 2021
fd5c781
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Oct 29, 2021
40490a8
Restructure some functions, add tests, for interpolation target value…
chaimain Nov 2, 2021
72d2303
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Nov 2, 2021
59b1962
Fix a test
chaimain Nov 2, 2021
8552e90
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Nov 4, 2021
98205a7
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Nov 5, 2021
b0d7123
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Nov 5, 2021
24243ae
fix last merge conflict
chaimain Nov 5, 2021
f608e7d
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Nov 8, 2021
d755680
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Jan 11, 2022
f8a8520
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Jan 14, 2022
0746dd4
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Jan 14, 2022
9a732c6
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Jan 24, 2022
7b8c26c
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Jan 27, 2022
fa86f68
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Feb 7, 2022
43974b2
Remove redundant function and some other fixes
chaimain Feb 7, 2022
e646df6
fix a test
chaimain Feb 7, 2022
e4336f2
Fix redefinitions
chaimain Feb 7, 2022
46bdc84
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain Feb 8, 2022
b0637ff
Fix some docs and default_value in a trait
chaimain Feb 9, 2022
f5e0b3e
Remove redundant function
chaimain Feb 9, 2022
6aa8bfb
Remove last mention of the redundant function
chaimain Feb 9, 2022
a9302e3
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain Mar 11, 2022
fddeab9
Add more accuracy to the sky pointing header values and use the full …
chaimain Mar 28, 2022
58b2635
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Apr 14, 2022
e9ae900
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Apr 14, 2022
4bbf64d
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Apr 25, 2022
bea16c6
Support for pyirf v0.7
chaimain Apr 25, 2022
5492fed
Add more precision to some angular parameters
chaimain Apr 25, 2022
2f2a7de
Update the correct arguments for Energy Dispersion interpolation
chaimain Apr 25, 2022
9ede7d3
Add PSF interpolation and update compare_irfs function
chaimain Apr 26, 2022
f798f80
Fix some imports
chaimain Apr 26, 2022
ff73373
Fix addition of astropy quantities to Header data and remove the extr…
chaimain May 2, 2022
a706411
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain May 2, 2022
8ba3b18
Fix an error in earlier merge
chaimain May 2, 2022
2f5793b
Fix formula with correct orientation of Azimuth - Eastwards
chaimain May 10, 2022
1fdff28
Add a fix on writing and reading quantities from fits headers
chaimain May 10, 2022
f308304
Use the latest ctaplot dependency
chaimain May 10, 2022
f6458d6
Merge branch 'master' into interp_irfs
chaimain May 10, 2022
f99865f
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain May 17, 2022
d75ee45
Fix the geomagnetic delta function and add precision on the sky point…
chaimain May 19, 2022
e2d19a1
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain May 19, 2022
d34df4d
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain May 19, 2022
3b45ae7
Temporary usage of code from pyirf PR https://github.com/cta-observat…
chaimain May 20, 2022
a2893c7
Fix function name
chaimain May 20, 2022
03df194
Add the option to just get the nearest IRF node and not perform any I…
chaimain May 22, 2022
9c5bad5
Fix default value for use_nearest_irf_node parameter
chaimain May 23, 2022
e5835d5
Remove the usage of Header comments to retrieve units of quantities a…
chaimain May 24, 2022
5db2a41
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain May 26, 2022
fde40c9
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain May 26, 2022
072be51
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain Jun 2, 2022
f30395d
Merge branch 'master' into interp_irfs
chaimain Jun 3, 2022
d00b0e6
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain Jun 7, 2022
6c3cfa5
Select from overlapping IRF nodes, those which are closer in azimuth …
chaimain Jun 7, 2022
94a51e6
Merge branch 'interp_irfs' of https://github.com/cta-observatory/cta-…
chaimain Jun 7, 2022
b20205d
Fix a small issue in using the nearest IRF node
chaimain Jun 14, 2022
eca1909
Merge branch 'master' into interp_irfs
chaimain Sep 5, 2022
24e665a
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Oct 21, 2022
5ab253d
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Oct 24, 2022
2687209
Update pyirf's interpolate_rad_max function
chaimain Oct 31, 2022
2182a1b
Fix the docstring on DL3 Tool
chaimain Oct 31, 2022
4872e82
Update pyirf with latest updates
chaimain Oct 31, 2022
0719962
Get latest pyirf
chaimain Oct 31, 2022
dcc6a68
Roll-back to pyirf v0.7 for the time being
chaimain Apr 18, 2023
ed993ed
Merge branch 'master' of https://github.com/cta-observatory/cta-lstch…
chaimain Apr 18, 2023
4991ebb
Sort the imports, add a test on get_nearest_az_node
chaimain Apr 21, 2023
bf5969e
Update docstrings and fix some formatting
chaimain Apr 21, 2023
a61b658
Add usage of src-dep IRF and IRFs with en-dep cuts for some tests
chaimain Apr 21, 2023
78223b7
Add more tests on IRF interpolations on more combinations of IRFs
chaimain Apr 24, 2023
57c154c
Update docstrings, some simple functionalities and tests
chaimain Apr 28, 2023
5c45465
Expand and simplify tests for compare_irf and fix an Error catch in D…
chaimain May 3, 2023
ec65c04
Fix typos
chaimain May 4, 2023
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 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",
chaimain marked this conversation as resolved.
Show resolved Hide resolved
"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__
chaimain marked this conversation as resolved.
Show resolved Hide resolved
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