Open wfeschen opened 3 years ago
Hi Wilhelm,
I have noticed the same problem before, thanks for reminding us about this issue. The quickest fix is to explicitly set p.scans.scan00.sample = None
in your run script. That's what I did whenever I encountered this issues. This is of course not very intuitive and should at the very least be documented.
As a proper fix, one option would be to change the default of sample.process
to None
, but there might be a reason for the current setup which is c;learly designed for the case when no initial object is provided.
Another option would be to check if an object is provided via sample.recon
and in that case disable sample.process
. @bjoernenders what do you think would be the best solution here?
Hi Wilhelm,
thanks for pointing this out. The best way here is to do p.scans.scan00.sample = /path/to/file.ptyr
or to explicitly set process=None
. We need to work on our documentation here to clarify this.
Best,
Bjoern
Hi Everyone,
I typically do as @wfeschen did, but adding process=None
:
p.scans.scan00.sample = u.Param()
p.scans.scan00.sample.model = "recon"
p.scans.scan00.sample.process = None
p.scans.scan00.sample.recon = u.Param()
p.scans.scan00.sample.recon.rfile = recon_obj_filepath
What is the difference between this and what @bjoernenders said by directly putting the file on sample
p.scans.scan00.sample = /path/to/file.ptyr
?
Another behaviour to watch is when the illumination is load from .ptyr
file, because the number of photons are normalised accord to the stats
ptypy estimates.
Hi @jcesardasilva.
These two ways to load the object from a .ptyr
file are effectively doing the same thing. As far as I understand, assigning the file directly to p.scans.scan00.sample
is the recommended way to just load the object without any further processing. The other option, changing p.scans.scan00.sample.model
to recon
and using p.scans.scan00.sample.recon
is the inteded way to load an object and modify it (unless you specifically turn it off via process=None
). We are planning to improve the documentation to make this more clear.
Also, thanks for the reminder regarding the photon normalisation when loading a probe from file. Its the same issue here, documentation needs to be improved.
Hi,
I figured out that loading the object from a reconstruction is broken (at least when I run ptypy with the following script):
I think the problem is caused by the following part of the code:
at this part of the code, ptypy tries to simulate the object, although I never specified "sim". This is the case because
p.process
is notNone
. For myself I solved this by removing the second part of the if condition.if str(p.model) == 'sim':
Best regards and thanks for keeping this wonderful library work! Wilhelm