(* 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[ 15335, 449] NotebookOptionsPosition[ 14375, 415] NotebookOutlinePosition[ 14740, 431] CellTagsIndexPosition[ 14697, 428] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Functions for field parameterization conversion", "Section"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"Ax", "[", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "ComplexAmplitude"}], "]"}], "=", "0"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"Ax", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex_", ",", "Ey_"}], "}"}], ",", "ComplexAmplitude"}], "]"}], ":=", FractionBox[ RowBox[{"Abs", "[", "Ex", "]"}], SqrtBox[ RowBox[{ SuperscriptBox[ RowBox[{"Abs", "[", "Ex", "]"}], "2"], "+", SuperscriptBox[ RowBox[{"Abs", "[", "Ey", "]"}], "2"]}]]]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"Ay", "[", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "ComplexAmplitude"}], "]"}], "=", "0"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"Ay", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex_", ",", "Ey_"}], "}"}], ",", "ComplexAmplitude"}], "]"}], ":=", FractionBox[ RowBox[{"Abs", "[", "Ey", "]"}], SqrtBox[ RowBox[{ SuperscriptBox[ RowBox[{"Abs", "[", "Ex", "]"}], "2"], "+", SuperscriptBox[ RowBox[{"Abs", "[", "Ey", "]"}], "2"]}]]]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"\[Phi]", "[", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "Ey_"}], "}"}], ",", "ComplexAmplitude"}], "]"}], "=", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Phi]", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex_", ",", "0"}], "}"}], ",", "ComplexAmplitude"}], "]"}], "=", "0"}], ";"}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"\[Phi]", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex_", ",", "Ey_"}], "}"}], ",", "ComplexAmplitude"}], "]"}], ":=", RowBox[{"Arg", "[", RowBox[{ FractionBox["Ey", RowBox[{"Abs", "[", "Ey", "]"}]], FractionBox[ RowBox[{"Abs", "[", "Ex", "]"}], "Ex"]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"AmplitudePhase", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex_", ",", "Ey_"}], "}"}], ",", "ComplexAmplitude"}], "]"}], ":=", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Ax", "[", RowBox[{"#1", ",", "#2"}], "]"}], ",", RowBox[{"Ay", "[", RowBox[{"#1", ",", "#2"}], "]"}], ",", RowBox[{"\[Phi]", "[", RowBox[{"#1", ",", "#2"}], "]"}]}], "}"}], "&"}], "[", RowBox[{ RowBox[{"{", RowBox[{"Ex", ",", "Ey"}], "}"}], ",", "ComplexAmplitude"}], "]"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"S1", "[", RowBox[{ RowBox[{"{", RowBox[{"Ax_", ",", "Ay_", ",", "\[Phi]_"}], "}"}], ",", "AmplitudePhase"}], "]"}], ":=", RowBox[{ SuperscriptBox["Ax", "2"], "-", SuperscriptBox["Ay", "2"]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"S2", "[", RowBox[{ RowBox[{"{", RowBox[{"Ax_", ",", "Ay_", ",", "\[Phi]_"}], "}"}], ",", "AmplitudePhase"}], "]"}], ":=", RowBox[{"2", "Ax", " ", "Ay", " ", RowBox[{"Cos", "[", "\[Phi]", "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"S3", "[", RowBox[{ RowBox[{"{", RowBox[{"Ax_", ",", "Ay_", ",", "\[Phi]_"}], "}"}], ",", "AmplitudePhase"}], "]"}], ":=", RowBox[{"2", "Ax", " ", "Ay", " ", RowBox[{"Sin", "[", "\[Phi]", "]"}]}]}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"Stokes", "[", RowBox[{ RowBox[{"{", RowBox[{"Ax_", ",", "Ay_", ",", "\[Phi]_"}], "}"}], ",", "AmplitudePhase"}], "]"}], ":=", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"S1", "[", RowBox[{"#1", ",", "#2"}], "]"}], ",", RowBox[{"S2", "[", RowBox[{"#1", ",", "#2"}], "]"}], ",", RowBox[{"S3", "[", RowBox[{"#1", ",", "#2"}], "]"}]}], "}"}], "&"}], "[", RowBox[{ RowBox[{"{", RowBox[{"Ax", ",", "Ay", ",", "\[Phi]"}], "}"}], ",", "AmplitudePhase"}], "]"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"\[Alpha]", "[", RowBox[{ RowBox[{"{", RowBox[{"S1_", ",", "S2_", ",", "S3_"}], "}"}], ",", "Stokes"}], "]"}], ":=", RowBox[{ FractionBox["1", "2"], RowBox[{"ArcTan", "[", RowBox[{"S1", ",", "S2"}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"\[Epsilon]", "[", RowBox[{ RowBox[{"{", RowBox[{"S1_", ",", "S2_", ",", "S3_"}], "}"}], ",", "Stokes"}], "]"}], ":=", RowBox[{ FractionBox["1", "2"], RowBox[{"ArcSin", "[", "S3", "]"}]}]}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"AngleEllipticity", "[", RowBox[{ RowBox[{"{", RowBox[{"S1_", ",", "S2_", ",", "S3_"}], "}"}], ",", "Stokes"}], "]"}], ":=", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Alpha]", "[", RowBox[{"#1", ",", "#2"}], "]"}], ",", RowBox[{"\[Epsilon]", "[", RowBox[{"#1", ",", "#2"}], "]"}]}], "}"}], "&"}], "[", RowBox[{ RowBox[{"{", RowBox[{"S1", ",", "S2", ",", "S3"}], "}"}], ",", "Stokes"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"AngleEllipticity", "[", RowBox[{ RowBox[{"{", RowBox[{"Ax_", ",", "Ay_", ",", "\[Phi]_"}], "}"}], ",", "AmplitudePhase"}], "]"}], ":=", RowBox[{"AngleEllipticity", "[", RowBox[{ RowBox[{"Stokes", "[", RowBox[{ RowBox[{"{", RowBox[{"Ax", ",", "Ay", ",", "\[Phi]"}], "}"}], ",", "AmplitudePhase"}], "]"}], ",", "Stokes"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"AngleEllipticity", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex_", ",", "Ey_"}], "}"}], ",", "ComplexAmplitude"}], "]"}], ":=", RowBox[{"AngleEllipticity", "[", RowBox[{ RowBox[{"AmplitudePhase", "[", RowBox[{ RowBox[{"{", RowBox[{"Ex", ",", "Ey"}], "}"}], ",", "ComplexAmplitude"}], "]"}], ",", "AmplitudePhase"}], "]"}]}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Read and plot data", "Section"], Cell["\<\ SetDirectory[NotebookDirectory[]]; fpDat = OpenRead[\"Genas_system_mg0.dat\",BinaryFormat -> True]; z1Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; z1 = Flatten[BinaryReadList[fpDat, {\"Real64\"}, z1Len, ByteOrdering->-1]]; t1Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; t1 = Flatten[BinaryReadList[fpDat, {\"Real64\"}, t1Len, ByteOrdering->-1]]; Exreout1Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; Exreout1 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t1Len, \ ByteOrdering->-1],{j1,1,z1Len}],{{1},{2,3}}]; Eximout1Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; Eximout1 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t1Len, \ ByteOrdering->-1],{j1,1,z1Len}],{{1},{2,3}}]; Eyreout1Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; Eyreout1 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t1Len, \ ByteOrdering->-1],{j1,1,z1Len}],{{1},{2,3}}]; Eyimout1Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; Eyimout1 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t1Len, \ ByteOrdering->-1],{j1,1,z1Len}],{{1},{2,3}}]; Close[fpDat]; ResetDirectory[]; SetDirectory[NotebookDirectory[]]; fpDat = OpenRead[\"Genas_system_mg1.dat\",BinaryFormat -> True]; z2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; z2 = Flatten[BinaryReadList[fpDat, {\"Real64\"}, z2Len, ByteOrdering->-1]]; t2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; t2 = Flatten[BinaryReadList[fpDat, {\"Real64\"}, t2Len, ByteOrdering->-1]]; r11out2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r11out2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r22out2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r22out2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r33out2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r33out2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r44out2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r44out2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r12reout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r12reout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r12imout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r12imout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r13reout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r13reout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r13imout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r13imout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r14reout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r14reout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r14imout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r14imout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r23reout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r23reout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r23imout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r23imout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r24reout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r24reout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r24imout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r24imout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r34reout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r34reout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; r34imout2Len = BinaryRead[fpDat, \"UnsignedInteger32\", ByteOrdering->-1]; r34imout2 = Flatten[Table[BinaryReadList[fpDat, {\"Real64\"}, t2Len, \ ByteOrdering->-1],{j1,1,z2Len}],{{1},{2,3}}]; Close[fpDat]; ResetDirectory[]; declaredVariables={\"z1\", \"t1\", \"Exreout1\", \"Eximout1\", \"Eyreout1\", \ \"Eyimout1\", \"z2\", \"t2\", \"r11out2\", \"r22out2\", \"r33out2\", \ \"r44out2\", \"r12reout2\", \"r12imout2\", \"r13reout2\", \"r13imout2\", \ \"r14reout2\", \"r14imout2\", \"r23reout2\", \"r23imout2\", \"r24reout2\", \ \"r24imout2\", \"r34reout2\", \"r34imout2\"} \ \>", "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"Exout1", "=", RowBox[{"Exreout1", "+", RowBox[{"\[ImaginaryI]", " ", "Eximout1"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Eyout1", "=", RowBox[{"Eyreout1", "+", RowBox[{"\[ImaginaryI]", " ", "Eyimout1"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{"ListAnimate", "@", RowBox[{"Table", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"intens", "=", RowBox[{ RowBox[{ RowBox[{".5", " ", SuperscriptBox["10", RowBox[{"-", "7"}]], RowBox[{"Abs", "[", "#", "]"}]}], "&"}], "/@", RowBox[{"Transpose", "@", RowBox[{"{", RowBox[{ RowBox[{"Exout1", "[", RowBox[{"[", RowBox[{"All", ",", "i"}], "]"}], "]"}], ",", RowBox[{"Eyout1", "[", RowBox[{"[", RowBox[{"All", ",", "i"}], "]"}], "]"}]}], "}"}]}]}]}], ";", "\[IndentingNewLine]", RowBox[{"mask", "=", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"#", "<", ".1"}], ",", "Null", ",", "1"}], "]"}], "&"}], "/@", RowBox[{"intens", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"alep", "=", RowBox[{ RowBox[{ RowBox[{"AngleEllipticity", "[", RowBox[{"#", ",", "ComplexAmplitude"}], "]"}], "&"}], "/@", RowBox[{"Transpose", "@", RowBox[{"{", RowBox[{ RowBox[{"Exout1", "[", RowBox[{"[", RowBox[{"All", ",", "i"}], "]"}], "]"}], ",", RowBox[{"Eyout1", "[", RowBox[{"[", RowBox[{"All", ",", "i"}], "]"}], "]"}]}], "}"}]}]}]}], ";", RowBox[{"ListLinePlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"{", RowBox[{"z1", ",", RowBox[{"mask", " ", RowBox[{"alep", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}]}], "}"}], "]"}], ",", RowBox[{"Transpose", "[", RowBox[{"{", RowBox[{"z1", ",", RowBox[{"intens", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], "}"}], "]"}]}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "\[Pi]"}], "/", "2"}], ",", RowBox[{"\[Pi]", "/", "2"}]}], "}"}]}]}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "t1", "]"}], ",", "1"}], "}"}]}], "]"}]}]}], "Input"] }, Open ]] }, WindowSize->{844, 920}, WindowMargins->{{-4, Automatic}, {2, Automatic}}, ShowSelection->True, 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, 66, 0, 71, "Section"], Cell[636, 24, 194, 7, 31, "Input"], Cell[833, 33, 388, 13, 57, "Input"], Cell[1224, 48, 194, 7, 31, "Input"], Cell[1421, 57, 388, 13, 57, "Input"], Cell[1812, 72, 403, 14, 52, "Input"], Cell[2218, 88, 342, 11, 49, "Input"], Cell[2563, 101, 582, 19, 52, "Input"], Cell[3148, 122, 807, 25, 72, "Input"], Cell[3958, 149, 602, 20, 52, "Input"], Cell[4563, 171, 543, 17, 83, "Input"], Cell[5109, 190, 524, 17, 31, "Input"], Cell[5636, 209, 431, 13, 52, "Input"], Cell[6070, 224, 413, 12, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[6520, 241, 37, 0, 71, "Section"], Cell[6560, 243, 5029, 84, 1017, "Input"], Cell[11592, 329, 2767, 83, 177, "Input"] }, Open ]] } ] *) (* End of internal cache information *)