Skip to content

McXtrace Filter.comp: Better handling of non-standard inputfiles#2552

Merged
ebknudsen merged 11 commits into
mainfrom
McXtrace-filter-inputfiles
Jul 5, 2026
Merged

McXtrace Filter.comp: Better handling of non-standard inputfiles#2552
ebknudsen merged 11 commits into
mainfrom
McXtrace-filter-inputfiles

Conversation

@willend

@willend willend commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Free-form text area

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

  • Files with 6 or more columns are “assumed” NIST files with mu in 5th column.
  • For non-standard < 6 column files the user must set mu_col to point out column index
  • mu_col can also be used for >=6 columns if required
  • Consequence-edits for various test-example instruments

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

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
  • My contribution contains something else

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

@willend

willend commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-07-04 at 17 08 37

@willend

willend commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author
(Instrument list filtered by those using component Filter )
Copying instruments to: ./mcxtrace-3.99.99_Filter_1e6_Darwin_20260704_1734_54

Compiling instruments [seconds]...
MAXII_711           :   3.01
MAXII_811           :   3.43
MAXIV_Bloch         :   3.52
MAXIV_DanMAX_pxrd1d :   5.99
MAXIV_DanMAX_pxrd2d :   4.15
MAXIV_FemtoMAX      :   3.25
NBI_Lab_TOMO        :   2.05
SOLEIL_ANATOMIX     :   2.83
SOLEIL_PSICHE       :   3.08
Test_Filter         :   1.88
Test_Filter_geom    :   2.04
Test_Absorption     :   2.47

Running tests / getting status...
MAXII_711            :   Display OK (1s)
MAXII_711            :   3.75    [val: 5.09671e-06 / 5.1609e-06 = 99 %]
 - Test 1 plots generated OK
MAXII_811            :   Display OK (1s)
MAXII_811            :   3.55    [val: 225063000.0 / 200000000.0 = 113 %]
 - Test 1 plots generated OK
MAXII_811_2          :   3.15    [val: 217080000000.0 / 225761000000.0 = 96 %]
 - Test 2 plots generated OK
MAXIV_Bloch          :   Display OK (1s)
MAXIV_Bloch          :   1.92    [val: 5.66921e-20 / 5.64942e-20 = 100 %]
 - Test 1 plots generated OK
MAXIV_Bloch_2        :   2.18    [val: 1.62797e-21 / 1.80435e-21 = 90 %]
 - Test 2 plots generated OK
MAXIV_DanMAX_pxrd1d  :   Display OK (7s)
MAXIV_DanMAX_pxrd1d  :  19.40    [val: 0.000785388 / 0.00081782 = 96 %]
 - Test 1 plots generated OK
MAXIV_DanMAX_pxrd2d  :   Display OK (5s)
MAXIV_DanMAX_pxrd2d  :   8.13    [val: 8.15001e-05 / 8.10837e-05 = 101 %]
 - Test 1 plots generated OK
MAXIV_FemtoMAX       :   Display OK (1s)
MAXIV_FemtoMAX       :   1.10    [val: 2.87291e-13 / 2.74995e-13 = 104 %]
 - Test 1 plots generated OK
NBI_Lab_TOMO         :   Display OK (2s)
NBI_Lab_TOMO         :  46.24    [val: 38838900000000.0 / 39000000000000.0 = 100 %]
 - Test 1 plots generated OK
NBI_Lab_TOMO_2       :  48.40    [val: 985999000000.0 / 977305000000.0 = 101 %]
 - Test 2 plots generated OK
SOLEIL_ANATOMIX      :   Display OK (2s)
SOLEIL_ANATOMIX      :  26.22    [val: 1.01513e+18 / 1e+18 = 102 %]
 - Test 1 plots generated OK
SOLEIL_PSICHE        :   Display OK (2s)
SOLEIL_PSICHE        :   5.17    [val: 72078100000000.0 / 76100000000000.0 = 95 %]
 - Test 1 plots generated OK
Test_Filter          :   Display OK (1s)
Test_Filter          :   1.21    [val: 1.31535e-07 / 1.31502e-07 = 100 %]
 - Test 1 plots generated OK
Test_Filter_2        :   1.15    [val: 4.00974e-29 / 4.04921e-29 = 99 %]
 - Test 2 plots generated OK
Test_Filter_3        :   1.40    [val: 1.14786e-08 / 1.14111e-08 = 101 %]
 - Test 3 plots generated OK
Test_Filter_4        :   1.20    [val: 1.05202e-07 / 1.04427e-07 = 101 %]
 - Test 4 plots generated OK
Test_Filter_5        :   1.27    [val: 1.65423e-06 / 1.645e-06 = 101 %]
 - Test 5 plots generated OK
Test_Filter_6        :   1.13    [val: 0.000412585 / 0.000412661 = 100 %]
 - Test 6 plots generated OK
Test_Filter_7        :   1.06    [val: 4.97281e-05 / 4.96145e-05 = 100 %]
 - Test 7 plots generated OK
Test_Filter_geom     :   Display OK (1s)
Test_Filter_geom     :   1.25    [val: 0.760028 / 0.760008 = 100 %]
 - Test 1 plots generated OK
Test_Filter_geom_2   :   1.27    [val: 0.579385 / 0.57936 = 100 %]
 - Test 2 plots generated OK
Test_Filter_geom_3   :   1.26    [val: 0.415404 / 0.415209 = 100 %]
 - Test 3 plots generated OK
Test_Filter_geom_4   :   1.20    [val: 0.759385 / 0.759422 = 100 %]
 - Test 4 plots generated OK
Test_Filter_geom_5   :   1.11    [val: 0.579385 / 0.571845 = 101 %]
 - Test 5 plots generated OK
Test_Filter_geom_6   :   1.14    [val: 0.415404 / 0.40875 = 102 %]
 - Test 6 plots generated OK
Test_Absorption      :   Display OK (1s)
Test_Absorption      :   1.04    [val: 8.23633e-12 / 8.25376e-12 = 100 %]
 - Test 1 plots generated OK
Test_Absorption_2    :   0.97    [val: 8.23633e-12 / 8.24127e-12 = 100 %]
 - Test 2 plots generated OK
Test_Absorption_3    :   2.50    [val: 8.23634e-12 / 8.28866e-12 = 99 %]
 - Test 3 plots generated OK
Test_Absorption_4    :   4.00    [val: 9.33634e-10 / 9.36962e-10 = 100 %]
 - Test 4 plots generated OK
======================================
Overall test result:
SUCCESS

@willend

willend commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@ebknudsen ready for review I believe. https://tmp.mcxtrace.org/Filter/RUN_output.html contains my local test output

@willend willend requested a review from ebknudsen July 5, 2026 05:46
@ebknudsen

Copy link
Copy Markdown
Contributor

So the logic here is:
if the number of columns in the datafile pointed to is >= 6 assume NIST format, be it legacy or not - and use column 5 for attenuation. mu_col overrrides this behaviour
if the number of columns is <6 require that mu_col is set.

code LGTM.

@ebknudsen ebknudsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ebknudsen ebknudsen merged commit fdf7109 into main Jul 5, 2026
20 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.

2 participants