Closed rbnvrw closed 6 years ago
You have accidentally wandered into some behavior that is not as well documented as it should be.
If you use the same prior object (pg5 in your case) in multiple places in your parameterization, HoloPy assumes you want those values tied together (ie they all vary the same and are actually one parameter in the model). So the last Uncertain value around 5 is actually the value for all of the other coordinates.
I think what you probably want to do is give a separate copy of the prior in each place, so that you allow each of those coordinates to vary independently
You can simply type out the prior.Gaussian in each place (which could be a good thing because then you can put a different dither on each one individually), or turn your pg5 into a function:
def pg5():
return prior.Gaussian(4.97, .08)
then in your sphere code
...
s2 = Sphere(center=(pg5(), pg5(), pg5()) ...
...
That way you will have a separate parameter object in each point and HoloPy will allow the parameters to vary independently.
More about tying parameters in the old fit docs (the inference uses the same parameter engine, we haven't moved all the old docs over) http://holopy.readthedocs.io/en/3.1.1/users/fit_tutorial.html#tying-parameters
Thank you very much for your quick and detailed answer. That is actually a very nice feature that I accidentally stumbled upon, I think it deserves a mention in the documentation!
I have updated and tested my code, it's working now, so I'll close the issue.
If you want to be extra helpful, you could put in a pull request for that documentation upgrade, otherwise someone will get to it eventually.
First of all, thank you for making this code publicly accessible and thank you for all the work that has gone into this.
I was following the tutorial on "Bayesian inference of Parameter Values" and I am trying to adapt it to multiple spheres. MWE:
If I run this code, I get a lot of
OverlapWarning
s and the following output:So, it seems the code is able to correctly determine the y coordinates, but for the other parameters I see no values. I could not find anything in the documentation about multiple spheres, however in your paper ("A Bayesian approach to analyzing holograms of colloidal particles", Dimiduk & Manoharan, 2016) you write in the conclusions "In the future, we aim to apply this technique to more complex scattering models such as the superposition solution for multiple spheres". Is this supported yet?