Skip to content
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

Merged
merged 2 commits into from
Sep 6, 2022
Merged

Add petab.Problem.__str__ #178

merged 2 commits into from
Sep 6, 2022

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Sep 6, 2022

... providing some high-level summary of the given problem.

... providing some high-level summary of the given problem.
@dweindl dweindl requested a review from dilpath September 6, 2022 07:14
@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2022

Codecov Report

Merging #178 (6ea0693) into develop (f73d915) will decrease coverage by 0.25%.
The diff coverage is 10.00%.

@@             Coverage Diff             @@
##           develop     #178      +/-   ##
===========================================
- Coverage    78.46%   78.21%   -0.26%     
===========================================
  Files           30       30              
  Lines         2652     2662      +10     
  Branches       605      606       +1     
===========================================
+ Hits          2081     2082       +1     
- Misses         412      421       +9     
  Partials       159      159              
Impacted Files Coverage Δ
petab/problem.py 66.66% <10.00%> (-2.26%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@dilpath dilpath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if self.parameter_df is not None:
num_estimated_parameters = sum(self.parameter_df[ESTIMATE] == 1) \
if ESTIMATE in self.parameter_df \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESTIMATE is a required column

Copy link
Member Author

@dweindl dweindl Sep 6, 2022

Choose a reason for hiding this comment

The 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 __str__?
Might be more convenient to allow for some slack, if this is used during assembling a Problem. Similar to libsbml where one is allowed to create invalid models.

@@ -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"
Copy link
Member

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?

Copy link
Member Author

@dweindl dweindl Sep 6, 2022

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.

@dweindl dweindl merged commit 4f4ab92 into develop Sep 6, 2022
@dweindl dweindl deleted the problem_str branch September 6, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants