Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sarpy/io/complex/sicd_elements/validation_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def _pfa_check_stdeskew(PFA, Grid) -> bool:
# If so, it logs a validity error and sets the return value to False.
if Grid.TimeCOAPoly is not None:
timecoa_poly = Grid.TimeCOAPoly.get_array(dtype='float64')
if timecoa_poly.shape == (1, 1) or numpy.all(timecoa_poly.flatten()[1:] < 1e-6):
if timecoa_poly.shape == (1, 1) or numpy.all(numpy.abs(timecoa_poly.flatten()[1:]) < 1e-6):
PFA.log_validity_error(
'PFA.STDeskew.Applied is True, and the Grid.TimeCOAPoly is essentially constant.')
cond = False
Expand Down
10 changes: 9 additions & 1 deletion tests/io/complex/sicd_elements/test_validation_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def test_timecoa_poly_constant(self):
grid = DummyGrid(timecoa_poly=timecoa_poly)
self.assertFalse(_pfa_check_stdeskew(pfa, grid))

def test_timecoa_poly_negative_nontrivial_terms(self):
stdeskew = DummySTDeskew(applied=True)
pfa = DummyPFA(stdeskew=stdeskew)
arr = np.array([[1.0, -1e-2], [0.0, 0.0]])
timecoa_poly = DummyPoly(arr)
grid = DummyGrid(timecoa_poly=timecoa_poly)
self.assertTrue(_pfa_check_stdeskew(pfa, grid))

def test_row_deltakcoa_and_stdsphasepoly_agree(self):
arr = np.array([[1.0, 2.0], [3.0, 4.0]])
stdeskew = DummySTDeskew(applied=True, stds_phase_poly=DummyPoly(arr))
Expand Down Expand Up @@ -104,4 +112,4 @@ def test_stdsphasepoly_none(self):
self.assertTrue(_pfa_check_stdeskew(pfa, grid))

if __name__ == "__main__":
unittest.main()
unittest.main()