Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request for two purposes (1) fix a bug in DenseAmpcor.py, the script that calls the low-level fortran ampcor.F to generate (dense) offset fields and (2) add a simpler way of setting the location of chips given the parameters of chip and search window sizes.
(1) Fix the bug in DenseAmpcor.py
The bug I find is at line 419:
startDown, endDown = proc_loc_down[0], proc_loc_down[-1]
It should be:
startDown, endDown = proc_loc_down[0] - self.pixLocOffDn, proc_loc_down[-1] - self.pixLocOffDn
Some explanation for understanding the code and bug-fix:
self.pixLocOffAc
,self.pixLocOffDn
are the half reference chip size + search window size in across and down direction (see line 647 and 648). The are used as the offset from the starting pixel of the secondary chip to the center of the reference/seconsary chip.self.gridLocAcross
andself.gridLocDown
store the the locations of the centers of all reference/secondary chips on the image in across and down directions. They are set at line 369 and 370: given the first and last valid pixel of the image (offAc, lastAc, offDn, lastDn), both self.pixLocOffAc and self.pixLocOffDn are used to determine the chip center.startAc, endAc, startDown, endDown
are the starting pixel of the first and last secondary chips. They are passed to low-level ampcor.F. To set these four parameters:At line 372:
startAc, endAc = offAc, self.gridLocAcross[-1] - self.pixLocOffAc
startAc and endAc are correctly set as the starting pixel of the secondary chip.
But at line 418-419:
proc_loc_down = self.gridLocDown[istart:iend]
startDown, endDown = proc_loc_down[0], proc_loc_down[-1]
startDown and endDown are set as the center of the reference/secondary chip by mistake.
It should be:
startDown, endDown = proc_loc_down[0] - self.pixLocOffDn, proc_loc_down[-1] - self.pixLocOffDn
(2) Add a simpler way of setting the location of chips.
The current way of setting the location of chips is a bit complicated and difficult to understand. When developing GPU ampcor, we use a much simpler logic of determining this. I use
limit_setting_option
to determine which logic to use. The default logic is the conventional one (limit_setting_option=0). To turn on the new logic, user needs to set limit_setting_option manually to 1 in the code. I don't expose this as a configurable parameter because it will introduce unnecessary complexity to common users of ISCE, but would like to keep it there for future developers of GPU ampcor for benchmark purposes.