📄 montecarlomaplet.mw
字号:
If the cylindrical geometry is chosen then the value of the maximum radius has to be given. On the other hand, if the geometry chosen is prismatic, then one needs to give the maximum values of the coordinates x and y. The infinite geometry requires no extra information. If only the numerical results are required, one should check the appropriate box which speeds up the simulation. Recommended if the number of photons is > 2000. Note that the following number of points have been established: Na=30 for the exit angle grid with resolution Pi/2Na, Nz=20 with resolution totald/Nz for the depth direction grid (where totald is the sum of the thicknesses of all tissue layers) and Nr=300 with resolution dr=0.05 for the radial direction grid. TO CHANGE THE GRIDS, CLOSE THE MAPLET, GO TO THE PROCEDURE SIMPROP AND CHANGE THE VALUES THERE. To start the simulation press the corresponding button. CLOSE THIS WINDOW BEFORE PROCEEDING!", 'font'=Font(times,bold,16 ) </Font> <Font size="9">) </Font> <Font size="9"> # closing TextBox ))),</Font><Font background="[255,255,153]" opaque="true" size="14">Window['W1']('title'= "Numerical Results Window",</Font><Font size="9"></Font>BoxRow(<Font size="9">BoxColumn( Label("<Font background="[204,255,204]" opaque="true">RESULTS OF THE MONTE CARLO SIMULATION</Font>",'font'=Font(Arial,bold,16)),BoxRow('border'='true', 'inset'=0, 'font'='F1', [MathMLViewer['ML1']('foreground'=black,'background'=white,'height'=25,</Font> 'width'=220),<Font size="9">Button("SPECULAR REFLECTANCE VALUE",'foreground'=black, 'background'=white,'font'='F1',Evaluate('ML1' = 'NumRes1()')) ]),BoxRow('border'='true', 'inset'=0, 'font'='F1', [MathMLViewer['ML2']('foreground'=black,'background'=white,'height'=25, 'width'=220),Button("DIFFUSE REFLECTANCE VALUE",'foreground'=black, 'background'=white,'font'='F1',Evaluate('ML2' = 'NumRes2()')) ]),BoxRow('border'='true', 'inset'=0, 'font'='F1', [MathMLViewer['ML3']('foreground'=black,'background'=white,'height'=25, 'width'=220),Button("ABSORBED FRACTION VALUE", 'foreground'=black, 'background'=white,'font'='F1',Evaluate('ML3' = 'NumRes3()')) ]),BoxRow('border'='true', 'inset'=0, 'font'='F1', [MathMLViewer['ML4']('foreground'=black,'background'=white,'height'=25, 'width'=220),Button("TRANSMITTANCE VALUE",'foreground'=black, 'background'=white,'font'='F1',Evaluate('ML4' = 'NumRes4()')), Button("CLEAR BOXES", Action(SetOption('ML1' = ""),SetOption('ML2' = ""),SetOption('ML3' = ""),SetOption('ML4' = ""))) ])))),</Font><Font background="[255,255,153]" opaque="true" size="14">Window['W2']('title'= "Graphical Results</Font><Font background="[255,255,153]" opaque="true" size="9"> </Font><Font background="[255,255,153]" opaque="true" size="14">Window",</Font><Font background="[255,255,153]" opaque="true" size="9"></Font>BoxColumn(<Font size="9"> BoxRow('vscroll'='always','hscroll'='always','inset'=0,'spacing'=0,'valign'='top', Label("<Font background="[153,255,102]" opaque="true">Absorption versus depth Plot</Font> ",'font'=Font(Arial,bold,14)), [Plotter['PLA'](Evaluate( 'PLA '= 'GraphMCA()' )), Button['B00']("SHOW PLOT",'foreground'=black, 'background'=white, 'font'='F0','enabled'='true', Action( Evaluate( 'PLA' = 'GraphMCA()' )) )]</Font> ), <Font foreground="[0,0,0]"># end of BoxColumn</Font><Font size="9">BoxRow('vscroll'='always','hscroll'='always','inset'=0,'spacing'=0,'valign'='top', Label("<Font background="[153,255,102]" opaque="true">Other graphs</Font></Font> <Font size="9"> ",'font'=Font(Arial,bold,18)),[ Button("Reflectance Graphs",'foreground'=black,'background'=white, 'font'='F1', RunWindow('W2R')),Button("Transmittance Graphs",'foreground'=black,'background'=white, 'font'='F1', RunWindow('W2T'))]))),</Font><Font background="[255,255,153]" opaque="true" size="14">Window['W2R']('title'= "Window for Plots for Reflectance ",</Font><Font size="9"></Font>BoxRow(<Font size="9">BoxColumn('vscroll'='always','hscroll'='always','inset'=0,'spacing'=0,'valign'='top', Label("<Font background="[153,255,102]" opaque="true">Reflectance versus radial distance</Font> ",'font'=Font(Arial,bold,16)), Plotter['PL2'](Evaluate( 'PL2' = 'GraphMC2()' )), Button['B22']("SHOW PLOT",'foreground'=black, 'background'=white, 'font'='F0','enabled'='true', Action( Evaluate( 'PL2' = 'GraphMC2()' ) )) ), # end of BoxColumnBoxColumn('vscroll'='always','hscroll'='always','inset'=0,'spacing'=0,'valign'='top', Label("<Font background="[153,255,102]" opaque="true">Angular resolution of Reflectance</Font> ",'font'=Font(Arial,bold,16)), Plotter['PL4'](Evaluate( 'PL4' = 'GraphMC4()' )), Button['B44']("SHOW PLOT",'foreground'=black, 'background'=white, 'font'='F0', 'enabled'='true', Action(Evaluate( 'PL4' = 'GraphMC4()' ) )) ) </Font><Font foreground="[0,0,0]"># end of BoxColumn</Font><Font size="9">)),</Font><Font background="[255,255,153]" opaque="true" size="14">Window['W2T']('title'= "Window for Plots for Transmittance",</Font><Font size="9">BoxRow(</Font><Font size="9">BoxColumn('vscroll'='always','hscroll'='always','inset'=0,'spacing'=0,'valign'='top', Label("<Font background="[153,255,102]" opaque="true">Transmittance versus radial distance</Font> ",'font'=Font(Arial,bold,16)), Plotter['PL1'](Evaluate( 'PL1' = 'GraphMC1()' )), Button['B11']("SHOW PLOT",'foreground'=black, 'background'=white, 'font'='F0', 'enabled'='true', Action( Evaluate( 'PL1' = 'GraphMC1()' )) ) ), </Font><Font foreground="[0,0,0]"># end of BoxColumn</Font><Font size="9">BoxColumn('vscroll'='always','hscroll'='always','inset'=0,'spacing'=0,'valign'='top', Label("<Font background="[153,255,102]" opaque="true">Angular Resolution of Transmittance</Font> ",'font'=Font(Arial,bold,16)), Plotter['PL3'](Evaluate( 'PL3' = 'GraphMC3()' )), Button['B33']("SHOW PLOT",'foreground'=black, 'background'=white, 'font'='F0', 'enabled'='true', Action( Evaluate( 'PL3' = 'GraphMC3()' ) ))</Font> <Font size="9">) </Font><Font foreground="[0,0,0]"># end of BoxColumn</Font><Font size="9">)),</Font><Font background="[255,255,153]" opaque="true" size="14">Window['Wout']('title'= "Explanation of Output",</Font><Font size="9"></Font>BoxRow(<Font size="9">BoxColumn( TextBox['TF_O']('editable' = 'false',20..65, " The output of the simulation can be obtained in numerical or graphical format. Activating the button [<Font underline="true">Proceed to numerical results</Font>] opens a new window where the values of the Specular Reflectance (TR) Diffuse Reflectance (RD) Absorbed Fraction and (AA) Transmittance (TD) retrieved from the Maple internal file MCnumerical.m are displayed. On the other hand, the button [<Font underline="true">Proceed to graphical results]</Font> opens a window where the graph of absorption versus layers depth (stored in MCgraphA.m) can be seen. At the bttom of this same window, there are two buttons which lead to the display of graphs of the radial-resolved and angular-resolved reflectance and transmittance. These radial resolved and angular resolved graphs are retrieved from the Maple internal files MCgraphRad.m and MCgraphAng.m respectively. Furthermore, in case the points of these graphs are needed they can be retrieved from the files: Abs_graph_points.m --- where the points for the absorption versus depth graph points are stored Ref_ang_graph_points.m --- where the points for the reflectance versus azimuthal angle graph points are stored Tra_ang_graph_points.m --- where the points for the tranmitance versus azimuthal angle graph points are stored Ref_rad_graph_points.m --- where the points for the reflectance versus radial coordinates graph points are stored Tra_rad_graph_points.m --- where the points for the tranmitance versus radial coordinates graph points are stored CLOSE THIS WINDOW BEFORE PROCEEDING! ", 'font'=Font(times,bold,14)</Font> ) <Font foreground="[0,0,0]"># closing TextBox</Font><Font size="9">)))): </Font><Font foreground="[0,0,0]"># closing Maplet</Font><Font size="9"></Font><Font size="14" foreground="[0,102,255]">end use:</Font><Font size="9"></Font></Text-field></Input></Group></Section><Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title><Text-field style="Heading 1" layout="Heading 1">2. Procedures for simulation when running the Maplet</Text-field></Title><Group labelreference="L115" drawlabel="true"><Input><Text-field prompt="> " style="Maple Input" layout="Normal"><Font foreground="[204,0,204]">SimulationMC:=proc()</Font><Font size="9">global layers, photons,geom,n, mua,mus,g,d,totald,rmax,xymax,xmax,ymax,entryang;local i,nn,mmua,mmus,gg,dd,g1,g2,g3,g4,graphs;use Maplets[Tools] in <Font background="[204,255,204]" opaque="true"></Font>g1:=Get('ChB1'):g2:=Get('ChB2'):g3:=Get('ChB3'):g4:=Get('ChB4'):if g4=true then graphs:=0; else graphs:=1;fi;if g1=true then geom:=cylindrical;rmax:=Get('TF_r'::integer);elif g2=true then geom:=prismatic; xymax:=Get('TF_xy'::list);xmax:=xymax[1];ymax:=xymax[2];else geom:=infinite;fi;<Font background="[204,255,204]" opaque="true"></Font>entryang:=Get('TF_0'::anything);<Font background="[204,255,204]" opaque="true"></Font>layers:=Get('TF_1'::integer);photons:=Get('TF_2':: integer);nn:=Get ('TF_3'::list);mmus:=Get ('TF_4'::list);mmua:=Get ('TF_5'::list);gg:=Get ('TF_6'::list);dd:=Get ('TF_7'::list);<Font foreground="[255,102,102]">end use:</Font> <Font italic="true" foreground="[0,0,0]"># Initialize layer property arrays</Font> n := array(0..layers+1): mua := array(1..layers): <Font italic="true" foreground="[0,0,0]"># changed the first index of the array from 0 to 1</Font> mus := array(1..layers): <Font italic="true" foreground="[0,0,0]"> # same change as above</Font> g := array(1..layers): d := array(0..layers): totald:=0;for i to layers don[i]:=nn[i];mua[i]:=mmua[i];mus[i]:=mmus[i];g[i]:=gg[i];<Font background="[204,255,204]" opaque="true"></Font>d[i]:=dd[i];totald:=totald+d[i];od;MonteCarloInMaple(graphs, geom,photons,entryang):RETURN("Simulation finished - Proceed to Results "); </Font><Font foreground="[204,0,255]">end proc:</Font><Font size="9"></Font><Font foreground="[204,0,255
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -