-
Notifications
You must be signed in to change notification settings - Fork 6
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
RML 2.0 #188
Comments
Here is a starting point on how we could do our beamline format. Instead of .rml we would then have a .toml suffix. # we need the elements to be ordered, as we use their element-id all over the place.
# Thus we use an array of elements using `[[element]]`
[[source]]
name = "a-pointy-source"
numberRays = 200
type = "PointSource"
[source.distribution]
type = "gaussian"
energy = 100 # in eV? or do we want to be explicit about units?
energySpread = 30
[[element]]
name = "miroir"
# We store the out-transform to express position & orientation.
# I prefer having a singular transform instead, as this answers the question in which order we apply position and orientation.
# We can easily calculate the in-transform by inverting this matrix.
transform = [
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
]
[element.behaviour]
type = "Mirror"
material = "Au"
[element.surface]
type = "Plane"
[element.cutout]
type = "Rectangle"
width = 20.0
length = 20.0
[[element]]
name = "the-imaginary-plane"
transform = [
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 100.0],
[0.0, 0.0, 0.0, 1.0],
]
# this is a shorter notation for tables.
behaviour = { type = "ImagePlane" }
surface = { type = "Plane" }
cutout = { type = "Unlimited" } My thoughts about this: If we wanted to have objects that are both light-sources and optical-elements, or if we wanted to have concrete indices to reference both light-sources or optical-elements (eg. the Ray::m_lastElement field might want that), we would need to use |
We made some more progress on our new TOML-based format, In the following I want to document our thought process and our decisions.
One big problem with the current RML model is that it's implicit which of the three calculation-method is used, Thus, our first thought was making this explicit by writing the required parameters as tables inside of The problem with defining stuff like this is that it is possible that multiple params depend on the same design parameters.
This would effectively force us to write the position twice (and thus create redundancy and sources of errors & confusion). Thus, we decided to use "calculation-strings" instead of nested tables:
This is a simple example file for the new state:
I'll now work on separating the current DesignObject from the XML parser so that we can use it for toml as well. |
Before we can reasonably implement a parser for a new format, it makes - in my opinion - sense to have a "DesignElement" definition. A "DesignElement" is like an Element, but with all the design parameters still in there. Because, if both the RML and the TOML parser simply produce "Elements" as outputs, both of these parsers need to resolve all of the the design parameters separately. This would cause a huge amount of code duplication. Hence, I claim that it makes more sense that both parsers produce a DesignElement as intermediate output. The relevant issue for this DesignElement idea should be #227. I'm hence closing this issue for now, as we first need to solve the DesignElement problem, which itself might take some time. |
We can continue this discussion since the design element has been implemented (#227), which adds an abstraction in the code base to the parameters in the rml files. |
Updated Work Outline:
Additionally, we might want to reconsider using JSON. While TOML is easier to read, JSON is more widely used and still offers improved readability compared to the current RML format. |
To properly support RAYX's new features, we are looking into creating a new format to load and save beamlines with.
The text was updated successfully, but these errors were encountered: