Open daurer opened 7 years ago
Hi Benedikt,
thanks for filing this well documented question.
I would first advise to try to do:
p.scans.MF.illumination.diversity = None
That way you skip illumination.py messing with your. Photon rescaling should not be an issue then.
In another option you simply sideload the probe after initialization.
P.probe.S['S00G00'].data = u.load_from_ptyr(....)
(or any other way)
and continue with the rest of Ptycho init routine manually.
Hope it helps, Bjoern
Hi Bjoern,
thanks for your answer.
diversity=None
does avoid unwanted rescalingHowever, both solutions are not very intuitive, so you might wanna improve the probe loading or document this particular case.
Thanks again, Benedikt
I'm reopening this to make sure that we don't forget to make the improvements when our model rewrite it complete.
Thanks for pointing that out.
Pierre
(with @bjoernenders and @aaron-parsons) Decision:
We will make side loading objects and probe from previous reconstructions a proper method of Ptycho. Bumped to next release
The first problem raised in the initial issue has been addressed in #417. We should also fix the issues with diversy implementing what has been suggested above.
Hi,
I am trying to load an existing multi-probe from a .ptyr file using this code:
What I was expecting is that
P.probe.S['S00G00'].data
would be the same as the multi-probe stored inf['content']['probe']['S00G00']['data']
of result.ptyr, which is not the case because of some rescaling during the loading procedure:1) Since I specified
p.scans.MF.illumination.photons = None
, the parameterphotons
is set toscan.diff.max_power
(line 647 of core/manager.py) which leads to a rescaling by the factornp.sqrt(photons / u.norm2(model))
(line 399 of core/illumination.py) whereu.norm2(model)
is the full power of all the multi-probes.2) Even though I did not specify anything about diversity,
p.diversity
(line 361 in core/illumination.py) is not None, instead it has the default parameters (power=1.0). But since it goes insideu.diversify(...)
, it leads to a rescaling of (1/sqrt("nr of probe modes")) which happens in line 67 of utils/scripts.py where power=1.0 has been expanded to an array of length "nr of probe modes". Each element of this array is rescaled by power.sum() (which equals "nr of probe modes") and then the multi-probe illumination is rescaled by this array.I am not sure if what I am trying to do is supposed to work, but it would certainly be nice if I could load a multiprobe reconstruction and have it properly scaled (as it is stored in the .ptyr file). Maybe there is another way of doing this?
Thanks, Benedikt