Closed carterbox closed 4 years ago
Hello @carterbox! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:
I would suggest making additional padding of psi at the beginning of reconstruction. One can add many extra pixels, e.g. psi[1].shape/8,psi[2].shape/8 to each side of psi and never have problems with positions. This will not affect performance.
'Check allowed position after position update' means ignoring the data related to the positions that are out of field of view, or means extending the field of view? Both cases are bad.
Both cases are bad.
@nikitinvv, From our discussions offline, I thought we decided that the operators should not ignore positions outside the field of view (illegal positions) and instead should raise an error if illegal positions were used. Thus, check_allowed_positions()
only raises an error that is more helpful than an unexplained indexing error from the Ptycho operator; it doesn't alter any arrays.
One can add many extra pixels, e.g. psi[1].shape/8,psi[2].shape/8 to each side of psi and never have problems with positions.
That makes sense. The question is whether we should (1) always pad the object automatically or (2) pad only if the user provides no initial guess for the object. I think (2) is a better choice; we could auto-initialize with something like np.ones(field_of_view * (1 + 1 / 8))
. What do you think?
Increasing the size of psi affects the tomography problem because it increases the projection volume?
@nikitinvv, From our discussions offline, I thought we decided that the operators should not ignore positions outside the field of view (illegal positions) and instead should raise an error if illegal positions were used. Thus, check_allowed_positions() only raises an error that is more helpful than an unexplained indexing error from the Ptycho operator; it doesn't alter any arrays.
Ok, we can keep in this developing mode.
That makes sense. The question is whether we should (1) always pad the object automatically or (2) pad only if the user provides no initial guess for the object. I think (2) is a better choice; we could auto-initialize with something like np.ones(field_of_view * (1 + 1 / 8)). What do you think?
Agree
Increasing the size of psi affects the tomography problem because it increases the projection volume?
This is true. But in tomo we typically do padding as well. I hope 1/8 should affect performance that much
I think we should choose the padding depending on the probe size not on the width of the scan area. This is because intuitively, covering a larger area with a scanning trajectory should not increase the uncertainty of the scan positions? I suggest that we pad with one width of the probe? Or like a half-width of a probe? @YudongYao, what do you think?
@carterbox In 3d cases one has to realign projections, i.e. perform some shifts. These shifts can be bigger than the probe size.. Then tomography will work faster with sizes of powers of 2.. You can do 1 probe padding if you want or ask users to do this. This is not a problem in practice, please dont spend much time thinking about this.
@carterbox If I understand this correctly, the reason you need padding is because during the position correction, some scan positions may go out of the defined field of view. For this purpose, I think it doesn't matter if you pad with the width of the probe or the scan area.
Thanks, @nikitinvv @YudongYao!
Purpose
With the altered single-mode-only operators the implementation of Dwivedi's position correction algorithm needs to be fixed, but also we need to implement some explicit checking for probe positions that are out of bounds.
Approach
Pre-Merge Checklists
Submitter
yapf
to format python code.Reviewer