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

Cylindrical MC - Uniform source off-centre and at an angle. #28

Open
l-hemsley opened this issue Oct 11, 2024 · 4 comments
Open

Cylindrical MC - Uniform source off-centre and at an angle. #28

l-hemsley opened this issue Oct 11, 2024 · 4 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@l-hemsley
Copy link

When I make a source that is off centre and at an angle to the cylindrical sample, as in;

source = mc.mcsource.UniformBeam([0.5e-3,5.0e-3],position =(-20e-3, 5e-3, 0),direction=(np.cos(2*np.pi*ang/360), np.sin(2*np.pi*ang/360),0))

Looks like this in the x-y plane

image

But the 2D cross section of the beam seems to be tilted - the beam should be symmetrical in the z axis I believe.

image

It looks like the beam is rotated somehow.

Thank you :)

@xopto
Copy link
Owner

xopto commented Oct 15, 2024

The rotation of non-circular beams in current implementation of the UniformBeam wont be aligned with the coordinate system if the propagation direction is not along the x, y, or z axis.

A solution to this issue is to slightly modify the UniformBeam constructor to take orientation of the beam (the first axis of the ellipse) and rewrite the sampling part of the OpenCL code. Unfortunately, I don't have an example yet but will come back to you later with a snippet.

@xopto xopto added bug Something isn't working enhancement New feature or request labels Oct 15, 2024
@l-hemsley
Copy link
Author

Thanks for your quick response! I am trying to implement a slit-type uniform input off-axis and off-angle. I was thinking if nothing else works then I can just iterate over the line source though will be time consuming.

@xopto
Copy link
Owner

xopto commented Oct 16, 2024

In the attached zip file there are two new sources (UniformEllipticBeam in uniformellipticbeam.py and UniformRectangularBeam in uniformrectangularbeam.py) and a slightly modified __init__.py file. Extract/copy the three files into the xopto/mccyl/mcsource directory.

The two new sources take an additional axes parameter that can be used to fix the orientation of the beam in the transverse plane. Note that this is experimental and not fully tested.

mcsources.zip

@l-hemsley
Copy link
Author

Thank you I will try it! I also realised I could simply shift the coordinate system... either rotate until the beam until it is centred on y=0 or is paralell to the x axis. This Also seems to work.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants