NickKarpowicz / LightwaveExplorer

An efficient, user-friendly solver for nonlinear light-matter interaction
MIT License
49 stars 8 forks source link

Plotting the spatial distribution of light #36

Open timk110 opened 4 weeks ago

timk110 commented 4 weeks ago

I am currently working on simulating SHG of low pulse energy, tightly focused light. Due to the presence of group velocity mismatch and spatial walk off in the system, the generated SH should exhibit signficant pulse front tilt and a distorted SH beam profile. I am trying to use python to plot the spatial profile of the output of a simulation to characterise this (e.g. a heatmap of the electric field over the x-y axes). However I am having trouble deciphering the way the electric fields are stored in a python lightwaveExplorer object. Do you have any sample code that I could use to get started, or just some tips on the way the electric field is stored in the lightwaveExplorer object?

Any help would be greatly appreciated!

NickKarpowicz commented 4 weeks ago

Hi there!

I made a simple example of how to do this in an ipynb notebook, which I've attached here, along with the result. The LWE result file is here: SHG_tilt_3D.zip

Here's how it looked at the end of the simulation. It's doing SHG of an 800 nm pulse in a BBO crystal, in 3D. Screenshot_20240610_151928

The notebook I used to process it is here: shg_tilt.zip

It produces these output images:

Slides through the electric field (x vs. time, y vs. time) FieldDistributionSlices.pdf

False-color images of the beam that emerges in the far-field FalseColorImages.pdf

Does this help?

edit: ignore the fact that I forgot to make a new x and y axis for the far-field image :)

timk110 commented 4 weeks ago

Thank you for the swift response! This is a lot more than I expected and perfect for what I need. I will have a play with this for my results.