Skip to content
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

Some doubts about the energy setting of X-ray sources #176

Closed
999-x opened this issue May 14, 2024 · 18 comments
Closed

Some doubts about the energy setting of X-ray sources #176

999-x opened this issue May 14, 2024 · 18 comments

Comments

@999-x
Copy link

999-x commented May 14, 2024

Hello, sorry to bother you. The example I run is 01BD_SourceZCrystalThetaAlpha.py .
I have some doubts about X-ray energy settings and would like to ask for your advice.
1
The energy circled in the above figure seems to be calculated from the formula in the following figure, only related to lattice spacing and theta.
3
May I ask what does the calculated energy represent?

2

The third image is the code for sources_geoms. py, where energies=(defaultenergy,), is it the energy of X-rays?
What is the significance of changing default energy?
How can I set the X-ray energy I need?

I sincerely hope to receive your reply!

@kklmn
Copy link
Owner

kklmn commented May 14, 2024

Hi,

The meaning of source parameters is explained in the docs.

How can I set the X-ray energy I need?

You set the value of energies field of your source instance. The interpretation of energies depends on the value of distE.

In the same example, there are three versions of energy definition:

beamLine.sources[0].distE = 'flat'
beamLine.sources[0].energies = eAxisMin, eAxisMax
beamLine.sources[0].distE = 'lines'
beamLine.sources[0].energies = E0,
beamLine.sources[0].distE = 'lines'
beamLine.sources[0].energies = [E0 + dEStep * i for i in range(-3, 4)]

@999-x
Copy link
Author

999-x commented May 20, 2024

Hi,

The meaning of source parameters is explained in the docs.

How can I set the X-ray energy I need?

You set the value of energies field of your source instance. The interpretation of energies depends on the value of distE.

In the same example, there are three versions of energy definition:

beamLine.sources[0].distE = 'flat'
beamLine.sources[0].energies = eAxisMin, eAxisMax
beamLine.sources[0].distE = 'lines'
beamLine.sources[0].energies = E0,
beamLine.sources[0].distE = 'lines'
beamLine.sources[0].energies = [E0 + dEStep * i for i in range(-3, 4)]

Hello! Thank you for your answer. At the same time, I would like to know how the Takagi Taupin equation is reflected in the code, but I was unable to find it in the code for this example. I hope you can give me some guidance.

Hi,

The meaning of source parameters is explained in the docs.

How can I set the X-ray energy I need?

You set the value of energies field of your source instance. The interpretation of energies depends on the value of distE.

In the same example, there are three versions of energy definition:

beamLine.sources[0].distE = 'flat'
beamLine.sources[0].energies = eAxisMin, eAxisMax
beamLine.sources[0].distE = 'lines'
beamLine.sources[0].energies = E0,
beamLine.sources[0].distE = 'lines'
beamLine.sources[0].energies = [E0 + dEStep * i for i in range(-3, 4)]

Hello! Thank you for your answer. At the same time, I would like to know how the Takagi Taupin equation is reflected in the code, but I was unable to find it in the code for this example. I hope you can give me some guidance.
屏幕截图 2024-05-20 204404

@kklmn
Copy link
Owner

kklmn commented May 20, 2024

If you look at the same compiled doc strings (here), you would see that the link the Takagi-Taupin equations <useTT> leads you to the useTT parameter of the Crystal class. There is a variable with the same name in the script that you may want to change.

@999-x
Copy link
Author

999-x commented May 20, 2024

If you look at the same compiled doc strings (here), you would see that the link the Takagi-Taupin equations <useTT> leads you to the useTT parameter of the Crystal class. There is a variable with the same name in the script that you may want to change.

First of all, thank you for your reply. Through the document you provided, I may be able to understand the content of the Takagi Taupin equation. But in the example I used, useTT seems to only be equal to True or False. Is it enough to change it to True or False according to my needs?

@kklmn
Copy link
Owner

kklmn commented May 20, 2024

Is it enough to change it to True or False according to my needs?

Yes. What holds you from trying?

@999-x
Copy link
Author

999-x commented May 20, 2024

Yes. What holds you from trying?

Thank you for your reply. Currently, I have not yet understood the specific content of this equation. I will try again after understanding the content of the equation.

@999-x
Copy link
Author

999-x commented May 21, 2024

Is it enough to change it to True or False according to my needs?

Yes. What holds you from trying?

Hello! may I bother you again.
I have two questions to ask. Firstly, does changing the crystal thickness cause any changes in the curve?
I changed the crystal thickness, as shown in Figures 1 and 2, and the curve seems to have not changed.
1
2

Secondly, the Bragg angle calculated by setting the crystal plane index to (6,6,0) should be between 89 ° and 90 °, but Figure 3 shows that the Bragg angle is 90 °. Why is this?
3

Looking forward to your reply!

@yxrmz
Copy link
Collaborator

yxrmz commented May 21, 2024

Well, the curve will stop changing after certain thickness threshold as it gets closer to "infinitely" thick crystal limit. Try 0.05-0.01mm, you will see the difference.
Regarding the Bragg angle, there might be a tiny difference between the value you use for the Si crystal lattice parameter and the one used in xrt, that becomes important as you approach 90deg. I get 89.923 deg for 9686.06eV.

@999-x
Copy link
Author

