Python Python FFT help, non linear scaling

Click For Summary
The discussion centers on a Python program designed to simulate the propagation of a Gaussian beam through a thick lens using Fourier optics. The user has implemented a non-linear scaling of the spatial axis to increase data point density at the focus, which is critical for achieving high resolution. However, they encounter issues with the FFT function from scipy.fft, which requires a linear distribution of points. This discrepancy leads to unexpected results when applying phase factors to the E-field and angular distribution. The user seeks advice on whether it is feasible to perform an FFT with non-linear scaling or if they should explore alternative methods for enhancing precision at the focal point, including the potential use of numpy.fft.fftfreq. The discussion emphasizes the challenges of maintaining data integrity while optimizing computational efficiency in optical simulations.
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(...)?
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
Replies
7
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