LASY-org / lasy

https://lasydoc.readthedocs.io
Other
29 stars 21 forks source link

Laser phase measurement (wavefront-sensor) and non-Gaussian intensity distribution in the focal spot #153

Closed alexanatoly closed 10 months ago

alexanatoly commented 1 year ago

Hi everyone,

It is great to know (from slack discussion) that LASY is soon going to be implemented for use in FBPIC. I am very excited about this additional powerful utility.

During the slack discussion with Remi, I mis-understood 'spectral phase' with the 'phase measured with the wave-front sensor'.

Non-uniform 'spectral-phase' tells that the laser pulse is not compressed to Fourier limit, however, it can not give any information about laser spot (please correct me if I am wrong). It is nicely available for use in the code (Paraxial_Approximation_Laser).

On the other hand, the non-uniform phase distribution, measured by wave-front sensor, tells how much the focal spot is deviated from Gaussian one (please correct me if I am wrong).

Do you think that we can load the phase distribution information measured by wave-front sensor in code and calculate the real intensity distribution in the laser spot. If this can be done, it will be extremely powerful and realistic.

Thank you and my best wishes to the entire team.

MaxThevenet commented 1 year ago

Hi @alexanatoly, Thank you for your question. Just rephrasing here, to make sure I understand: the transverse profile of a laser pulse at 1 location is characterized by both its intensity profile and phase profile (given some approximation). In your case, you have a direct measurement of the phase profile, e.g. with a Shack-Hartmann, and would like to initialize a pulse from this information, correct? Do you also have the intensity profile at the same location? If so, I believe adding such a profile should not be too hard.

In a slightly different case: the Gerchberg-Saxton algorithm implemented in #139 reconstructs the intensity and phase profiles from measurement2 of intensity only, at 2 locations. I believe the main ingredients can be recycled from this PR.

alexanatoly commented 1 year ago

Hi @MaxThevenet ,

Thank you for your reply and sorry for my very late response. I was too much busy with semester-end examinations and then grade assignments. It was too hectic. Now, I can again focus on research.

You understand my question correctly. I have phase-profile and intensity profile both at the same location.

Also, the Gerchberg-Saxton algorithm implemented in https://github.com/LASY-org/lasy/pull/139 is quite attractive and useful. Can you suggest me how to use Gerchberg-Saxton algorithm with two intensity distribution images ? So that I can proceed testing/working with it.

Thanks and best wishes.

alexanatoly commented 1 year ago

Hi @MaxThevenet ,

I used the example = https://github.com/LASY-org/lasy/blob/development/examples/example_modal_decomposition_data.py

and got the following error

C:\Users\Alex\anaconda3\lib\site-packages\lasy\utils\mode_decomposition.py:140: ComplexWarning: Casting complex values to real discards the imaginary part coeffTest[i] = np.sum(profile * field) Estimated w0 = 13.20 microns C:\Users\Alex\anaconda3\lib\site-packages\lasy\utils\mode_decomposition.py:91: ComplexWarning: Casting complex values to real discards the imaginary part if math.isnan(coef): Traceback (most recent call last):

File "C:\Users\Alex\Desktop\MyWork\sim\Lasy\example_modal_decomposition_data.py", line 59, in reconstructedProfile = modeCoeffs[

File "C:\Users\Alex\anaconda3\lib\site-packages\lasy\profiles\profile.py", line 67, in rmul return ScaledProfile(self, factor)

File "C:\Users\Alex\anaconda3\lib\site-packages\lasy\profiles\profile.py", line 128, in init assert isinstance(factor, (int, float)), "The factor must be a number."

AssertionError: The factor must be a number.

how to fix the above error ? May be this example, although not Gerchberg-Saxton algorithm, but may help to understand how to use two intensity distribution images

alexanatoly commented 1 year ago

May be @rob-shalloo can help me to figure out what is wrong in the above attempt. I guess he wrote the above example.

Hi @rob-shalloo sorry to bring you inside the discussion. If you will have some time (not urgent) please, could you help me to sort out the above error.

Thanks. Alex

rob-shalloo commented 1 year ago

Hey @alexanatoly no problem, happy to help. Are you running the example exactly as it's provided or have you made any modifications?

Also, to your earlier question. It is not fully correct to say a non-uniform spatial phase tells you how far from gaussian your spot is. The spatial phase can of course inform you about aberrations in your beam, but the spot intensity profile depends on both the amplitude and the phase. For example, a top hat beam focused with a parabola will have an intensity profile at focus which is not a gaussian, even in the case of perfectly flat spatial phase.

alexanatoly commented 1 year ago

Hi @rob-shalloo , thanks a lot for your kind reply and explanation. I am running the example as it is. I downloaded both examples:

(1) example_gerchberg_saxton_algo.py and (this works without any problem) (2) example_modal_decomposition_data.py (but this throws an error)

Once again, I downloaded the script file ("example_modal_decomposition_data.py") and run it. The error message was the same:

Estimated w0 = 13.20 microns Traceback (most recent call last):

File "C:\Users\Alex\Desktop\MyWork\sim\Lasy\example_modal_decomposition_data.py", line 59, in reconstructedProfile = modeCoeffs[

File "C:\Users\Alex\anaconda3\lib\site-packages\lasy\profiles\profile.py", line 67, in rmul return ScaledProfile(self, factor)

File "C:\Users\Alex\anaconda3\lib\site-packages\lasy\profiles\profile.py", line 128, in init assert isinstance(factor, (int, float)), "The factor must be a number."

AssertionError: The factor must be a number.

Although the final goal is to learn how to implement real intensity and phase profile (measured in the experiment) in the simulation, but I would like to go gradually. Foremost, I would like to use / learn both the above examples script and get some idea about the procedure.

Also, thanks for the great work of LASY.

Thanks. Alex

alexanatoly commented 10 months ago

Hi @rob-shalloo any update on why this example cannot be run ? (example_modal_decomposition_data.py)

rob-shalloo commented 10 months ago

Hey @alexanatoly sorry for the delay! I've had a look into this and identified the issue. More details can be found in PR #206

As a workaround for you to get the code running, you simply need to add two np.reals to the example_modal_decomposition_data.py file as detailed here https://github.com/LASY-org/lasy/pull/206

Can you let me know if this works for you?

alexanatoly commented 10 months ago

Hi @rob-shalloo thank you for the fix. Now, the example file can be run without any issue.

Thanks. Alex