Skip to content

Commit

Permalink
update to experiment setup; no text box; relative path saving
Browse files Browse the repository at this point in the history
  • Loading branch information
AFg6K7h4fhy2 committed Dec 24, 2024
1 parent 1506841 commit 6e33ecb
Show file tree
Hide file tree
Showing 7 changed files with 606 additions and 526 deletions.
116 changes: 116 additions & 0 deletions assets/misc/paste_bin.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,120 @@

"""
Plots and or saves the executed
cliodynamics model results. The file name
included the model name, the configuration
file, and the date as (ISO 8601). The PDF
or image file metadata contains the
Python code and toml file contents for the
images produced therein. Overwrite defaults
to False. Parameter box defaults to False.

Parameters
----------
model_name : str
The name of the model used. Usually is
either DFM or DWM.
config : dict[str, str | float | int | list[int] | list[float]]
A dictionary of model specifications,
parameters, and variables. The
following parameters and variables
are permitted to be lists: init_N,
init_S, init_rho, init_s, init_k,
max_k, c, r, beta.
y0s : list[jax.Array]
The initial variable values for
the model.
args : list[jax.Array]
Different combinations of parameters
for the specified model.
sols : list[jax.Array]
A list of ODE solutions corresponding
to different combinations of variables
and parameters of the specified model.
model_input : dict[str, list[float] | list[int]]
Parameters and their values for the
specified model.
save_name : str
What to name the output file.
overwrite : bool
Whether to overwrite a saved output
file. Defaults to False.
param_box : bool
Whether to use a parameter box showing
the values of parameters used in the
model.
style : str
The name of the style file to use for
plotting. Defaults to None, i.e.
matplotlib's default style.

Returns
-------
None
A PDF or image of the figures produced.
"""

# plot as an image if there is only a
# single plot (all vars and params len 1
# or just one that is not len 1),
# otherwise plot as a pdf
plot_as_img = (
sum(
[
0 if len(elt) == 1 else 1
for elt in len_model_vars_and_params.values()
]
)
<= 1
)

if param_box:
figure.subplots_adjust(bottom=0.5)
param_list = "; ".join(
[
f"{LABELS[_]}={', '.join([str(round(e, 2)) for e in config[_]])}"
for _ in model_vars_and_params
if _ != k
]
)
figure.text(
0.5, # center
0.02, # near bottom
f"Parameters: {param_list}",
ha="center",
va="top",
fontsize=12,
bbox=dict(
facecolor="white",
edgecolor="black",
boxstyle="round,pad=0.5",
),
)



if param_box:
figure.subplots_adjust(bottom=0.5)
param_list = "; ".join(
[
f"{LABELS[_]}={', '.join([str(round(e, 2)) for e in config[_]])}"
for _ in model_vars_and_params
if _ != k
]
)
figure.text(
0.5, # center
0.02, # near bottom
f"Parameters: {param_list}",
ha="center",
va="top",
fontsize=12,
bbox=dict(
facecolor="white",
edgecolor="black",
boxstyle="round,pad=0.5",
),
)

# # get model name
# model_name = "DFM" if args.DFM else "DWM"
Expand Down
14 changes: 14 additions & 0 deletions config/fig_08.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
model = "DWM"
t0 = 0
t1 = 1000
dt0 = 1
init_S = 0.01
init_N = 0.5
init_k = 2
max_k = 2.5
alpha = 0.05
c = 0.5
r = 0.02
g = 0.15
d = 1
beta = 0.1
14 changes: 14 additions & 0 deletions config/fig_09.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
model = "DWM"
t0 = 0
t1 = 1000
dt0 = 1
init_S = 0.01
init_N = 0.5
init_k = 1
max_k = 1.5
alpha = 0.05
c = 0.5
r = 0.01
g = 0.15
d = 1
beta = 0.1
14 changes: 14 additions & 0 deletions config/fig_10.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
model = "DWM"
t0 = 0
t1 = 1000
dt0 = 1
init_S = 0.01
init_N = 0.5
init_k = 1
max_k = 1.5
alpha = 0.01
c = 0.5
r = 0.02
g = 0.15
d = 1
beta = 0.1
14 changes: 14 additions & 0 deletions config/fig_11.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
model = "DWM"
t0 = 0
t1 = 1000
dt0 = 1
init_S = 0.01
init_N = 0.33
init_k = 1
max_k = 1.5
alpha = 0.006
c = 0.5
r = 0.04
g = 0.16
d = 1
beta = 0.1
Loading

0 comments on commit 6e33ecb

Please sign in to comment.