Skip to content

Commit

Permalink
Bug: 'DataPlotting' object has no attribute '_filename_stub'. Howto B…
Browse files Browse the repository at this point in the history
…F 003 #1122
  • Loading branch information
detlefarend committed Jan 17, 2025
1 parent d4267b1 commit 53e1542
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/mlpro/bf/various.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down Expand Up @@ -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()

Expand Down
12 changes: 3 additions & 9 deletions test/howtos/bf/howto_bf_003_store_plot_and_save_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 53e1542

Please sign in to comment.