-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from siftech/develop
v1.8.0
- Loading branch information
Showing
116 changed files
with
19,670 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,3 +315,7 @@ gmon.out | |
unsat.core | ||
.gitignore | ||
core.dimacs | ||
notebooks/saved-results/out | ||
**/*.bbl | ||
**/*.blg | ||
**/*.out |
2 changes: 1 addition & 1 deletion
2
auxiliary_packages/funman_benchmarks/src/funman_benchmarks/_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Version information.""" | ||
|
||
# The following line *must* be the last in the module, exactly as formatted: | ||
__version__ = "1.5.2" | ||
__version__ = "1.8.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Version information.""" | ||
|
||
# The following line *must* be the last in the module, exactly as formatted: | ||
__version__ = "1.7.0" | ||
__version__ = "1.8.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
auxiliary_packages/funman_demo/src/funman_demo/example/pde.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import logging | ||
import os | ||
from typing import List, Optional | ||
|
||
import matplotlib.animation as animation | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import pandas as pd | ||
import seaborn as sns | ||
from IPython.display import HTML | ||
from sklearn import preprocessing | ||
|
||
from funman.server.query import FunmanResults | ||
|
||
|
||
def animate_heat_map(my_df, frames): | ||
fig = plt.figure() | ||
|
||
vmin = my_df.min().min() | ||
vmax = my_df.max().max() | ||
# ax = sns.heatmap(data, vmin=0, vmax=1) | ||
# fig, ax = plt.subplots() | ||
# sns.heatmap(data, vmin=vmin, vmax=vmax, cmap="crest", ax=ax) | ||
|
||
def init(): | ||
# plt.clf() | ||
fig.clear() | ||
data = my_df.loc[0, :] | ||
ax = sns.heatmap(data, vmin=vmin, vmax=vmax, cmap="crest") | ||
ax.set_xlabel(data.columns[0][0]) | ||
ax.set_ylabel(data.index.name) | ||
ax.set_title(data.columns[0][0]) | ||
|
||
def animate(i): | ||
# plt.clf() | ||
fig.clear() | ||
data = my_df.loc[i, :] | ||
# ax.set_data(data) | ||
ax = sns.heatmap(data, vmin=vmin, vmax=vmax, cmap="crest") | ||
ax.set_xlabel(data.columns[0][0]) | ||
ax.set_ylabel(data.index.name) | ||
ax.set_title(f"{data.columns[0][0]}: time = {i}") | ||
|
||
anim = animation.FuncAnimation( | ||
fig, | ||
animate, | ||
interval=1000, | ||
frames=frames, | ||
init_func=init, | ||
) | ||
|
||
return anim | ||
|
||
|
||
def plot_spatial_timeseries( | ||
results: FunmanResults, | ||
variables: Optional[List[str]] = None, | ||
outdir=None, | ||
fps=1, | ||
): | ||
logging.getLogger("matplotlib.animation").setLevel(logging.ERROR) | ||
logging.getLogger("matplotlib.colorbar").setLevel(logging.ERROR) | ||
|
||
df = results.dataframe(points=[results.parameter_space.true_points()[-1]]) | ||
steps = len(df) | ||
parameters = results.model._parameter_names() | ||
vars = results.model._state_var_names() | ||
to_drop = ( | ||
parameters | ||
+ ["id", "label"] | ||
+ [v for v in vars if variables is not None and v not in variables] | ||
) | ||
df = df.drop(columns=to_drop) | ||
|
||
# x = df.values #returns a numpy array | ||
# min_max_scaler = preprocessing.MinMaxScaler() | ||
# standard_scaler = preprocessing.StandardScaler() | ||
# x_scaled = min_max_scaler.fit_transform(x) | ||
# # x_scaled = standard_scaler.fit_transform(x) | ||
# df = pd.DataFrame(x_scaled, columns =df.columns) | ||
|
||
df.columns = df.columns.str.split("_", expand=True) | ||
df = df.stack([1]) | ||
df.index = df.index.set_names(["time"] + [df.columns[0][0]]) | ||
|
||
anim_h = animate_heat_map(df, steps) | ||
if outdir: | ||
anim_h.save( | ||
os.path.join(outdir, "h.gif"), | ||
writer=animation.PillowWriter(fps=fps), | ||
) | ||
hh = HTML(anim_h.to_jshtml()) | ||
dh = df.unstack().diff().fillna(0).stack([1]).rename(columns={"h": "dh"}) | ||
anim_dh = animate_heat_map(dh, steps) | ||
if outdir: | ||
anim_dh.save( | ||
os.path.join(outdir, "dh.gif"), | ||
writer=animation.PillowWriter(fps=fps), | ||
) | ||
hdh = HTML(anim_dh.to_jshtml()) | ||
|
||
return hh, hdh, anim_h, anim_dh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Version information.""" | ||
|
||
# The following line *must* be the last in the module, exactly as formatted: | ||
__version__ = "1.7.0" | ||
__version__ = "1.8.0" |
Oops, something went wrong.