-
Notifications
You must be signed in to change notification settings - Fork 56
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
math in the <dim> element #1084
Comments
It was suggested at the 2022 Code Camp that such math be expressed in a single symbol (in the symbol table) and that symbol be used in the <symbols>
<doc>symbolic array lengths to be coordinated between various fields</doc>
<symbol name="nDarkFrames "><doc>number of dark frames </doc></symbol>
<symbol name="nBrightFrames "><doc>number of bright frames </doc></symbol>
<symbol name="nSampleFrame"><doc>number of sample frame </doc></symbol>
<symbol name="nTotalFrames">
<doc>total number of frames</doc>
<math>nDarkFrames + nBrightFrames + nSampleFrame</math>
</symbol>
</symbols> then later <dim index="1" value="nTotalFrames" /> |
We would add a |
For example, that the math expression can be interpreted as javascript and the variables must be defined in the symbol table. |
@mkoennecke asked:
@yayahjb suggests: |
A C library for processing math strings in EPICS is one used in the calc record scrolling down a bit it discusses supported operators and some examples |
The EPICS library likely needs additional work to use in this context. |
next code camp I could look at how much work this would be |
Proposal is to explore the use of javascript syntax for mathematical expressions in NXDL symbol tables (and elsewhere in NeXus) and encourage the production of a technical demonstration. |
Other candidates for a parser/interpreter: |
Sounds worth exploring |
Formal grammars are available for Javascript/Typescript expressions: |
Also mentioned this topic on the Code Camp in relationship to #1271 where it is suggested that an NX_CHAR metadata filed with a purpose of describing relationships between other data objects shall follow a specific syntax (provided by an EBNF grammar). Please note that we do not introduce any formal language to the NXDL in #1271 , but only encourage the use of text entries to become easier to read by machine (which may be less and less important with the evolution of AI). What I mean:
Hence, some rules are formal part of the definitions expressed in NXDL and are expected to be interpreted, verified by a generic(!) NXDL tool, while others are only expressed in docstrings and expected to be understood only(!) by specific software coded after understanding the docsrting.
One more interesting point: Note that here we do not use, but define a syntax, and so we rule the space what can be expressed by it. |
Some NXDL files use mathematics involving one or more symbols to describe a
<dim />
element.definitions/applications/NXtomophase.nxdl.xml
Line 162 in ed064a1
definitions/contributed_definitions/NXsnshisto.nxdl.xml
Line 196 in ed064a1
definitions/contributed_definitions/NXsnshisto.nxdl.xml
Line 314 in ed064a1
The text was updated successfully, but these errors were encountered: