diff --git a/lstchain/reco/dl1_to_dl2.py b/lstchain/reco/dl1_to_dl2.py index 5fdc8d0444..35eba0742f 100644 --- a/lstchain/reco/dl1_to_dl2.py +++ b/lstchain/reco/dl1_to_dl2.py @@ -431,19 +431,19 @@ def build_models(filegammas, fileprotons, os.makedirs(path_models, exist_ok=True) file_reg_energy = path_models + "/reg_energy.sav" - joblib.dump(reg_energy, file_reg_energy) + joblib.dump(reg_energy, file_reg_energy, compress=3) if config['disp_method'] == 'disp_vector': file_reg_disp_vector = path_models + "/reg_disp_vector.sav" - joblib.dump(reg_disp_vector, file_reg_disp_vector) + joblib.dump(reg_disp_vector, file_reg_disp_vector, compress=3) elif config['disp_method'] == 'disp_norm_sign': file_reg_disp_norm = os.path.join(path_models, 'reg_disp_norm.sav') file_cls_disp_sign = os.path.join(path_models, 'cls_disp_sign.sav') - joblib.dump(reg_disp_norm, file_reg_disp_norm) - joblib.dump(cls_disp_sign, file_cls_disp_sign) + joblib.dump(reg_disp_norm, file_reg_disp_norm, compress=3) + joblib.dump(cls_disp_sign, file_cls_disp_sign, compress=3) file_cls_gh = path_models + "/cls_gh.sav" - joblib.dump(cls_gh, file_cls_gh) + joblib.dump(cls_gh, file_cls_gh, compress=3) if config['disp_method'] == 'disp_vector': return reg_energy, reg_disp_vector, cls_gh diff --git a/lstchain/tests/test_lstchain.py b/lstchain/tests/test_lstchain.py index 1a1bebae1f..dbea9e504e 100644 --- a/lstchain/tests/test_lstchain.py +++ b/lstchain/tests/test_lstchain.py @@ -163,10 +163,10 @@ def test_build_models(simulated_dl1_file, rf_models): import joblib - joblib.dump(reg_energy, rf_models["energy"]) - joblib.dump(cls_gh, rf_models["gh_sep"]) - joblib.dump(reg_disp_norm, rf_models["disp_norm"]) - joblib.dump(cls_disp_sign, rf_models["disp_sign"]) + joblib.dump(reg_energy, rf_models["energy"], compress=3) + joblib.dump(cls_gh, rf_models["gh_sep"], compress=3) + joblib.dump(reg_disp_norm, rf_models["disp_norm"], compress=3) + joblib.dump(cls_disp_sign, rf_models["disp_sign"], compress=3) def test_apply_models(simulated_dl1_file, simulated_dl2_file, rf_models): diff --git a/notebooks/rf-performance.ipynb b/notebooks/rf-performance.ipynb index 70c0efb151..75ea891a51 100644 --- a/notebooks/rf-performance.ipynb +++ b/notebooks/rf-performance.ipynb @@ -442,9 +442,9 @@ "fileE = \"RFreg_Energy.sav\" \n", "fileD = \"RFreg_Disp.sav\" \n", "fileH = \"RFcls_GH.sav\" \n", - "joblib.dump(RFreg_Energy, fileE) \n", - "joblib.dump(RFreg_Disp, fileD) \n", - "joblib.dump(RFcls_GH, fileH)" + "joblib.dump(RFreg_Energy, fileE, compress=3)\n", + "joblib.dump(RFreg_Disp, fileD, compress=3)\n", + "joblib.dump(RFcls_GH, fileH, compress=3)" ] }, { @@ -885,4 +885,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file