Skip to content

Commit 32efbd5

Browse files
0.24.0
1 parent f70433f commit 32efbd5

2 files changed

Lines changed: 12 additions & 23 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotpython"
10-
version = "0.23.6"
10+
version = "0.24.0"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotpython/utils/file.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import importlib
88
from spotpython.utils.eda import gen_design_table
99
from spotpython.utils.init import setup_paths
10+
import copy
1011

1112

1213
# from torch.utils.tensorboard import SummaryWriter
@@ -233,40 +234,28 @@ def load_core_model_from_file(coremodel, dirname="userModel"):
233234
return core_model
234235

235236

236-
def load_and_run_spot_python_experiment(spot_filename) -> tuple:
237+
def load_and_run_spot_python_experiment(PREFIX=None, filename=None) -> object:
237238
"""Loads and runs a spot experiment.
238239
239240
Args:
240-
spot_filename (str):
241-
The name of the spot experiment file.
241+
PREFIX (str, optional): Prefix of the experiment. Defaults to None.
242+
filename (str): Name of the pickle file. Defaults to None
242243
243244
Returns:
244-
tuple: A tuple containing the spot tuner, fun control,
245-
design control, surrogate control, optimizer control,
246-
and the tensorboard process object (p_popen).
247-
248-
Notes:
249-
p_open is deprecated and should be removed in future versions.
250-
It returns None.
245+
spot_tuner (Spot): The spot tuner object.
251246
252247
Examples:
253248
>>> from spotpython.utils.file import load_and_run_spot_python_experiment
254-
>>> spot_tuner = load_and_run_spot_python_experiment("spot_branin_experiment.pickle")
249+
>>> spot_tuner = load_and_run_spot_python_experiment(filename="spot_branin_experiment.pickle")
250+
>>> # Or use PREFIX
251+
>>> spot_tuner = load_and_run_spot_python_experiment(PREFIX="spot_branin_experiment")
255252
256253
"""
257-
p_open = None
258-
(spot_tuner, fun_control, design_control, surrogate_control, optimizer_control) = load_experiment(spot_filename)
259-
print("\nLoaded fun_control in spotRun():")
260-
# pprint.pprint(fun_control)
254+
spot_tuner = load_experiment(PREFIX=PREFIX, filename=filename)
255+
fun_control = copy.copy(spot_tuner.fun_control)
261256
print(gen_design_table(fun_control))
262257
setup_paths(fun_control["TENSORBOARD_CLEAN"])
263258
spot_tuner.init_spot_writer()
264-
# if fun_control["tensorboard_start"]:
265-
# p_open = start_tensorboard()
266-
# else:
267-
# p_open = None
268259
spot_tuner.run()
269-
# # tensorboard --logdir="runs/"
270-
# stop_tensorboard(p_open)
271260
print(gen_design_table(fun_control=fun_control, spot=spot_tuner))
272-
return spot_tuner, fun_control, design_control, surrogate_control, optimizer_control, p_open
261+
return spot_tuner

0 commit comments

Comments
 (0)