-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add petab.Problem.__str__ #178
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,31 @@ def __setattr__(self, name, value): | |
else: | ||
super().__setattr__(name, value) | ||
|
||
def __str__(self): | ||
model = f"with model ({self.model})" if self.model else "without model" | ||
conditions = f"{self.condition_df.shape[0]} conditions" \ | ||
if self.condition_df is not None else "without conditions table" | ||
|
||
observables = f"{self.observable_df.shape[0]} observables" \ | ||
if self.observable_df is not None else "without observables table" | ||
|
||
measurements = f"{self.measurement_df.shape[0]} measurements" \ | ||
if self.measurement_df is not None \ | ||
else "without measurements table" | ||
|
||
if self.parameter_df is not None: | ||
num_estimated_parameters = sum(self.parameter_df[ESTIMATE] == 1) \ | ||
if ESTIMATE in self.parameter_df \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True. Not sure how much we want to assume/require correctness here. Should it just fail if this is missing? Should we validate in |
||
else self.parameter_df.shape[0] | ||
parameters = f"{num_estimated_parameters} estimated parameters" | ||
else: | ||
parameters = "without parameter_df table" | ||
|
||
return ( | ||
f"PEtab Problem {model}, {conditions}, {observables}, " | ||
f"{measurements}, {parameters}" | ||
) | ||
|
||
@staticmethod | ||
def from_files( | ||
sbml_file: Union[str, Path] = None, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model
has no__str__
, what gets printed here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the not so informative default
__repr__
. The plan would be to add something more meaningful there as well.