McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 54 forks source link

Using PSD_monitor with e.g. ny=100 nx=1 breaks plotting #1107

Open rmdalgliesh opened 3 years ago

rmdalgliesh commented 3 years ago

The new SEMSANS_Delft.instr file makes use of a PSD_monitor call with ny=1001 nx=1. This was obviously done for making subsequent data extraction from the text data file easier. However, it breaks the default plotting which seems to be unable to cope with a psd that minimic a linear detector. The error message generated is long and confusing. It's not a huge problem but is a bug that should probably be trapped in the mcplot code. I have no idea where to start looking.

willend commented 3 years ago

Hi @rmdalgliesh and thanks for writing up the issue!

How this is meant to work is in fact that internally, the detector_out macros should make the 2D -> 1D transition, but evidently something does not work right at your end... :-)

Which McStas version are you running with? Here, I ran 2.7 with SEMSANS_Delft.instr and Foil_flipper_magnet2.comp from the repo:

pkwi@pkwi-mbp2018:~/tmp/Delft$ mcrun SEMSANS_Delft.instr AnaSign=1 --autoplot
INFO: No output directory specified (--dir)
INFO: Using directory: "SEMSANS_Delft_20210211_115624"
INFO: Using existing c-file: ./SEMSANS_Delft.c
INFO: Using existing binary: ./SEMSANS_Delft.out
INFO: ===
[SEMSANS_Delft] Initialize
INFO: Set_pol(set_pol): Setting polarization to (1.000000, 0.000000, 0.000000)
foil normal (f1) 0 0.995396 -0.0958456
foil normal (f2) 0 0.995396 -0.0958456

Save [SEMSANS_Delft]
Detector: det_I=7.82316e-08 det_ERR=1.57268e-10 det_N=952072 "det.dat"

Finally [SEMSANS_Delft: SEMSANS_Delft_20210211_115624]. Time: 5 [s] 
Warning: 23752 events were removed in Component[8] det=PSD_monitor()
         (negative time, miss next components, rounding errors, Nan, Inf).
INFO: Placing instr file copy SEMSANS_Delft.instr in dataset SEMSANS_Delft_20210211_115624
INFO: Running plotter mcplot-pyqtgraph on dataset SEMSANS_Delft_20210211_115624

I think the output at my end is OK?

Screen Shot 2021-02-11 at 11 57 05

Here is the monitor-file, which has become 1D (and I assume will load ok in your plotter?)

det.dat.txt

rmdalgliesh commented 3 years ago

Good point, my apologies, this is a problem with 2.5. 2.7 is fine so the upgrade on our CentOS system should sort it out.