999-x commented May 22, 2024

Well, the curve will stop changing after certain thickness threshold as it gets closer to "infinitely" thick crystal limit. Try 0.05-0.01mm, you will see the difference. Regarding the Bragg angle, there might be a tiny difference between the value you use for the Si crystal lattice parameter and the one used in xrt, that becomes important as you approach 90deg. I get 89.923 deg for 9686.06eV.

Thank you for your reply

@999-x
Copy link
Author

999-x commented May 27, 2024

Well, the curve will stop changing after certain thickness threshold as it gets closer to "infinitely" thick crystal limit. Try 0.05-0.01mm, you will see the difference. Regarding the Bragg angle, there might be a tiny difference between the value you use for the Si crystal lattice parameter and the one used in xrt, that becomes important as you approach 90deg. I get 89.923 deg for 9686.06eV.

Hello, I'm sorry to bother you. I may need to insert a capillary optical element for simulation. May I ask if there is a model of the optical element capillary in xrt?

@kklmn
Copy link
Owner

kklmn commented May 27, 2024

Hi,
Looking the documentation website for "capillary" is not an option for you?

@999-x
Copy link
Author

999-x commented May 28, 2024

Hi, Looking the documentation website for "capillary" is not an option for you?

thank you!

@999-x
Copy link
Author

999-x commented Jul 1, 2024

Hi, Looking the documentation website for "capillary" is not an option for you?

Hello, sorry to bother you. About code 01BD_SourceZCrystalThetaAlpha, I would like to ask a question. Can I plot the light source image at the light source point? I want to confirm that the light source size value set in the code is consistent with the light source size formed after the code is run.
Then there are two more questions I would like to ask.
Firstly,is the unit of divergence angle of a light source in radians?
344091431-04ffce21-417a-4159-9286-761e9510c3bd
Secondly,can I set the curvature radius of the analytical crystal to infinity, and then set the analytical crystal to flat?
344091878-b26d69f5-ef3a-4eff-90bf-4312c8c39f57
I am looking forward to your reply!

@kklmn
Copy link
Owner

kklmn commented Jul 1, 2024

Can I plot the light source image at the light source point?

Yes, find the example examples/withRaycing/09_Gratings/GratingFlexPES.py and look for ''beamSource' in it. There is a plot of its xz distributions that is commented out in this example. In general, you can plot beam arrays “x”, “y”, “z”, “x’”, “z’”, “energy” and some others of any beam that you create in your run_process().

is the unit of divergence angle of a light source in radians?

Yes, unless it is specifically stated differently, like for undulators where for historical reasons the angular limits are in mrad.

can I set the curvature radius of the analytical crystal to infinity

Yes, you can give it a very big value or np.inf.

@999-x
Copy link
Author

999-x commented Jul 1, 2024

Can I plot the light source image at the light source point?

Yes, find the example examples/withRaycing/09_Gratings/GratingFlexPES.py and look for ''beamSource' in it. There is a plot of its xz distributions that is commented out in this example. In general, you can plot beam arrays “x”, “y”, “z”, “x’”, “z’”, “energy” and some others of any beam that you create in your run_process().

is the unit of divergence angle of a light source in radians?

Yes, unless it is specifically stated differently, like for undulators where for historical reasons the angular limits are in mrad.

can I set the curvature radius of the analytical crystal to infinity

Yes, you can give it a very big value or np.inf.

Ok, Thank you for your reply.Thank you so much!

@999-x
Copy link
Author

999-x commented Jul 3, 2024

Yes, find the example examples/withRaycing/09_Gratings/GratingFlexPES.py and look for ''beamSource' in it. There is a plot of its xz distributions that is commented out in this example. In general, you can plot beam arrays “x”, “y”, “z”, “x’”, “z’”, “energy” and some others of any beam that you create in your run_process().

Hello, sorry to bother you again. I have a question that I would like to ask you.
The linear distribution of the light source is a normal distribution, and the linear size is set as shown in the first figure. Why is the size of the light source image plotted different from the parameters I set?
微信截图_20240703152336
2D-01b-Si660-88 6074-beamSource-flat
The code for the plot light source is shown in the third image, which I copied from ’examples/withRaycing/09_Gratings/GratingFlexPES.py‘.Does the plot produced by this code represent the light source I have input?
1
I am looking forward to your reply!

@kklmn
Copy link
Owner

kklmn commented Jul 3, 2024

The horizontal size was set to 0.2/2.35 sigma, which is 0.2 fwhm, and this is what you have in the plot.
The vertical size was set in the constructor to 0.05 (sigma) but modified in the generator to 0.07/2.35, which is 0.07 fwhm, and this is what is plotted.

@kklmn kklmn closed this as completed Jul 3, 2024
@999-x
Copy link
Author

999-x commented Jul 3, 2024

The horizontal size was set to 0.2/2.35 sigma, which is 0.2 fwhm, and this is what you have in the plot. The vertical size was set in the constructor to 0.05 (sigma) but modified in the generator to 0.07/2.35, which is 0.07 fwhm, and this is what is plotted.

Thank you for your prompt reply!
So if I want to set the size of the light source, is it useless to set it in the constructor?
Can only change the size of the light source by changing the horizontal and vertical dimensions shown in the following figure?
2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants