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

mccodelib ray parsing issue when using JUMP #604

Closed willend closed 6 years ago

willend commented 6 years ago

mcdisplay and mcdisplay-webgl fails when running the attached instrument using JUMP with e.g.

mcdisplay NMX_version_20180410_3.instr JMP=2 

(Note that JMP has to be 2 or more) Parsing of the instr geometry looks OK:

instrument definition parsed
reading particle data...
Component                         Origin AT (0,0,0)    0 m from origin
Component                         Source AT (0,0,0)    0 m from origin
Component                       PortOrig AT (0.027928,0,0.032373)    0.0427549 m from origin
Component                          XmonC AT (0.0268808,0,0.132368)    0.142755 m from origin
Component                           tofC AT (0.0268808,0,0.132368)    0.142755 m from origin
Component                           LamC AT (0.0268808,0,0.132368)    0.142755 m from origin
Component                    divAtSource AT (0.0268808,0,0.132368)    0.142755 m from origin
Component                    psdAtSource AT (0.0268808,0,0.132368)    0.142755 m from origin
Component         MonolithGuide_window_1 AT (0.00602825,0,2.12357)    2.13406 m from origin
Component                  MonolithGuide AT (0.00601778,0,2.12457)    2.13506 m from origin
Component         MonolithGuide_window_2 AT (-0.0282239,0,5.39429)    5.40496 m from origin
Component              Monolith_window_1 AT (-0.0282658,0,5.39829)    5.40896 m from origin
Component          GammaShutter_window_1 AT (-0.0283421,0,5.40558)    5.41625 m from origin
Component              GammaShutterGuide AT (-0.0283474,0,5.40608)    5.41675 m from origin
Component          GammaShutter_window_2 AT (-0.0334524,0,5.89355)    5.90425 m from origin
Component                 armCurvedGuide AT (-0.0337089,0,5.91805)    5.92875 m from origin
Component                       psdGuide AT (-0.0337089,0,5.91805)    5.92875 m from origin
Component                      toflGuide AT (-0.0337089,0,5.91805)    5.92875 m from origin
Component                      divlGuide AT (-0.0337089,0,5.91805)    5.92875 m from origin
Component                armCurvedGuide1 AT (-0.0389448,0,6.41802)    6.42875 m from origin
Component                   CurvedGuide1 AT (-0.0389448,0,6.41802)    6.42875 m from origin
[NMX_chop_Def_Curv_Parab_Focus] Initialize
Source: Setting up for sector W, beamline 1, global orientation angle is 150, internal angle 55
Source: Focusing at rectagle sized 0.05 x 0.05 
  - positioned at location (x,y,z)=(0.00601778 m, 0 m, 2.12457 m) 
 ( from target_index 8 -> distance 2.12458 )
Source: Cold and Thermal brilliance performance multiplicators are c_performance=1 and t_performance=1
Source: NOT using time focusing
Normal vectors pointing in directions
 -0.0249999 0 7.08115e-05 and 
 0 -0.025 0 

Save [NMX_chop_Def_Curv_Parab_Focus]
Detector: XmonC_I=3.05539e+11 XmonC_ERR=5.79816e+10 XmonC_N=100 "XmonC.dat"
Detector: tofC_I=3.05539e+11 tofC_ERR=5.79816e+10 tofC_N=100 "tofC.dat"
Detector: LamC_I=2.11772e+11 LamC_ERR=4.65088e+10 LamC_N=72 "LamC.dat"
Detector: divAtSource_I=0 divAtSource_ERR=0 divAtSource_N=0 "At_SourceDIVVDIVH.pos"
Detector: psdAtSource_I=3.05539e+11 psdAtSource_ERR=5.79816e+10 psdAtSource_N=100 "psdAtSource_psd.dat"
Detector: psdGuide_I=3.11359e+07 psdGuide_ERR=3.11359e+07 psdGuide_N=1 "PreCurvedGuide_psd.dat"
Detector: toflGuide_I=0 toflGuide_ERR=0 toflGuide_N=0 "PreCurvedGuide_tofl.dat"
Detector: divlGuide_I=3.11359e+07 divlGuide_ERR=3.11359e+07 divlGuide_N=1 "PreCurvedGuide_divl.dat"

Finally [NMX_chop_Def_Curv_Parab_Focus: NMX_version_20180410_3_20180411_131744]. Time: 0 [s] 
loading user configuration from /Users/pkwi/.mcstas/2.4.1/mccode_config.json
INFO: Using directory: "NMX_version_20180410_3_20180411_131744"
INFO: Using existing binary: ./NMX_version_20180410_3.out
INFO: ===
INFO: Placing instr file copy NMX_version_20180410_3.instr in dataset NMX_version_20180410_3_20180411_131744

But the particle parsing fails:

starting particle parsing
error
Traceback (most recent call last):
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/mcdisplay.py", line 572, in 
    raise e
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/mcdisplay.py", line 567, in 
    main(args)
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/mcdisplay.py", line 534, in main
    raybundle = reader.read_particles()
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/../../mccodelib/mcdisplayutils.py", line 87, in read_particles
    rays = parser.execute(particles)
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/../../mccodelib/fcparticleparser.py", line 229, in execute
    flowchart.process(args)
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/../../mccodelib/flowchart.py", line 86, in process
    next = node.process(args)
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/../../mccodelib/flowchart.py", line 67, in process
    self.result = self.fct(args)
  File "/Applications/McStas-2.4.1.app/Contents/Resources/mcstas/2.4.1/bin/../tools/Python/mcdisplay/pyqtgraph/../../mccodelib/fcparticleparser.py", line 16, in t_error
    raise Exception("error")
Exception: error

NMX_version_20180410_3.zip

willend commented 6 years ago

The above was tested with 2.4.1 - but also tried the tools "as they come" on main - same issue.

climbcat commented 6 years ago

What is the proposed behavior of mcdisplay parsing when encountering JUMP?

willend commented 6 years ago

neutron coords are given in global coordinates from the simulation - so it should simply be allowed to repeat a certain portion of the instrument.

climbcat commented 6 years ago

As by 8cc048d0ca0d98008aa4c1440deee222b859e212 this should now be fixed, at least the current instrument parses.

willend commented 6 years ago

Works. closing