Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
465b committed May 22, 2020
2 parents 21cede4 + 66e37c2 commit 403f5b4
Show file tree
Hide file tree
Showing 34 changed files with 3,010 additions and 1,180 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
*.log
*.egg-info
*dist
example_files/
110 changes: 0 additions & 110 deletions configuration_files/micro_baltic_model_config.yml

This file was deleted.

17 changes: 17 additions & 0 deletions doc/releases/v0.3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# v0.3.0 (May 2020)

This is a major release introducing scipy's integration and optimization routines into the framework.

## New forward modelling

* Replaced the self written *time_integration* routine with *scipy.integrate.solve_ivp*.
* Adjusted *forward_model* and plotting routines accordingly and introduced supporting functions.

## New inverse modelling

* Replaced the self written *gradient_descent* method with *scipy.optimize.minimize*.
* Adjusted *inverse_model* and plotting routines accordingly and introduced supporting functions.

## Visualization

* Added *initial_guess* plotting function to visualize the model output before any optimization has been applied.
140 changes: 140 additions & 0 deletions example_files/NPZD_oscillation_on_1990.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,87 +9,91 @@
# List of all present compartments in the model.
compartment:
N: # name of the compartment
value: 1.0 # initial value of the compartment
value: 1 # initial value of the compartment
optimise: # if the above value shall not be optimized, this remains empty
lower: 0 # if not, lower and
lower: 1.0e-9 # if not, lower and
upper: 2 # upper constraints must be defined
P:
value: 1.0
value: 1 #.20835024e+00
optimise:
lower: 0
lower: 1.0e-9
upper: 2
Z:
value: 1.0
value: 1 #8.84333950e-01
optimise:
lower: 0
lower: 1.0e-9
upper: 2
D:
value: 0
value: 1 # 8.57333742e-01
optimise:
lower: 0
lower: 1.0e-9
upper: 2

# List of all interactions/flows between compartments
interactions:
# Note, that the functions are automatically multiplied by the current value
# of the secondly named compartment

N:P: # names of the interacting compartments
P:N: # names of the interacting compartments
- fkt: nutrition_limited_growth # name of the type of interaction
sign: '-1' # direction of flow (from P to N in this case)
parameters: # list of parameters required for interaction
- 'N' # Parameters can also be other compartments
- 0.27
- 0.7
optimise: # whether or not some of these parameters
# shall be optimized
P:Z:
Z:P:
- fkt: holling_type_III
sign: '-1'
parameters:
- 'P'
- 1.6
- 1.575
- 0.02
- 0.575
optimise:
- parameter_no: 2
lower: 0.015
upper: 0.025
- parameter_no: 3
lower: 0.5
upper: 0.6
D:P:
- fkt: linear_mortality
sign: '+1'
parameters:
- 'P'
- 0.04
optimise:
D:Z:
- fkt: linear_mortality
sign: '+1'
parameters:
- 'Z'
- 0.01
optimise:
N:D:
- fkt: remineralisation
sign: '+1'
parameters:
- 0.048
- 'D'
- 0.148
optimise:


# list of details for the forward and inverse modelling modules
configuration:
# time evolution / forward modelling
integration_scheme: euler_forward
time_evo_max: 300
dt_time_evo: 0.1
ode_coeff_model: interaction_model_generator
# convergence criteria for forward and inverse modelling
stability_rel_tolerance: 1.0e-3
tail_length_stability_check: 10
start_stability_check: 50
time_evo_max: 1000
dt_time_evo: 1

# optional keys:
# --------------

# integration_scheme: euler_forward

# fitting - details for the inverse modelling
fit_model: direct_fit_model
fit_target: [1.,0.5,1.,0.1]
# sinks and sources
## models are expected to conserve their model currency/quantity.
## if something enters or leave the model they should be labled here
sources: null
sinks: null
## if not null then this may look for example like:
## sources: 'N'
## sinks: 'D'
fit_data_path: 'example_files/NPZD_oscillation_on_1990.csv'

## sinks and sources
# models are expected to conserve their model currency/quantity.
# if something enters or leave the model they should be labled here
# if not null then this may look for example like:
# sources: 'N'
# sinks: 'D'
# sources: null
# sinks: null
5 changes: 2 additions & 3 deletions examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import gemf

# provide the path of model/system configuration
path = ('configuration_files/exemplary_NPZD_model.yml')
path = ('example_files/exemplary_NPZD_model.yml')

# load the model configuration
model_config = gemf.model_class(path)
Expand All @@ -19,7 +19,6 @@


# if the model shall be fitted as well call:
output_dict = gemf.inverse_model(model_config,
sample_sets=1, gd_max_iter=100, grad_scale=1e-1)
output_dict = gemf.inverse_model(model_config)
# to plot the results:
gemf.output_summary(output_dict)
1 change: 0 additions & 1 deletion gemf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from gemf.caller import forward_model as forward_model
from gemf.caller import inverse_model as inverse_model
from gemf.caller import time_evolution as time_evolution

from gemf.plot import output_summary as output_summary
from gemf.plot import interaction_graph as interaction_graph
Expand Down
Loading

0 comments on commit 403f5b4

Please sign in to comment.