diff --git a/docs/lstchain_api/scripts/index.rst b/docs/lstchain_api/scripts/index.rst index f087fa9587..d2006908c5 100644 --- a/docs/lstchain_api/scripts/index.rst +++ b/docs/lstchain_api/scripts/index.rst @@ -9,7 +9,6 @@ The scripts to be executed from the command line are described below: Currently both `scripts` and `Tools` are meant to be run from the command line. Please see also :ref:`tools` section for more information. -* `lstchain_add_source_dependent_parameters`_ * `lstchain_check_dl1`_ * `lstchain_create_run_summary`_ * `lstchain_data_create_time_calibration_file`_ @@ -30,20 +29,6 @@ The scripts to be executed from the command line are described below: * `lstchain_tune_nsb`_ -.. _lstchain_add_source_dependent_parameters: - -lstchain_add_source_dependent_parameters -++++++++++++++++++++++++++++++++++++++++ - -.. automodule:: lstchain.scripts.lstchain_add_source_dependent_parameters - -Usage ------ -.. argparse:: - :module: lstchain.scripts.lstchain_add_source_dependent_parameters - :func: parser - :prog: lstchain_add_source_dependent_parameters - .. _lstchain_check_dl1: lstchain_check_dl1 @@ -296,4 +281,4 @@ Usage .. argparse:: :module: lstchain.scripts.lstchain_dump_config :func: build_parser - :prog: lstchain_dump_config \ No newline at end of file + :prog: lstchain_dump_config diff --git a/lstchain/reco/dl1_to_dl2.py b/lstchain/reco/dl1_to_dl2.py index a78d78245b..fec9342004 100644 --- a/lstchain/reco/dl1_to_dl2.py +++ b/lstchain/reco/dl1_to_dl2.py @@ -8,6 +8,7 @@ """ import os +import logging import astropy.units as u import joblib @@ -31,6 +32,10 @@ from ctapipe.image.hillas import camera_to_shower_coordinates from ctapipe.instrument import SubarrayDescription +from ctapipe.coordinates import CameraFrame, TelescopeFrame +from ctapipe_io_lst import OPTICS + +logger = logging.getLogger(__name__) __all__ = [ 'apply_models', @@ -43,6 +48,7 @@ 'train_energy', 'train_reco', 'train_sep', + 'update_disp_with_effective_focal_length' ] @@ -67,15 +73,15 @@ def train_energy(train, custom_config=None): features = config['energy_regression_features'] model = RandomForestRegressor - print("Given features: ", features) - print("Number of events for training: ", train.shape[0]) - print("Training Random Forest Regressor for Energy Reconstruction...") + logger.info("Given features: ", features) + logger.info("Number of events for training: ", train.shape[0]) + logger.info("Training Random Forest Regressor for Energy Reconstruction...") reg = model(**energy_regression_args) reg.fit(train[features], train['log_mc_energy']) - print("Model {} trained!".format(model)) + logger.info("Model {} trained!".format(model)) return reg @@ -105,16 +111,16 @@ def train_disp_vector(train, custom_config=None, predict_features=None): features = config['disp_regression_features'] model = RandomForestRegressor - print("Given features: ", features) - print("Number of events for training: ", train.shape[0]) - print("Training model {} for disp vector regression".format(model)) + logger.info("Given features: ", features) + logger.info("Number of events for training: ", train.shape[0]) + logger.info("Training model {} for disp vector regression".format(model)) reg = model(**disp_regression_args) x = train[features] y = np.transpose([train[f] for f in predict_features]) reg.fit(x, y) - print("Model {} trained!".format(model)) + logger.info("Model {} trained!".format(model)) return reg @@ -139,16 +145,16 @@ def train_disp_norm(train, custom_config=None, predict_feature='disp_norm'): features = config['disp_regression_features'] model = RandomForestRegressor - print("Given features: ", features) - print("Number of events for training: ", train.shape[0]) - print("Training model {} for disp norm regression".format(model)) + logger.info("Given features: ", features) + logger.info("Number of events for training: ", train.shape[0]) + logger.info("Training model {} for disp norm regression".format(model)) reg = model(**disp_regression_args) x = train[features] y = np.transpose(train[predict_feature]) reg.fit(x, y) - print("Model {} trained!".format(model)) + logger.info("Model {} trained!".format(model)) return reg @@ -173,16 +179,16 @@ def train_disp_sign(train, custom_config=None, predict_feature='disp_sign'): features = config["disp_classification_features"] model = RandomForestClassifier - print("Given features: ", features) - print("Number of events for training: ", train.shape[0]) - print("Training model {} for disp sign classification".format(model)) + logger.info("Given features: ", features) + logger.info("Number of events for training: ", train.shape[0]) + logger.info("Training model {} for disp sign classification".format(model)) clf = model(**classification_args) x = train[features] y = np.transpose(train[predict_feature]) clf.fit(x, y) - print("Model {} trained!".format(model)) + logger.info("Model {} trained!".format(model)) return clf @@ -211,24 +217,24 @@ def train_reco(train, custom_config=None): disp_features = config['disp_regression_features'] model = RandomForestRegressor - print("Given energy_features: ", energy_features) - print("Number of events for training: ", train.shape[0]) - print("Training Random Forest Regressor for Energy Reconstruction...") + logger.info("Given energy_features: ", energy_features) + logger.info("Number of events for training: ", train.shape[0]) + logger.info("Training Random Forest Regressor for Energy Reconstruction...") reg_energy = model(**energy_regression_args) reg_energy.fit(train[energy_features], train['log_mc_energy']) - print("Random Forest trained!") - print("Given disp_features: ", disp_features) - print("Training Random Forest Regressor for disp_norm Reconstruction...") + logger.info("Random Forest trained!") + logger.info("Given disp_features: ", disp_features) + logger.info("Training Random Forest Regressor for disp_norm Reconstruction...") reg_disp = RandomForestRegressor(**disp_regression_args) reg_disp.fit(train[disp_features], train['disp_norm']) - print("Random Forest trained!") - print("Done!") + logger.info("Random Forest trained!") + logger.info("Done!") return reg_energy, reg_disp @@ -253,16 +259,16 @@ def train_sep(train, custom_config=None): features = config["particle_classification_features"] model = RandomForestClassifier - print("Given features: ", features) - print("Number of events for training: ", train.shape[0]) - print("Training Random Forest Classifier for", + logger.info("Given features: ", features) + logger.info("Number of events for training: ", train.shape[0]) + logger.info("Training Random Forest Classifier for", "Gamma/Hadron separation...") clf = model(**classification_args) clf.fit(train[features], train['mc_type']) - print("Random Forest trained!") + logger.info("Random Forest trained!") return clf @@ -342,6 +348,19 @@ def build_models(filegammas, fileprotons, df_gamma = pd.read_hdf(filegammas, key=dl1_params_lstcam_key) df_proton = pd.read_hdf(fileprotons, key=dl1_params_lstcam_key) + # Update parameters related to target direction on camera frame for gamma MC + # taking into account of the abrration effect using effective focal length + try: + subarray_info = SubarrayDescription.from_hdf(filegammas) + tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 + effective_focal_length = subarray_info.tel[tel_id].optics.effective_focal_length + except OSError: + logger.warning("subarray table is not readable because of the version incompatibility.") + logger.warning("The effective focal length for the standard LST optics will be used.") + effective_focal_length = OPTICS.effective_focal_length + + df_gamma = update_disp_with_effective_focal_length(df_gamma, effective_focal_length = effective_focal_length) + if config['source_dependent']: # if source-dependent parameters are already in dl1 data, just read those data # if not, source-dependent parameters are added here @@ -349,10 +368,9 @@ def build_models(filegammas, fileprotons, src_dep_df_gamma = get_srcdep_params(filegammas) else: - subarray_info = SubarrayDescription.from_hdf(filegammas) - tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 - focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length - src_dep_df_gamma = get_source_dependent_parameters(df_gamma, config, focal_length=focal_length) + src_dep_df_gamma = get_source_dependent_parameters( + df_gamma, config, effective_focal_length=effective_focal_length + ) df_gamma = pd.concat([df_gamma, src_dep_df_gamma['on']], axis=1) @@ -362,10 +380,18 @@ def build_models(filegammas, fileprotons, src_dep_df_proton = get_srcdep_params(fileprotons) else: - subarray_info = SubarrayDescription.from_hdf(fileprotons) - tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 - focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length - src_dep_df_proton = get_source_dependent_parameters(df_proton, config, focal_length=focal_length) + try: + subarray_info = SubarrayDescription.from_hdf(fileprotons) + tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 + effective_focal_length = subarray_info.tel[tel_id].optics.effective_focal_length + except OSError: + logger.warning("subarray table is not readable because of the version incompatibility.") + logger.warning("The effective focal length for the standard LST optics will be used.") + effective_focal_length = OPTICS.effective_focal_length + + src_dep_df_proton = get_source_dependent_parameters( + df_proton, config, effective_focal_length=effective_focal_length + ) df_proton = pd.concat([df_proton, src_dep_df_proton['on']], axis=1) @@ -546,7 +572,7 @@ def apply_models(dl1, reg_disp_vector=None, reg_disp_norm=None, cls_disp_sign=None, - focal_length=28 * u.m, + effective_focal_length=29.30565 * u.m, custom_config=None, ): """ @@ -572,7 +598,7 @@ def apply_models(dl1, cls_disp_sign: string | Path | bytes | sklearn.ensemble.RandomForestClassifier Path to the random forest filename or file or pre-loaded RandomForestClassifier object for disp sign reconstruction - focal_length: `astropy.unit` + effective_focal_length: `astropy.unit` custom_config: dictionary Modified configuration to update the standard one @@ -597,6 +623,13 @@ def apply_models(dl1, + config['disp_classification_features'], ) + # Update parameters related to target direction on camera frame for MC data + # taking into account of the abrration effect using effective focal length + is_simu = 'disp_norm' in dl2.columns + if is_simu: + dl2 = update_disp_with_effective_focal_length(dl2, effective_focal_length = effective_focal_length) + + # Reconstruction of Energy and disp_norm distance if isinstance(reg_energy, (str, bytes, Path)): reg_energy = joblib.load(reg_energy) @@ -664,7 +697,7 @@ def apply_models(dl1, dl2.y.values * u.m, dl2.reco_disp_dx.values * u.m, dl2.reco_disp_dy.values * u.m, - focal_length, + effective_focal_length, alt_tel * u.rad, az_tel * u.rad) @@ -698,7 +731,7 @@ def apply_models(dl1, return dl2 -def get_source_dependent_parameters(data, config, focal_length=28 * u.m): +def get_source_dependent_parameters(data, config, effective_focal_length=29.30565 * u.m): """Get parameters dict for source-dependent analysis. Parameters @@ -714,8 +747,9 @@ def get_source_dependent_parameters(data, config, focal_length=28 * u.m): else: data_type = 'real_data' - expected_src_pos_x_m, expected_src_pos_y_m = get_expected_source_pos(data, data_type, config, - focal_length=focal_length) + expected_src_pos_x_m, expected_src_pos_y_m = get_expected_source_pos( + data, data_type, config, effective_focal_length=effective_focal_length + ) src_dep_params = calc_source_dependent_parameters(data, expected_src_pos_x_m, expected_src_pos_y_m) src_dep_params_dict = {'on': src_dep_params} @@ -765,7 +799,7 @@ def calc_source_dependent_parameters(data, expected_src_pos_x_m, expected_src_po return src_dep_params -def get_expected_source_pos(data, data_type, config, focal_length=28 * u.m): +def get_expected_source_pos(data, data_type, config, effective_focal_length=29.30565 * u.m): """Get expected source position for source-dependent analysis . Parameters @@ -777,21 +811,21 @@ def get_expected_source_pos(data, data_type, config, focal_length=28 * u.m): # For gamma MC, expected source position is actual one for each event if data_type == 'mc_gamma': + data = update_disp_with_effective_focal_length(data, effective_focal_length = effective_focal_length) expected_src_pos_x_m = data['src_x'].values expected_src_pos_y_m = data['src_y'].values # For proton MC, nominal source position is one written in config file if data_type == 'mc_proton': - expected_src_pos = utils.sky_to_camera( - u.Quantity(data['mc_alt_tel'].values + config['mc_nominal_source_x_deg'], u.deg, copy=False), - u.Quantity(data['mc_az_tel'].values + config['mc_nominal_source_y_deg'], u.deg, copy=False), - focal_length, - u.Quantity(data['mc_alt_tel'].values, u.deg, copy=False), - u.Quantity(data['mc_az_tel'].values, u.deg, copy=False) + source_pos = SkyCoord( + fov_lon = -1 * config['mc_nominal_source_y_deg'] * u.deg, + fov_lat = config['mc_nominal_source_x_deg'] * u.deg, + frame=TelescopeFrame() ) - - expected_src_pos_x_m = expected_src_pos.x.to_value(u.m) - expected_src_pos_y_m = expected_src_pos.y.to_value(u.m) + camera_frame = CameraFrame(focal_length=effective_focal_length) + source_camera = source_pos.transform_to(camera_frame) + expected_src_pos_x_m = source_camera.x.to_value(u.m) + expected_src_pos_y_m = source_camera.y.to_value(u.m) # For real data if data_type == 'real_data': @@ -816,7 +850,7 @@ def get_expected_source_pos(data, data_type, config, focal_length=28 * u.m): obstime = Time(time, scale='utc', format='unix') pointing_alt = u.Quantity(data['alt_tel'], u.rad, copy=False) pointing_az = u.Quantity(data['az_tel'], u.rad, copy=False) - source_pos = utils.radec_to_camera(source_coord, obstime, pointing_alt, pointing_az, focal_length) + source_pos = utils.radec_to_camera(source_coord, obstime, pointing_alt, pointing_az, effective_focal_length) expected_src_pos_x_m = source_pos.x.to_value(u.m) expected_src_pos_y_m = source_pos.y.to_value(u.m) @@ -827,3 +861,43 @@ def get_expected_source_pos(data, data_type, config, focal_length=28 * u.m): ) return expected_src_pos_x_m, expected_src_pos_y_m + + +def update_disp_with_effective_focal_length(data, effective_focal_length=29.30565 * u.m): + """Update disp parameters using effective focal length + + Parameters + ---------- + data: Pandas DataFrame + config: dictionnary containing configuration + """ + + source_pos_in_camera = utils.sky_to_camera( + u.Quantity(data['mc_alt'].values, u.rad, copy=False), + u.Quantity(data['mc_az'].values, u.rad, copy=False), + effective_focal_length, + u.Quantity(data['mc_alt_tel'].values, u.rad, copy=False), + u.Quantity(data['mc_az_tel'].values, u.rad, copy=False) + ) + + expected_src_pos_x_m = source_pos_in_camera.x.to_value(u.m) + expected_src_pos_y_m = source_pos_in_camera.y.to_value(u.m) + + data['src_x'] = expected_src_pos_x_m + data['src_y'] = expected_src_pos_y_m + + disp_dx, disp_dy, disp_norm, disp_angle, disp_sign = disp.disp( + data['x'].values, + data['y'].values, + expected_src_pos_x_m, + expected_src_pos_y_m, + data['psi'].values + ) + + data['disp_dx'] = disp_dx + data['disp_dy'] = disp_dy + data['disp_norm'] = disp_norm + data['disp_angle'] = disp_angle + data['disp_sign'] = disp_sign + + return data diff --git a/lstchain/scripts/lstchain_add_source_dependent_parameters.py b/lstchain/scripts/lstchain_add_source_dependent_parameters.py deleted file mode 100644 index b5054561ca..0000000000 --- a/lstchain/scripts/lstchain_add_source_dependent_parameters.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python3 - -""" -Script to add the source dependent parameters to a DL1 file. - -Input: DL1 data file. Source dependent parameters will be added to this file. - -Usage: - -$> python lstchain_add_source_dependent_parameters.py ---input-file dl1_LST-1.Run02033.0137.h5 ---config lstchain_src_dep_config.json - -""" - -import argparse -import os - -import pandas as pd -from ctapipe.instrument import SubarrayDescription - -from lstchain.io import ( - get_standard_config, - read_configuration_file, -) -from lstchain.io.io import ( - dl1_params_lstcam_key, - dl1_params_src_dep_lstcam_key, - global_metadata, - write_dataframe, -) -from lstchain.reco.dl1_to_dl2 import get_source_dependent_parameters - -parser = argparse.ArgumentParser(description="Add the source dependent parameters to a DL1 file") - -# Required arguments -parser.add_argument('--input-file', '-f', type=str, - dest='input_file', - help='path to a DL1 HDF5 file', - ) - -# Optional arguments -parser.add_argument('--config', '-c', action='store', type=str, - dest='config_file', - help='Path to a configuration file for source dependent analysis', - default=None - ) - - -def main(): - - args = parser.parse_args() - - dl1_filename = os.path.abspath(args.input_file) - - config = get_standard_config() - if args.config_file is not None: - try: - config = read_configuration_file(os.path.abspath(args.config_file)) - except("Custom configuration could not be loaded !!!"): - pass - - dl1_params = pd.read_hdf(dl1_filename, key=dl1_params_lstcam_key) - subarray_info = SubarrayDescription.from_hdf(dl1_filename) - tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 - focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length - - src_dep_df = pd.concat(get_source_dependent_parameters(dl1_params, config, focal_length=focal_length), axis=1) - - metadata = global_metadata() - write_dataframe(src_dep_df, dl1_filename, dl1_params_src_dep_lstcam_key, config=config, meta=metadata) - - -if __name__ == '__main__': - main() diff --git a/lstchain/scripts/lstchain_dl1_to_dl2.py b/lstchain/scripts/lstchain_dl1_to_dl2.py index a10fea90af..ac94ebc356 100644 --- a/lstchain/scripts/lstchain_dl1_to_dl2.py +++ b/lstchain/scripts/lstchain_dl1_to_dl2.py @@ -15,6 +15,7 @@ import astropy.units as u from astropy.coordinates import Angle from ctapipe.instrument import SubarrayDescription +from ctapipe_io_lst import OPTICS from tables import open_file from lstchain.io import ( @@ -97,6 +98,15 @@ def apply_to_file(filename, models_dict, output_dir, config): data.alt_tel = - np.pi / 2. data.az_tel = - np.pi / 2. + try: + subarray_info = SubarrayDescription.from_hdf(filename) + tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 + effective_focal_length = subarray_info.tel[tel_id].optics.effective_focal_length + except OSError: + print("subarray table is not readable because of the version incompatibility.") + print("The effective focal length for the standard LST optics will be used.") + effective_focal_length = OPTICS.effective_focal_length + # Normalize all azimuth angles to the range [0, 360) degrees data.az_tel = Angle(data.az_tel, u.rad).wrap_at(360 * u.deg).rad @@ -104,9 +114,6 @@ def apply_to_file(filename, models_dict, output_dir, config): if 'sin_az_tel' not in data.columns: data['sin_az_tel'] = np.sin(data.az_tel) - subarray_info = SubarrayDescription.from_hdf(filename) - tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 - focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length # Apply the models to the data @@ -125,7 +132,7 @@ def apply_to_file(filename, models_dict, output_dir, config): models_dict['cls_gh'], models_dict['reg_energy'], reg_disp_vector=models_dict['disp_vector'], - focal_length=focal_length, + effective_focal_length=effective_focal_length, custom_config=config) elif config['disp_method'] == 'disp_norm_sign': dl2 = dl1_to_dl2.apply_models(data, @@ -133,7 +140,7 @@ def apply_to_file(filename, models_dict, output_dir, config): models_dict['reg_energy'], reg_disp_norm=models_dict['disp_norm'], cls_disp_sign=models_dict['disp_sign'], - focal_length=focal_length, + effective_focal_length=effective_focal_length, custom_config=config) # Source-dependent analysis @@ -145,7 +152,7 @@ def apply_to_file(filename, models_dict, output_dir, config): # if not, source-dependent parameters are added now else: data_srcdep = pd.concat(dl1_to_dl2.get_source_dependent_parameters( - data, config, focal_length=focal_length), axis=1) + data, config, effective_focal_length=effective_focal_length), axis=1) dl2_srcdep_dict = {} srcindep_keys = data.keys() @@ -166,7 +173,7 @@ def apply_to_file(filename, models_dict, output_dir, config): models_dict['cls_gh'], models_dict['reg_energy'], reg_disp_vector=models_dict['disp_vector'], - focal_length=focal_length, + effective_focal_length=effective_focal_length, custom_config=config) elif config['disp_method'] == 'disp_norm_sign': dl2_df = dl1_to_dl2.apply_models(data_with_srcdep_param, @@ -174,7 +181,7 @@ def apply_to_file(filename, models_dict, output_dir, config): models_dict['reg_energy'], reg_disp_norm=models_dict['disp_norm'], cls_disp_sign=models_dict['disp_sign'], - focal_length=focal_length, + effective_focal_length=effective_focal_length, custom_config=config) dl2_srcdep = dl2_df.drop(srcindep_keys, axis=1) diff --git a/lstchain/scripts/lstchain_mc_rfperformance.py b/lstchain/scripts/lstchain_mc_rfperformance.py index 5ec26b916d..179bf692b1 100644 --- a/lstchain/scripts/lstchain_mc_rfperformance.py +++ b/lstchain/scripts/lstchain_mc_rfperformance.py @@ -21,6 +21,7 @@ import matplotlib.pyplot as plt import pandas as pd from ctapipe.instrument import SubarrayDescription +from ctapipe_io_lst import OPTICS from lstchain.io import ( read_configuration_file, @@ -87,10 +88,15 @@ def main(): config = replace_config(standard_config, custom_config) - subarray_info = SubarrayDescription.from_hdf(args.gammatest) - tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 - focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length - + try: + subarray_info = SubarrayDescription.from_hdf(args.gammatest) + tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 + effective_focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length + except OSError: + print("subarray table is not readable because of the version incompatibility.") + print("The effective focal length for the standard LST optics will be used.") + effective_focal_length = OPTICS.effective_focal_length + reg_energy, reg_disp_norm, cls_disp_sign, cls_gh = dl1_to_dl2.build_models( args.gammafile, args.protonfile, @@ -110,7 +116,7 @@ def main(): data = pd.concat([gammas, proton], ignore_index=True) dl2 = dl1_to_dl2.apply_models(data, cls_gh, reg_energy, reg_disp_norm=reg_disp_norm, - cls_disp_sign=cls_disp_sign, focal_length=focal_length, + cls_disp_sign=cls_disp_sign, effective_focal_length=effective_focal_length, custom_config=config) ####PLOT SOME RESULTS##### diff --git a/lstchain/scripts/tests/test_lstchain_scripts.py b/lstchain/scripts/tests/test_lstchain_scripts.py index 3e7d00d90c..1d39b6029a 100644 --- a/lstchain/scripts/tests/test_lstchain_scripts.py +++ b/lstchain/scripts/tests/test_lstchain_scripts.py @@ -65,16 +65,6 @@ def simulated_dl1ab(temp_dir_simulated_files, simulated_dl1_file): run_program("lstchain_dl1ab", "-f", simulated_dl1_file, "-o", output_file) return output_file -def test_add_source_dependent_parameters(temp_dir_simulated_srcdep_files, simulated_dl1_file): - shutil.copy(simulated_dl1_file, temp_dir_simulated_srcdep_files / "dl1_copy.h5") - dl1_file = temp_dir_simulated_srcdep_files / "dl1_copy.h5" - run_program("lstchain_add_source_dependent_parameters", "-f", dl1_file) - dl1_params_src_dep = get_srcdep_params(dl1_file) - - assert 'alpha' in dl1_params_src_dep['on'].columns - assert 'dist' in dl1_params_src_dep['on'].columns - assert 'time_gradient_from_source' in dl1_params_src_dep['on'].columns - assert 'skewness_from_source' in dl1_params_src_dep['on'].columns @pytest.fixture(scope="session") def merged_simulated_dl1_file(simulated_dl1_file, temp_dir_simulated_files): diff --git a/lstchain/tests/test_lstchain.py b/lstchain/tests/test_lstchain.py index 08dfecf702..ffd09aac02 100644 --- a/lstchain/tests/test_lstchain.py +++ b/lstchain/tests/test_lstchain.py @@ -196,7 +196,7 @@ def test_get_source_dependent_parameters_mc(simulated_dl1_file): assert (src_dep_df_gamma['on']['expected_src_y'] == dl1_params['src_y']).all() np.testing.assert_allclose( - src_dep_df_proton['on']['expected_src_x'], 0.195, atol=1e-2 + src_dep_df_proton['on']['expected_src_x'], 0.205, atol=1e-2 ) np.testing.assert_allclose( src_dep_df_proton['on']['expected_src_y'], 0., atol=1e-2 @@ -224,13 +224,13 @@ def test_get_source_dependent_parameters_observed(observed_dl1_files): assert (src_dep_df_on['on']['expected_src_y'] == 0).all() np.testing.assert_allclose( - src_dep_df_wobble['on']['expected_src_x'], -0.195, atol=1e-2 + src_dep_df_wobble['on']['expected_src_x'], -0.205, atol=1e-2 ) np.testing.assert_allclose( src_dep_df_wobble['on']['expected_src_y'], 0., atol=1e-2 ) np.testing.assert_allclose( - src_dep_df_wobble['off_180']['expected_src_x'], 0.195, atol=1e-2 + src_dep_df_wobble['off_180']['expected_src_x'], 0.205, atol=1e-2 ) np.testing.assert_allclose( src_dep_df_wobble['off_180']['expected_src_y'], 0., atol=1e-2