我正在尝试使用 复制用于 CPA 的光学设置pst-optexp
。我当前的代码如下:
\begin{pspicture}(18,20)
\Large
\definecolor{passiveFiberColor}{HTML}{FF8000}
\definecolor{activeFiberColor}{HTML}{0080FF}
\definecolor{fiberLoopColor}{HTML}{8000FF}
\definecolor{dispersionFiberColor}{HTML}{80FF00}
\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}%
\psset[optexp]{fiber=none, usefiberstyle}
\newpsstyle{Fiber}{linewidth=2\pslinewidth}
\pnodes(1.5, 4){LaserIn}(2, 4){LaserOut}
\pnodes (5, 4) {BSIn} (4, 3.5) {BSOut} (4, 4){BSCenter}
\pnodes (7, 4) {MCenter} (6, 3) {Mout}
\pnodes (5.5, 2.5) {GICenter} (6.5, 2.5) {GIOut}
\pnodes (7.5, 2.5) {LIOut} (7, 2.5) {LICenter} (8, 2.5) {LIICenter} (8.5, 2.5) {LIIOut}
\pnodes (10, 2.5) {GIICenter} (8.5, 3.5) {GIIOut}
\drawbeam[beam, ArrowInside=->](LaserIn)(BSIn)
%Stretcher stage
\mirror[beam, mirrortype=extended, fillstyle=solid](BSIn)(MCenter)(Mout)
\drawbeam[beam](Mout)(GICenter)
%Fancy beams in stretcher
\multido{\i=0+1}{40}{%
\pstVerb{\i\space 650 400 sub 39 div mul 400 add tx@addDict begin wavelengthToRGB end}%
\drawbeam[linecolor=bl, beamangle=\i\space 16 sub 0.2 mul](GICenter)(LICenter)%
\drawbeam[linecolor=bl, loadbeampoints](LICenter)(LIICenter)%
\drawbeam[linecolor=bl, loadbeampoints, beamangle=\i\space 16 sub 0.125 mul -1 mul](LIICenter)(GIICenter)%
\drawbeam[linecolor=bl, loadbeampoints](GIICenter)(GIIOut)%
}%
\optgrating[reverse, angle=0, gratingalign=c, fillstyle=solid](Mout)(GICenter)(GIOut)
\lens[fillstyle=solid](GIOut)(LIOut)
\lens[fillstyle=solid](LIOut)(LIIOut)
\optgrating[angle = 0, gratingalign = c, fillstyle=solid](LIIOut)(GIICenter)(GIIOut)
\mirror[mirrortype=extended](GIICenter)(GIIOut)(GIICenter)
%Amp stage
\pnodes (4, 2.5) {AmpIn} (4, 0.5) {AmpOut}
%Compressor stage
\pnodes (4, -1) {BSIICenter} (5, -1) {BSIIOut}
\pnodes (7, -1) {MIICenter} (6, 0) {MIIOut}
\pnodes (5.5, 0.5) {GIIICenter} (6.5, 0.5) {GIIIOut}
\pnodes (8.5, 0.5) {GIVCenter} (8, 1) {GIVOut}
\pnode (7.5, -0.5) {MREFCenter}
%Output
\pnode(1.5, -1) {CPAOut}
\drawbeam[beam, ArrowInside=->] (BSCenter) (AmpIn)
\drawbeam[beam, ArrowInside=->] (AmpOut)(BSIICenter)
\drawbeam[beam, ArrowInside=<->] (BSIICenter) (BSIIOut)
\drawbeam[beam, ArrowInside = ->] (BSIICenter) (CPAOut)
\pnodes (3.5, 2.5) {RectLowerX} (4.5, 0.5) {RectUpperX}
%
\beamsplitter(BSIn)(BSCenter)(BSOut){}
\psframe[fillstyle=solid, fillcolor=red!40!black](RectLowerX)(RectUpperX)
\beamsplitter(AmpOut)(BSIICenter)(BSIIOut)
\mirror[mirrortype=extended](BSIIOut)(MIICenter)(MIIOut)
\mirror[beam, mirrortype=extended](GIVCenter)(MREFCenter)(GIVCenter)
%Fancy beams in compressor
\multido{\i=0+1}{40}{%
\pstVerb{\i\space 650 400 sub 39 div mul 400 add tx@addDict begin wavelengthToRGB end}%
\drawbeam[linecolor=bl, beamangle=\i\space 16 sub 0.2 mul](GIIICenter)(GIVCenter)%
\drawbeam[linecolor=bl, loadbeampoints](GIVCenter)(MREFCenter)
}%
\drawbeam[beam](MIICenter)(GIIICenter)
\optgrating[reverse, angle = 0, gratingalign = c, fillstyle=solid] (MIIOut)(GIIICenter)(GIIIOut)
\optgrating[angle = -45, fillstyle=solid](GIIIOut)(GIVCenter)(MREFCenter)
\drawbeam[beam] (MIICenter) (BSIIOut)
\end{pspicture}
它看起来非常接近我想要的效果,但在下部压缩机部分,我遇到了不重叠扩展光束的问题。我该如何解决这个问题?
旁注:是的,代码很乱,我必须稍后清理,但如果有任何明显的改进,我也会接受。
答案1
的主要优点\drawbeam
是连接组件,而无需了解实际形状、反射和传输行为。您根本没有使用过它,因此它\drawbeam
从通过给定节点的平面开始,而不是从光栅组件开始。这就是您在压缩机中观察到的错误。
您所有的\drawbeam
用途都可能被取代\psline
。
要连接组件,例如,您可以使用 为它们命名compname
。您可以在手册的“9 连接组件”部分找到非常详细的描述和许多示例pst-optexp
。
此外,还有一个optexp
组件,它在梁的顶部绘制组件,尽管它们是在梁之前定义的。
\documentclass{standalone}
\usepackage{pst-optexp}
\begin{document}
\begin{pspicture}(0,-2)(11,5)
\begin{optexp}
\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}%
\psset[optexp]{mirrortype=extended, gratingalign=c}
\pnodes(1.5, 4){LaserIn}(2, 4){LaserOut}
\pnodes (5, 4) {BSIn} (4, 3.5) {BSOut} (4, 4){BSCenter}
\pnodes (7, 4) {MCenter} (6, 3) {Mout}
\pnodes (5.5, 2.5) {GICenter} (6.5, 2.5) {GIOut}
\pnodes (7.5, 2.5) {LIOut} (7, 2.5) {LICenter} (8, 2.5) {LIICenter} (8.5, 2.5) {LIIOut}
\pnodes (10, 2.5) {GIICenter} (8.5, 3.5) {GIIOut}
%Stretcher stage
\mirror[compname=StretcherM1](BSIn)(MCenter)(Mout)
\optgrating[reverse, fillstyle=solid, compname=StretcherG1](Mout)(GICenter)(GIOut)
\lens[compname=StretcherL1](GIOut)(LIOut)
\lens[compname=StretcherL2](LIOut)(LIIOut)
\optgrating[compname=StretcherG2, fillstyle=solid](LIIOut)(GIICenter)(GIIOut)
\mirror[compname=StretcherM2](GIICenter)(GIIOut)(GIICenter)
%Fancy beams in stretcher
\multido{\i=0+1}{40}{%
\pstVerb{\i\space 650 400 sub 39 div mul 400 add tx@addDict begin wavelengthToRGB end}%
\drawbeam[linecolor=bl, beamangle=\i\space 16 sub 0.2 mul, n=1.3]{StretcherG1}{StretcherL1}{StretcherL2}{StretcherG2}%
\drawbeam[linecolor=bl, loadbeampoints]{StretcherG2}{StretcherM2}%
}%
% %Amp stage
\pnodes (4, 2.5) {AmpIn} (4, 0.5) {AmpOut}
% %Compressor stage
\pnodes (4, -1) {BSIICenter} (5, -1) {BSIIOut}
\pnodes (7, -1) {MIICenter} (6, 0) {MIIOut}
\pnodes (5.5, 0.5) {GIIICenter} (6.5, 0.5) {GIIIOut}
\pnodes (8.5, 0.5) {GIVCenter} (8, 1) {GIVOut}
\pnode (7.5, -0.5) {MREFCenter}
% %Output
\pnode(1.5, -1) {CPAOut}
% %
\beamsplitter[compname=BS1](BSIn)(BSCenter)(BSOut)
\optbox[optboxsize=2 1, fillstyle=solid, fillcolor=red!40!black, compname=Amp](BSCenter)(BSIICenter)
\beamsplitter[compname=BS2](AmpOut)(BSIICenter)(BSIIOut)
\mirror[compname=CompressorM1](BSIIOut)(MIICenter)(MIIOut)
\mirror[compname=CompressorM2](GIVCenter)(MREFCenter)(GIVCenter)
\optgrating[reverse, fillstyle=solid, compname=CompressorG1] (MIIOut)(GIIICenter)(GIIIOut)
\optgrating[angle = -45, fillstyle=solid, compname=CompressorG2](GIIIOut)(GIVCenter)(MREFCenter)
%Fancy beams in compressor
\multido{\i=0+1}{40}{%
\pstVerb{\i\space 650 400 sub 39 div mul 400 add tx@addDict begin wavelengthToRGB end}%
\drawbeam[linecolor=bl, beamangle=\i\space 16 sub 0.2 mul]{CompressorG1}{CompressorG2}%
\drawbeam[linecolor=bl, loadbeampoints]{CompressorG2}{CompressorM2}
}%
% finally draw all beam between the respective components
\drawbeam[ArrowInside=->, ArrowInsideMinLength=1](LaserIn){BS1}{StretcherM1}{StretcherG1}
\drawbeam[ArrowInside=->, ArrowInsideMinLength=1, beaminsidefirst]{BS1}{Amp}{BS2}{CompressorM1}{CompressorG1}
\drawbeam[ArrowInside=->, ArrowInsideMinLength=1, beaminsidefirst]{BS2}(CPAOut)
\end{optexp}
\end{pspicture}
\end{document}