Commit faa36e7
Handle division by zero at DC component in FFT shear
The previous fix included the DC component (kx=0, ky=0) in the frequency
arrays, which caused division by zero errors in the shear calculations.
Fixed by:
- Using safe division with np.where to replace zeros with 1.0 temporarily
- Explicitly setting DC component of perturbations to 0 after calculation
- Applying same fix to filter_highfrequencies function
The DC component represents the mean value and doesn't contribute to
perturbations, so setting it to zero is physically correct.
Co-authored-by: Sierd <14054272+Sierd@users.noreply.github.com>1 parent 31bd01c commit faa36e7
1 file changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
585 | 589 | | |
586 | | - | |
587 | | - | |
| 590 | + | |
| 591 | + | |
588 | 592 | | |
589 | 593 | | |
590 | 594 | | |
591 | | - | |
| 595 | + | |
592 | 596 | | |
593 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
594 | 601 | | |
595 | 602 | | |
596 | 603 | | |
| |||
668 | 675 | | |
669 | 676 | | |
670 | 677 | | |
671 | | - | |
672 | | - | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
673 | 683 | | |
674 | 684 | | |
675 | 685 | | |
| |||
0 commit comments