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

Last updated scripts (4-LSTs): Torino group #180

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
20 changes: 14 additions & 6 deletions magicctapipe/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def RF_monly(gamma_stereo_monly, p_stereo_monly, temp_rf_monly, config_monly):


@pytest.fixture(scope="session")
def gamma_dl2(temp_DL1_gamma_test, RF, temp_DL2_gamma):
def gamma_dl2(temp_DL1_gamma_test, RF, temp_DL2_gamma, config):
"""
Produce a DL2 file
"""
Expand All @@ -651,6 +651,7 @@ def gamma_dl2(temp_DL1_gamma_test, RF, temp_DL2_gamma):
f"-d{str(file)}",
f"-r{str(RF)}",
f"-o{str(temp_DL2_gamma)}",
f"-c{str(config)}",
]
)

Expand All @@ -673,7 +674,9 @@ def gamma_dl2(temp_DL1_gamma_test, RF, temp_DL2_gamma):


@pytest.fixture(scope="session")
def gamma_dl2_monly(temp_DL1_gamma_test_monly, RF_monly, temp_DL2_gamma_monly):
def gamma_dl2_monly(
temp_DL1_gamma_test_monly, RF_monly, temp_DL2_gamma_monly, config_monly
):
"""
Produce a DL2 file
"""
Expand All @@ -685,6 +688,7 @@ def gamma_dl2_monly(temp_DL1_gamma_test_monly, RF_monly, temp_DL2_gamma_monly):
f"-d{str(file)}",
f"-r{str(RF_monly)}",
f"-o{str(temp_DL2_gamma_monly)}",
f"-c{str(config_monly)}",
]
)

Expand Down Expand Up @@ -742,7 +746,7 @@ def IRF_monly(gamma_dl2_monly, config_monly, temp_irf_monly):


@pytest.fixture(scope="session")
def p_dl2(temp_DL1_p_test, RF, temp_DL2_p):
def p_dl2(temp_DL1_p_test, RF, temp_DL2_p, config):
"""
Produce a DL2 file
"""
Expand All @@ -754,13 +758,14 @@ def p_dl2(temp_DL1_p_test, RF, temp_DL2_p):
f"-d{str(file)}",
f"-r{str(RF)}",
f"-o{str(temp_DL2_p)}",
f"-c{str(config)}",
]
)
return temp_DL2_p


@pytest.fixture(scope="session")
def p_dl2_monly(temp_DL1_p_test_monly, RF_monly, temp_DL2_p_monly):
def p_dl2_monly(temp_DL1_p_test_monly, RF_monly, temp_DL2_p_monly, config_monly):
"""
Produce a DL2 file
"""
Expand All @@ -772,6 +777,7 @@ def p_dl2_monly(temp_DL1_p_test_monly, RF_monly, temp_DL2_p_monly):
f"-d{str(file)}",
f"-r{str(RF_monly)}",
f"-o{str(temp_DL2_p_monly)}",
f"-c{str(config_monly)}",
]
)
return temp_DL2_p_monly
Expand Down Expand Up @@ -951,7 +957,7 @@ def stereo_monly(merge_magic_monly, temp_stereo_monly, config_monly):


@pytest.fixture(scope="session")
def real_dl2(coincidence_stereo, RF, temp_DL2_real):
def real_dl2(coincidence_stereo, RF, temp_DL2_real, config):
"""
Produce a DL2 file
"""
Expand All @@ -963,13 +969,14 @@ def real_dl2(coincidence_stereo, RF, temp_DL2_real):
f"-d{str(file)}",
f"-r{str(RF)}",
f"-o{str(temp_DL2_real)}",
f"-c{str(config)}",
]
)
return temp_DL2_real


@pytest.fixture(scope="session")
def real_dl2_monly(stereo_monly, RF_monly, temp_DL2_real_monly):
def real_dl2_monly(stereo_monly, RF_monly, temp_DL2_real_monly, config_monly):
"""
Produce a DL2 file
"""
Expand All @@ -981,6 +988,7 @@ def real_dl2_monly(stereo_monly, RF_monly, temp_DL2_real_monly):
f"-d{str(file)}",
f"-r{str(RF_monly)}",
f"-o{str(temp_DL2_real_monly)}",
f"-c{str(config_monly)}",
]
)
return temp_DL2_real_monly
Expand Down
4 changes: 0 additions & 4 deletions magicctapipe/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
format_object,
get_dl2_mean,
get_stereo_events,
get_stereo_events_old,
load_dl2_data_file,
load_irf_files,
load_lst_dl1_data_file,
load_magic_dl1_data_files,
load_mc_dl2_data_file,
load_train_data_files,
load_train_data_files_tel,
resource_file,
save_pandas_data_in_table,
Expand All @@ -42,13 +40,11 @@
"format_object",
"get_dl2_mean",
"get_stereo_events",
"get_stereo_events_old",
"load_dl2_data_file",
"load_irf_files",
"load_lst_dl1_data_file",
"load_magic_dl1_data_files",
"load_mc_dl2_data_file",
"load_train_data_files",
"load_train_data_files_tel",
"save_pandas_data_in_table",
"telescope_combinations",
Expand Down
17 changes: 7 additions & 10 deletions magicctapipe/io/gadf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from magicctapipe import __version__
from magicctapipe.utils.functions import HEIGHT_ORM, LAT_ORM, LON_ORM

# from .io import telescope_combinations
from .io import telescope_combinations

__all__ = [
"create_gh_cuts_hdu",
Expand Down Expand Up @@ -90,7 +90,7 @@ def create_gh_cuts_hdu(gh_cuts, reco_energy_bins, fov_offset_bins, **header_card


def create_event_hdu(
event_table, on_time, deadc, source_name, source_ra=None, source_dec=None
event_table, config, on_time, deadc, source_name, source_ra=None, source_dec=None
):
"""
Creates a fits binary table HDU for shower events.
Expand All @@ -99,17 +99,19 @@ def create_event_hdu(
----------
event_table : astropy.table.table.QTable
Table of the DL2 events surviving gammaness cuts
config : dict
Dictionary with information about the telescope IDs.
on_time : astropy.table.table.QTable
ON time of the input data
deadc : float
Dead time correction factor
source_name : str
Name of the observed source
source_ra : str, optional
source_ra : str
Right ascension of the observed source, whose format should be
acceptable by `astropy.coordinates.sky_coordinate.SkyCoord`
(Used only when the source name cannot be resolved)
source_dec : str, optional
source_dec : str
Declination of the observed source, whose format should be
acceptable by `astropy.coordinates.sky_coordinate.SkyCoord`
(Used only when the source name cannot be resolved)
Expand All @@ -125,12 +127,7 @@ def create_event_hdu(
If the source name cannot be resolved and also either or both of
source RA/Dec coordinate is set to None
"""
TEL_COMBINATIONS = {
"M1_M2": [2, 3], # combo_type = 0
"LST1_M1": [1, 2], # combo_type = 1
"LST1_M2": [1, 3], # combo_type = 2
"LST1_M1_M2": [1, 2, 3], # combo_type = 3
} # TODO: REMOVE WHEN SWITCHING TO THE NEW RFs IMPLEMENTTATION (1 RF PER TELESCOPE)
_, TEL_COMBINATIONS = telescope_combinations(config)

mjdreff, mjdrefi = np.modf(MJDREF.mjd)

Expand Down
Loading