Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Dec 20, 2024
1 parent 04670c9 commit ad9ba38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions petab/v2/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def run(self, problem: Problem) -> ValidationIssue | None:
# handle default-experiment
used_experiments = set(
filter(
lambda x: not isinstance(x, float) or not np.isnan(x),
lambda x: not pd.isna(x),
used_experiments,
)
)
Expand Down Expand Up @@ -839,7 +839,8 @@ def append_overrides(overrides):
CheckMeasurementTable(),
CheckConditionTable(),
CheckExperimentTable(),
CheckValidPetabIdColumn("experiment", EXPERIMENT_ID, ignore_nan=True),
CheckValidPetabIdColumn("measurement", EXPERIMENT_ID, ignore_nan=True),
CheckValidPetabIdColumn("experiment", EXPERIMENT_ID),
CheckValidPetabIdColumn("experiment", CONDITION_ID),
CheckExperimentConditionsExist(),
CheckObservableTable(),
Expand Down
10 changes: 4 additions & 6 deletions petab/v2/petab1to2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from .. import v1, v2
from ..v1 import Problem as ProblemV1
from ..v1.yaml import get_path_prefix, load_yaml, validate, write_yaml
from ..v2.models import MODEL_TYPE_SBML
from ..versions import get_major_version
from .models import MODEL_TYPE_SBML

__all__ = ["petab1to2"]

Expand Down Expand Up @@ -70,7 +70,6 @@ def petab1to2(yaml_config: Path | str, output_dir: Path | str = None):
# Update YAML file
new_yaml_config = _update_yaml(yaml_config)

# Write new YAML file
output_dir = Path(output_dir)
output_dir.mkdir(parents=True, exist_ok=True)

Expand Down Expand Up @@ -179,10 +178,8 @@ def create_experiment_id(sim_cond_id: str, preeq_cond_id: str) -> str:
# add pre-eq condition id if not present or convert to string
# for simplicity
if v1.C.PREEQUILIBRATION_CONDITION_ID in measurement_df.columns:
measurement_df[
v1.C.PREEQUILIBRATION_CONDITION_ID
] = measurement_df[v1.C.PREEQUILIBRATION_CONDITION_ID].fillna(
""
measurement_df.fillna(
{v1.C.PREEQUILIBRATION_CONDITION_ID: ""}, inplace=True
)
else:
measurement_df[v1.C.PREEQUILIBRATION_CONDITION_ID] = ""
Expand Down Expand Up @@ -223,6 +220,7 @@ def create_experiment_id(sim_cond_id: str, preeq_cond_id: str) -> str:
measurement_df, get_dest_path(measurement_file)
)

# Write new YAML file
new_yaml_file = output_dir / Path(yaml_file).name
write_yaml(new_yaml_config, new_yaml_file)

Expand Down

0 comments on commit ad9ba38

Please sign in to comment.