Skip to content

mcrun -L list was broken, fixed here by (re-)calculating number of elements …#2377

Merged
willend merged 2 commits into
mainfrom
fix-broken-listmode-mcrun
Mar 28, 2026
Merged

mcrun -L list was broken, fixed here by (re-)calculating number of elements …#2377
willend merged 2 commits into
mainfrom
fix-broken-listmode-mcrun

Conversation

@willend
Copy link
Copy Markdown
Contributor

@willend willend commented Mar 28, 2026

Free-form text area

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

mcrun -L list has been broken for a while since number of scan points in this case became ’None'
Simple fix: Calculate again post other logic considerations between -N and -L modes


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 contains something else

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

@willend
Copy link
Copy Markdown
Contributor Author

willend commented Mar 28, 2026

Quite nice, allows to scan e.g. all .laz files in a diffractometer and plot the output easily:

mcrun PSI_DMC.instr --mpi=auto -n1e7 -L filename=Ag.laz,Al.laz,Al2O3_sapphire.laz,Au.laz,B4C.laz,Ba.laz,Be.laz,BeO.laz,Bi.laz,C_graphite.laz,Cd.laz,Cr.laz,Cs.laz,Cu.laz,Cu2MnAl.laz,Fe.laz,Fe_Gamma.laz,Ga.laz,Gd.laz,Ge.laz,H2O_ice_1h.laz,He4_hcp.laz,Hg.laz,I2.laz,K.laz,Li.laz,LiF.laz,Mo.laz,Na2Ca3Al2F14.laz,Nb.laz,Ni.laz,Pb.laz,Pd.laz,Pt.laz,Rb.laz,Se_alpha.laz,Se_beta.laz,Si.laz,SiO2_quartza.laz,SiO2_quartzb.laz,Sn_alpha.laz,Sn_beta.laz,Ti.laz,Tl.laz,UO2.laz,V.laz,Y2O3.laz,Y3Fe5O12_YIG.laz,Zn.laz,Zr.laz --autoplot -d Materials_scan --autoplot

Screenshot 2026-03-28 at 11 22 54 data here:

https://tmp.mcstas.org/Materials_scan.zip

@willend
Copy link
Copy Markdown
Contributor Author

willend commented Mar 28, 2026

@farhi @jorobledo combined with append mode here: https://tmp.mcstas.org/Materials_scan_HDF.h5

@willend willend merged commit be46b90 into main Mar 28, 2026
36 checks passed
@jorobledo
Copy link
Copy Markdown
Contributor

That's great Peter,

Explored it with mcrun -c --format=NeXuS Test_SANS.instr -L SAMPLE=0,1,2,3,4,5,6 and it's looking cool :) We get one nexus file with one entry per sample simulation.

image

Small bug comes up (might be related to nexusformat version mismatch?), but when opening the entries to plot the data, I'm getting an error.

File ~/.local/share/mamba/envs/mcstas/lib/python3.12/site-packages/nexusformat/nexus/tree.py:7710, in NXdata.nxaxes(self)
   7709     axis_names = _readaxes(self.nxsignal.attrs['axes'])
-> 7710 axes = [None] * len(axis_names)
   7711 for i, axis_name in enumerate(axis_names):

UnboundLocalError: cannot access local variable 'axis_names' where it is not associated with a value

I just ran mcplot on the folder and nexpy popped up. then I just double clicked on an entry PSDMonitor and it raises this error.

Running with NeXpy v2.0.1 | NeXus API: nexusformat v2.0.2

@willend
Copy link
Copy Markdown
Contributor Author

willend commented Mar 31, 2026

@jorobledo I think it is maybe a ‘known bug’? I never got a plot until I expanded all the way to the underlying ‘data’.

@willend willend deleted the fix-broken-listmode-mcrun branch April 20, 2026 13:27
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