Giter Site home page Giter Site logo

Comments (7)

kklmn avatar kklmn commented on July 16, 2024

Yes, you're right. If the optical axis is deflected, the parametric representation needs a shifted pitch angle. In the present implementation this is not available. I will implement it in about a week.
Thank you for discovering the problem!

from xrt.

kklmn avatar kklmn commented on July 16, 2024

Hi,
Please try the last update. Please look at the docs and a new test script test_param_mirror.py for a usage example and get back with your results/comments.

from xrt.

wholingfei avatar wholingfei commented on July 16, 2024

Hi,
In test script test_param_mirror.py, I changed the inclination to -2.5e-3, something weird happened. Dose that mean the inclination couldn't be negative?

from xrt.

kklmn avatar kklmn commented on July 16, 2024

Yes, you're right. Thanks for finding it!
I've fixed it. Please try the update.

from xrt.

wholingfei avatar wholingfei commented on July 16, 2024

Hi, the test script test_param_mirror.py could run correctly in my computer now.
However, I still can't successfully apply the new EllipticalMirrorParam to my own codes. Here is the main building of the optical elements .

    beamLine.TorM = roe.ToroidMirror(beamLine, 'ToroidMirrir', [0., 41000., 0.], 
                                     pitch=2.5e-3, 
                                     roll=-np.pi/2, 
                                     material=None, 
                                     limPhysX=[-20., 20.], limPhysY=[-256., 256.], 
                                     R=[41000., 19000.], r=[41000., 19000.])
    beamLine.Screen2 = rsc.Screen(beamLine, '2ndSource', [0., 60000., 0.])
    beamLine.Screen2.center[0] = beamLine.TorM.center[0] - (beamLine.Screen2.center[1] - 
                                    beamLine.TorM.center[1])*np.tan(2*beamLine.TorM.pitch)
    KB1_center1 = 76440.
    KB1_center0 = beamLine.TorM.center[0] - (KB1_center1- 
                                      beamLine.TorM.center[1])*np.tan(2*beamLine.TorM.pitch)
    beamLine.KB1 = roe.EllipticalMirrorParam(beamLine, 'VKB', [0., 76440, 0.], 
                                             pitch=1.5e-3, material=mPt, 
                                             limPhysY=[-190., 190.], 
                                             p=16440., q=1560., 
                                             isCylindrical=True)

    f1_x = beamLine.TorM.center[0] - (beamLine.Screen2.center[1] - 
                          beamLine.TorM.center[1])*np.tan(2*beamLine.TorM.pitch)
    KB2_center1 = 76870.
    KB2_center0 = beamLine.Screen2.center[0] - (KB2_center1-beamLine.Screen2.center[1]) * 
                                                  np.tan(2*beamLine.TorM.pitch)
    KB2_center2 = beamLine.KB1.center[2] + (KB2_center1-KB1_center1)
                             *np.tan(2*beamLine.KB1.pitch)
    
    #beamLine.KB2 = roe.EllipticalMirrorParam(beamLine, 'HKB', 
    #                                 [KB2_center0, 76870, KB2_center2], 
    #                                 pitch=1.5e-3, material=mPt,  
    #                                 roll=np.pi/2, extraPitch=-5.0e-3, 
    #                                 limPhysY=[-195., 195.], 
    #                                 p=16870., q=1130., isCylindrical=True)
    beamLine.KB2 = roe.EllipticalMirrorParam(beamLine, 'HKB', 
                                   [KB2_center0, 76870, KB2_center2], 
                                   pitch=1.5e-3-5.e-3, material=mPt, 
                                   roll=np.pi/2,
                                   limPhysY=[-195., 195.], 
                                   f1=[f1_x, 60000., 0.], q=1130., 
                                   isCylindrical=True)
    beamLine.KBSampleShort = rsc.Screen(beamLine, 'AtSamplePos', [0., 78000., 0])

The commented out statements are my original treatment. Toroidal mirror provide a second source at Screen2.
I think the main difference between my codes and the test script is that my codes deflect in sagittal plane not the meridian as shown in test script.

I just want to make sure whether it's my own problem in parameter setting or not.
Thanks for your quick update anyway!

from xrt.

kklmn avatar kklmn commented on July 16, 2024

Hi,
I have now implemented the most general case and have tested it with test_param_mirror.py. I have removed pitch from the ellipse calculations and put the general coordinate system transformation. Please try the last update.
Note also that when you use a horizontally deflecting mirror and the incoming beam is not horizontal, you should also define a yaw angle. Specify a sequence for the rotations to get the orientation that you expect. Please look at test_param_mirror.py for yaw.

from xrt.

wholingfei avatar wholingfei commented on July 16, 2024

Hi,
it seems that both the test script and my own script could run correctly on my computer now.
Thanks very much for your help!

from xrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.