-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i.ifft: Add Test Suite #5264
base: main
Are you sure you want to change the base?
i.ifft: Add Test Suite #5264
Conversation
self.assertModule( | ||
"i.ifft", | ||
real=self.real_input, | ||
imaginary=self.imag_input, | ||
output=self.output_raster, | ||
overwrite=True, | ||
) | ||
self.assertRasterExists(self.output_raster) | ||
|
||
self.assertModule( | ||
"i.ifft", | ||
real="real_input2", | ||
imaginary="imag_input2", | ||
output="output_raster2", | ||
overwrite=True, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these 2 i.ifft runs testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two i.ifft
runs generate two separate rasters by performing the inverse Fourier transform on different input sets. The outputs are then combined into a third raster (output_raster_sum
) using the summed inputs (real_input_sum
, imag_input_sum
). Finally, the results of output_raster_sum
are compared against reference statistics, which were derived using the same method. This test validates the linearity property of the inverse Fourier transform by ensuring that IFFT(A) + IFFT(B) = IFFT(A + B)
.
self.temp_rasters.append("output_sym") | ||
|
||
self.runModule( | ||
"r.mapcalc", expression="shifted = output_sym[5, 5]", overwrite=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this test more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test checks whether i.ifft
preserves symmetry in the real-valued output. The input (real_sym
) is designed to be symmetric around column 5, and imag_zero
ensures there is no imaginary component. I wanted to compare the flipped raster with the raster generated by i.ifft
and initially, I attempted to use r.flip
to create the shifted raster, but it did not work as expected. So instead, I used shifted = output_sym[5, 5]
to obtain a reference value and computed sym_diff = abs(output_sym - shifted)
to find deviations from symmetry. Then this is compared against reference statistics which validates that the IFFT output maintains the expected symmetry.
This PR introduces a test suite for the
i.ifft
GRASS GIS module. The test suite is aimed at verifying the module’s core functionality, confirming statistical accuracy, and testing various edge cases to ensure stable and reliable performance.Key Updates in this PR:
Test Case Additions
ifft(2.5 * x) == 2.5 * ifft(x)
(test_scaling_property).Performance
The test suite execution times:
This test suite enhances the reliability of the
i.ifft
module by covering a broad spectrum of cases. Looking forward to feedback and potential refinements!