Python FFT help, non linear scaling

Click For Summary
SUMMARY

The discussion centers on using Python's SciPy library for simulating Gaussian beam propagation through a thick lens using Fourier optics. The user attempts to optimize data points by implementing a non-linear scaling of the axis, which results in a challenge when applying the FFT function from scipy.fft. The user questions whether FFT can accommodate non-linear scaling and seeks advice on whether to continue debugging their code or explore alternative methods for enhancing precision at the focus.

PREREQUISITES
  • Understanding of Fourier optics principles
  • Familiarity with Python programming and libraries, specifically SciPy and NumPy
  • Knowledge of FFT algorithms and their requirements
  • Experience with data scaling techniques in numerical simulations
NEXT STEPS
  • Research the use of numpy.fft.fftfreq for frequency domain analysis
  • Explore alternative methods for non-linear data interpolation in FFT applications
  • Investigate the implementation of custom FFT algorithms that can handle non-linear data
  • Learn about advanced techniques in Fourier optics for improving resolution
USEFUL FOR

This discussion is beneficial for physicists, optical engineers, and software developers working on simulations involving Fourier optics and Gaussian beam propagation, particularly those seeking to optimize data resolution in computational models.

Hypochondriac
Messages
35
Reaction score
0
Im writing a program in python to simulate the propagation of a gaussian beam through a thick lens and to the focussing point using Fourier optics.

Due to the strength of the focussing I need a lot of data points so that I have a decent resolution at the focus. To speed things up and to reduce the number of data points I need, I rescaled my axis so that instead of the points being linear in space, (i.e. each data point is the same delta x from the next) I scaled it so that it was more cubic than linear. This gives me many more points in the centre of my axis (where I need them) and a lot less for the outer regions where not a lot is happening.
Thats the best I can explain it sorry.

However the fft function in scipy.fft (I assume) requires a linear distribution of points.
Because when I start multiplying my E-field and angular distribution by phase factors to focus it, the results are not what I expect. (If it doesn't require linear spacing, how can I put tell it my real space values as well as the E-field values at them points?)

Either I'm wrong and my code is wrong, or it cannot be done because I've been ripping my code to pieces for days now trying to solve this.

So, can I do a FFT with a non-linear scaling? and should I persevere with my code to make it work?
Or should I give up and try another method of increasing the precision in the centre?
 
Technology news on Phys.org
can you use numpy.fft.fftfreq(...)?
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K