From 13173660726546dd2b5e8461b667184df3a06145 Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Fri, 25 Oct 2024 10:57:07 +0200 Subject: [PATCH 1/6] Add MAGIC+LST-1 performance --- .../MAGIC_LST1_low_zenith_performance.ecsv | 41 +++++++++++++++++++ .../MAGIC_LST1_mid_zenith_performance.ecsv | 41 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/iact_estimator/resources/MAGIC_LST1_low_zenith_performance.ecsv create mode 100644 src/iact_estimator/resources/MAGIC_LST1_mid_zenith_performance.ecsv diff --git a/src/iact_estimator/resources/MAGIC_LST1_low_zenith_performance.ecsv b/src/iact_estimator/resources/MAGIC_LST1_low_zenith_performance.ecsv new file mode 100644 index 0000000..1fc73a9 --- /dev/null +++ b/src/iact_estimator/resources/MAGIC_LST1_low_zenith_performance.ecsv @@ -0,0 +1,41 @@ +# %ECSV 1.0 +# --- +# datatype: +# - {name: min_energy, unit: GeV, datatype: float64} +# - {name: max_energy, unit: GeV, datatype: float64} +# - {name: gamma_rate, unit: 1 / min, datatype: float64} +# - {name: background_rate, unit: 1 / min, datatype: float64} +# meta: +# __serialized_columns__: +# background_rate: +# __class__: astropy.units.quantity.Quantity +# unit: !astropy.units.Unit {unit: 1 / min} +# value: !astropy.table.SerializedColumn {name: background_rate} +# gamma_rate: +# __class__: astropy.units.quantity.Quantity +# unit: !astropy.units.Unit {unit: 1 / min} +# value: !astropy.table.SerializedColumn {name: gamma_rate} +# max_energy: +# __class__: astropy.units.quantity.Quantity +# unit: &id001 !astropy.units.Unit {unit: GeV} +# value: !astropy.table.SerializedColumn {name: max_energy} +# min_energy: +# __class__: astropy.units.quantity.Quantity +# unit: *id001 +# value: !astropy.table.SerializedColumn {name: min_energy} +# name: MAGIC_LST1_low_zenith +# schema: astropy-2.0 +min_energy max_energy gamma_rate background_rate +39.81071705534972 63.09573444801933 0.3795 0.8887 +63.09573444801933 100.0 2.5808 1.6505 +100.0 158.48931924611136 2.8257 0.57688 +158.48931924611136 251.188643150958 1.6654 0.050804 +251.188643150958 398.1071705534973 1.3289 0.020521 +398.1071705534973 630.9573444801933 1.2871 0.021718 +630.9573444801933 1000.0 0.8834 0.0056106 +1000.0 1584.8931924611143 0.7045 0.0039491 +1584.8931924611143 2511.886431509581 0.3908 0.0032053 +2511.886431509581 3981.0717055349733 0.1963 0.0018074 +3981.0717055349733 6309.573444801933 0.089 0.00073253 +6309.573444801933 10000.0 0.0368 1.1352e-05 +10000.0 15848.931924611143 0.0 0.0 diff --git a/src/iact_estimator/resources/MAGIC_LST1_mid_zenith_performance.ecsv b/src/iact_estimator/resources/MAGIC_LST1_mid_zenith_performance.ecsv new file mode 100644 index 0000000..ccf7288 --- /dev/null +++ b/src/iact_estimator/resources/MAGIC_LST1_mid_zenith_performance.ecsv @@ -0,0 +1,41 @@ +# %ECSV 1.0 +# --- +# datatype: +# - {name: min_energy, unit: GeV, datatype: float64} +# - {name: max_energy, unit: GeV, datatype: float64} +# - {name: gamma_rate, unit: 1 / min, datatype: float64} +# - {name: background_rate, unit: 1 / min, datatype: float64} +# meta: +# __serialized_columns__: +# background_rate: +# __class__: astropy.units.quantity.Quantity +# unit: !astropy.units.Unit {unit: 1 / min} +# value: !astropy.table.SerializedColumn {name: background_rate} +# gamma_rate: +# __class__: astropy.units.quantity.Quantity +# unit: !astropy.units.Unit {unit: 1 / min} +# value: !astropy.table.SerializedColumn {name: gamma_rate} +# max_energy: +# __class__: astropy.units.quantity.Quantity +# unit: &id001 !astropy.units.Unit {unit: GeV} +# value: !astropy.table.SerializedColumn {name: max_energy} +# min_energy: +# __class__: astropy.units.quantity.Quantity +# unit: *id001 +# value: !astropy.table.SerializedColumn {name: min_energy} +# name: MAGIC_LST1_mid_zenith +# schema: astropy-2.0 +min_energy max_energy gamma_rate background_rate +39.81071705534972 63.09573444801933 0.0 0.0 +63.09573444801933 100.0 0.59 0.715 +100.0 158.48931924611136 2.43 1.42 +158.48931924611136 251.188643150958 2.65 0.307 +251.188643150958 398.1071705534973 2.03 0.093 +398.1071705534973 630.9573444801933 1.171 0.0229 +630.9573444801933 1000.0 0.899 0.0093 +1000.0 1584.8931924611143 0.806 0.0096 +1584.8931924611143 2511.886431509581 0.319 0.00264 +2511.886431509581 3981.0717055349733 0.185 0.0007 +3981.0717055349733 6309.573444801933 0.113 0.00138 +6309.573444801933 10000.0 0.084 0.00148 +10000.0 15848.931924611143 0.0 0.0 From af0a418326411896934403d814690c19a9ce5492 Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Fri, 25 Oct 2024 10:57:47 +0200 Subject: [PATCH 2/6] Add paths for MAGIC-LST-1 datasets --- src/iact_estimator/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/iact_estimator/__init__.py b/src/iact_estimator/__init__.py index 888c54d..73d51ca 100644 --- a/src/iact_estimator/__init__.py +++ b/src/iact_estimator/__init__.py @@ -39,3 +39,15 @@ ) """`~astropy.table.QTable` with energy bins, rate of gammas and background for mid zenith performance (30 to 45 degrees).""" + +MAGIC_LST1_LOW_ZENITH_PERFORMANCE = QTable.read( + RESOURCES_PATH / Path("MAGIC_LST1_low_zenith_performance.ecsv") +) +"""`~astropy.table.QTable` with energy bins, rate of gammas and background for +low zenith performance (0 to 30 degrees).""" + +MAGIC_LST1_MID_ZENITH_PERFORMANCE = QTable.read( + RESOURCES_PATH / Path("MAGIC_LST1_mid_zenith_performance.ecsv") +) +"""`~astropy.table.QTable` with energy bins, rate of gammas and background for +mid zenith performance (30 to 45 degrees).""" From 3b6017974c8f6e03c365a8e2d2c88091e08a3468 Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Fri, 25 Oct 2024 10:58:16 +0200 Subject: [PATCH 3/6] Allow use of MAGIC-LST1 datasets in prepare_data Fix inner quotes --- src/iact_estimator/core.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/iact_estimator/core.py b/src/iact_estimator/core.py index c42b5ff..798e717 100644 --- a/src/iact_estimator/core.py +++ b/src/iact_estimator/core.py @@ -12,6 +12,8 @@ from . import ( LOW_ZENITH_PERFORMANCE, MID_ZENITH_PERFORMANCE, + MAGIC_LST1_LOW_ZENITH_PERFORMANCE, + MAGIC_LST1_MID_ZENITH_PERFORMANCE, ) from .io import load_ebl from .spectral import crab_nebula_spectrum @@ -338,19 +340,30 @@ def prepare_data(config): performance_data = { "low": LOW_ZENITH_PERFORMANCE, "mid": MID_ZENITH_PERFORMANCE, + "magic_lst1_low": MAGIC_LST1_LOW_ZENITH_PERFORMANCE, + "magic_lst1_mid": MAGIC_LST1_MID_ZENITH_PERFORMANCE, } + if config["sum_trigger"] and config["magic_lst1"]: + message = "LST-1 is not compatible with the MAGIC SUM trigger." + " is not currently available." + logger.critical(message) + raise NotImplementedError(message) + if config["sum_trigger"] and config["zenith_performance"] == "low": message = "Low zenith performance with the SUM trigger" " is not currently available." logger.critical(message) raise NotImplementedError(message) - min_energy = performance_data[config["zenith_performance"]]["min_energy"] - max_energy = performance_data[config["zenith_performance"]]["max_energy"] + magic_lst1 = "magic_lst1_" if config["magic_lst1"] else "" + dataset = f"{magic_lst1}{config['zenith_performance']}" + + min_energy = performance_data[dataset]["min_energy"] + max_energy = performance_data[dataset]["max_energy"] energy_bins = np.append(min_energy.value, max_energy[-1].value) * min_energy.unit - gamma_rate = performance_data[config["zenith_performance"]]["gamma_rate"] - background_rate = performance_data[config["zenith_performance"]]["background_rate"] + gamma_rate = performance_data[dataset]["gamma_rate"] + background_rate = performance_data[dataset]["background_rate"] return energy_bins, gamma_rate, background_rate From 375201d675c98a5b525b62c48f359364bc08d208 Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Fri, 25 Oct 2024 10:58:38 +0200 Subject: [PATCH 4/6] Add name of instrument in SED plot label Fix inner quotes --- src/iact_estimator/plots.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/iact_estimator/plots.py b/src/iact_estimator/plots.py index 8af48a9..b331e71 100644 --- a/src/iact_estimator/plots.py +++ b/src/iact_estimator/plots.py @@ -156,7 +156,10 @@ def plot_sed( np.log10(max_energy.to_value(energy_unit)), 50, ) * u.Unit(energy_unit) - labeltext = rf"Expected SED ($T_{{obs}}$ = {config['observation_time']})" + performance_name = f"{'MAGIC+LST-1' if config['magic_lst1'] else 'MAGIC'} ({config['zenith_performance']} zenith)" + labeltext = ( + rf"{performance_name} Expected SED ($T_{{obs}}$ = {config['observation_time']})" + ) plt.plot( energy, energy * energy * crab_nebula_spectrum()(energy), From 18bb235614de3b28406c1190b3e286892df41003 Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Fri, 25 Oct 2024 11:00:41 +0200 Subject: [PATCH 5/6] Add new magic_lst1 option to config file --- src/iact_estimator/resources/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iact_estimator/resources/config.yml b/src/iact_estimator/resources/config.yml index 45190c4..7d4806f 100644 --- a/src/iact_estimator/resources/config.yml +++ b/src/iact_estimator/resources/config.yml @@ -14,6 +14,7 @@ extension: 0.0 deg redshift: -1 # redshift of the source (for the EBL absorption), if -1 then no absorption sum_trigger: False zenith_performance: "low" # "low"=0-30deg, "mid"=30-45deg +magic_lst1: True # you can check visibility of your source e.g. here: http://www.magic.iac.es/scheduler/ ebl_file_path: From ac5726f42eeec4f3c701da41d16ba8b1766dbc71 Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Fri, 25 Oct 2024 11:02:02 +0200 Subject: [PATCH 6/6] Add news fragment for PR #28 --- docs/source/changes/28.added.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/source/changes/28.added.rst diff --git a/docs/source/changes/28.added.rst b/docs/source/changes/28.added.rst new file mode 100644 index 0000000..563fea4 --- /dev/null +++ b/docs/source/changes/28.added.rst @@ -0,0 +1 @@ +Added support for MAGIC+LST-1 performance estimation.