Conversation
…ation of the tables
The component reads its 10 pixel-hit-efficiency tables by fixed file names,
which McStas looks up e.g. in the working directory and next to the
instrument file. Since McStas only ships the tables next to the test
instrument, other instruments must copy them next to themselves. The new
parameter table_dir gives the directory of the tables (e.g. "localdata"), so
instruments can keep them in a subdirectory. The default ("") keeps the
previous behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
Test output for the table_dir parameter of Union_abs_logger_nD_scintillatorMcStas 3.8.8 (conda-forge), Case C sets Monitor values (mccode.sim)Case A: Case B: Case C: List-mode output (abs_logger_nD_scintillator_list), compared to case ACase D (table_dir = "nosuchdir") |
Contributor
Author
|
The failed job looks to be just the usual suspect. |
Contributor
|
Just for the record @MilanKlausz who contributed the component wrote me and asked for advise on where to place these datafiles, and since they are highly specific to one instrument I recommended the instrument folder, and then a simple one for the test case. |
Contributor
Author
|
Right @mads-bertelsen that makes sense. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is needed so we can have SKADI using this component instead of a local copy (there might be other work needed as well, but this is a blocker).
The rest from claude:
Union_abs_logger_nD_scintillator: add
table_dirparameter for the location of the tablesUnion_abs_logger_nD_scintillator(new in McStas 3.8.8) reads its 10pixel-hit-efficiency tables by fixed file names, e.g.
"true_pixel_hit_efficiency.txt"or"true_pixel_hit_efficiency_high_resolution.txt". McStas looks for these, asfor other data files:
The tables are only shipped next to the test instrument
(
examples/Tests_union/Test_abs_logger_nD_scintillator/). So every otherinstrument using the component must copy the 10 tables next to itself. This
is inconvenient for instrument repositories that keep their data files in a
subdirectory. For example, in the standard layout of the ESS instrument model
repositories they go into
localdata/, and the SKADI model (which uses thiscomponent) needs exactly this.
This PR adds the parameter:
It gives the directory of the tables, e.g.
table_dir="localdata", so thatthe tables are looked up as
localdata/true_pixel_hit_efficiency.txtetc.,with the same search rules as before. The default
""keeps the previousbehaviour, so existing instruments are not affected.
The change is small: a short helper function, and the file names in the 10
Table_Readcalls are wrapped inTABLE_FILE (...). The code was checkedwith
devel/bin/mccode-clangformat(no changes needed).Testing
Tested with McStas 3.8.8 (conda-forge) and the test instrument
Test_abs_logger_nD_scintillator, with 1e6 rays and a fixed seed. Thecomponent was placed next to the instrument, so it takes precedence:
main)table_dirnot settable_dir="tables"for all 4 loggerstables/table_dir="nosuchdir""Identical" means that all monitor values in
mccode.simare identical, andthat the list-mode output is identical apart from the ray number column. That
column differs even between two runs of the unmodified component with the same
seed. See the attached test output for details.
Possible follow-up
The tables could also be installed in the McStas data directory, so that
instruments find them without copies at all. They are specific to the SoNDe
detector type modelled by the component, so they are needed by every
instrument using it. This PR does not do that.
🤖 Generated with Claude Code