Skip to content

Commit

Permalink
Add method to add model to standard object
Browse files Browse the repository at this point in the history
  • Loading branch information
haeussma committed Sep 19, 2024
1 parent 2d99b23 commit 8c021bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
24 changes: 24 additions & 0 deletions calipytion/tools/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,30 @@ def from_excel(

return cls(**args)

def add_model_to_standard(self, model: CalibrationModel | str) -> None:
"""Adds a model to the result object of the standard.
Args:
model (CalibrationModel | str): The model object or name which should be added to the standard.
Raises:
ValueError: If the model has not been fitted yet.
ValueError: If no standard object is found.
"""

if isinstance(model, str):
model = self.get_model(model)

if not model.was_fitted:
raise ValueError("Model has not been fitted yet. Run 'fit_models' first.")

if self.standard is None:
raise ValueError(
"No standard object found. Create a standard first by calling 'create_standard'."
)

self.standard.result = model

@classmethod
def from_json(
cls,
Expand Down
4 changes: 2 additions & 2 deletions calipytion/tools/equations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from calipytion.model import CalibrationModel

lower_bound = -1e6
upper_bound = 1e6
lower_bound = -1e4
upper_bound = 1e4


linear_model = CalibrationModel(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "calipytion"
version = "0.9.0"
version = "0.9.1"
description = "Tool for creating standard curves and concentration calculations."
authors = ["haeussma <[email protected]>"]
license = "MIT License"
Expand Down
2 changes: 0 additions & 2 deletions tests/test_map_enzymeme.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import math

import pyenzyme as pe
from pyenzyme.units import mM, second
Expand Down Expand Up @@ -58,7 +57,6 @@ def test_conversion_of_enzymeml_doc():
20,
10,
]
assert math.isnan(doc.measurements[1].species_data[0].data[0])


def test_conversion_of_enzymeml_doc_extrapolate():
Expand Down

0 comments on commit 8c021bf

Please sign in to comment.