McCode icon indicating copy to clipboard operation
McCode copied to clipboard

Issue in Monitor_nD "buffer rewind" mechanism for ascii output

Open willend opened this issue 1 year ago • 0 comments

Issue: The attached instrument (generated via McStasScript with local comps etc.) has the issue that the event-monitor seems to generate jumps in the number of columns once the output is big / long enough and mpi is used.

This mcrun commandline reproduces the behaviour here on my machine with McStas 3.3: mcrun --mpi=2 SANS.instr -n5e6 -s 1693379751749909 sample_distance=150, d_wavelength=1.5, enable_sample=1, n_pulses=1, integration_time=500

WORKAROUND: The issue does not occur if one either runs without mpi (or mpi=1) or by lifting the Monitor_nD buffersize by adding --bufsiz=10000000 to the mcrun command...


(When output is broken, problems are detected in the event file detector_signal_event.dat e.g. via mcplot:

mcplot repro_handheld4/detector_signal_event.dat 
loading system configuration

q              - quit
p              - save png
s              - save svg
l              - log toggle
t              - textinfo toggle
c              - cycle colormap
F1/h           - help
F5             - replot
click          - display subplot
right-click/b  - back
Meta + click   - sweep monitors
x              - expand subplots
mcplot error: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (7927910,) + inhomogeneous part.
Traceback (most recent call last):
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/bin/../tools/Python/mcplot/pyqtgraph/mcplot.py", line 68, in <module>
    main(args)
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/bin/../tools/Python/mcplot/pyqtgraph/mcplot.py", line 58, in main
    raise e
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/bin/../tools/Python/mcplot/pyqtgraph/mcplot.py", line 52, in main
    plotter.runplot()
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/tools/Python/mcplot/pyqtgraph/../../mccodelib/pqtgfrontend.py", line 117, in runplot
    self.plot_node(node)
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/tools/Python/mcplot/pyqtgraph/../../mccodelib/pqtgfrontend.py", line 192, in plot_node
    viewbox, plt = self.add_plot(node, i, n)
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/tools/Python/mcplot/pyqtgraph/../../mccodelib/pqtgfrontend.py", line 425, in add_plot
    view_box, plt_itm = self.plot_func(node, i, plt, options)
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/tools/Python/mcplot/pyqtgraph/plotfuncs.py", line 34, in plot
    view_box, lyt = plot_Data2D(data, plt, log=opts['log'], legend=opts['legend'], icolormap=opts['icolormap'],
  File "/Applications/McStas-3.3.app/Contents/Resources/mcstas/3.3/tools/Python/mcplot/pyqtgraph/plotfuncs.py", line 190, in plot_Data2D
    dataset = np.array(data.zvals)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (7927910,) + inhomogeneous part.

)

bug.zip

willend avatar Aug 30 '23 08:08 willend