From 2f2bfaaa26e006ea645b6bd6225fce739bb5d684 Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Thu, 20 May 2021 22:20:17 -0500 Subject: [PATCH 1/9] refactor: raise ValueError instead of AttributeError --- dinjo/model.py | 6 +++--- dinjo/optimizer.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dinjo/model.py b/dinjo/model.py index cd886a1..b1dc87a 100644 --- a/dinjo/model.py +++ b/dinjo/model.py @@ -69,18 +69,18 @@ def bounds(self, bounds_input): ) if not type_check: - raise AttributeError(attr_err_message) + raise ValueError(attr_err_message) order_check: bool = bounds_input[0] <= bounds_input[1] if not order_check: - raise AttributeError(attr_err_message) + raise ValueError(attr_err_message) if not ( bounds_input[0] <= self.initial_value and bounds_input[1] >= self.initial_value ): - raise AttributeError(init_val_not_in_bounds_range) + raise ValueError(init_val_not_in_bounds_range) self._bounds = bounds_input diff --git a/dinjo/optimizer.py b/dinjo/optimizer.py index ecd44bb..c10cc64 100644 --- a/dinjo/optimizer.py +++ b/dinjo/optimizer.py @@ -52,7 +52,7 @@ def __init__( reference_state_variable ) except ValueError: - raise AttributeError( + raise ValueError( "self.reference_state_variable must be in model.state_variables" ) @@ -63,13 +63,13 @@ def reference_t_values(self): @reference_t_values.setter def reference_t_values(self, reference_t_values_input: List[float]): if len(self.reference_values) != len(reference_t_values_input): - raise AttributeError( + raise ValueError( "self.reference_values and self.reference_t_values must have the same length" ) for i, t in enumerate(reference_t_values_input[:-1]): if not t < reference_t_values_input[i + 1]: - raise AttributeError( + raise ValueError( "self.reference_t_values must be a list of floats in increasing order" ) @@ -83,7 +83,7 @@ def reference_t_values(self, reference_t_values_input: List[float]): ) if not t_span_condition: - raise AttributeError( + raise ValueError( "self.model.t_span and self.reference_t_values initial and " "final entries must coincide." ) From cf4d449f06cd54a74e37612ab3ed0e844bb5e322 Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Thu, 20 May 2021 22:29:44 -0500 Subject: [PATCH 2/9] fix: bug because of bad signature in Parameter __init__ method --- dinjo/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dinjo/model.py b/dinjo/model.py index b1dc87a..40dde35 100644 --- a/dinjo/model.py +++ b/dinjo/model.py @@ -47,7 +47,7 @@ class Parameter(Variable): """ def __init__( self, name: str, representation: str, initial_value: float = 0, - *args, bounds: Optional[List[float]] = None, **kwargs + bounds: Optional[List[float]] = None, *args, **kwargs ) -> None: super().__init__(name, representation, initial_value) self.bounds = bounds if bounds else [initial_value, initial_value] From e96e7ae63fbd03f0ed360f4ffa78f80c3e4fe3cd Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Thu, 20 May 2021 23:32:03 -0500 Subject: [PATCH 3/9] tests: refactoring tests - developing better tests --- dinjo/model.py | 2 +- .../{test_optimizer.py => _test_optimizer.py} | 0 ...st_seirv_model.py => _test_seirv_model.py} | 4 +- tests/conftest.py | 48 +++++++++++ tests/test_model.py | 79 +++++++++++++++++++ 5 files changed, 130 insertions(+), 3 deletions(-) rename tests/{test_optimizer.py => _test_optimizer.py} (100%) rename tests/{test_seirv_model.py => _test_seirv_model.py} (98%) create mode 100644 tests/conftest.py create mode 100644 tests/test_model.py diff --git a/dinjo/model.py b/dinjo/model.py index 40dde35..f37edc4 100644 --- a/dinjo/model.py +++ b/dinjo/model.py @@ -240,7 +240,7 @@ def run_model( ) parameters_permitted_types = (list, tuple, np.ndarray) - parameters_type_is_permitted = True + parameters_type_is_permitted = False for permitted_type in parameters_permitted_types: parameters_type_is_permitted += isinstance(parameters, permitted_type) diff --git a/tests/test_optimizer.py b/tests/_test_optimizer.py similarity index 100% rename from tests/test_optimizer.py rename to tests/_test_optimizer.py diff --git a/tests/test_seirv_model.py b/tests/_test_seirv_model.py similarity index 98% rename from tests/test_seirv_model.py rename to tests/_test_seirv_model.py index 2e5ab01..1cf9c17 100644 --- a/tests/test_seirv_model.py +++ b/tests/_test_seirv_model.py @@ -76,7 +76,7 @@ def test_parameters_init_vals(model_SEIRV: ModelSEIRV, parameters_source): def test_parameters_bounds(bounds): try: model.Parameter("a", "b", 1.5, bounds=bounds) - except AttributeError: + except ValueError: assert False else: assert True @@ -95,7 +95,7 @@ def test_parameters_bounds(bounds): ] ) def test_parameters_bounds_error_handling(initial_value, bounds): - with pytest.raises(AttributeError): + with pytest.raises(ValueError): model.Parameter("a", "b", initial_value, bounds=bounds) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..314f0c9 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,48 @@ +import pytest + +from numpy import pi + +from dinjo.model import StateVariable, Parameter +from dinjo.predefined.physics import ModelOscillator + + +@pytest.fixture(scope='session') +def ho_state_vars(): + # Harmonic Oscillator Initial Value Problem + q = StateVariable( + name='position', representation='q', initial_value=1.0 + ) + p = StateVariable( + name='momentum', representation='p', initial_value=0.0 + ) + return [q, p] + + +@pytest.fixture(scope='session') +def ho_params(): + # Define Paramters + omega = Parameter( + name='frequency', representation='w', initial_value=2 * pi, bounds=[4, 8] + ) + return [omega] + + +@pytest.fixture(scope='session') +def t_span(): + return [0, 1] + + +@pytest.fixture(scope='session') +def t_steps(): + return 50 + + +@pytest.fixture(scope='session') +def model_oscillator(ho_state_vars, ho_params, t_span, t_steps): + # Instantiate the IVP class with appropiate State Variables and Parameters + return ModelOscillator( + state_variables=ho_state_vars, + parameters=ho_params, + t_span=t_span, + t_steps=t_steps + ) diff --git a/tests/test_model.py b/tests/test_model.py new file mode 100644 index 0000000..4181381 --- /dev/null +++ b/tests/test_model.py @@ -0,0 +1,79 @@ +import pytest + +from dinjo.model import Variable, StateVariable, Parameter, ModelIVP +from dinjo.predefined.physics import ModelOscillator + +VAR_PARAMS = 'foo', 'foo', 0.0 + + +def test_variable(): + Variable(*VAR_PARAMS) + assert True + + +def test_state_variable(): + StateVariable(*VAR_PARAMS) + assert True + + +def test_parameter(): + Parameter(*VAR_PARAMS, bounds=[0.0, 1.0]) + + +def test_parameter_bounds_not_explicit(): + Parameter(*VAR_PARAMS) + + +def test_get_parameter(): + p = Parameter(*VAR_PARAMS) + p.bounds + + +def test_parameter_bounds_not_list(): + with pytest.raises(ValueError): + Parameter(*VAR_PARAMS, bounds=(1.0, 0.0)) + + +def test_parameter_bounds_not_number(): + with pytest.raises(ValueError): + Parameter(*VAR_PARAMS, bounds=['a', 0.0]) + + +def test_parameter_bounds_reversed(): + with pytest.raises(ValueError): + Parameter(*VAR_PARAMS, bounds=[1.0, 0.0]) + + +def test_parameter_init_val_not_in_bounds(): + with pytest.raises(ValueError): + Parameter(*VAR_PARAMS, bounds=[0.1, 1.0]) + + +class TestModelIVP: + def setup(self): + self.v = StateVariable(*VAR_PARAMS) + self.p = Parameter(*VAR_PARAMS) + self.model_ivp = ModelIVP( + [self.v], [self.p], t_span=[0., 1.], t_steps=50 + ) + + def test_state_vars_init_vals(self): + sv_iv = self.model_ivp.state_variables_init_vals + assert sv_iv == [self.v.initial_value] + + def test_parameters_init_vals(self): + params_iv = self.model_ivp.state_variables_init_vals + assert params_iv == [self.p.initial_value] + + def test_build_model_not_implemented(self): + with pytest.raises(NotImplementedError): + self.model_ivp.build_model(0, 0) + + def test_run_model(self, model_oscillator: ModelOscillator): + model_oscillator.run_model() + + def test_run_model_params_not_list( + self, model_oscillator: ModelOscillator + ): + with pytest.raises(TypeError): + model_oscillator.run_model(parameters=set((0, 1))) From 332654fe6a72670139b35b3c8b42aca631ada44c Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Fri, 21 May 2021 11:21:12 -0500 Subject: [PATCH 4/9] tests: added tests for dinjo.optimizer --- tests/conftest.py | 32 ++++++++ tests/test_optimizer.py | 173 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 tests/test_optimizer.py diff --git a/tests/conftest.py b/tests/conftest.py index 314f0c9..3c2f862 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,11 @@ +from typing import Any, List import pytest from numpy import pi +from numpy.random import random from dinjo.model import StateVariable, Parameter +from dinjo.optimizer import Optimizer from dinjo.predefined.physics import ModelOscillator @@ -46,3 +49,32 @@ def model_oscillator(ho_state_vars, ho_params, t_span, t_steps): t_span=t_span, t_steps=t_steps ) + + +@pytest.fixture(scope='session') +def oscillator_solution(model_oscillator: ModelOscillator): + return model_oscillator.run_model() + + +@pytest.fixture(scope='session') +def ho_mock_values(oscillator_solution: Any, t_steps: List[float]): + noise_factor = 0.3 + return ( + oscillator_solution.y[0] + + (2 * random(t_steps) - 1) * noise_factor + ) + + +@pytest.fixture(scope='session') +def ho_optimizer( + model_oscillator: ModelOscillator, + oscillator_solution: Any, + ho_mock_values: List[float], + ho_state_vars: List[StateVariable] +): + return Optimizer( + model_oscillator, + ho_state_vars[0], + ho_mock_values, + oscillator_solution.t + ) diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py new file mode 100644 index 0000000..2c29cf0 --- /dev/null +++ b/tests/test_optimizer.py @@ -0,0 +1,173 @@ +from typing import Any, List + +import pytest + +from dinjo.model import ModelIVP, Parameter, StateVariable +from dinjo.optimizer import Optimizer +from dinjo.predefined.physics import ModelOscillator + + +def test_bad_reference_state_variable( + model_oscillator: ModelOscillator, + oscillator_solution: Any, + ho_mock_values: List[float], +): + with pytest.raises(ValueError): + Optimizer( + model_oscillator, + StateVariable('foo', 'foo', 0.0), + ho_mock_values, + oscillator_solution.t + ) + + +def test_reference_values_bad_length( + model_oscillator: ModelOscillator, + ho_state_vars: List[StateVariable], + ho_mock_values: List[float], + oscillator_solution: Any +): + longer_ref_values = list(ho_mock_values[:]) + longer_ref_values.append(0) + with pytest.raises(ValueError): + Optimizer( + model_oscillator, + ho_state_vars[0], + longer_ref_values, + oscillator_solution.t + ) + + +def test_reference_t_values_bad_length( + model_oscillator: ModelOscillator, + ho_state_vars: List[StateVariable], + ho_mock_values: List[float], + oscillator_solution: Any +): + longer_t_vlaues = list(oscillator_solution.t[:]) + longer_t_vlaues.append(0) + with pytest.raises(ValueError): + Optimizer( + model_oscillator, + ho_state_vars[0], + ho_mock_values, + longer_t_vlaues + ) + + +def test_unordered_reference_t_values( + model_oscillator: ModelOscillator, + ho_state_vars: List[StateVariable], + ho_mock_values: List[float], + oscillator_solution: Any +): + longer_t_vlaues = list(oscillator_solution.t[:]) + longer_t_vlaues[1] = 10 + with pytest.raises(ValueError): + Optimizer( + model_oscillator, + ho_state_vars[0], + ho_mock_values, + longer_t_vlaues + ) + + +def test_reference_t_values_bad_limits( + model_oscillator: ModelOscillator, + ho_state_vars: List[StateVariable], + ho_mock_values: List[float], + oscillator_solution: Any +): + longer_t_vlaues = list(oscillator_solution.t[:]) + longer_t_vlaues[0] = 0.01 + with pytest.raises(ValueError): + Optimizer( + model_oscillator, + ho_state_vars[0], + ho_mock_values, + longer_t_vlaues + ) + + +def test_reference_t_values_property(ho_optimizer: Optimizer): + assert ho_optimizer.reference_t_values.any() + + +def test_cost_function_root_mean_square( + model_oscillator: ModelOscillator, + ho_optimizer: Optimizer +): + ho_optimizer.cost_function( + model_oscillator.parameters_init_vals, + cost_method='root_mean_square' + ) + + +def test_cost_function_bad_cost_method( + model_oscillator: ModelOscillator, + ho_optimizer: Optimizer +): + with pytest.raises(ValueError): + ho_optimizer.cost_function( + model_oscillator.parameters_init_vals, + cost_method='foo' + ) + + +def test_optimize_algorithm_diff_evol( + ho_optimizer: Optimizer +): + ho_optimization = ho_optimizer.optimize( + algorithm='differential_evolution' + ) + assert ho_optimization.success + + +def test_optimize_algorithm_shgo( + ho_optimizer: Optimizer +): + ho_optimization = ho_optimizer.optimize( + algorithm='shgo' + ) + assert ho_optimization.success + + +@pytest.mark.skip('Takes more time. Comment this line to run this test.') +def test_optimize_algorithm_dual_annealing( + ho_optimizer: Optimizer +): + ho_optimization = ho_optimizer.optimize( + algorithm='dual_annealing' + ) + assert ho_optimization.success + + +def test_optimize_bad_algorithm_name( + ho_optimizer: Optimizer +): + with pytest.raises(ValueError): + ho_optimizer.optimize( + algorithm='foo' + ) + + +def test_optimize_bad_algotrithm_keyword_arguments( + ho_optimizer: Optimizer +): + with pytest.raises(ValueError): + ho_optimizer.optimize( + algorithm_kwargs={'foo': 'foo'} + ) + + +def test_optimize_runtime_error(): + class Foo(ModelIVP): + def build_model(self, t, y, foo): + return None + variable_params = ('foo', 'foo', 0.0) + foo_var = StateVariable(*variable_params) + foo_param = Parameter(*variable_params) + foo_model = Foo([foo_var], [foo_param], [0, 1], 2) + foo_optimizer = Optimizer(foo_model, foo_var, [0, 1], [0, 1]) + with pytest.raises(RuntimeError): + foo_optimizer.optimize() From d3f512d3fb4aa16a71c7d3bf547700f8f1d5ac97 Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Fri, 21 May 2021 12:54:59 -0500 Subject: [PATCH 5/9] tests: added tests of predefined subpackage --- tests/predefined/__init__.py | 0 tests/predefined/test_epidemiology.py | 102 ++++++++++++++++++++++++++ tests/predefined/test_physics.py | 14 ++++ 3 files changed, 116 insertions(+) create mode 100644 tests/predefined/__init__.py create mode 100644 tests/predefined/test_epidemiology.py create mode 100644 tests/predefined/test_physics.py diff --git a/tests/predefined/__init__.py b/tests/predefined/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/predefined/test_epidemiology.py b/tests/predefined/test_epidemiology.py new file mode 100644 index 0000000..bdeb36c --- /dev/null +++ b/tests/predefined/test_epidemiology.py @@ -0,0 +1,102 @@ +from typing import List +from pytest import approx + +from dinjo.model import ModelIVP, StateVariable, Parameter +from dinjo.predefined.epidemiology import ( + ModelSEIR, ModelSimpleSEIRV, ModelSIR, ModelSEIRV +) + + +class TestEpidemiologyModels: + def setup(self): + S = StateVariable('Succeptible', 'S', 0.5) + E = StateVariable('Exposed', 'E', 0.5) + Inf = StateVariable('Infected', 'I', 0.5) + R = StateVariable('recovered', 'R', 0.5) + V = StateVariable('Virus', 'V', 0.5) + + Lmbd = Parameter('Lambda', r'\Lambda', 1 / 2) + mu = Parameter('mu', r'\mu', 1 / 2) + inv_alpha = Parameter('inverse_alpha', r'\frac{1}{\alpha}', 1 / 2) + omega = Parameter('omega', r'\omega', 1 / 2) + gamma = Parameter('gamma', r'\gamma', 1 / 2) + xi_E = Parameter('xi_E', r'\xi_E', 1 / 2) + xi_I = Parameter('xi_I', r'\xi_I', 1 / 2) + sigma = Parameter('sigma', r'\sigma', 1 / 2) + beta_E = Parameter('beta_E', r'\beta_E', 1 / 2) + beta_I = Parameter('beta_I', r'\beta_I', 1 / 2) + beta_V = Parameter('beta_V', r'\beta_V', 1 / 2) + c_E = Parameter('c_E', r'\c_E', 1 / 2) + c_I = Parameter('c_I', r'\c_I', 1 / 2) + c_V = Parameter('c_V', r'\c_V', 1 / 2) + + chi = Parameter('chi', r'\chi', 1 / 2) + eta = Parameter('eta', r'\eta', 1 / 2) + Pi = Parameter('Pi', r'\Pi', 1 / 2) + tau = Parameter('tau', r'\tau', 1 / 2) + + self.sir_state_vars = [S, Inf, R] + self.sir_params = [Lmbd, mu, omega, gamma, chi, eta, Pi, tau] + + self.seir_state_vars = [S, E, Inf, R] + self.seir_params = [ + Lmbd, mu, omega, gamma, inv_alpha, chi, beta_E, beta_I + ] + + self.seirv_state_vars = [S, E, Inf, R, V] + self.seirv_params = [ + Lmbd, mu, inv_alpha, omega, gamma, xi_E, xi_I, sigma, beta_E, + beta_I, beta_V, c_E, c_I, c_V + ] + + self.seirv_simple_params = [ + Lmbd, mu, omega, gamma, inv_alpha, xi_E, xi_I, sigma, + beta_E, beta_I, beta_V + ] + + self.t_span = [0, 1] + self.t_steps = 2 + + def assert_approx_dydt( + self, + model: ModelIVP, + approx_dydt: List[float], + rel_tol: float = 0.99 + ): + dydt = model.build_model( + self.t_span[0], + model.state_variables_init_vals, + *model.parameters_init_vals + ) + + print(dydt) + + assert dydt == approx(approx_dydt, rel_tol) + + def test_seir(self): + model_seir = ModelSEIR( + self.seir_state_vars, self.seir_params, self.t_span, self.t_steps + ) + self.assert_approx_dydt(model_seir, [-0.25, -0.25, -0.5, 0.25]) + + def test_seirv(self): + model_seirv = ModelSEIRV( + self.seirv_state_vars, self.seirv_params, self.t_span, self.t_steps + ) + self.assert_approx_dydt(model_seirv, [-0.05, -0.2, -0.5, 0.0, 0.25]) + + def test_seirv_fixed(self): + model_seirv_fixed = ModelSimpleSEIRV( + self.seirv_state_vars, self.seirv_simple_params, self.t_span, + self.t_steps + ) + self.assert_approx_dydt( + model_seirv_fixed, + [-0.125, -0.125, -0.5, 0.0, 0.25] + ) + + def test_sir(self): + model_sir = ModelSIR( + self.sir_state_vars, self.sir_params, self.t_span, self.t_steps + ) + self.assert_approx_dydt(model_sir, [0.125, -0.875, -0.25]) diff --git a/tests/predefined/test_physics.py b/tests/predefined/test_physics.py new file mode 100644 index 0000000..7ff6679 --- /dev/null +++ b/tests/predefined/test_physics.py @@ -0,0 +1,14 @@ +from pytest import approx +from numpy import pi + +from dinjo.model import StateVariable, Parameter +from dinjo.predefined.physics import ModelOscillator + + +def test_model_oscillator(): + q = StateVariable('position', 'q', 1.0) + p = StateVariable('momentum', 'p', 0.0) + omega = Parameter('frequency', 'w', 2 * pi, [4, 8]) + oscillator_model = ModelOscillator([q, p], [omega], [0, 1], 50) + dydt = oscillator_model.build_model(0, [1/2, 1/2], 1/2) # noqa + assert dydt == approx([1/2, - 1/8], 0.99) # noqa From d6610f9a7597e4723274fc1561d6c5ee904b1e8f Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Fri, 21 May 2021 12:55:42 -0500 Subject: [PATCH 6/9] tests: deleted old tests --- tests/_test_optimizer.py | 266 ------------------------------------- tests/_test_seirv_model.py | 153 --------------------- 2 files changed, 419 deletions(-) delete mode 100644 tests/_test_optimizer.py delete mode 100644 tests/_test_seirv_model.py diff --git a/tests/_test_optimizer.py b/tests/_test_optimizer.py deleted file mode 100644 index 1e9d71d..0000000 --- a/tests/_test_optimizer.py +++ /dev/null @@ -1,266 +0,0 @@ -from typing import List - -import pytest -import numpy as np - -from dinjo import model, optimizer -from .test_seirv_model import ( # noqa: F401 - state_variables_source, state_variables, parameters_source, parameters, - model_SEIRV, -) -from examples.seirv_model_colombia import infected_reference_col - - -@pytest.fixture -def infected(state_variables: model.StateVariable): # noqa: F811 - infected: model.StateVariable = state_variables[2] - return infected - - -@pytest.fixture -def reference_values(): - """ - Number of Infections in Colombia by day - """ - return infected_reference_col - - -def test_optimizer_initialization( - model_SEIRV: model.ModelIVP, # noqa: F811 - infected: model.StateVariable, - reference_values: List[float] -): - try: - optimizer.Optimizer( - model=model_SEIRV, - reference_state_variable=infected, - reference_values=reference_values, - reference_t_values=model_SEIRV.t_eval - ) - except AttributeError: - assert False - except Exception: - assert False - else: - assert True - - -@pytest.mark.skip( - "Error Handling should be improved in optimizer module. " - "For example, AttributeError is raised inappropiately" -) -def test_optimizer_initialization_error_handling( - model_SEIRV: model.ModelIVP, # noqa: F811 - infected: model.StateVariable, - reference_values: List[float] -): - raise NotImplementedError - - -@pytest.fixture -def seirv_optimizer( - model_SEIRV: model.ModelIVP, # noqa: F811 - infected: model.StateVariable, - reference_values: List[float] -) -> optimizer.Optimizer: - """ - Optimizer for seirv model. - """ - seirv_optimizer = optimizer.Optimizer( - model=model_SEIRV, - reference_state_variable=infected, - reference_values=reference_values, - reference_t_values=model_SEIRV.t_eval - ) - - return seirv_optimizer - - -def test_optimizer_cost_function( - seirv_optimizer: optimizer.Optimizer, - model_SEIRV: model.ModelIVP # noqa: F811 -): - - root_mean_square = seirv_optimizer.cost_function( - model_SEIRV.parameters_init_vals - ) - print(root_mean_square) - # Value calculated with Boris' definition of RootMeanSquare in Mathematica script - assert root_mean_square == pytest.approx(6878.03, rel=0.99) - - -def test_optimizer_cost_function_cost_method_value_error( - seirv_optimizer: optimizer.Optimizer, - model_SEIRV: model.ModelIVP # noqa: F811 -): - """Test error handling in - :method:`cmodel.optimizer.Optimizer.cost_function` passing unsupported - value for cost_method kwarg to cost_function() method in optimizer class - """ - try: - seirv_optimizer.cost_function( - model_SEIRV.parameters_init_vals, - cost_method='some_random_method' - ) - except ValueError: - assert True - else: - assert False - - -############################################################################### -# Test optimizer minimize_global with a very simple one-parameter # -# harmonic oscillator model # -############################################################################### - - -@pytest.fixture -def state_variables_oscillator() -> List[model.StateVariable]: - """List of state variables for optimizator tests. - """ - q = model.StateVariable( - name='position', representation='q', initial_value=1.0 - ) - p = model.StateVariable( - name='momentum', representation='p', initial_value=0.0 - ) - return [q, p] - - -@pytest.fixture -def parameters_oscillator() -> List[model.Parameter]: - """ - List of parameters for oscillator optimizator tests. - """ - omega = model.Parameter( - name='frequency', representation='w', initial_value=5, bounds=[4, 8] - ) - return [omega] - - -@pytest.fixture -def t_span_oscillator( - parameters_oscillator: List[model.Parameter] -) -> List[float]: - """Time span for oscillator optimizer tests.""" - omega = parameters_oscillator[0] - t_span = [0, 2 * np.pi / omega.initial_value] - return t_span - - -@pytest.fixture -def t_steps_oscillator() -> int: - """Number of time seteps for oscillator optimizer tests.""" - t_steps = 50 - return int(t_steps) - - -@pytest.fixture -def model_oscillator( - parameters_oscillator: List[model.Parameter], - state_variables_oscillator: List[model.StateVariable], - t_span_oscillator: List[float], - t_steps_oscillator: int -) -> model.ModelIVP: - """Build compartmental model of Harmonic Oscillator.""" - - # Build oscillator model - class ModelOscillator(model.ModelIVP): - def build_model(self, t, y, w): - """Harmonic Oscillator differential equations - """ - q, p = y - - # Hamilton's equations - dydt = [ - p, - - (w ** 2) * q - ] - return dydt - - # Instantiate Model - model_oscillator = ModelOscillator( - state_variables=state_variables_oscillator, - parameters=parameters_oscillator, - t_span=t_span_oscillator, - t_steps=t_steps_oscillator - ) - - return model_oscillator - - -@pytest.fixture -def solution_oscillator(model_oscillator: model.ModelIVP): - """Numerical solution of oscillator model with initial value of - parameters_oscillator. - """ - return model_oscillator.run_model() - - -@pytest.fixture -def fake_position_reference_values_oscillator( - solution_oscillator, - t_steps_oscillator: int -) -> np.ndarray: - """Generate fake position reference values by adding noise to a numerical - solution. - """ - # Get the position solution - solution_position = solution_oscillator.y[0] - - # Build fake observation data from the solution (to test optimizer) - noise_factor = 0.15 # Keep this number less than 0.2 or some tests will fail - oscillator_fake_position_reference_values: np.ndarray = ( - solution_position - + (2 * np.random.random(t_steps_oscillator) - 1) * noise_factor - ) - - return oscillator_fake_position_reference_values - - -@pytest.fixture -def optimizer_oscillator( - model_oscillator: model.ModelIVP, - state_variables_oscillator: List[model.StateVariable], - fake_position_reference_values_oscillator: np.ndarray, - solution_oscillator, -): - """ - docstring - """ - position_oscillator: model.StateVariable = state_variables_oscillator[0] - optimizer_oscillator = optimizer.Optimizer( - model=model_oscillator, - reference_state_variable=position_oscillator, - reference_values=fake_position_reference_values_oscillator, - reference_t_values=solution_oscillator.t - ) - return optimizer_oscillator - - -def test_optimizer_minimize_global_oscillator( - optimizer_oscillator: optimizer.Optimizer, - test_dual_annealing: bool = False -): - """ - Test :method:`Optimizer.minimize_global` mehtod using harmonic Oscillator - example. - """ - - # Algorithms to test - minimize_global_algorithms = ['differential_evolution', 'shgo'] - - # 'dual_annealing' is very slow (approx 13 seconds for a one-parameter optimization). - if test_dual_annealing: - minimize_global_algorithms.append('dual_annealing') - - # Rune one assert statement for each algorithm - for algorithm in minimize_global_algorithms: - optimal_parameters_oscillator = optimizer_oscillator.optimize( - algorithm=algorithm - ) - expected_parameters_oscillator = optimizer_oscillator.model.parameters_init_vals - - assert optimal_parameters_oscillator.x == pytest.approx( - expected_parameters_oscillator, rel=0.9 - ) diff --git a/tests/_test_seirv_model.py b/tests/_test_seirv_model.py deleted file mode 100644 index 1cf9c17..0000000 --- a/tests/_test_seirv_model.py +++ /dev/null @@ -1,153 +0,0 @@ -from typing import List - -import pytest -from pytest import approx -import numpy as np - -from dinjo import model -from dinjo.predefined.epidemiology import ModelSEIRV -from examples.col_vars_params import ( - seirv_state_variables_colombia_src, - seirv_parameters_colombia_src_ini -) - - -@pytest.fixture -def state_variables_source(): - return seirv_state_variables_colombia_src - - -@pytest.fixture -def state_variables(state_variables_source): - state_variables = [ - model.StateVariable(*sv) for sv in state_variables_source - ] - - return state_variables - - -@pytest.fixture -def parameters_source(): - return [param_info[:3] for param_info in seirv_parameters_colombia_src_ini] - - -@pytest.fixture -def parameters(parameters_source): - """The values of the parameters were obtained from Boris' optimization - script. - """ - parameters = [model.Parameter(*param) for param in parameters_source] - - return parameters - - -@pytest.fixture -def model_SEIRV(state_variables, parameters): - t_span = [0, 171] - t_steps = 172 - - model_SEIRV = ModelSEIRV(state_variables, parameters, t_span, t_steps) - - return model_SEIRV - - -def test_state_variables_init_vals( - model_SEIRV: ModelSEIRV, - state_variables_source -): - sv_init_vals = [sv[2] for sv in state_variables_source] - assert model_SEIRV.state_variables_init_vals == sv_init_vals - - -def test_parameters_init_vals(model_SEIRV: ModelSEIRV, parameters_source): - params = [param[2] for param in parameters_source] - assert model_SEIRV.parameters_init_vals == params - - -@pytest.mark.parametrize( - 'bounds', - [ - [1, 2], - [1., 2], - [1, 2.], - [1., 2.] - ] -) -def test_parameters_bounds(bounds): - try: - model.Parameter("a", "b", 1.5, bounds=bounds) - except ValueError: - assert False - else: - assert True - - -@pytest.mark.parametrize( - 'initial_value,bounds', - [ - (1.3, "a"), - (1.5, (1, 2.)), - (1.5, [1, 2, 3]), - (1.5, ["a", 2.]), - (1.5, [1, "b"]), - (1.5, [2, 1]), - (0, [1, 2]), - ] -) -def test_parameters_bounds_error_handling(initial_value, bounds): - with pytest.raises(ValueError): - model.Parameter("a", "b", initial_value, bounds=bounds) - - -def test_state_variables_initialization( - state_variables: List[model.StateVariable], state_variables_source -): - state_variables_source_test = [ - (sv.name, sv.representation, sv.initial_value) for sv in state_variables - ] - - assert state_variables_source_test == state_variables_source - - -def test_parameters_initialization( - parameters: List[model.Parameter], parameters_source -): - parameters_source_test = [ - (param.name, param.representation, param.initial_value) for param in parameters - ] - - assert parameters_source_test == parameters_source - - -def test_model_SEIRV_build_model( - model_SEIRV: ModelSEIRV, -): - """Tests if evaluation of differential equation defined in SEIRV model is OK""" - - state_variables = model_SEIRV.state_variables_init_vals - parameters = model_SEIRV.parameters_init_vals - - # Expected value calculated in Mathematica, in Boris' script - expected_diff_eqn_value = approx( - [1324.04, 0.134732, -0.0780818, 0.0666667, 6.32609], rel=0.99 - ) - - # Evaluation of differential equation must be independent of time - for t in range(10): - diff_eqn_value = model_SEIRV.build_model( - t, state_variables, *parameters - ) - assert diff_eqn_value == expected_diff_eqn_value - - -def test_model_SEIRV_run_model_initial_value( - model_SEIRV: ModelSEIRV, - state_variables: List[model.StateVariable] -): - initial_state_variables = model_SEIRV.state_variables_init_vals - param_types = (list, tuple, np.array) - parameters = model_SEIRV.parameters_init_vals - for param_type in param_types: - solution = model_SEIRV.run_model(parameters=param_type(parameters)) - solution_initial_values = [y[0] for y in solution.y] - assert solution_initial_values == approx(initial_state_variables) From 1fa49f0e99a39a35fe368683f8180b2b7c48a389 Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Fri, 21 May 2021 18:21:23 -0500 Subject: [PATCH 7/9] chore: added dinjo to pipfile as developer, editable install --- Pipfile | 5 +- Pipfile.lock | 352 +++++++++------------ dinjo/model.py | 2 +- examples/optimizer_oscillator.py | 11 +- examples/optimizer_seirv_model_colombia.py | 17 +- examples/seirv_model_colombia.py | 15 +- pyproject.toml | 3 + setup.py | 2 +- 8 files changed, 181 insertions(+), 226 deletions(-) create mode 100644 pyproject.toml diff --git a/Pipfile b/Pipfile index ce4f5e0..057c0b1 100644 --- a/Pipfile +++ b/Pipfile @@ -6,8 +6,6 @@ name = "pypi" [packages] scipy = "*" numpy = "*" -matplotlib = "*" -pillow = ">=8.1.1" [dev-packages] pytest = "*" @@ -16,6 +14,9 @@ flake8 = "*" pytest-cov = "*" sphinx = "*" sphinx-rtd-theme = "*" +matplotlib = "*" +pillow = ">=8.1.1" +dinjo = {editable = true, path = "."} [scripts] tests = "python -m pytest tests" diff --git a/Pipfile.lock b/Pipfile.lock index c000327..587f37e 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "b301219bf527b6ee40e42a137c50931d145879e531075fba11c0bc0c9e82d33f" + "sha256": "716c0c1810a92bbf4ecb4ead426dc06b73e829768a81319ea53a3866ec7394c2" }, "pipfile-spec": 6, "requires": { @@ -16,76 +16,6 @@ ] }, "default": { - "cycler": { - "hashes": [ - "sha256:1d8a5ae1ff6c5cf9b93e8811e581232ad8920aeec647c37316ceac982b08cb2d", - "sha256:cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8" - ], - "version": "==0.10.0" - }, - "kiwisolver": { - "hashes": [ - "sha256:0cd53f403202159b44528498de18f9285b04482bab2a6fc3f5dd8dbb9352e30d", - "sha256:1e1bc12fb773a7b2ffdeb8380609f4f8064777877b2225dec3da711b421fda31", - "sha256:225e2e18f271e0ed8157d7f4518ffbf99b9450fca398d561eb5c4a87d0986dd9", - "sha256:232c9e11fd7ac3a470d65cd67e4359eee155ec57e822e5220322d7b2ac84fbf0", - "sha256:31dfd2ac56edc0ff9ac295193eeaea1c0c923c0355bf948fbd99ed6018010b72", - "sha256:33449715e0101e4d34f64990352bce4095c8bf13bed1b390773fc0a7295967b3", - "sha256:401a2e9afa8588589775fe34fc22d918ae839aaaf0c0e96441c0fdbce6d8ebe6", - "sha256:44a62e24d9b01ba94ae7a4a6c3fb215dc4af1dde817e7498d901e229aaf50e4e", - "sha256:50af681a36b2a1dee1d3c169ade9fdc59207d3c31e522519181e12f1b3ba7000", - "sha256:563c649cfdef27d081c84e72a03b48ea9408c16657500c312575ae9d9f7bc1c3", - "sha256:5989db3b3b34b76c09253deeaf7fbc2707616f130e166996606c284395da3f18", - "sha256:5a7a7dbff17e66fac9142ae2ecafb719393aaee6a3768c9de2fd425c63b53e21", - "sha256:5c3e6455341008a054cccee8c5d24481bcfe1acdbc9add30aa95798e95c65621", - "sha256:5f6ccd3dd0b9739edcf407514016108e2280769c73a85b9e59aa390046dbf08b", - "sha256:72c99e39d005b793fb7d3d4e660aed6b6281b502e8c1eaf8ee8346023c8e03bc", - "sha256:78751b33595f7f9511952e7e60ce858c6d64db2e062afb325985ddbd34b5c131", - "sha256:834ee27348c4aefc20b479335fd422a2c69db55f7d9ab61721ac8cd83eb78882", - "sha256:8be8d84b7d4f2ba4ffff3665bcd0211318aa632395a1a41553250484a871d454", - "sha256:950a199911a8d94683a6b10321f9345d5a3a8433ec58b217ace979e18f16e248", - "sha256:a357fd4f15ee49b4a98b44ec23a34a95f1e00292a139d6015c11f55774ef10de", - "sha256:a53d27d0c2a0ebd07e395e56a1fbdf75ffedc4a05943daf472af163413ce9598", - "sha256:acef3d59d47dd85ecf909c359d0fd2c81ed33bdff70216d3956b463e12c38a54", - "sha256:b38694dcdac990a743aa654037ff1188c7a9801ac3ccc548d3341014bc5ca278", - "sha256:b9edd0110a77fc321ab090aaa1cfcaba1d8499850a12848b81be2222eab648f6", - "sha256:c08e95114951dc2090c4a630c2385bef681cacf12636fb0241accdc6b303fd81", - "sha256:c5518d51a0735b1e6cee1fdce66359f8d2b59c3ca85dc2b0813a8aa86818a030", - "sha256:c8fd0f1ae9d92b42854b2979024d7597685ce4ada367172ed7c09edf2cef9cb8", - "sha256:ca3820eb7f7faf7f0aa88de0e54681bddcb46e485beb844fcecbcd1c8bd01689", - "sha256:cf8b574c7b9aa060c62116d4181f3a1a4e821b2ec5cbfe3775809474113748d4", - "sha256:d3155d828dec1d43283bd24d3d3e0d9c7c350cdfcc0bd06c0ad1209c1bbc36d0", - "sha256:f8d6f8db88049a699817fd9178782867bf22283e3813064302ac59f61d95be05", - "sha256:fd34fbbfbc40628200730bc1febe30631347103fc8d3d4fa012c21ab9c11eca9" - ], - "markers": "python_version >= '3.6'", - "version": "==1.3.1" - }, - "matplotlib": { - "hashes": [ - "sha256:0bea5ec5c28d49020e5d7923c2725b837e60bc8be99d3164af410eb4b4c827da", - "sha256:1c1779f7ab7d8bdb7d4c605e6ffaa0614b3e80f1e3c8ccf7b9269a22dbc5986b", - "sha256:21b31057bbc5e75b08e70a43cefc4c0b2c2f1b1a850f4a0f7af044eb4163086c", - "sha256:32fa638cc10886885d1ca3d409d4473d6a22f7ceecd11322150961a70fab66dd", - "sha256:3a5c18dbd2c7c366da26a4ad1462fe3e03a577b39e3b503bbcf482b9cdac093c", - "sha256:5826f56055b9b1c80fef82e326097e34dc4af8c7249226b7dd63095a686177d1", - "sha256:6382bc6e2d7e481bcd977eb131c31dee96e0fb4f9177d15ec6fb976d3b9ace1a", - "sha256:6475d0209024a77f869163ec3657c47fed35d9b6ed8bccba8aa0f0099fbbdaa8", - "sha256:6a6a44f27aabe720ec4fd485061e8a35784c2b9ffa6363ad546316dfc9cea04e", - "sha256:7a58f3d8fe8fac3be522c79d921c9b86e090a59637cb88e3bc51298d7a2c862a", - "sha256:7ad19f3fb6145b9eb41c08e7cbb9f8e10b91291396bee21e9ce761bb78df63ec", - "sha256:85f191bb03cb1a7b04b5c2cca4792bef94df06ef473bc49e2818105671766fee", - "sha256:956c8849b134b4a343598305a3ca1bdd3094f01f5efc8afccdebeffe6b315247", - "sha256:a9d8cb5329df13e0cdaa14b3b43f47b5e593ec637f13f14db75bb16e46178b05", - "sha256:b1d5a2cedf5de05567c441b3a8c2651fbde56df08b82640e7f06c8cd91e201f6", - "sha256:b26535b9de85326e6958cdef720ecd10bcf74a3f4371bf9a7e5b2e659c17e153", - "sha256:c541ee5a3287efe066bbe358320853cf4916bc14c00c38f8f3d8d75275a405a9", - "sha256:d8d994cefdff9aaba45166eb3de4f5211adb4accac85cbf97137e98f26ea0219", - "sha256:df815378a754a7edd4559f8c51fc7064f779a74013644a7f5ac7a0c31f875866" - ], - "index": "pypi", - "version": "==3.4.2" - }, "numpy": { "hashes": [ "sha256:1676b0a292dd3c99e49305a16d7a9f42a4ab60ec522eac0d3dd20cdf362ac010", @@ -116,61 +46,6 @@ "index": "pypi", "version": "==1.20.3" }, - "pillow": { - "hashes": [ - "sha256:01425106e4e8cee195a411f729cff2a7d61813b0b11737c12bd5991f5f14bcd5", - "sha256:031a6c88c77d08aab84fecc05c3cde8414cd6f8406f4d2b16fed1e97634cc8a4", - "sha256:083781abd261bdabf090ad07bb69f8f5599943ddb539d64497ed021b2a67e5a9", - "sha256:0d19d70ee7c2ba97631bae1e7d4725cdb2ecf238178096e8c82ee481e189168a", - "sha256:0e04d61f0064b545b989126197930807c86bcbd4534d39168f4aa5fda39bb8f9", - "sha256:12e5e7471f9b637762453da74e390e56cc43e486a88289995c1f4c1dc0bfe727", - "sha256:22fd0f42ad15dfdde6c581347eaa4adb9a6fc4b865f90b23378aa7914895e120", - "sha256:238c197fc275b475e87c1453b05b467d2d02c2915fdfdd4af126145ff2e4610c", - "sha256:3b570f84a6161cf8865c4e08adf629441f56e32f180f7aa4ccbd2e0a5a02cba2", - "sha256:463822e2f0d81459e113372a168f2ff59723e78528f91f0bd25680ac185cf797", - "sha256:4d98abdd6b1e3bf1a1cbb14c3895226816e666749ac040c4e2554231068c639b", - "sha256:5afe6b237a0b81bd54b53f835a153770802f164c5570bab5e005aad693dab87f", - "sha256:5b70110acb39f3aff6b74cf09bb4169b167e2660dabc304c1e25b6555fa781ef", - "sha256:5cbf3e3b1014dddc45496e8cf38b9f099c95a326275885199f427825c6522232", - "sha256:624b977355cde8b065f6d51b98497d6cd5fbdd4f36405f7a8790e3376125e2bb", - "sha256:63728564c1410d99e6d1ae8e3b810fe012bc440952168af0a2877e8ff5ab96b9", - "sha256:66cc56579fd91f517290ab02c51e3a80f581aba45fd924fcdee01fa06e635812", - "sha256:6c32cc3145928c4305d142ebec682419a6c0a8ce9e33db900027ddca1ec39178", - "sha256:8bb1e155a74e1bfbacd84555ea62fa21c58e0b4e7e6b20e4447b8d07990ac78b", - "sha256:95d5ef984eff897850f3a83883363da64aae1000e79cb3c321915468e8c6add5", - "sha256:a013cbe25d20c2e0c4e85a9daf438f85121a4d0344ddc76e33fd7e3965d9af4b", - "sha256:a787ab10d7bb5494e5f76536ac460741788f1fbce851068d73a87ca7c35fc3e1", - "sha256:a7d5e9fad90eff8f6f6106d3b98b553a88b6f976e51fce287192a5d2d5363713", - "sha256:aac00e4bc94d1b7813fe882c28990c1bc2f9d0e1aa765a5f2b516e8a6a16a9e4", - "sha256:b91c36492a4bbb1ee855b7d16fe51379e5f96b85692dc8210831fbb24c43e484", - "sha256:c03c07ed32c5324939b19e36ae5f75c660c81461e312a41aea30acdd46f93a7c", - "sha256:c5236606e8570542ed424849f7852a0ff0bce2c4c8d0ba05cc202a5a9c97dee9", - "sha256:c6b39294464b03457f9064e98c124e09008b35a62e3189d3513e5148611c9388", - "sha256:cb7a09e173903541fa888ba010c345893cd9fc1b5891aaf060f6ca77b6a3722d", - "sha256:d68cb92c408261f806b15923834203f024110a2e2872ecb0bd2a110f89d3c602", - "sha256:dc38f57d8f20f06dd7c3161c59ca2c86893632623f33a42d592f097b00f720a9", - "sha256:e98eca29a05913e82177b3ba3d198b1728e164869c613d76d0de4bde6768a50e", - "sha256:f217c3954ce5fd88303fc0c317af55d5e0204106d86dea17eb8205700d47dec2" - ], - "index": "pypi", - "version": "==8.2.0" - }, - "pyparsing": { - "hashes": [ - "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", - "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.4.7" - }, - "python-dateutil": { - "hashes": [ - "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c", - "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.8.1" - }, "scipy": { "hashes": [ "sha256:01b38dec7e9f897d4db04f8de4e20f0f5be3feac98468188a0f47a991b796055", @@ -195,14 +70,6 @@ ], "index": "pypi", "version": "==1.6.3" - }, - "six": { - "hashes": [ - "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", - "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.16.0" } }, "develop": { @@ -305,6 +172,17 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", "version": "==5.5" }, + "cycler": { + "hashes": [ + "sha256:1d8a5ae1ff6c5cf9b93e8811e581232ad8920aeec647c37316ceac982b08cb2d", + "sha256:cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8" + ], + "version": "==0.10.0" + }, + "dinjo": { + "editable": true, + "path": "." + }, "docutils": { "hashes": [ "sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af", @@ -346,69 +224,114 @@ }, "jinja2": { "hashes": [ - "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419", - "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6" + "sha256:1f06f2da51e7b56b8f238affdd6b4e2c61e39598a378cc49345bc1bd42a978a4", + "sha256:703f484b47a6af502e743c9122595cc812b0271f661722403114f71a79d0f5a4" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==2.11.3" + "markers": "python_version >= '3.6'", + "version": "==3.0.1" + }, + "kiwisolver": { + "hashes": [ + "sha256:0cd53f403202159b44528498de18f9285b04482bab2a6fc3f5dd8dbb9352e30d", + "sha256:1e1bc12fb773a7b2ffdeb8380609f4f8064777877b2225dec3da711b421fda31", + "sha256:225e2e18f271e0ed8157d7f4518ffbf99b9450fca398d561eb5c4a87d0986dd9", + "sha256:232c9e11fd7ac3a470d65cd67e4359eee155ec57e822e5220322d7b2ac84fbf0", + "sha256:31dfd2ac56edc0ff9ac295193eeaea1c0c923c0355bf948fbd99ed6018010b72", + "sha256:33449715e0101e4d34f64990352bce4095c8bf13bed1b390773fc0a7295967b3", + "sha256:401a2e9afa8588589775fe34fc22d918ae839aaaf0c0e96441c0fdbce6d8ebe6", + "sha256:44a62e24d9b01ba94ae7a4a6c3fb215dc4af1dde817e7498d901e229aaf50e4e", + "sha256:50af681a36b2a1dee1d3c169ade9fdc59207d3c31e522519181e12f1b3ba7000", + "sha256:563c649cfdef27d081c84e72a03b48ea9408c16657500c312575ae9d9f7bc1c3", + "sha256:5989db3b3b34b76c09253deeaf7fbc2707616f130e166996606c284395da3f18", + "sha256:5a7a7dbff17e66fac9142ae2ecafb719393aaee6a3768c9de2fd425c63b53e21", + "sha256:5c3e6455341008a054cccee8c5d24481bcfe1acdbc9add30aa95798e95c65621", + "sha256:5f6ccd3dd0b9739edcf407514016108e2280769c73a85b9e59aa390046dbf08b", + "sha256:72c99e39d005b793fb7d3d4e660aed6b6281b502e8c1eaf8ee8346023c8e03bc", + "sha256:78751b33595f7f9511952e7e60ce858c6d64db2e062afb325985ddbd34b5c131", + "sha256:834ee27348c4aefc20b479335fd422a2c69db55f7d9ab61721ac8cd83eb78882", + "sha256:8be8d84b7d4f2ba4ffff3665bcd0211318aa632395a1a41553250484a871d454", + "sha256:950a199911a8d94683a6b10321f9345d5a3a8433ec58b217ace979e18f16e248", + "sha256:a357fd4f15ee49b4a98b44ec23a34a95f1e00292a139d6015c11f55774ef10de", + "sha256:a53d27d0c2a0ebd07e395e56a1fbdf75ffedc4a05943daf472af163413ce9598", + "sha256:acef3d59d47dd85ecf909c359d0fd2c81ed33bdff70216d3956b463e12c38a54", + "sha256:b38694dcdac990a743aa654037ff1188c7a9801ac3ccc548d3341014bc5ca278", + "sha256:b9edd0110a77fc321ab090aaa1cfcaba1d8499850a12848b81be2222eab648f6", + "sha256:c08e95114951dc2090c4a630c2385bef681cacf12636fb0241accdc6b303fd81", + "sha256:c5518d51a0735b1e6cee1fdce66359f8d2b59c3ca85dc2b0813a8aa86818a030", + "sha256:c8fd0f1ae9d92b42854b2979024d7597685ce4ada367172ed7c09edf2cef9cb8", + "sha256:ca3820eb7f7faf7f0aa88de0e54681bddcb46e485beb844fcecbcd1c8bd01689", + "sha256:cf8b574c7b9aa060c62116d4181f3a1a4e821b2ec5cbfe3775809474113748d4", + "sha256:d3155d828dec1d43283bd24d3d3e0d9c7c350cdfcc0bd06c0ad1209c1bbc36d0", + "sha256:f8d6f8db88049a699817fd9178782867bf22283e3813064302ac59f61d95be05", + "sha256:fd34fbbfbc40628200730bc1febe30631347103fc8d3d4fa012c21ab9c11eca9" + ], + "markers": "python_version >= '3.6'", + "version": "==1.3.1" }, "markupsafe": { "hashes": [ - "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", - "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", - "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", - "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", - "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", - "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f", - "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39", - "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", - "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", - "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014", - "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f", - "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", - "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", - "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", - "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", - "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", - "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", - "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", - "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", - "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85", - "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1", - "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", - "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", - "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", - "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850", - "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0", - "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", - "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", - "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb", - "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", - "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", - "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", - "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1", - "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2", - "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", - "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", - "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", - "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7", - "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", - "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8", - "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", - "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193", - "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", - "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b", - "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", - "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", - "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5", - "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c", - "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032", - "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", - "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be", - "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621" + "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298", + "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64", + "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b", + "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567", + "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff", + "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74", + "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35", + "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26", + "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7", + "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75", + "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f", + "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135", + "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8", + "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a", + "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914", + "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18", + "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8", + "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2", + "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d", + "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b", + "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f", + "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb", + "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833", + "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415", + "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902", + "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9", + "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d", + "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066", + "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f", + "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5", + "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94", + "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509", + "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51", + "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.1.1" + "markers": "python_version >= '3.6'", + "version": "==2.0.1" + }, + "matplotlib": { + "hashes": [ + "sha256:0bea5ec5c28d49020e5d7923c2725b837e60bc8be99d3164af410eb4b4c827da", + "sha256:1c1779f7ab7d8bdb7d4c605e6ffaa0614b3e80f1e3c8ccf7b9269a22dbc5986b", + "sha256:21b31057bbc5e75b08e70a43cefc4c0b2c2f1b1a850f4a0f7af044eb4163086c", + "sha256:32fa638cc10886885d1ca3d409d4473d6a22f7ceecd11322150961a70fab66dd", + "sha256:3a5c18dbd2c7c366da26a4ad1462fe3e03a577b39e3b503bbcf482b9cdac093c", + "sha256:5826f56055b9b1c80fef82e326097e34dc4af8c7249226b7dd63095a686177d1", + "sha256:6382bc6e2d7e481bcd977eb131c31dee96e0fb4f9177d15ec6fb976d3b9ace1a", + "sha256:6475d0209024a77f869163ec3657c47fed35d9b6ed8bccba8aa0f0099fbbdaa8", + "sha256:6a6a44f27aabe720ec4fd485061e8a35784c2b9ffa6363ad546316dfc9cea04e", + "sha256:7a58f3d8fe8fac3be522c79d921c9b86e090a59637cb88e3bc51298d7a2c862a", + "sha256:7ad19f3fb6145b9eb41c08e7cbb9f8e10b91291396bee21e9ce761bb78df63ec", + "sha256:85f191bb03cb1a7b04b5c2cca4792bef94df06ef473bc49e2818105671766fee", + "sha256:956c8849b134b4a343598305a3ca1bdd3094f01f5efc8afccdebeffe6b315247", + "sha256:a9d8cb5329df13e0cdaa14b3b43f47b5e593ec637f13f14db75bb16e46178b05", + "sha256:b1d5a2cedf5de05567c441b3a8c2651fbde56df08b82640e7f06c8cd91e201f6", + "sha256:b26535b9de85326e6958cdef720ecd10bcf74a3f4371bf9a7e5b2e659c17e153", + "sha256:c541ee5a3287efe066bbe358320853cf4916bc14c00c38f8f3d8d75275a405a9", + "sha256:d8d994cefdff9aaba45166eb3de4f5211adb4accac85cbf97137e98f26ea0219", + "sha256:df815378a754a7edd4559f8c51fc7064f779a74013644a7f5ac7a0c31f875866" + ], + "index": "pypi", + "version": "==3.4.2" }, "mccabe": { "hashes": [ @@ -477,6 +400,45 @@ "index": "pypi", "version": "==1.2.4" }, + "pillow": { + "hashes": [ + "sha256:01425106e4e8cee195a411f729cff2a7d61813b0b11737c12bd5991f5f14bcd5", + "sha256:031a6c88c77d08aab84fecc05c3cde8414cd6f8406f4d2b16fed1e97634cc8a4", + "sha256:083781abd261bdabf090ad07bb69f8f5599943ddb539d64497ed021b2a67e5a9", + "sha256:0d19d70ee7c2ba97631bae1e7d4725cdb2ecf238178096e8c82ee481e189168a", + "sha256:0e04d61f0064b545b989126197930807c86bcbd4534d39168f4aa5fda39bb8f9", + "sha256:12e5e7471f9b637762453da74e390e56cc43e486a88289995c1f4c1dc0bfe727", + "sha256:22fd0f42ad15dfdde6c581347eaa4adb9a6fc4b865f90b23378aa7914895e120", + "sha256:238c197fc275b475e87c1453b05b467d2d02c2915fdfdd4af126145ff2e4610c", + "sha256:3b570f84a6161cf8865c4e08adf629441f56e32f180f7aa4ccbd2e0a5a02cba2", + "sha256:463822e2f0d81459e113372a168f2ff59723e78528f91f0bd25680ac185cf797", + "sha256:4d98abdd6b1e3bf1a1cbb14c3895226816e666749ac040c4e2554231068c639b", + "sha256:5afe6b237a0b81bd54b53f835a153770802f164c5570bab5e005aad693dab87f", + "sha256:5b70110acb39f3aff6b74cf09bb4169b167e2660dabc304c1e25b6555fa781ef", + "sha256:5cbf3e3b1014dddc45496e8cf38b9f099c95a326275885199f427825c6522232", + "sha256:624b977355cde8b065f6d51b98497d6cd5fbdd4f36405f7a8790e3376125e2bb", + "sha256:63728564c1410d99e6d1ae8e3b810fe012bc440952168af0a2877e8ff5ab96b9", + "sha256:66cc56579fd91f517290ab02c51e3a80f581aba45fd924fcdee01fa06e635812", + "sha256:6c32cc3145928c4305d142ebec682419a6c0a8ce9e33db900027ddca1ec39178", + "sha256:8bb1e155a74e1bfbacd84555ea62fa21c58e0b4e7e6b20e4447b8d07990ac78b", + "sha256:95d5ef984eff897850f3a83883363da64aae1000e79cb3c321915468e8c6add5", + "sha256:a013cbe25d20c2e0c4e85a9daf438f85121a4d0344ddc76e33fd7e3965d9af4b", + "sha256:a787ab10d7bb5494e5f76536ac460741788f1fbce851068d73a87ca7c35fc3e1", + "sha256:a7d5e9fad90eff8f6f6106d3b98b553a88b6f976e51fce287192a5d2d5363713", + "sha256:aac00e4bc94d1b7813fe882c28990c1bc2f9d0e1aa765a5f2b516e8a6a16a9e4", + "sha256:b91c36492a4bbb1ee855b7d16fe51379e5f96b85692dc8210831fbb24c43e484", + "sha256:c03c07ed32c5324939b19e36ae5f75c660c81461e312a41aea30acdd46f93a7c", + "sha256:c5236606e8570542ed424849f7852a0ff0bce2c4c8d0ba05cc202a5a9c97dee9", + "sha256:c6b39294464b03457f9064e98c124e09008b35a62e3189d3513e5148611c9388", + "sha256:cb7a09e173903541fa888ba010c345893cd9fc1b5891aaf060f6ca77b6a3722d", + "sha256:d68cb92c408261f806b15923834203f024110a2e2872ecb0bd2a110f89d3c602", + "sha256:dc38f57d8f20f06dd7c3161c59ca2c86893632623f33a42d592f097b00f720a9", + "sha256:e98eca29a05913e82177b3ba3d198b1728e164869c613d76d0de4bde6768a50e", + "sha256:f217c3954ce5fd88303fc0c317af55d5e0204106d86dea17eb8205700d47dec2" + ], + "index": "pypi", + "version": "==8.2.0" + }, "pluggy": { "hashes": [ "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", @@ -581,11 +543,11 @@ }, "sphinx": { "hashes": [ - "sha256:b2566f5f339737a6ef37198c47d56de1f4a746c722bebdb2fe045c34bfd8b9d0", - "sha256:cf5104777571b2b7f06fa88ee08fade24563f4a0594cf4bd17d31c47b8740b4c" + "sha256:b5c2ae4120bf00c799ba9b3699bc895816d272d120080fbc967292f29b52b48c", + "sha256:d1cb10bee9c4231f1700ec2e24a91be3f3a3aba066ea4ca9f3bbe47e59d5a1d4" ], "index": "pypi", - "version": "==4.0.1" + "version": "==4.0.2" }, "sphinx-rtd-theme": { "hashes": [ diff --git a/dinjo/model.py b/dinjo/model.py index f37edc4..9ca2b6b 100644 --- a/dinjo/model.py +++ b/dinjo/model.py @@ -151,7 +151,7 @@ def build_model(self, t, y, *args): time at which the differential equation must be evaluated. y : list[float] state vector at which the differential must be evaluated. - \*args : any + *args : any other parameters of the differential equation Returns diff --git a/examples/optimizer_oscillator.py b/examples/optimizer_oscillator.py index c61581d..9d98ade 100644 --- a/examples/optimizer_oscillator.py +++ b/examples/optimizer_oscillator.py @@ -1,19 +1,18 @@ -from datetime import datetime, timedelta import os -import sys from typing import Any, Dict, List, Union import pickle +from datetime import datetime, timedelta + import numpy as np import matplotlib.pyplot as plt import pandas as pd -# Add project root directory to path +from dinjo import model, optimizer + + this_file_dir = os.path.dirname(__file__) project_root_dir = os.path.join(this_file_dir, '..') -sys.path.append(project_root_dir) - -from dinjo import model, optimizer class ModelOscillator(model.ModelIVP): diff --git a/examples/optimizer_seirv_model_colombia.py b/examples/optimizer_seirv_model_colombia.py index 79167e2..6be891f 100644 --- a/examples/optimizer_seirv_model_colombia.py +++ b/examples/optimizer_seirv_model_colombia.py @@ -1,6 +1,5 @@ # Optimize the seirv model for colombia -# This script may take some hours to execute -import sys +# This script may take several minutes to execute import os import pickle from time import time @@ -11,19 +10,15 @@ import pandas as pd from pandas.errors import EmptyDataError -from cmodel_examples_utilities import int_to_str_date, setup_csv - -# Add project root and this file's directories to path in order to find cmodel -# package -this_file_dir = os.path.dirname(__file__) -project_root_dir = os.path.join(this_file_dir, '..') -sys.path.append(this_file_dir) -sys.path.append(project_root_dir) - import dinjo.optimizer as optimizer from seirv_model_colombia import ( seirv_state_variables_colombia, seirv_model_example, infected_reference_col ) +from cmodel_examples_utilities import int_to_str_date, setup_csv + + +this_file_dir = os.path.dirname(__file__) +project_root_dir = os.path.join(this_file_dir, '..') def optimizer_seirv_model_colombia_example( diff --git a/examples/seirv_model_colombia.py b/examples/seirv_model_colombia.py index a9de3f9..35f17e5 100644 --- a/examples/seirv_model_colombia.py +++ b/examples/seirv_model_colombia.py @@ -1,19 +1,11 @@ -import sys import os -from time import time from typing import Any, Dict, List, Union +from time import time import matplotlib.pyplot as plt import pandas as pd -# Add project root and this file's directories to path in order to find cmodel -# package -this_file_dir = os.path.dirname(__file__) -project_root_dir = os.path.join(this_file_dir, '..') -sys.path.append(this_file_dir) -sys.path.append(project_root_dir) - -from dinjo import model, predefined +from dinjo import model from dinjo.predefined.epidemiology import ModelSEIRV # State variables and parameters are setup in col_vars_params.py module from examples.col_vars_params import ( @@ -26,6 +18,9 @@ t_span_col = [0, 171] t_steps_col = 172 +this_file_dir = os.path.dirname(__file__) +project_root_dir = os.path.join(this_file_dir, '..') + infected_reference_col_path = os.path.join( this_file_dir, '..', 'example_data', 'infected_reference_col.csv' ) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b0471b7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta:__legacy__" \ No newline at end of file diff --git a/setup.py b/setup.py index 8bca3e3..be5357e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='DINJO', - version='0.0.0', + version='0.0.dev1', description='DINJO lets you find optimal values of initial value problems\' parameters', long_description=long_description, long_description_content_type="text/markdown", From 624843fb033ea64d7699db93770fdd2de72d5b40 Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Sat, 22 May 2021 15:23:48 -0500 Subject: [PATCH 8/9] chore: updated requirements --- requirements-dev.txt | 7 ++++--- requirements.txt | 7 ------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 8efb4b7..d83670d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,6 +9,7 @@ # requirements. To emit only development requirements, pass "--dev-only". -i https://pypi.org/simple +-e . alabaster==0.7.12 attrs==21.2.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' babel==2.9.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' @@ -21,9 +22,9 @@ flake8==3.9.2 idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' imagesize==1.2.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' iniconfig==1.1.1 -jinja2==2.11.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' +jinja2==3.0.1; python_version >= '3.6' kiwisolver==1.3.1; python_version >= '3.6' -markupsafe==1.1.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' +markupsafe==2.0.1; python_version >= '3.6' matplotlib==3.4.2 mccabe==0.6.1 numpy==1.20.3 @@ -45,7 +46,7 @@ scipy==1.6.3 six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' snowballstemmer==2.1.0 sphinx-rtd-theme==0.5.2 -sphinx==4.0.1 +sphinx==4.0.2 sphinxcontrib-applehelp==1.0.2; python_version >= '3.5' sphinxcontrib-devhelp==1.0.2; python_version >= '3.5' sphinxcontrib-htmlhelp==1.0.3; python_version >= '3.5' diff --git a/requirements.txt b/requirements.txt index 0ad5c47..30c391a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,12 +6,5 @@ # -i https://pypi.org/simple -cycler==0.10.0 -kiwisolver==1.3.1; python_version >= '3.6' -matplotlib==3.4.2 numpy==1.20.3 -pillow==8.2.0 -pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3' -python-dateutil==2.8.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' scipy==1.6.3 -six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' From 4f93dc6871c443f977676f751e50ba20c885952a Mon Sep 17 00:00:00 2001 From: Juan Esteban Aristizabal Date: Sat, 22 May 2021 15:58:37 -0500 Subject: [PATCH 9/9] chore: updated requirements --- Pipfile.lock | 14 +++++++------- requirements-dev.txt | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 587f37e..32d287c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -575,11 +575,11 @@ }, "sphinxcontrib-htmlhelp": { "hashes": [ - "sha256:3c0bc24a2c41e340ac37c85ced6dafc879ab485c095b1d65d2461ac2f7cca86f", - "sha256:e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b" + "sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07", + "sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2" ], - "markers": "python_version >= '3.5'", - "version": "==1.0.3" + "markers": "python_version >= '3.6'", + "version": "==2.0.0" }, "sphinxcontrib-jsmath": { "hashes": [ @@ -599,11 +599,11 @@ }, "sphinxcontrib-serializinghtml": { "hashes": [ - "sha256:eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc", - "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a" + "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd", + "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952" ], "markers": "python_version >= '3.5'", - "version": "==1.1.4" + "version": "==1.1.5" }, "toml": { "hashes": [ diff --git a/requirements-dev.txt b/requirements-dev.txt index d83670d..f06ecae 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -49,9 +49,9 @@ sphinx-rtd-theme==0.5.2 sphinx==4.0.2 sphinxcontrib-applehelp==1.0.2; python_version >= '3.5' sphinxcontrib-devhelp==1.0.2; python_version >= '3.5' -sphinxcontrib-htmlhelp==1.0.3; python_version >= '3.5' +sphinxcontrib-htmlhelp==2.0.0; python_version >= '3.6' sphinxcontrib-jsmath==1.0.1; python_version >= '3.5' sphinxcontrib-qthelp==1.0.3; python_version >= '3.5' -sphinxcontrib-serializinghtml==1.1.4; python_version >= '3.5' +sphinxcontrib-serializinghtml==1.1.5; python_version >= '3.5' toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3' urllib3==1.26.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'