From 53e1542b75988bd34ddeb67852095059c4532a30 Mon Sep 17 00:00:00 2001 From: detlefarend Date: Fri, 17 Jan 2025 14:27:50 +0100 Subject: [PATCH] Bug: 'DataPlotting' object has no attribute '_filename_stub'. Howto BF 003 #1122 --- src/mlpro/bf/various.py | 4 +++- .../bf/howto_bf_003_store_plot_and_save_variables.py | 12 +++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mlpro/bf/various.py b/src/mlpro/bf/various.py index 0a2aa053b..c08584e16 100644 --- a/src/mlpro/bf/various.py +++ b/src/mlpro/bf/various.py @@ -55,10 +55,11 @@ ## -- 2024-12-06 2.6.0 DA Class Log: tuning by about 10% ## -- 2024-12-29 2.7.0 DA - Method Log.log(): new parameter p_type_col ## -- - Class Log: code optimization +## -- 2025-01-17 2.7.1 DA/SY Correction of method Persistent.save() ## ------------------------------------------------------------------------------------------------- """ -Ver. 2.7.0 (2024-12-29) +Ver. 2.7.1 (2025-01-17) This module provides various classes with elementry functionalities for reuse in higher level classes. For example: logging, persistence, timer... @@ -501,6 +502,7 @@ def save(self, p_path:str, p_filename:str=None) -> bool: if p_filename is not None: filename = p_filename + self.set_filename( p_filename_stub=p_filename ) else: filename = self.get_filename() diff --git a/test/howtos/bf/howto_bf_003_store_plot_and_save_variables.py b/test/howtos/bf/howto_bf_003_store_plot_and_save_variables.py index 0c494699f..fe614cd2d 100644 --- a/test/howtos/bf/howto_bf_003_store_plot_and_save_variables.py +++ b/test/howtos/bf/howto_bf_003_store_plot_and_save_variables.py @@ -12,10 +12,11 @@ ## -- 2021-10-25 1.2.2 SY Adjustment due to improvement in DataPlotting ## -- 2021-10-26 1.2.3 SY Rename module ## -- 2023-03-02 1.2.4 LSB Refactoring +## -- 2025-01-17 1.2.5 SY/DA Refactoring/correction ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.2.4 (2023-03-02) +Ver. 1.2.5 (2025-01-17) This module demonstrates how to store, plot, save and load variables. @@ -77,17 +78,10 @@ #Do not include quote-unquote ("" or '' ) into target path name mem_plot.save_plots(path_save, "pdf") mem_plot.save(path_save, "plot_memory") - mem.save(path_save, "data_memory") mem.save_data(path_save, "data_storage", "\t") - ## 4. How to load data from binary file ## + ## 4. How to load data from csv file ## path_load = path_save - mem_load = DataStoring.load(path_load, "data_memory") - print("Comparison :") - print("Original data : %.5f"%mem.memory_dict["reward"]["ep. 1"][0]) - print("Loaded data from binary file : %.5f"%mem_load.memory_dict["reward"]["ep. 1"][0]) - - ## 5. How to load data from csv file ## data_names = [] mem_from_csv = DataStoring(data_names) mem_from_csv.load_data(path_load, "data_storage.csv", "\t")