Closed hnakahara79 closed 1 year ago
Dear @hnakahara79
The basic usage is exampled in the Usage
section of the readme and there is an working example of synchrad
use with FBPIC in the tutorials/PIC
. Basically you need to:
tutorials/PIC/fbpic_lwfa_script.py
)synchrad
format using synchrad.utils.tracksFromOPMD
(see tutorials/PIC/extract_tracks.py
)synchrad
with the tracks file and save the spectrum to the file (see tutorials/PIC/compute_spectrum.py
)You may find more information on the possible arguments for the calculate_spectrum
method in the doc strings (or see tutorials/Introduction.ipynb
)
Let me know if this is helpful
Dear @hightower8083
Thank you for quick and very clear response ... I get some confidence after your reply.
However, I am still finding ways to install OpenCL, it is not as straight forward as PyOpenCL. Once OpenCL installation will be successful, I will proceed for spectrum calculation.
Thank you for your help. Naka
Dear @hightower8083
Finally, I was able to install OpenCL. PyOpenCL is installed through "pip" and I have also installed "synchrad".
I will try to run the test as you suggested above.
I will update you about the result of my attempt.
Thank you very much. Naka
Dear @hightower8083
I was able to run the code and generate figures.
It was awesome to use synchrad !!
I have two questions (please see the attached pdf file).
Thank you very much for your help.
Dear @hnakahara79
To work with the calculated data we are typically using synchrad
itself initiated from the spectrum file, and it has the convenience methods to do the analysis :
get_full_spectrum
, which returns is a radiation spectral-angular density calculated as :$$ \cfrac{\mathrm{d}\mathcal{W}}{\mathrm{d}\Omega \mathrm{d}\hbar\omega} = \frac{\alpha}{4\pi^2} \sump \left| \int{-\infty}^{\infty} \mathrm{d}t \cfrac{\bf n \times (\bf n-\beta) \times \dot{\beta}}{(1-{\bf n\beta})^2}\mathrm{e}^{i \omega (t-\mathbf{n}\mathbf{r}_e/c )}\right|^2 $$
get_energy_spectrum
-- the result integrated over anglesget_energy
is additionally integrated over photon energies (frequencies)get_spot_cartesian
returns the radiation angular density, which is get_full_spectrum
integrated over photon energies and projected onto a 2D map instead of polar-like ($\theta, \phi$) coordinates that are used internally.You may see, that the data is actually dimensionless $\cfrac{\mathrm{d}\mathcal{W}}{\mathrm{d}\Omega \mathrm{d}\hbar\omega}$, and it turns to the energy when we integrate it. For the physical (SI) units, the only thing we need is to define the units of space coordinates and we do that with the spatial scale in microns lambda0_um
which can be provided as an argument to all get_..
analysis methods above. For the case of the tracks extracted from openPMD files, the coordinates are in meters
which corresponds to lambda0_um=1e6
and the units of get_spot_cartesian
spot should be [J/rad^2]
. Actually for what concerns your question, in our example the get_spot_cartesian
method has lambda0_um=1
, which isn't very correct and the units are not very meaningful. I will correct this ambiguity asap.
For the second question about the common "synchrotron units": the calculation result $\cfrac{\mathrm{d}\mathcal{W}}{\mathrm{d}\Omega \mathrm{d}\hbar\omega}$ that we obtain from get_full_spectrum
, can be translated to the units of number of photons per 0.1% bandwidth per mrad^2
by multiplying it by 1e3
, but in order to add /s/mm^2
you need to make estimates of the electron bunch duration and radius and normalize data yourself -- estimations of the source size and duration are not in the scope of synchrad
and the way to make such estimates may vary from case to case.
Let me know if this makes things more clear, and do not hesitate to explore the methods in utils.py
module and their documentation
Dear @hightower8083
Thank you very much for your clear explanation. I will look into them and follow in the post-processing.
I will ask you again, if there will be more questions.
I am really glad to use synchrad and to see how nicely you are helping others to make the complicated spectrum calculation so easily.
Thank you very much again.
you are very welcome, and glad to have more people using synchrad
, after all more users=more development=more fun
. Do not hesitate to ping me in this issue if you find something unclear.
@hightower8083 Thank you. Sure I will contact you again. I will also tell my friends about synchrad.
Dear Developers,
I would like to use "synchrad" for calculating the radiation emitted by the oscillating electron beam in LWFA.
Could you please provide me some initial help on how to do it if I have position and momentum information of the electrons.
I am using FBPIC code for studying radiation generated by electron beams in LWFA.
Thanks a lot. Naka