Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #136 +/- ##
===========================================
+ Coverage 97.64% 97.74% +0.10%
===========================================
Files 37 37
Lines 2460 2486 +26
Branches 413 421 +8
===========================================
+ Hits 2402 2430 +28
+ Misses 34 32 -2
Partials 24 24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
As I see from the API of InstrumentModel, ResolutionModel and BackgroundModel, Q can be set to None in each of those. Default value is also None for all of their init parameter Q. When you set Q in the InstrumentModel it propagates to InstrumentModel and ResolutionModel. But if you set Q to None in the InstrumentModel afterwards, the value will not be propagated to ResolutionModel and BackgroundModel, creating a discrepancy in state between the three models. |
|
Well, the issue is that the expected workflow is something like this: I probably need a more sophisticated way of handling the state of these things, but it's kind of difficult. I don't want users to have to think about supplying their One potential solution is to get rid of In this case, the workflow is Hmm, the more I think about it, the more I like it. I had it like this at first, then changed it, and I don't remember why anymore... |
|
Thinking a bit more.. perhaps the solution is to initialize Q to None. Then if self.Q is not None, the Q setter throws an error unless the new Q is identical to what's already there. I can add a |
| instrument_model._background_model.Q = new_Q | ||
| instrument_model._resolution_model.Q = new_Q |
There was a problem hiding this comment.
Should those also have a conditional for if self._Q is not None?
|
Not quite done yet (missing unit tests, for one), but updated so that Q cannot be set if it's not None. This avoids many of the potential problems. |
|
LGTM for me. Text below is something you might want to take into consideration I am a bit confused by current implementation. I think the best way to undertand the implementation requirements is to derive them from use-case requirements. As far as I understand them there are two workflows:
Assuming these two, there is no reason for What is the Q getter from |
There is not always a previous Q, which is part of the difficulty
Yes, that is the idea. If it matters, it gets it from
I don't know if this is a good reason, but my thinking was this: what happens if the user removes an
Again, not saying this is optimal, but I do want to be able to change
I didn't think much about it - I made a setter, so I also made a getter.
Perhaps we can chat a bit about this tomorrow? It's clearly not a perfect implementation yet, but here's what I'm trying to make happen:
All the However, if the It should be easy to transfer any and all Finally, it should be easy to work with all of these things outside |
Fixes #135
I planned to also work on #101 , hence the name of the branch, but I need to think more about it. For now, it's good to fix this bug.