Modeling/handle more out than in#3250
Merged
Merged
Conversation
they have inputs, at least in the most basic cases. This sort of works the same as how models with more inputs than they have outputs work, which is that each input is not necessarily directly tied to each output; instead all outputs are just assumed to have the same dimensions, which are determined from the result of broadcasting all inputs with all parameters. In the future there may be more ways for individual model implementations to control this (besides outright overriding prepare_inputs and/or prepare_outputs). This provides an alternate to this PR: #12
Member
Author
|
I'll add, it would be good if a test were added that tests this against compound models. If this PR is merged before #3231 then that PR can be rebased on this one. If the other way around then I can update this PR to include such a test. |
Member
Author
|
Passed--going ahead and merging so I can incorporate this into #3231. |
embray
added a commit
that referenced
this pull request
Dec 23, 2014
Modeling/handle more out than in
embray
added a commit
that referenced
this pull request
Dec 31, 2014
Modeling/handle more out than in Conflicts: astropy/modeling/core.py astropy/modeling/tests/test_input.py
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 fixes an issue raised by @nden here, and iterates on a suggested fix at embray#12 so as to explicitly support this case. This still makes certain assumptions about the design of the model evaluation function. The main assumption is that all outputs from the model's
evaluatefunction will have the same shape as would result from performing some Numpy ufuncs involving all inputs and parameters to the model. In other words, the shape of all outputs are assumed to be the same, which is the broadcast shape of all inputs with all parameters.This still suffices for most cases (particularly where all inputs/parameters are just scalars). This was a known issue, but hadn't been brought up before due to there not being any built in models in Astropy that have this format. However, the compound modeling feature [#3231] makes it easier to make such models, and this fix should is good enough for most cases involving compound models as well.