Open
Conversation
# Conflicts: # src/scarlet2/frame.py # src/scarlet2/observation.py # src/scarlet2/renderer.py # src/scarlet2/scene.py
Scene.fit/sample
Click here to view all benchmarks. |
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.
This PR brings significant changes under the hood in who parameters are stored and treated. In particular:
Parametersnow derive fromdict, so allow lookup likeparameters["spectrum_0"].parameter_registry, which uses the memory location of a module instance to hold the parameters of that instance. This entry is created by the init functionParameters(some_module_instance). The parameter set can be retrieved by calling the propertyModule.parameters.Modulealso allows forsetandgetof the parameter values.infer.fitandinfer.samplenow accept parameters from multiple modules and internally combine them into a dynamically created eqx.Module that contains attributes for every key/value pair in the parameters dict. Only this new module of values get optimized/sampled, which massively reduces the overhead per iteration as it avoids copying non-optimized data structures.The main purpose is to allow Parameters to be defined not just for
Scene, but for any otherModule, in particularObservation. As an example, we can adjust the astrometric offset by parameterizing the.shiftattribute in theConvolutionRenderer:A detailed example is given in the multi-observation howto.
As a consequence of these changes, the signature of the
fit/samplefunctions does not require theparametersargument (it's held already by the module that gets optimized). This shorter call signature will do and is now used in the docs:While the changes are quite substantial, scripts that are based on the v0.3 API should all still work.