Giter VIP home page Giter VIP logo

Comments (11)

kklmn avatar kklmn commented on August 17, 2024

Hi,

As I understand you want a lateral grading, not depth grading, so don't mix them. In your implementation, even for one ray the thickness variation is averaged out as it propagates through the layers. Then also many rays are averaged over the footprint.
I would go in a more deterministic way. For example, make the 4 quadrants different in t and b thickness (but not vary with depth) and see the results. A linear gradient is may be a next trial.

If you don't see any change, please send me your script.

from xrt.

hgretar avatar hgretar commented on August 17, 2024

I've tried to follow where get_t_thickness is used in the Multilayer class. I've realized that it only appears in get_amplitude but there I'm not able to use is since "if ucl is None" gives False. What is ucl and how do I change it to None?

from xrt.

kklmn avatar kklmn commented on August 17, 2024

you don't need to modify get_amplitude. You only need to specify get_t_thickness and get_b_thickness accordingly to your lateral grading. If you need some user parameters that you pass to your formulas, you also need to modify __init__ .

from xrt.

hgretar avatar hgretar commented on August 17, 2024

Following your advice I've split the Multilayer into 4 segments each with different t and b thickness. It's now clear that this works, I get steps in reflectivity as a function of beam height. Thanks for your suggestion. This however only works if I do not use targetOpenCL=r"auto" for my OE.

from xrt.

yxrmz avatar yxrmz commented on August 17, 2024

Hi, could you clarify what happens if you do calculate the ML amplitudes with OpenCL?

from xrt.

hgretar avatar hgretar commented on August 17, 2024

Then get_t_thickness or get_b_thickness are never called in the get_amplitude function of the Multilayer class. This mean there is no lateral grading.

from xrt.

yxrmz avatar yxrmz commented on August 17, 2024

Oh, I see what you mean now, I thought it stops with errors. Now there's no way to expose custom user functions to OpenCL, but if you are interested it's not hard to implement.

from xrt.

hgretar avatar hgretar commented on August 17, 2024

It would be great if you could implement that.

from xrt.

kklmn avatar kklmn commented on August 17, 2024

I hope you understand that OpenCL is only for acceleration of reflectivity calculations. And by the way, this acceleration is not as dramatic as for other heavy calculations: undulator source and wave propagation. You can do lateral grading already now, no reason for waiting for custom functions in OpenCL Multilayer. Just remove targetOpenCL from the constructor options of your optical element and implement your own get_t_thickness and get_b_thickness in a Multilayer subclass.

To write these methods in OpenCL (basically C language) is possible, as Roman has said, but one needs these functions in hands. "Implement that" -- what is "that"? Give it. Or you want an automatic translation of python functions to OpenCL? We don't have it.

from xrt.

yxrmz avatar yxrmz commented on August 17, 2024

Wait for it, the plan is to pass the get_t and get_b functions as multiline text varialbe, similar to OpenGL shaders (if you know what this is). I'll explain the rules and give an example.

from xrt.

hgretar avatar hgretar commented on August 17, 2024

Ok, but there is no rush. As Konstantin pointed out this already works without OpenCL and the calculations are not that heavy. I simply did not know the scope of this problem.

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.