-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
[WIP] Combiner refactor #656
base: main
Are you sure you want to change the base?
Conversation
dd6a26f
to
244b2ec
Compare
Thank you @SaOgaz for your work here 👍. I plan to have a look over the changes and the points you mentioned soon-ish (although I cannot promise anything currently). |
@SaOgaz thanks for the implementation -- I think this is great and really gives a concrete example to discuss! While there isn't a reduction in the repetition of the code, it does enable more precise handling of the uncertainty. I think there is something very interesting in having different methods for the Uncertainty, and that would be incredible useful. I'd like to see a different name than If this would make optimization of the memory easier, that is a very big positive to this implementation, so if you can expand on that point, that would be very helpful. I'm okay with At to There are two concerns this raises:
|
cc @eteq |
I haven't had a chance to give this a detailed look-over yet (weekend, hopefully), but looks very promising. One change -- I think we want to keep the old That said, it is great to have you working on this @SaOgaz -- this is an area of the code that has needed attention for a while! |
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.
A high-level review (i.e., I didn't go line-by-line but can do so on the next iteration if desirable). I've already discussed some of this with @SaOgaz, but others are welcome to pipe up if they disagree with any of this.
- I realize now I wasn't clear about this in Consider revising the Combiner machinery into a class heirarchy #578, but the intent of making the combiner classes in a hierarchy like this is that the images should be passed in at call-time, rather than being attached to the objects themselves. That is, I think
combiner_method
should get theccd_list
argument, rather than it going into__init__
. That is, the combiner classes should be "light-weight" and just have the implementation, but not carry around the data themselves. - I think
combiner_method
isn't a good name because it's not an action (see my point 1 above) - instead something likecombine_images
is better. (To put the idea out there as a possibility, it could even be a__call__
, although I think @SaOgaz convinced me that's going too far.) - I don't think we should have
use_input_uncertainties
anduncertainty_func
, as they overlap. Moreover, I don't even thinguncertainty_func
should exist at all. The "old-style" (i.e., infer from the data) uncertainty should be at the combiner class level - if a user wants to roll their own they should sub-class and overrideuncertainty_fresh
. Relatedly, I think it's better to let the data tell the combiner what to do: that is, if theCCDData
have uncertainties, do the error propogation, but if there are no uncertainties do the "fresh" method. A middle ground (which @SaOgaz preferred and I am OK with) is to haveuse_input_uncertainties
have three options: True, False, and 'auto' (default), where "auto" is the behavior I outlined above. - Related to the above: where possible, the combiners should completely defer to the
CCDData
's uncertainty propogation methods. That's hard/impossible forMedianCombiner
I think, but for the others it should be fine because they are basic arithmetic operations. - If possible,
AverageCombiner
should be implemented as a subclass ofSumCombiner
that just does the same thing and then divides bylen(ccd_list)
.
Oh, and I agree with @mwcraig the old one should stay in, but with a deprecation warning (probably at class-creation-time?)
About halfway though removing the |
@eteq I've actually just run across another problem when trying to use the built in The current Since I'm posting here anyway I should add, the combination of pulling out the data from being an instance variable (something i do think is worthwhile) in combination with trying to use the native *lot more time meaning more than a few more hours, maybe a half week of effort including updating the tests and docs etc. |
@SaOgaz -- I'll try to digest your comments by early next week. I need to review the current code base and your changes to make sure I understand the issues you are hitting. Off the top of my head, I think Just so I understand does this
mean all of the code in |
@mwcraig, all of the code in combine. |
[Edit: Was apparently working off an old master, fixing conflicts right now]
[Edit 2: Resolved conflicts]
See discussion in #578.
This is my first pass/prototype of the new structure laid out in #578. I have some things I'd like people to look at... okay, a lot of things. I updated the tests to reflect the new structure and they are all passing now.
There is still the same amount of repeat code here that was there before. But the only way I can think of getting rid of it, while still retaining
combine_method
as an abstract class, which I think makes it more clear to users that they should not be using the base class ever, is to put some of the repeated code bits into separate non-abstract functions. But that might end up making the code more piecemeal/confusing then it needs to be...We should rename
combine_method
, anybody got any suggestions?I left the combine function override parameter with the
combine_method
, seemed a little more obvious to the users that way, but I'm not set on it.Same could be said of scale_to. Do we think this is something users will want to change based on different combination runs? IN that case, I think it makes sense to leave it as a parameter to
combine_method
Uncertainty still needs work/filling out, but I put in some basic structure for this. Not sure if I'm happy with what I have though. The simplest approach was to make constructing the uncertainty from the data, versus from input uncertainties a boolean flag. The default being re-calculate uncertainties from the input data values. But there's probably a more elegant solution to this.
With this restructure it seems like it shouldn't be too bad to move the chunking/memory handling into the BaseClass, per @crawfordsm's wish list in our tag up.
I think a test needs to be added for weighting with the
combiner
function. I didn't get any errors related to that while I was still updatingcombiner
and it should have been broken, so seems to be a gap.Obviously more doc strings / etc. to come.
Please have a look at the following list and replace the "[ ]" with a "[x]" if
the answer to this question is yes.
For documentation changes:
Note that it should not if you changed any examples!
For bugfixes:
For new functionality:
Please note that the last point is not a requirement. It is meant as a check if
the pull request potentially breaks backwards-compatibility.