Skip to content

Example instrument with adjustable ESS pulse-length.#2430

Merged
willend merged 3 commits intomccode-dev:mainfrom
willend:main
Apr 30, 2026
Merged

Example instrument with adjustable ESS pulse-length.#2430
willend merged 3 commits intomccode-dev:mainfrom
willend:main

Conversation

@willend
Copy link
Copy Markdown
Contributor

@willend willend commented Apr 30, 2026

Free-form text area

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

Add example instrument that allows adjusting ESS pulse-length.

Ingredients:

  • Input parameter named pulse_duration
  • Checks for define ADJUSTABLE_ESS_PULSE
  • DEPENDENCY “ -DADJUSTABLE_ESS_PULSE “ in the instrument file.

This PR constitutes a first implementation, improvements may come later.


Development OS / boundary conditions

Please describe what OS you developed and tested your additions on, and if any special dependencies are required:


PR Checklist for contributing to McStas/McXtrace

  • 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 a new 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 ensured that basic use of the instrument is OK (e.g. it compiles?)
    • ... and provided reasonable default parameters in that instrument that produce reasonable output
    • ... and maybe even added a %Example: line to describe expected behaviour
    • I have used the mcrun --c-lint "linter" and followed advice to remove most / all warnings that are raised
    • My new instrument is added within the examples hierarchy in a folder in the style of examples/ESS/New_stuff/New_stuff.instr
    • My new instrument has a new, unique filename, not clashing with existing example instruments
    • My new instrument requires a data/input file. If the datafile is specific for my instrument I have left it in the same example folder, but if general use I have placed it in the global data folder.
  • My work touches / adds to the runtime lib code (.c,.h etc in multiple locations

    • I am have added reasoning and documentation for the change below
    • I am attaching test output in the comments
  • My contribution contains something else

    • Explanation is added in free form text above or below the checklist

@willend
Copy link
Copy Markdown
Contributor Author

willend commented Apr 30, 2026

This error on windows / without conda is understood:

False positive. The ESS_butterfly.comp was touched, meaning that all instruments including that component were tested/compile attempted. (And currently MCPL is for some reason not functional in this limited importance workflow.)

@willend willend changed the title PROTOTYPING: Example instrument with adjustable ESS pulse-length. Example instrument with adjustable ESS pulse-length. Apr 30, 2026
@willend
Copy link
Copy Markdown
Contributor Author

willend commented Apr 30, 2026

(mcstas-dev) CIN-969631:tmp peterwillendrup$ mctest --instr=butterfly                    
loading system configuration
Output of test will be placed in: .
ncount is: 1e6
Testing: 3.99.99

Finding instruments in: /Users/peterwillendrup/micromamba/envs/mcstas-dev/share/mcstas/resources/examples
Copying instruments to: ./mcstas-3.99.99_butterfly_1e6_Darwin_20260430_1846_04

Compiling instruments [seconds]...
ESS_butterfly_Ajustable_Pulse     :   3.39
ESS_butterfly_Guide_curved_test   :   3.51
ESS_butterfly_MCPL_test           :   3.59
ESS_butterfly_test                :   3.05
ESS_butterfly_tfocus_NOFOCUS_test :   3.10
ESS_butterfly_tfocus_test         :   3.11

Running tests / getting status...
ESS_butterfly_Ajustable_Pulse      :   1.97    [val: 272665000000.0 / 270000000000.0 = 101 %]
ESS_butterfly_Guide_curved_test    :   3.16    [val: 437995000000.0 / 440000000000.0 = 100 %]
ESS_butterfly_MCPL_test            :   NO TEST
ESS_butterfly_test                 :   1.94    [val: 272665000000.0 / 270000000000.0 = 101 %]
ESS_butterfly_tfocus_NOFOCUS_test  :   2.05    [val: 155625000.0 / 150000000.0 = 104 %]
ESS_butterfly_tfocus_test          :   1.30    [val: 148882000.0 / 150000000.0 = 99 %]
======================================
Overall test result:
SUCCESS
(mcstas-dev) CIN-

@willend willend merged commit 2ece6e5 into mccode-dev:main Apr 30, 2026
15 of 16 checks passed
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.

1 participant