(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 19401, 503] NotebookOptionsPosition[ 18097, 458] NotebookOutlinePosition[ 18525, 475] CellTagsIndexPosition[ 18482, 472] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ "Assigment near field optics:\n", StyleBox["Simulating image formation of a conventional and a near-field \ microscope", "Subtitle"] }], "Title", CellChangeTimes->{{3.4066391719880705`*^9, 3.4066391947541323`*^9}, { 3.406818739765625*^9, 3.406818751390625*^9}}], Cell[CellGroupData[{ Cell["\<\ Functions that define discrete Fourier transform and it's inverse\ \>", "Subsection", CellChangeTimes->{{3.4066391335029564`*^9, 3.406639150253278*^9}, { 3.4066392160670414`*^9, 3.4066392346611485`*^9}, {3.4068181131875*^9, 3.406818114125*^9}}], Cell["\<\ Use these functions to perform a Fourier transform and an inverse Fourier \ transform of a two-dimensional matrix, when needed:\ \>", "Text", CellChangeTimes->{{3.406639255286545*^9, 3.4066393028655834`*^9}, { 3.406817929140625*^9, 3.40681797190625*^9}, {3.406818086875*^9, 3.40681810609375*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Four", "[", "data_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"fourdata", ",", "dim"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"fourdata", "=", RowBox[{"Fourier", "[", RowBox[{"data", ",", RowBox[{"FourierParameters", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"dim", "=", RowBox[{"Dimensions", "[", "fourdata", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fourdata", "=", RowBox[{"Join", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Join", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}], "]"}]}], "]"}], "]"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}]}], "]"}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"Join", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}], "]"}]}], "]"}], "]"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}]}], "]"}], "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "fourdata", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.406634819076371*^9, 3.40663487629622*^9}, { 3.4066349067968054`*^9, 3.4066352007086983`*^9}, {3.4066352486471186`*^9, 3.4066352722725725`*^9}, {3.406635415587824*^9, 3.406635430603737*^9}, { 3.4066356465297575`*^9, 3.406635758985042*^9}, {3.406635845439827*^9, 3.4066360965071473`*^9}, {3.4066361856963596`*^9, 3.4066361961028094`*^9}, { 3.406636392434704*^9, 3.4066364088568945`*^9}, {3.406814671078125*^9, 3.40681469115625*^9}, {3.40681476534375*^9, 3.40681477575*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"InvFour", "[", "fourdata_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"data", ",", "dim"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"dim", "=", RowBox[{"Dimensions", "[", "fourdata", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"data", "=", RowBox[{"Join", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Join", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}], "]"}]}], "]"}], "]"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}]}], "]"}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"Join", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}], "+", "1"}], ",", RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}], "]"}]}], "]"}], "]"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"fourdata", "[", RowBox[{"[", RowBox[{ RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}], ",", RowBox[{"Range", "[", RowBox[{"1", ",", RowBox[{ RowBox[{ "dim", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "/", "2"}]}], "]"}]}], "]"}], "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"data", "=", RowBox[{"InverseFourier", "[", RowBox[{"data", ",", RowBox[{"FourierParameters", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "data", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.4066362168532076`*^9, 3.406636217493845*^9}, { 3.4066363071361914`*^9, 3.406636386731469*^9}, 3.406814699296875*^9, { 3.406815400671875*^9, 3.4068154025625*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["a) Importing the object data file and plotting the object", "Subsection", CellChangeTimes->{{3.406630662012182*^9, 3.4066306694654503`*^9}, { 3.4066308159682627`*^9, 3.4066308174214153`*^9}, {3.406818695921875*^9, 3.406818701828125*^9}}], Cell[TextData[{ "Type the correct path of the data file here, to import the field \ distribution in the object plane (", StyleBox["z", FontSlant->"Italic"], "=0)" }], "Text", CellChangeTimes->{{3.40663067362178*^9, 3.4066306754499397`*^9}, { 3.406630731060383*^9, 3.406630737576133*^9}, {3.4066307925146875`*^9, 3.406630793124074*^9}, {3.406639717326666*^9, 3.4066397231080265`*^9}, { 3.406639769999552*^9, 3.4066397830154266`*^9}, {3.40681360884375*^9, 3.406813610921875*^9}, {3.406813700890625*^9, 3.406813701421875*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"field", "=", RowBox[{ RowBox[{"Import", "[", RowBox[{ "\"\\"", ",", "\"\\""}], "]"}], "/", "127."}]}], ";"}]], "Input", CellChangeTimes->{{3.40663069759099*^9, 3.4066307502170005`*^9}, { 3.406630797249153*^9, 3.4066307983585496`*^9}, {3.406637005055841*^9, 3.406637005852731*^9}, {3.40681470696875*^9, 3.40681474253125*^9}, { 3.406815314203125*^9, 3.406815316*^9}}], Cell["\<\ The maximum field amplitude is 1. The dimensions of the object are 5120 x \ 5120 nm. All pixels have the same phase (the sample is illuminated with a \ plane wave under normal incidence) Calculate the intensity in the object plane:\ \>", "Text", CellChangeTimes->{{3.406630807014966*^9, 3.406630833656102*^9}, { 3.406636694643631*^9, 3.40663669900309*^9}, {3.4066397908437023`*^9, 3.4066397999688773`*^9}, {3.40681363690625*^9, 3.4068136908125*^9}, { 3.406820150390625*^9, 3.4068201783125*^9}}], Cell[BoxData[ RowBox[{"intensity", "="}]], "Input", CellChangeTimes->{{3.406636705159458*^9, 3.4066367366756883`*^9}, { 3.406637012180978*^9, 3.4066370202123823`*^9}, 3.4066398053908567`*^9, { 3.406814659140625*^9, 3.4068146663125*^9}}], Cell["...and plot the intensity distribution:", "Text", CellChangeTimes->{{3.406639814641034*^9, 3.4066398187192373`*^9}, { 3.406818138640625*^9, 3.406818143125*^9}}], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"Graphics", "[", RowBox[{ RowBox[{"Raster", "[", "intensity", "]"}], ",", RowBox[{"AspectRatio", "\[Rule]", "1"}]}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.406636258025873*^9, 3.406636288479583*^9}, { 3.4066364327323523`*^9, 3.406636441123139*^9}, {3.4066365193590155`*^9, 3.406636525265379*^9}, {3.4066365663442926`*^9, 3.406636568313081*^9}, { 3.406636681909012*^9, 3.4066366837840476`*^9}, {3.4066367184878387`*^9, 3.406636718800345*^9}, {3.406637025056225*^9, 3.406637025681237*^9}, { 3.4066398354539337`*^9, 3.406639841047791*^9}}], Cell[TextData[{ "(Note on plotting matrices: If you calculate an intensity matrix further on \ in the exercise, ", StyleBox["Mathematica", FontSlant->"Italic"], " might add very small imaginary parts to the otherwise real entries of the \ matrix, which does not allow you to plot them using the ", StyleBox["'Graphics[Raster[matrix]]", "Input"], "' command. To remove these negligible imaginary parts, use the function ", StyleBox["'Chop[matrix]", "Input"], "', e.g. '", StyleBox["Show[Graphics[Raster[Chop[matrix]]]]", "Input"], "'.)" }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["c) Simulating an aberration free image with NA=1", "Subsection", CellChangeTimes->{{3.40663087129745*^9, 3.4066309016417828`*^9}, { 3.40681868865625*^9, 3.406818688765625*^9}}], Cell["\<\ Calculate the angular spectrum representation of the field in the plane of \ the object. Use it to simulate the intensity distribution in an image plane, \ formed by an aberration-free lens system that collects all propagating angles \ (NA=1). The wavelength of illumination is 600 nm.\ \>", "Text", CellChangeTimes->{{3.406813174953125*^9, 3.406813182734375*^9}, { 3.40681323740625*^9, 3.40681328975*^9}, {3.406813433109375*^9, 3.406813524421875*^9}, {3.406813744453125*^9, 3.406813755890625*^9}, { 3.4068201824375*^9, 3.4068201914375*^9}, {3.500883318801025*^9, 3.5008833190816193`*^9}}], Cell[BoxData[""], "Input", CellChangeTimes->{{3.406630912313863*^9, 3.406630921767169*^9}, { 3.40663676412934*^9, 3.4066367852859964`*^9}, {3.406637042103427*^9, 3.4066370561193213`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ d) Simulating the image formed by a scanning near-field aperture\ \>", "Subsection", CellChangeTimes->{{3.4066327459115667`*^9, 3.4066327926624646`*^9}, { 3.406821198375*^9, 3.406821198921875*^9}}], Cell[TextData[{ "Calculate the object field at the height of the aperture (", StyleBox["z", FontSlant->"Italic"], "=35 nm), and plot the intensity in that plane" }], "Text", CellChangeTimes->{{3.4066327990688376`*^9, 3.406632824350573*^9}, { 3.406821093546875*^9, 3.406821101625*^9}, {3.406821171484375*^9, 3.406821171578125*^9}, {3.40682120934375*^9, 3.40682121046875*^9}, { 3.406821451296875*^9, 3.4068214570625*^9}, {3.5008833255353003`*^9, 3.5008833255508885`*^9}}], Cell[BoxData[""], "Input", CellChangeTimes->{{3.4066328796328845`*^9, 3.4066330546831207`*^9}, { 3.4066331857793875`*^9, 3.4066331965764694`*^9}, {3.406633377267439*^9, 3.4066333807987566`*^9}, {3.406633441237417*^9, 3.4066334419561806`*^9}, { 3.4066343750209703`*^9, 3.406634375099097*^9}, {3.406634483913686*^9, 3.4066344844918222`*^9}, {3.4066345390397444`*^9, 3.4066345767123427`*^9}, {3.4066372224506397`*^9, 3.40663723312272*^9}, { 3.4066377428043804`*^9, 3.406637799399217*^9}, {3.4066378670411406`*^9, 3.406637878166354*^9}, {3.4066379301986036`*^9, 3.406637941167564*^9}, 3.406638040075713*^9, {3.4066382991588125`*^9, 3.406638299861951*^9}, { 3.4066388807012277`*^9, 3.406638881498118*^9}, {3.406638943968067*^9, 3.406638944061819*^9}, {3.406820211171875*^9, 3.406820213796875*^9}, 3.406820271140625*^9, {3.40682054296875*^9, 3.406820557578125*^9}, { 3.406820737015625*^9, 3.406820820515625*^9}, {3.406820891484375*^9, 3.40682092865625*^9}, {3.406821104328125*^9, 3.406821104390625*^9}, 3.406821178328125*^9}], Cell["\<\ The aperture is a circular hole with a diameter of 90 nm mounted in a square \ tip also with sides of 90 nm (see assignment for image). Simulate the image \ formed when the aperture scans over the sample in steps of 10 nm. The amount \ of light scattered by the aperture only depends on the intensity under the \ aperture, and all of the scattered light is collected at the other side of \ the screen. Compare with question c and d and explain the result. \:f35f \ \>", "Text", CellChangeTimes->{{3.406821470203125*^9, 3.406821473828125*^9}, { 3.40682202415625*^9, 3.40682205984375*^9}, {3.500883335013169*^9, 3.5008833696978035`*^9}}], Cell[BoxData[""], "Input", CellChangeTimes->{{3.406638358784957*^9, 3.406638557304394*^9}, { 3.406638709541692*^9, 3.406638729682703*^9}, {3.406638845138045*^9, 3.406638852825692*^9}, {3.406821956734375*^9, 3.4068219606875*^9}, { 3.40682200271875*^9, 3.406822007125*^9}}] }, Open ]] }, Open ]] }, WindowSize->{1664, 915}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, DockedCells->FEPrivate`FrontEndResource[ "FEExpressions", "CompatibilityToolbar"], FrontEndVersion->"7.0 for Microsoft Windows (64-bit) (February 18, 2009)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 282, 6, 123, "Title"], Cell[CellGroupData[{ Cell[874, 32, 260, 5, 36, "Subsection"], Cell[1137, 39, 312, 6, 29, "Text"], Cell[1452, 47, 4868, 121, 152, "Input"], Cell[6323, 170, 4547, 117, 152, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[10907, 292, 249, 3, 36, "Subsection"], Cell[11159, 297, 539, 11, 29, "Text"], Cell[11701, 310, 477, 11, 31, "Input"], Cell[12181, 323, 512, 9, 47, "Text"], Cell[12696, 334, 244, 4, 31, "Input"], Cell[12943, 340, 169, 2, 29, "Text"], Cell[13115, 344, 615, 11, 31, "Input"], Cell[13733, 357, 558, 13, 49, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[14328, 375, 185, 2, 36, "Subsection"], Cell[14516, 379, 610, 10, 29, "Text"], Cell[15129, 391, 193, 3, 31, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[15359, 399, 210, 4, 36, "Subsection"], Cell[15572, 405, 485, 10, 29, "Text"], Cell[16060, 417, 1071, 15, 31, "Input"], Cell[17134, 434, 653, 14, 119, "Text"], Cell[17790, 450, 279, 4, 31, "Input"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)