Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Conversation

nocturnalastro
Copy link
Collaborator

We have two solutions to astropy models only allowing parameters to other parameters in the model which owns them.
The first is presented in the code, is two mapping-like models (Split and Join) which can be used to create compound models with a list of models as in model_split_join.
Split separates input based on known indexes allowing each submodel to act on separate parts of the input.
This is demonstrated in this notebook.

The second solution is akin to that of astropy's JointFitter which takes a list of parameter pairs to join, this can be seen in this notebook. This solution will clearly have less overhead but is perhaps a bit less flexible as anything more than simple this equals this could get tricky.

@taldcroft @hamogu @olaurino @DougBurke (sorry for the spam)
Did we decide which solution was best during GSOC?
I can't remember and the notes don't seem to mention a preference.

@hamogu
Copy link
Member

hamogu commented Jan 5, 2017

I don't remember even discussing that. Maybe it was on one of the times where I missed our hangouts... I just looked at both notebooks and that does not ring a bell either.
What problem is this trying to solve?
I'm pretty sure that plain sherpa allows us to tie parameters from two different models or model on different datasets as in

set_source(1, xsphabs.p1 * xsapec.a1)
set_source(2, xsphabs.p2 * xsapec.a2)
p1.nH = 0.5 * p2.nH

(Yes, I know, that not the OO interface).
So, I don't quite understand where the problem comes from and thus I cannot really say what my favorite solution is.
I appologize for this lapse in memory. Please keep in mind that you spent a lot more time thinking about this than I did. I essentially have not looked at the internals of saba for 6 months now (but I have used it for fitting).

@nocturnalastro
Copy link
Collaborator Author

@hamogu It has been been a while, good to hear it's been getting some use.
I think you suggested the Split/Join in passing in our first meeting (which seems like forever ago).
Anyway whilst its easy in sherpa, astropy model's only allow links between parameters within a model.

So the question is how do we get the user to supply the information of which parameters (between models) are to be linked. Split/Join where the user makes a compound model and then links normally or supply it to the fitter directly.

@hamogu
Copy link
Member

hamogu commented Jan 5, 2017

Maybe the solution should be to improve astropy in general to allow links between models so that we don't have to jump through all those hoops?

@astrofrog I know you are knee-deep in the astropy modeling stuff. Is this planned (or already implemented) in astropy?

@nocturnalastro
Copy link
Collaborator Author

@hamogu
I also did a proof of concept for that, using numpy array references(?) which can be found here.
However I don't know enough to say if this is feasible.

Base automatically changed from master to main March 11, 2021 11:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants