465b / nemf

A novel three step network-based general ecosystem modeling framework
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Potential bug if interaction function does not require parameters #28

Closed 465b closed 4 years ago

465b commented 4 years ago

Check if it is possible to use interaction functions which do not take any parameters.

Potential thrown error: Traceback (most recent call last): File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/examples.py", line 17, in <module> output_dict = caller.dn_monte_carlo(path, File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/decorators.py", line 14, in wrapper result = func(*args,**kwargs) File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/caller.py", line 383, in dn_monte_carlo gradient_descent(model_configuration, File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/caller.py", line 201, in gradient_descent model_config.calc_cost(param_stack[ii],barrier_slope)[0:2+1] File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/models.py", line 630, in calc_cost model_log, prediction, is_stable = self.calc_prediction() File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/models.py", line 606, in calc_prediction ode_states,ode_coeff_model, ode_coeff = self.to_ode() File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/models.py", line 537, in to_ode ode_coeff = ode_coeff_model(self) File "/home/ls/Documents/scr/phd/carbon_flux_baltic/code/modules/models.py", line 83, in interaction_model_generator parameters = item['parameters'].copy() AttributeError: 'NoneType' object has no attribute 'copy'

465b commented 4 years ago

it now always requires a parameter