Allow empty string "" in columns to be overridden with default values in priors#384
Merged
Allow empty string "" in columns to be overridden with default values in priors#384
Conversation
dilpath
approved these changes
Apr 28, 2025
petab/v1/priors.py
Outdated
| @@ -278,7 +278,10 @@ def from_par_dict( | |||
| :return: A distribution object. | |||
| """ | |||
| dist_type = d.get(f"{type_}PriorType", C.PARAMETER_SCALE_UNIFORM) | |||
Member
There was a problem hiding this comment.
IMO the default can come first, and the override can then be stated in the "positive" case, instead of nots. This is how it's mostly done elsewhere in the code as I recall.
But fine as is too.
This suggestion is for the changed code too, but github wouldn't let me edit the block.
Suggested change
| dist_type = d.get(f"{type_}PriorType", C.PARAMETER_SCALE_UNIFORM) | |
| dist_type = C.PARAMETER_SCALE_UNIFORM | |
| if _table_dist_type := d.get(f"{type_}PriorType") and (isinstance(_table_dist_type, str) or not np.isnan(_table_dist_type)): | |
| dist_type = _table_dist_type |
ab2e812 to
6b1ca4f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #384 +/- ##
=======================================
Coverage 73.86% 73.86%
=======================================
Files 62 62
Lines 6764 6764
Branches 1194 1194
=======================================
Hits 4996 4996
Misses 1308 1308
Partials 460 460 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The check only looked for whether it was not a string, but empty string values that are passed as
""were not caught here. This should fix the error.