Skip to content

Commit 4f439dd

Browse files
committed
ruff
1 parent 2312834 commit 4f439dd

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

pypesto/objective/amici/amici.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
try:
4242
import amici
4343
import amici.petab.petab_importer
44-
import pandas as pd
4544
from amici.petab.parameter_mapping import ParameterMapping
4645
except ImportError:
4746
pass
@@ -705,7 +704,7 @@ def update_from_problem(
705704

706705
id_to_val = {
707706
self.x_ids[x_idx]: x_val
708-
for x_idx, x_val in zip(x_fixed_indices, x_fixed_vals)
707+
for x_idx, x_val in zip(x_fixed_indices, x_fixed_vals, strict=True)
709708
}
710709
for condition_mapping in self.parameter_mapping:
711710
for (

pypesto/petab/objective_creator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
import shutil
1010
import warnings
1111
from abc import ABC, abstractmethod
12-
from collections.abc import Iterable, Sequence
12+
from collections.abc import Callable, Iterable, Sequence
1313
from dataclasses import dataclass
1414
from typing import (
1515
Any,
16-
Callable,
1716
)
1817

1918
import numpy as np
@@ -49,7 +48,6 @@
4948
import amici.petab.petab_importer
5049
import amici.petab.simulations
5150
from amici.petab.import_helpers import check_model
52-
import amici.sim.sundials as asd
5351
except ImportError:
5452
amici = None
5553
try:
@@ -322,7 +320,11 @@ def create_objective(
322320
# fill in dummy parameters (this is needed since some objective
323321
# initialization e.g. checks for preeq parameters)
324322
problem_parameters = dict(
325-
zip(self.petab_problem.x_ids, self.petab_problem.x_nominal_scaled)
323+
zip(
324+
self.petab_problem.x_ids,
325+
self.petab_problem.x_nominal_scaled,
326+
strict=True,
327+
)
326328
)
327329
amici.petab.conditions.fill_in_parameters(
328330
edatas=edatas,
@@ -651,7 +653,7 @@ def _check_noise_formulae(
651653
to_change = []
652654
# check that noise formulae are valid
653655
for i_edata, (edata, par_map) in enumerate(
654-
zip(edatas, parameter_mapping)
656+
zip(edatas, parameter_mapping, strict=True)
655657
):
656658
for j_formula, noise_formula in enumerate(edata.noise_formulae):
657659
# constant values are allowed
@@ -763,7 +765,7 @@ def create_parameter_mapping(self):
763765
if not overrides:
764766
return mapping
765767
for (_, condition), mapping_per_condition in zip(
766-
simulation_conditions.iterrows(), mapping
768+
simulation_conditions.iterrows(), mapping, strict=True
767769
):
768770
for override in overrides:
769771
preeq_id = condition.get(PREEQUILIBRATION_CONDITION_ID)

pypesto/petab/util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import petab.v1 as petab
77
from petab.v1.C import (
88
ESTIMATE,
9+
LIN,
910
NOISE_PARAMETERS,
1011
OBSERVABLE_ID,
12+
PARAMETER_SCALE_UNIFORM,
1113
)
1214
except ImportError:
1315
petab = None
@@ -140,6 +142,7 @@ def _setup(
140142
petab.parameters.get_priors_from_df(
141143
parameter_df, mode=petab.INITIALIZATION
142144
),
145+
strict=True,
143146
)
144147
)
145148
else:

0 commit comments

Comments
 (0)