Skip to content

Mono bent complex string parsing#2395

Merged
willend merged 10 commits into
mainfrom
mono_bent_complex_string_parsing
Apr 10, 2026
Merged

Mono bent complex string parsing#2395
willend merged 10 commits into
mainfrom
mono_bent_complex_string_parsing

Conversation

@Lomholy
Copy link
Copy Markdown
Collaborator

@Lomholy Lomholy commented Apr 10, 2026

Free-form text area

Please describe what your PR is adding in terms of features or bugfixes:

Monochromator_bent_complex is updated regarding the changes to the parameter "plane_of_reflections". This is reflected in updates to the header as well. Other minor beauty changes are performed in the header, such as a mu being rendered with html char now, and linking to the article on monochromator_bent.

The plane_of_reflection parameter could previously only be a string of planes, delimited by a semicolon between each plane. With this update, the option of having a single plane of reflection for all crystals is added. E.g. a three crystal array could previously only be instantiated with <plane_of_reflection = "Si111;Si111;Si111"> but now it can also be instantiated by <plane_of_reflection = "Si111">.


Development OS / boundary conditions

Please describe what OS you developed and tested your additions on, and if any special dependencies are required:
Developed on MacOS Tahoe 26.3.1, and no special dependencies are required.


PR Checklist for contributing to McStas/McXtrace

For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:

  • My contribution includes patches to an existing component file

    • I have used the mcdoc utility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)
    • I have ensured that basic use of the component is OK (e.g. an instrument using it compiles?)
    • I have used the mctest utility to test one or more instruments making use of the component (please attach mcviewtest report as screenshot in comments)
    • I have used the mccode-clangformat tool to apply the standard McCode component indentation scheme
    • I have used the mcrun --c-lint "linter" and followed advice to remove most / all warnings that are raised
  • My contribution includes patches to an existing instrument file

    • I have used the mcdoc utility and rendered a reasonable documentation page for the instrument (please attach as screenshot in comments!)
    • I have used the mctest utility to test the instrument (please attach mcviewtest report as screenshot in comments)
    • I have used the mcrun --c-lint "linter" and followed advice to remove most / all warnings that are raised

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Apr 10, 2026

There seems to be an error with the micro meter being parsed into the Description:
image

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Apr 10, 2026

Test instrument mcdoc:
image

@willend
Copy link
Copy Markdown
Contributor

willend commented Apr 10, 2026

I have no issue with micro meter here:
Screenshot 2026-04-10 at 10 53 05

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Apr 10, 2026

Ah yes it seems that I was using a slightly old version of McStas, and this what what caused it (Probably recent changes to the parsing tools). I now have no problem with micrometer:
image

@willend
Copy link
Copy Markdown
Contributor

willend commented Apr 10, 2026

Don’t do that. ;-) Make a dedicated mcstas-dev conda env and make it routine to simply roll a new McStas for all the testing. Use the in-repo dev tools. :-)

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Apr 10, 2026

I suppose you are right, and that is the proper way to do it. I will do it in the future, but currently I am in a bit of a phase where I am not quite comfortable with the whole conda dev and rolling out new McStas' whenever something should be tested 😅

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Apr 10, 2026

I made a dedicated mcstas-dev conda env and rolled a new mcstas for testing as you suggested.

Then I ran mctest with:
mctest --comp=Monochromator_bent_complex --testdir=tmp

But the Test instrument Test_Monochromator_bent_complex.instr should have two tests to my mind (There are two %Examples), however only 1 is run:

image

@willend
Copy link
Copy Markdown
Contributor

willend commented Apr 10, 2026

I think you might be picking up an older/earlier version?

I at least get both here:

mctest --instr=Test_Monochromator_bent_complex.instr
loading system configuration
Output of test will be placed in: /Users/peterwillendrup/tmp/mcstas-test_20260410_1130_23/
ncount is: 1e6
Testing: 3.99.99

Finding instruments in: /Users/peterwillendrup/micromamba/envs/mcstas-dev/share/mcstas/resources/examples
Copying instruments to: /Users/peterwillendrup/tmp/mcstas-test_20260410_1130_23/mcstas-3.99.99_Test_Monochromator_bent_complex.instr_Darwin

Compiling instruments [seconds]...
Test_Monochromator_bent_complex :   3.05

Running tests / getting status...
Test_Monochromator_bent_complex  :  19.63    [val: 0.000215074 / 0.000215194 = 100 %]
Test_Monochromator_bent_complex_2:  19.61    [val: 0.000215074 / 0.000215194 = 100 %]
======================================
Overall test result:
SUCCESS

@willend
Copy link
Copy Markdown
Contributor

willend commented Apr 10, 2026

And the same is the case if you look within the “passed checks”, e.g. mcstas-conda-basictest:
https://github.com/mccode-dev/McCode/actions/runs/24234925832/job/70755008814?pr=2395, expanding the section “Check for changed instruments” and scroll toward the end:

Screenshot 2026-04-10 at 13 21 16

@willend
Copy link
Copy Markdown
Contributor

willend commented Apr 10, 2026

@Lomholy I think the state of the PR is good. Let me know if anything is still pending or you feel ready for me to push merge.

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Apr 10, 2026

I was looking at an older version. I don't have anything pending, so you can go ahead and merge. Thank you for the help with this!

@willend willend merged commit c71164a into main Apr 10, 2026
32 checks passed
@Lomholy Lomholy deleted the mono_bent_complex_string_parsing branch April 13, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants