-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about plotting energy spectrum #165
Comments
I hope you have seen the documentation on xrt plots. What is plotted as 1D and 2D distributions are not the original beams but their histograms. If you want to directly work with beams, XYCPlot is useless, and inversely, if you want the facilities of XYCPlot, you shouldn't work directly with beams. The option withAmplitudes=True enables complex field amplitudes, this is only needed for special applications like wave propagation. What is histogrammed and plotted are intensities, not amplitudes. If you have a defined idea on what you want to get and cannot get it, just ask again. |
Thanks a lot for the explanation.
I was trying to extract overall x-ray properties after the optical
elements. For example, I want to get the energy spectra after the DCM. I
came up with the idea of getting the energy of all the beams
by raycing.get_energy and do a histogram. However, it seems I get a flat
distribution (by withamplitudes = False).
In another case, I wanted to get the overall degree of circular
polarization after a quater wave plate, as well as the psi angle of the
polarization ellipse. I again used raycing.get_circular_polarization_rate
and raycing.get_polarization_psi, and averaged the resulting np.arrays. But
I wonder whether I got the correct numbers since I feel these numbers
should be weighted by the amplitude of the corresponding beams before
averaging.
Anyway, I feel that the histograms shown in the XYCplots are exactly what I
want, but I am not clear how to extract them without directly working with
beams.
Konstantin Klementiev ***@***.***> 于2023年12月16日周六 17:52写道:
… I hope you have seen the documentation
<https://xrt.readthedocs.io/plots.html> on xrt plots.
What is plotted as 1D and 2D distributions are not the original beams but
their histograms. If you want to directly work with beams, XYCPlot is
useless, and inversely, if you want the facilities of XYCPlot, you
shouldn't work directly with beams. The option withAmplitudes=True enables
complex field amplitudes, this is only needed for special applications like
wave propagation. What is histogrammed and plotted are *intensities*, not
amplitudes.
If you have a defined idea on what you want to get and cannot get it, just
ask again.
—
Reply to this email directly, view it on GitHub
<#165 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDKPXCLISNB6L7AH3EMMTX3YJVVPBAVCNFSM6AAAAABAVVTYE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYG43TOMBVGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
See this part of documentation. In particular, if you put your wanted property as c-axis (color axis), you get it as: You can find more usage examples if you search the supplied examples for |
Thanks a lot. This is exactly what I was looking for.
A following question is, can I skip the plotting procedure of the XYCplot
and directly extract the properties in it? When I iterate some parameters
of the beamline and just want to extract some properties in the plots, I
hope it wouldn't plot everything for every iteration.
And an additional small problem that I asked before. Somehow my XYCplot
only works by running the scripts in command line. When I run the script in
Spyder or Jupyter notebook, it shows empty plots. It seems that the
run_ray_tracing is not working in these environments. When I try to use
operations like yourPlot.caxis.binCenters, it results in a traceback
"'XYCAxis' object has no attribute 'binCenters'". If I try yourPlot.dE, it
returns 0. I am using the Spyder and Jupyter within a Winpython
environment. Could you please kindly provide some clue to solve it?
Konstantin Klementiev ***@***.***> 于2023年12月18日周一 17:25写道:
… See this part <https://xrt.readthedocs.io/using.html#saving-the-results>
of documentation.
In particular, if you put your wanted property as c-axis (color axis), you
get it as:
x = yourPlot.caxis.binCenters
y = yourPlot.caxis.total1D
You can find more usage examples if you search the supplied examples for
afterScript.
—
Reply to this email directly, view it on GitHub
<#165 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDKPXCNW5HJKXMYMNHIKWGTYKADW7AVCNFSM6AAAAABAVVTYE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZHA3TSNJTG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thanks a lot for your explanation. All my questions are now perfectly
solved.
Konstantin Klementiev ***@***.***> 于2023年12月19日周二 16:09写道:
… can I skip the plotting procedure of the XYCplot and directly extract the
properties in it?
Yes, see the "Tip" here <https://xrt.readthedocs.io/plots.html>.
When I run the script in Spyder or Jupyter notebook, it shows empty plots.
See a paragraph about Spyder here
<https://xrt.readthedocs.io/instructions.html#dependencies>.
Note also that the documentation is searchable.
—
Reply to this email directly, view it on GitHub
<#165 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDKPXCLHFCKTZS2DJBFUIOTYKFDT3AVCNFSM6AAAAABAVVTYE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRSGI4TMOBUGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I am a beginner of xrt and trying to demo a simple ray-tracing case. I constructed a beamline with a geometric source and a Si(111) DCM, and monitor the beam properties after the DCM by a screen called "beamFSM1". I had energy bandwidth of around 5eV at the source and expected the energy bandwidth to be reduced to around 1.6eV. This was confirmed by the energy FWHM value in a XYCplot of beamFSM1.
On the other hand, I used shine(withAmplitudes=True) to get the amplitude of the rays. Then I used raycing.get_energy(run_process(beamLine)["beamFSM1"]) and raycing.get_Es_amp(run_process(beamLine)["beamFSM1"]) to get arrays of beam energy and amplitude. I expected that the energy spectrum that the DCM produces could be obtained by plotting Es_amp against energy, but I only got random distribution of Es_amp in the energy axis.
I wonder why it is the case, and what is actually plotted in the energy spectrum of the XYCplot.
Thanks in advance!
The text was updated successfully, but these errors were encountered: