Closed pmelchior closed 2 years ago
Just to make sure that I'm following everything: it looks like you're creating the detection image once, caching it in the first observation, then weighting by the spectra only if the spectra is given, right?
Exactly.
That seems fine to me given the current architecture. In the long run it might be better to make a MultiObservation class that contains observations and the mappings between them and the model space, to make sure that things are always consistent. Just attaching the _detect image to the first observation seems problematic for a general use code, but the scarlet users might be specialized enough that a "buyer beware" type of attitude for changing the list of observations later on may be sufficient.
I agree. I'd be more worried if we had use cases where one would want to re-use one observation together with a different one, in which case the detection image would be inconsistent. But I don't see this to be a problem now.
This PR reimplements a single function,
build_initialization_image
, with one main change. The resulting data structures are attached to the first observation in the list and not put on the cache. This change should fix #256 becauseObservation
goes out of scope.There are two other changes:
spectra
).Because of the last change, the result of this method is not identical to the previous method, but I doubt that the differences are large.