diff --git a/.github/workflows/unit-test-python-versions.yml b/.github/workflows/unit-test-python-versions.yml index c7b0f930..177386b2 100644 --- a/.github/workflows/unit-test-python-versions.yml +++ b/.github/workflows/unit-test-python-versions.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ['3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v1 @@ -24,7 +24,7 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: x64 - + - name: install sundials run: | sudo apt-get update diff --git a/LICENSE.md b/LICENSE.md index bac41ad3..3da5425a 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2022, David Augustin +Copyright (c) 2023, David Augustin All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/chi/_error_models.py b/chi/_error_models.py index 5c3f083e..9208570f 100644 --- a/chi/_error_models.py +++ b/chi/_error_models.py @@ -1791,7 +1791,7 @@ def fix_parameters(self, name_value_dict): self._fixed_params_values[index] = value # If all parameters are free, set mask and values to None again - if np.alltrue(~self._fixed_params_mask): + if np.all(~self._fixed_params_mask): self._fixed_params_mask = None self._fixed_params_values = None diff --git a/chi/_log_pdfs.py b/chi/_log_pdfs.py index fc4271d2..5323ce7d 100644 --- a/chi/_log_pdfs.py +++ b/chi/_log_pdfs.py @@ -130,8 +130,8 @@ def __call__(self, parameters): top_parameters, bottom_parameters, covariates=self._covariates) # Return if values already lead to a rejection - if np.isinf(score): - return score + if np.isinf(score): # noqa: no cover + return score # noqa: no cover # Transform bottom-level parameters # Identity, if model does not tranform parameters diff --git a/chi/_mechanistic_models.py b/chi/_mechanistic_models.py index f58b885f..e8378b13 100644 --- a/chi/_mechanistic_models.py +++ b/chi/_mechanistic_models.py @@ -986,7 +986,7 @@ def fix_parameters(self, name_value_dict): self._fixed_params_values[index] = value # If all parameters are free, set mask and values to None again - if np.alltrue(~self._fixed_params_mask): + if np.all(~self._fixed_params_mask): self._fixed_params_mask = None self._fixed_params_values = None diff --git a/chi/_population_models.py b/chi/_population_models.py index ea717b6b..3648c18f 100644 --- a/chi/_population_models.py +++ b/chi/_population_models.py @@ -3274,7 +3274,7 @@ def fix_parameters(self, name_value_dict): self._fixed_params_values[index] = value # If all parameters are free, set mask and values to None again - if np.alltrue(~self._fixed_params_mask): + if np.all(~self._fixed_params_mask): self._fixed_params_mask = None self._fixed_params_values = None diff --git a/chi/plots/_time_series.py b/chi/plots/_time_series.py index 29291909..2cfa25be 100644 --- a/chi/plots/_time_series.py +++ b/chi/plots/_time_series.py @@ -149,11 +149,11 @@ def _compute_bulk_probs(self, data, bulk_probs, time_key, sample_key): biom_upper = reduced_data[mask][sample_key].min() # Append percentiles to container - container = container.append(pd.DataFrame({ + container = pd.concat([container, pd.DataFrame({ 'Time': [time], 'Lower': [biom_lower], 'Upper': [biom_upper], - 'Bulk probability': [str(bulk_prob)]})) + 'Bulk probability': [str(bulk_prob)]})]) return container @@ -538,11 +538,11 @@ def _compute_bulk_probs(self, data, bulk_probs, time_key, sample_key): biom_upper = reduced_data[mask][sample_key].min() # Append percentiles to container - container = container.append(pd.DataFrame({ + container = pd.concat([container, pd.DataFrame({ 'Time': [time], 'Lower': [biom_lower], 'Upper': [biom_upper], - 'Bulk probability': [str(bulk_prob)]})) + 'Bulk probability': [str(bulk_prob)]})]) return container diff --git a/chi/tests/test_error_models.py b/chi/tests/test_error_models.py index 98e1b675..cc2205b6 100644 --- a/chi/tests/test_error_models.py +++ b/chi/tests/test_error_models.py @@ -1487,11 +1487,11 @@ def test_set_get_parameter_names(self): self.error_model.fix_parameters(name_value_dict={ 'Sigma base': 1}) self.error_model.set_parameter_names( - ['myokit.tumour_volume Sigma rel.']) + ['global.tumour_volume Sigma rel.']) names = self.error_model.get_parameter_names() self.assertEqual(len(names), 1) - self.assertEqual(names[0], 'myokit.tumour_volume Sigma rel.') + self.assertEqual(names[0], 'global.tumour_volume Sigma rel.') # Reset to defaults self.error_model.set_parameter_names(None) diff --git a/chi/tests/test_inference.py b/chi/tests/test_inference.py index a39d3285..5a552607 100644 --- a/chi/tests/test_inference.py +++ b/chi/tests/test_inference.py @@ -223,7 +223,7 @@ def test_call(self): self.assertEqual(draws.loc[2], 2) # Map parameters - param_map = {'myokit.tumour_volume': 'myokit.tumour_volume'} + param_map = {'global.tumour_volume': 'global.tumour_volume'} pw_ll = chi.compute_pointwise_loglikelihood( self.log_likelihood, self.posterior_samples, param_map=param_map) @@ -396,7 +396,7 @@ def test_call(self): # # Map parameters # param_map = { - # 'Pooled myokit.tumour_volume': 'Pooled myokit.tumour_volume'} + # 'Pooled global.tumour_volume': 'Pooled global.tumour_volume'} # pw_ll = chi.compute_pointwise_loglikelihood( # self.hierarch_log_likelihood, # self.hierarch_posterior_samples, @@ -510,7 +510,7 @@ def test_call_bad_input(self): param_map=param_map) # Not all parameters of the log-likelihood can be identified - param_map = {'myokit.tumour_volume': 'Something else'} + param_map = {'global.tumour_volume': 'Something else'} with self.assertRaisesRegex(ValueError, 'The parameter could'): problem.set_data( @@ -1062,7 +1062,7 @@ def test_set_log_prior(self): # Test case I: PD model problem = chi.ProblemModellingController( self.pd_model, self.error_model) - problem.set_data(self.data, {'myokit.tumour_volume': 'Tumour volume'}) + problem.set_data(self.data, {'global.tumour_volume': 'Tumour volume'}) log_prior = pints.ComposedLogPrior( *[pints.HalfCauchyLogPrior(0, 1)] * 7) problem.set_log_prior(log_prior) @@ -1076,7 +1076,7 @@ def test_set_log_prior_bad_input(self): problem.set_log_prior('some prior') # Wrong log-prior type - problem.set_data(self.data, {'myokit.tumour_volume': 'Tumour volume'}) + problem.set_data(self.data, {'global.tumour_volume': 'Tumour volume'}) log_prior = 'Wrong type' with self.assertRaisesRegex(ValueError, 'The log-prior has to be an'): problem.set_log_prior(log_prior) @@ -1091,7 +1091,7 @@ def test_set_population_model(self): # Test case I: PD model problem = chi.ProblemModellingController( self.pd_model, self.error_model) - problem.set_data(self.data, {'myokit.tumour_volume': 'Tumour volume'}) + problem.set_data(self.data, {'global.tumour_volume': 'Tumour volume'}) pop_model = chi.ComposedPopulationModel([ chi.PooledModel(), chi.PooledModel(), @@ -1123,7 +1123,7 @@ def test_set_population_model(self): self.data, output_observable_dict={ 'central.drug_concentration': 'IL 6', - 'myokit.tumour_volume': 'Tumour volume'}) + 'global.tumour_volume': 'Tumour volume'}) pop_model = chi.ComposedPopulationModel([ chi.LogNormalModel(), chi.LogNormalModel(), diff --git a/docs/source/getting_started/code/1_simulation_1.py b/docs/source/getting_started/code/1_simulation_1.py index 00473797..58d587db 100644 --- a/docs/source/getting_started/code/1_simulation_1.py +++ b/docs/source/getting_started/code/1_simulation_1.py @@ -222,7 +222,7 @@ fig.add_trace( go.Histogram( name='Posterior samples', - x=posterior_samples['myokit.elimination_rate'].values.flatten(), + x=posterior_samples['global.elimination_rate'].values.flatten(), histnorm='probability', showlegend=False ), @@ -497,7 +497,7 @@ fig.add_trace( go.Histogram( name='Posterior samples', - x=posterior_samples['myokit.elimination_rate'].values.flatten(), + x=posterior_samples['global.elimination_rate'].values.flatten(), histnorm='probability', showlegend=False ), diff --git a/docs/source/getting_started/code/1_simulation_2.py b/docs/source/getting_started/code/1_simulation_2.py index 1d53762b..cc158ead 100644 --- a/docs/source/getting_started/code/1_simulation_2.py +++ b/docs/source/getting_started/code/1_simulation_2.py @@ -395,7 +395,7 @@ fig.add_trace( go.Histogram( name='Patient 1 Post. samples', - x=posterior_samples['myokit.elimination_rate'].values[ + x=posterior_samples['global.elimination_rate'].values[ 0, :, 0].flatten(), histnorm='probability', showlegend=False, @@ -407,7 +407,7 @@ fig.add_trace( go.Histogram( name='Patient 1 Post. samples', - x=posterior_samples['myokit.elimination_rate'].values[ + x=posterior_samples['global.elimination_rate'].values[ 0, :, 1].flatten(), histnorm='probability', showlegend=False, @@ -419,7 +419,7 @@ fig.add_trace( go.Histogram( name='Patient 1 post. samples', - x=posterior_samples['myokit.elimination_rate'].values[ + x=posterior_samples['global.elimination_rate'].values[ 0, :, 2].flatten(), histnorm='probability', showlegend=False, @@ -953,7 +953,7 @@ fig.add_trace( go.Histogram( name='Patient 1 Post. samples', - x=posterior_samples['myokit.elimination_rate'].values[ + x=posterior_samples['global.elimination_rate'].values[ 0, :, 0].flatten(), histnorm='probability', showlegend=False, @@ -965,7 +965,7 @@ fig.add_trace( go.Histogram( name='Patient 1 Post. samples', - x=posterior_samples['myokit.elimination_rate'].values[ + x=posterior_samples['global.elimination_rate'].values[ 0, :, 1].flatten(), histnorm='probability', showlegend=False, @@ -977,7 +977,7 @@ fig.add_trace( go.Histogram( name='Patient 1 post. samples', - x=posterior_samples['myokit.elimination_rate'].values[ + x=posterior_samples['global.elimination_rate'].values[ 0, :, 2].flatten(), histnorm='probability', showlegend=False, diff --git a/setup.py b/setup.py index 781beeb7..d690cf23 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( # Module name name='chi-drm', - version='0.2.2', + version='0.2.3', description='Package to model dose response dynamics', long_description=readme, long_description_content_type="text/markdown", @@ -31,7 +31,7 @@ # List of dependencies install_requires=[ 'arviz>=0.11', - 'myokit>=1.33', + 'myokit>=1.34', 'numpy>=1.17', 'pandas>=0.24', 'pints>=0.4',