2

I have code that produces the following image at the end of the post:

enter image description here

I need to draw different kinds of filters in my setup. For instance, a bandpass filter (BP) a neutral-density filter (ND) and a shortpass (SP). In the manual, the symbol for a BP was different, it shows three waves inside the box, rather than the just one as shown in the picture. How can I change the symbol for the BP so it looks different from the ND? Moreover, I can't draw a second beam from FM (flip mirror) to M3 and the APD. How can I do that?

\documentclass[margin=10pt,pstricks]{standalone}
\usepackage{pst-optexp}
\usepackage{newtxtext,newtxmath}
\begin{document}
\begin{pspicture}[showgrid](10,5)
  \psset[optexp]{fiber=none,usefiberstyle}
  \newpsstyle{Fiber}{linecolor=red,linewidth=2\pslinewidth}
  \newpsstyle{Beam}{linecolor=red}
  \pnodes(2,4){Laser}(8,4){M1}(8,2){M2}(4,4){BP}(5,4){ND}(1,2){M3}(1,1){End}(4,2){FM}
  (4,1){SPEC}
  \optbox[optboxsize=2 1,innerlabel,position=start](Laser)(M1){Laser}
  \optfiber[compname=FB,labeloffset=0.5](Laser)(BP){Fiber}
  \optfilter[filtertype=bandpass,filtersize=0.5,compname=BP,labeloffset=0.5](BP)(ND){BP}
  \optfilter[filtertype=bandpass,filtersize=0.5,compname=ND,labeloffset=0.5](ND)(M1){ND}
  \mirror[compname=M1,labeloffset=0.5](ND)(M1)(M2){M1}
  \beamsplitter[labelangle=-90,compname=M2,bsstyle=plate,labeloffset=0.5](M1)(M2)(M3){BS}
  \lens[n=2, lensradius=1 1,lensheight=1,compname=L](8,2)(10,2)
  \optfilter[filtertype=lowpass,filtersize=0.5,compname=SP,labeloffset=0.5,labelangle=-180](M2)(FM){SP}
  \mirror[labelangle=-45,compname=FM,bsstyle=plate,labeloffset=0.5](M2)(FM)(SPEC){FM}
  \optbox[position=end,optboxsize=1 1,innerlabel](FM)(SPEC){SPEC}
  \mirror[compname=M3,labeloffset=0.5](FM)(M3)(End){M3}
  \optdetector[compname=APD,labelangle=90,dettype=diode](M3)(End){APD}
  \drawbeam (Laser){M1}{M2}{FM}(SPEC)
\end{pspicture}
\end{document}
1
  • 2
    Hi Rodrigo, you can (and should!) post your code on site, rather than linking to it elsewhere. Once you have pasted your code into your post, you can select it all and click the { } button in order to have it enclosed in a code block. I did this for you in my edit.
    – Scott H.
    Feb 23, 2020 at 3:44

1 Answer 1

2

First of all, pst-optexp doesn't work properly with XeLaTeX, compile with latex, dvips and ps2pdf. That's the reason, why your filter look weird, and different from those in the manual.

  • As flip mirror you could use e.g. a beamsplitter with bsstye=plate. Then you can draw both reflected and transmitted beams. To identify this component better in the code, you can define your own using \newpssobject:

    \newpsobject{flipmirror}{beamsplitter}{bsstyle=plate}
    ...
    \flipmirror[labelangle=-45,compname=FM,labeloffset=0.5](M2)(FM)(SPEC){FM}
    
  • I don't know a proper symbol for a neutral density filter. But if you have one, you can use \optdipole to define your own component with this symbol. As example:

    \newpsobject{ndfilter}{optdipole}{optdipolesize=0.5, allowbeaminside=false,
      optdipolecomp={%
        \psframe(-0.25,-0.25)(0.25,0.25)
        \rput(0,0){?}% DRAW HERE YOUR STUFF
    }}
    

Putting all together:

\documentclass[margin=10pt,pstricks]{standalone}
\usepackage{pst-optexp}
\newpsobject{flipmirror}{beamsplitter}{bsstyle=plate}
\newpsobject{ndfilter}{optdipole}{optdipolesize=0.5, allowbeaminside=false,
  optdipolecomp={%
    \psframe(-0.25,-0.25)(0.25,0.25)
    \rput(0,0){?}%
}}
\begin{document}
\begin{pspicture}[showgrid](10,5)
  \psset[optexp]{fiber=none,usefiberstyle}
  \newpsstyle{Fiber}{linecolor=red, linewidth=2\pslinewidth}
  \newpsstyle{Beam}{linecolor=red, linewidth=2\pslinewidth}
  \pnodes(2,4){Laser}(8,4){M1}(8,2){M2}(4,4){BP}(5,4){ND}(1,2){M3}(1,1){End}(4,2){FM}
  (4,1){SPEC}
  \optbox[optboxsize=2 1,innerlabel,position=start](Laser)(M1){Laser}
  \optfiber[compname=FB,labeloffset=0.5](Laser)(BP){Fiber}
  \optfilter[filtertype=bandpass,filtersize=0.5,compname=BP,labeloffset=0.5](BP)(ND){BP}
  \ndfilter[compname=ND,labeloffset=0.5](ND)(M1){ND}
  \mirror[compname=M1,labeloffset=0.5](ND)(M1)(M2){M1}
  \beamsplitter[labelangle=-90,compname=M2,bsstyle=plate,labeloffset=0.5](M1)(M2)(M3){BS}
  \lens[n=2, lensradius=1 1,lensheight=1,compname=L](8,2)(10,2)
  \optfilter[filtertype=lowpass,filtersize=0.5,compname=SP,labeloffset=0.5,labelangle=-180](M2)(FM){SP}
  \flipmirror[labelangle=-45,compname=FM,labeloffset=0.5](M2)(FM)(SPEC){FM}
  \optbox[position=end,optboxsize=1 1,innerlabel](FM)(SPEC){SPEC}
  \mirror[compname=M3,labeloffset=0.5](FM)(M3)(End){M3}
  \optdetector[compname=APD,labelangle=90,dettype=diode](M3)(End){APD}
  \drawfiber{1-3}
  \drawbeam{3-6}{8-10}
  \drawbeam{9}{11}{12}
\end{pspicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .