(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 8.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 40075, 921] NotebookOptionsPosition[ 39032, 882] NotebookOutlinePosition[ 39409, 899] CellTagsIndexPosition[ 39366, 896] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Solar Limb darkening analysis", "Title", CellChangeTimes->{{3.526466983509647*^9, 3.5264670026845827`*^9}}], Cell["Basic functions ", "Subtitle", CellChangeTimes->{{3.526466974372745*^9, 3.526466981720312*^9}}], Cell[TextData[StyleBox["Open video file (fileName) in directory \ (directoryName) and import frame (frameNumber) as an array", FontSize->16]], "Text", CellChangeTimes->{{3.526467019716639*^9, 3.5264670548319473`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"singleFrameData", "[", RowBox[{"directoryName_", ",", "fileName_", ",", "frameNumber_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"f", ",", "fd", ",", "ia"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"f", " ", "=", " ", RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", "frameNumber", "}"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fd", " ", "=", " ", RowBox[{"ImageData", "[", "f", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ia", " ", "=", " ", RowBox[{"fd", "[", RowBox[{"[", RowBox[{";;", ",", ";;", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "ia", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.526359693716226*^9, 3.526359771330778*^9}, { 3.526360616084709*^9, 3.526360634916502*^9}, {3.526360677043906*^9, 3.526360685283589*^9}, {3.526465959936603*^9, 3.526465970703248*^9}, { 3.526466612585948*^9, 3.526466615024337*^9}, {3.5264760469354877`*^9, 3.526476143778689*^9}, {3.526749946326825*^9, 3.526749946704349*^9}, { 3.5267653649437943`*^9, 3.526765370368039*^9}}], Cell[TextData[StyleBox["Define rectangular area of interest using x0, x1, y0, \ y1 sliders and frameNumber slider ", FontSize->16]], "Text", CellChangeTimes->{{3.526467019716639*^9, 3.5264670548319473`*^9}, { 3.5264671045777483`*^9, 3.52646713235019*^9}, {3.526745385364805*^9, 3.5267453859753237`*^9}, {3.526764935909523*^9, 3.526764936519415*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"defineAreaOfInterest", "[", RowBox[{"directoryName_", ",", "fileName_"}], "]"}], " ", ":=", " ", RowBox[{"Manipulate", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "fd", ",", "nf", ",", "nb", ",", "ix", ",", "iy", ",", "aoiArea", ",", "id", ",", "ida", ",", "ias", ",", "iaa", ",", "iam", ",", "ig", ",", "rg", ",", "fnText", ",", "x0Text", ",", "x1Text", ",", "y0Text", ",", "y1Text", ",", "sText", ",", "aText", ",", "mText"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"fd", " ", "=", " ", RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", "frameNumber", "}"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nf", " ", "=", " ", RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nb", " ", "=", " ", RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ix", " ", "=", " ", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iy", " ", "=", " ", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"aoiArea", " ", "=", " ", RowBox[{"yw", "*", "xw"}]}], ";", "\[IndentingNewLine]", RowBox[{"id", " ", "=", " ", RowBox[{"ImageData", "[", "fd", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ida", " ", "=", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"2", "^", "nb"}], "-", "1"}], ")"}], "*", RowBox[{"id", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"iy", "-", RowBox[{"IntegerPart", "[", RowBox[{"y0", "+", "yw", "-", "1"}], "]"}]}], ";;", RowBox[{"iy", "-", RowBox[{"IntegerPart", "[", "y0", "]"}]}]}], ",", RowBox[{ RowBox[{"IntegerPart", "[", "x0", "]"}], ";;", RowBox[{"IntegerPart", "[", RowBox[{"x0", "+", "xw", "-", "1"}], "]"}]}], ",", "1"}], "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"ias", " ", "=", " ", RowBox[{"Total", "[", RowBox[{"Total", "[", "ida", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iaa", " ", "=", " ", RowBox[{"ias", "/", "aoiArea"}]}], ";", "\[IndentingNewLine]", RowBox[{"iam", " ", "=", " ", RowBox[{"Max", "[", "ida", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ig", " ", "=", " ", RowBox[{"Image", "[", RowBox[{"id", ",", RowBox[{"ImageSize", "\[Rule]", "ix"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rg", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{ RowBox[{"EdgeForm", "[", "Dashed", "]"}], ",", "Pink", ",", RowBox[{"FaceForm", "[", RowBox[{"Directive", "[", RowBox[{ RowBox[{"Opacity", "[", "0.2", "]"}], ",", RowBox[{"Hue", "[", "aoiHue", "]"}]}], "]"}], "]"}], ",", RowBox[{"Rectangle", "[", RowBox[{ RowBox[{"{", RowBox[{"x0", ",", "y0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"x0", "+", "xw"}], ",", RowBox[{"y0", "+", "yw"}]}], "}"}]}], "]"}]}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fnText", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", "frameNumber", "]"}], ",", "\"\\"", ",", RowBox[{"ToString", "[", "nf", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "10"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"x0Text", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", "x0", "]"}], ",", "\"\\"", ",", RowBox[{"ToString", "[", "ix", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "30"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"x1Text", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", RowBox[{"x0", "+", "xw"}], "]"}], ",", "\"\\"", ",", RowBox[{"ToString", "[", "ix", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "50"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"y0Text", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", "y0", "]"}], ",", "\"\\"", ",", RowBox[{"ToString", "[", "iy", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "70"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"y1Text", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", RowBox[{"y0", "+", "yw"}], "]"}], ",", "\"\\"", ",", RowBox[{"ToString", "[", "iy", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "90"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"sText", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", "ias", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "110"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"aText", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", "iaa", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "130"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"mText", " ", "=", " ", RowBox[{"Graphics", "[", RowBox[{"Text", "[", RowBox[{ RowBox[{"Style", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"ToString", "[", "iam", "]"}]}], "}"}], "]"}], ",", RowBox[{"Hue", "[", "legendHue", "]"}], ",", "18"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"ix", "-", "150"}], ",", RowBox[{"iy", "-", "150"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Show", "[", RowBox[{ "ig", ",", "rg", ",", "fnText", ",", "x0Text", ",", "x1Text", ",", "y0Text", ",", "y1Text", ",", "sText", ",", "aText", ",", "mText"}], "]"}]}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"x0", ",", "10", ",", "\"\\""}], "}"}], ",", "1", ",", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ",", "1"}], "}"}], ",", " ", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xw", ",", "50", ",", " ", "\"\\""}], "}"}], ",", "1", ",", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ",", "1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"y0", ",", "10", ",", " ", "\"\\""}], "}"}], ",", "1", ",", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], ",", "1"}], "}"}], ",", " ", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"yw", ",", "50", ",", " ", "\"\\""}], "}"}], ",", "1", ",", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], ",", "1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"frameNumber", ",", "1", ",", "\"\\""}], "}"}], ",", "1", ",", RowBox[{"Import", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"directoryName", ",", "fileName"}], "]"}], ",", RowBox[{"{", "\"\\"", "}"}]}], "]"}], ",", "1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"legendHue", ",", "0.9", ",", "\"\\""}], "}"}], ",", "0", ",", "1", ",", "0.01"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"aoiHue", ",", "0.9", ",", "\"\\""}], "}"}], ",", "0", ",", "1", ",", "0.01"}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.5263608462884808`*^9, 3.5263608916442842`*^9}, { 3.52636097500266*^9, 3.5263609918504963`*^9}, {3.5263610377056313`*^9, 3.526361058417708*^9}, {3.5263611274301*^9, 3.526361158519658*^9}, { 3.5263612100487347`*^9, 3.526361241124035*^9}, {3.526465736046136*^9, 3.526465737284853*^9}, {3.5264672152585707`*^9, 3.526467218664089*^9}, { 3.5264682697709846`*^9, 3.526468290689848*^9}, 3.5264697854389553`*^9, { 3.526475412472126*^9, 3.526475420332684*^9}, {3.526475465236576*^9, 3.526475538260063*^9}, {3.526475586595085*^9, 3.5264757516948977`*^9}, 3.5264757825996857`*^9, {3.526475871445801*^9, 3.526475908004321*^9}, { 3.52647595516676*^9, 3.526475956974044*^9}, {3.52647656886331*^9, 3.526476619167657*^9}, {3.5264767171968603`*^9, 3.5264767303323793`*^9}, { 3.526476858722321*^9, 3.526476939464673*^9}, {3.5264770237773848`*^9, 3.5264770589501038`*^9}, {3.526745851080757*^9, 3.526745866161085*^9}, { 3.526746255032112*^9, 3.526746478734589*^9}, {3.526746595165194*^9, 3.5267469302837057`*^9}, {3.526747026144906*^9, 3.526747047241795*^9}, { 3.5267471988127823`*^9, 3.52674730609921*^9}, {3.526751127176969*^9, 3.526751153049156*^9}, {3.526751190122527*^9, 3.52675120511447*^9}, { 3.526751265608671*^9, 3.52675131659797*^9}, {3.5267534607904167`*^9, 3.526753690857852*^9}, {3.526753764031619*^9, 3.5267537852534943`*^9}, { 3.526754410121126*^9, 3.526754438623217*^9}, {3.526754792550577*^9, 3.526754862586238*^9}, {3.526754909932671*^9, 3.52675491622821*^9}, { 3.52675495257026*^9, 3.526754966714293*^9}, {3.5267550423612957`*^9, 3.5267551884150143`*^9}, {3.5267555965356913`*^9, 3.526755613548963*^9}, { 3.526765396300909*^9, 3.526765432762697*^9}, {3.527005695041265*^9, 3.527005698733745*^9}, {3.527101541518216*^9, 3.527101552286124*^9}, { 3.527101648595121*^9, 3.527101654351392*^9}, {3.527101765973013*^9, 3.5271017981445932`*^9}, {3.527102617403015*^9, 3.5271026211846247`*^9}}], Cell[TextData[StyleBox["Extract sum of all pixels in area of interest for all \ frames and return as an array \nUsage : \nIn[N]:= r = videoData[\ \[OpenCurlyDoubleQuote]fileDirectory\[CloseCurlyDoubleQuote],\ \[CloseCurlyDoubleQuote]fileName\[CloseCurlyDoubleQuote],x0,xw,y0,yw]\n\nx0 \ is the box horizontal lower left corner\nxw is the horizontal box width\ny0 \ is the box vertical lower left corner\nyw is the vertical box width\nr is a \ list of lists \nr[[1]] is an array of frame numbers \nr[[2]] is an array of \ pixel values summed in an area\nr[[3]] is the average pixel value\nr[[4]] is \ the average pixel RMS value\nr[[5]] is the maximum pixel value", FontSize->16]], "Text", CellChangeTimes->{{3.526467019716639*^9, 3.5264670548319473`*^9}, { 3.5264671045777483`*^9, 3.52646713235019*^9}, {3.526467165528922*^9, 3.526467185190151*^9}, {3.5267643984475517`*^9, 3.5267645889682198`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"videoData", "[", RowBox[{ "directoryName_", ",", " ", "fileName_", ",", "x0_", ",", "xw_", ",", "y0_", ",", "yw_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ "info", ",", "nfames", ",", "imagesize", ",", "nb", ",", "encoding", ",", "i", ",", "fd", ",", "id", ",", "ida", ",", "ias", ",", "iaa", ",", "iae", ",", "iam", ",", "fna", ",", "iasa", ",", "iaaa", ",", "iaea", ",", "iama"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"dn", " ", "=", RowBox[{"SetDirectory", "[", "directoryName", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"info", " ", "=", " ", RowBox[{"Import", "[", RowBox[{"fileName", ",", RowBox[{"{", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", " ", "\"\\"", ",", "\"\\""}], "}"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nfames", " ", "=", " ", RowBox[{"info", "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"imagesize", " ", "=", " ", RowBox[{"info", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ix", " ", "=", " ", RowBox[{"imagesize", "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iy", " ", "=", RowBox[{"imagesize", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nb", "=", " ", RowBox[{"info", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"encoding", " ", "=", " ", RowBox[{"info", "[", RowBox[{"[", "4", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fna", " ", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"iasa", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"iaaa", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"iaea", " ", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"iama", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<", "nfames"}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"fd", " ", "=", " ", RowBox[{"Import", "[", RowBox[{"fileName", ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", "i", "}"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"id", " ", "=", " ", RowBox[{"ImageData", "[", "fd", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ida", " ", "=", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"2", "^", "nb"}], "-", "1"}], ")"}], "*", RowBox[{"id", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"iy", "-", RowBox[{"IntegerPart", "[", RowBox[{"y0", "+", "yw", "-", "1"}], "]"}]}], ";;", RowBox[{"iy", "-", RowBox[{"IntegerPart", "[", "y0", "]"}]}]}], ",", RowBox[{ RowBox[{"IntegerPart", "[", "x0", "]"}], ";;", RowBox[{"IntegerPart", "[", RowBox[{"x0", "+", "xw", "-", "1"}], "]"}]}], ",", "1"}], "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"ias", " ", "=", " ", RowBox[{"Total", "[", RowBox[{"Total", "[", "ida", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iaa", " ", "=", " ", RowBox[{"ias", "/", RowBox[{"(", RowBox[{"xw", "*", "yw"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"iae", " ", "=", " ", RowBox[{ RowBox[{"StandardDeviation", "[", RowBox[{"Flatten", "[", "ida", "]"}], "]"}], "/", RowBox[{"(", RowBox[{"xw", "*", "yw"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"iam", " ", "=", " ", RowBox[{"Max", "[", "ida", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Print", "[", RowBox[{"StringJoin", "[", RowBox[{"{", RowBox[{ RowBox[{"ToString", "[", "i", "]"}], ",", "\"\< \>\"", ",", RowBox[{"ToString", "[", "ias", "]"}], ",", "\"\< \>\"", ",", RowBox[{"ToString", "[", "iaa", "]"}], ",", "\"\< \>\"", ",", RowBox[{"ToString", "[", "iae", "]"}], ",", "\"\< \>\"", ",", RowBox[{"ToString", "[", "iam", "]"}]}], "}"}], "]"}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", RowBox[{"fna", " ", "=", RowBox[{"Append", "[", RowBox[{"fna", ",", "i"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iasa", " ", "=", " ", RowBox[{"Append", "[", RowBox[{"iasa", ",", "ias"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iaaa", " ", "=", " ", RowBox[{"Append", "[", RowBox[{"iaaa", ",", "iaa"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iaea", " ", "=", RowBox[{"Append", "[", RowBox[{"iaea", ",", "iae"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"iama", " ", "=", " ", RowBox[{"Append", "[", RowBox[{"iama", ",", "iam"}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], " ", "\[IndentingNewLine]", RowBox[{"ListPlot", "[", "iaaa", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", RowBox[{"{", RowBox[{"fna", ",", "iasa", ",", "iaaa", ",", "iaea", ",", "iama"}], "}"}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.526311983781466*^9, 3.5263121144740963`*^9}, { 3.526312146120549*^9, 3.526312149517886*^9}, {3.5263122721017857`*^9, 3.52631227530824*^9}, {3.526312329806038*^9, 3.526312440723114*^9}, { 3.526312502330558*^9, 3.526312587282999*^9}, {3.526312631906599*^9, 3.526312645962261*^9}, {3.526325728145041*^9, 3.526325730309681*^9}, { 3.52635945918217*^9, 3.526359653802185*^9}, {3.526359691913735*^9, 3.526359692312111*^9}, {3.526359965170745*^9, 3.5263599722718487`*^9}, { 3.526474713488558*^9, 3.526474721427114*^9}, {3.526474762918231*^9, 3.526474776661268*^9}, {3.5267552724063683`*^9, 3.5267553927071733`*^9}, { 3.526755490713888*^9, 3.526755564842408*^9}, {3.5267556530001907`*^9, 3.526755654574613*^9}, {3.526755693345525*^9, 3.526755693457026*^9}, 3.52675574095505*^9, 3.526755772945367*^9, {3.526755810594314*^9, 3.526755915883833*^9}, {3.526755993634286*^9, 3.526756040000311*^9}, { 3.526756071511467*^9, 3.526756119512429*^9}, {3.5267561543995132`*^9, 3.526756182623579*^9}, {3.526756397716611*^9, 3.526756486650045*^9}, { 3.526756681831905*^9, 3.526756684496833*^9}, {3.526763680069564*^9, 3.5267637769426928`*^9}, {3.526763867016679*^9, 3.52676388580077*^9}, { 3.526764089173752*^9, 3.526764180180565*^9}, {3.526764230607728*^9, 3.526764288465686*^9}, {3.526764616875581*^9, 3.52676462133305*^9}, 3.527101928622962*^9, {3.5271024036247787`*^9, 3.5271024219540567`*^9}, { 3.527102647661047*^9, 3.5271026507520313`*^9}}], Cell[BoxData[""], "Input", CellChangeTimes->{{3.526764279242537*^9, 3.526764283517514*^9}}], Cell[CellGroupData[{ Cell["Examples", "Subtitle", CellChangeTimes->{{3.526466960182383*^9, 3.5264669896824217`*^9}, { 3.526475375178124*^9, 3.526475376832858*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"defineAreaOfInterest", "[", RowBox[{ "\"\\"", ",", "\"\\""}], "]"}]], "Input", CellChangeTimes->{{3.526360819988871*^9, 3.526360820925609*^9}, { 3.526361000603359*^9, 3.5263610052734833`*^9}, {3.526475545102441*^9, 3.526475553126853*^9}, 3.526475773969553*^9, {3.5267428238223133`*^9, 3.5267428268182096`*^9}, {3.526755575140973*^9, 3.5267555811010637`*^9}, 3.526756265679875*^9}], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`aoiHue$$ = 0.9, $CellContext`frameNumber$$ = 1, $CellContext`legendHue$$ = 0.9, $CellContext`x0$$ = 10, $CellContext`xw$$ = 1, $CellContext`y0$$ = 10, $CellContext`yw$$ = 1, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`x0$$], 10, "x start"}, 1, 640, 1}, {{ Hold[$CellContext`xw$$], 50, "x width"}, 1, 640, 1}, {{ Hold[$CellContext`y0$$], 10, "y start"}, 1, 480, 1}, {{ Hold[$CellContext`yw$$], 50, "y width"}, 1, 480, 1}, {{ Hold[$CellContext`frameNumber$$], 1, "frame number"}, 1, 147, 1}, {{ Hold[$CellContext`legendHue$$], 0.9, "legend color"}, 0, 1, 0.01}, {{ Hold[$CellContext`aoiHue$$], 0.9, "area color"}, 0, 1, 0.01}}, Typeset`size$$ = {640., {238., 242.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`x0$14122$$ = 0, $CellContext`xw$14123$$ = 0, $CellContext`y0$14124$$ = 0, $CellContext`yw$14125$$ = 0, $CellContext`frameNumber$14126$$ = 0, $CellContext`legendHue$14127$$ = 0, $CellContext`aoiHue$14128$$ = 0}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`aoiHue$$ = 0.9, $CellContext`frameNumber$$ = 1, $CellContext`legendHue$$ = 0.9, $CellContext`x0$$ = 10, $CellContext`xw$$ = 50, $CellContext`y0$$ = 10, $CellContext`yw$$ = 50}, "ControllerVariables" :> { Hold[$CellContext`x0$$, $CellContext`x0$14122$$, 0], Hold[$CellContext`xw$$, $CellContext`xw$14123$$, 0], Hold[$CellContext`y0$$, $CellContext`y0$14124$$, 0], Hold[$CellContext`yw$$, $CellContext`yw$14125$$, 0], Hold[$CellContext`frameNumber$$, $CellContext`frameNumber$14126$$, 0], Hold[$CellContext`legendHue$$, $CellContext`legendHue$14127$$, 0], Hold[$CellContext`aoiHue$$, $CellContext`aoiHue$14128$$, 0]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`fd$, $CellContext`nf$, $CellContext`nb$, \ $CellContext`ix$, $CellContext`iy$, $CellContext`aoiArea$, $CellContext`id$, \ $CellContext`ida$, $CellContext`ias$, $CellContext`iaa$, $CellContext`iam$, \ $CellContext`ig$, $CellContext`rg$, $CellContext`fnText$, \ $CellContext`x0Text$, $CellContext`x1Text$, $CellContext`y0Text$, \ $CellContext`y1Text$, $CellContext`sText$, $CellContext`aText$, \ $CellContext`mText$}, $CellContext`fd$ = Import[ StringJoin[ "/Users/sboogert/Teaching/PH3010/SolarLimbDarkening/", "NoFilter_350.avi"], { "Frames", {$CellContext`frameNumber$$}}]; $CellContext`nf$ = Import[ StringJoin[ "/Users/sboogert/Teaching/PH3010/SolarLimbDarkening/", "NoFilter_350.avi"], {"FrameCount"}]; $CellContext`nb$ = Import[ StringJoin[ "/Users/sboogert/Teaching/PH3010/SolarLimbDarkening/", "NoFilter_350.avi"], {"BitDepth"}]; $CellContext`ix$ = Part[ Import[ StringJoin[ "/Users/sboogert/Teaching/PH3010/SolarLimbDarkening/", "NoFilter_350.avi"], {"ImageSize"}], 1]; $CellContext`iy$ = Part[ Import[ StringJoin[ "/Users/sboogert/Teaching/PH3010/SolarLimbDarkening/", "NoFilter_350.avi"], {"ImageSize"}], 2]; $CellContext`aoiArea$ = $CellContext`yw$$ $CellContext`xw$$; \ $CellContext`id$ = ImageData[$CellContext`fd$]; $CellContext`ida$ = (2^$CellContext`nb$ - 1) Part[$CellContext`id$, Span[$CellContext`iy$ - IntegerPart[$CellContext`y0$$ + $CellContext`yw$$ - 1], $CellContext`iy$ - IntegerPart[$CellContext`y0$$]], Span[ IntegerPart[$CellContext`x0$$], IntegerPart[$CellContext`x0$$ + $CellContext`xw$$ - 1]], 1]; $CellContext`ias$ = Total[ Total[$CellContext`ida$]]; $CellContext`iaa$ = \ $CellContext`ias$/$CellContext`aoiArea$; $CellContext`iam$ = Max[$CellContext`ida$]; $CellContext`ig$ = Image[$CellContext`id$, ImageSize -> $CellContext`ix$]; $CellContext`rg$ = Graphics[{ EdgeForm[Dashed], Pink, FaceForm[ Directive[ Opacity[0.2], Hue[$CellContext`aoiHue$$]]], Rectangle[{$CellContext`x0$$, $CellContext`y0$$}, \ {$CellContext`x0$$ + $CellContext`xw$$, $CellContext`y0$$ + \ $CellContext`yw$$}]}]; $CellContext`fnText$ = Graphics[ Text[ Style[ StringJoin[{"Frame :", ToString[$CellContext`frameNumber$$], "/", ToString[$CellContext`nf$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 10}]]; $CellContext`x0Text$ = Graphics[ Text[ Style[ StringJoin[{"x0 : ", ToString[$CellContext`x0$$], "/", ToString[$CellContext`ix$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 30}]]; $CellContext`x1Text$ = Graphics[ Text[ Style[ StringJoin[{"x1 : ", ToString[$CellContext`x0$$ + $CellContext`xw$$], "/", ToString[$CellContext`ix$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 50}]]; $CellContext`y0Text$ = Graphics[ Text[ Style[ StringJoin[{"y0 : ", ToString[$CellContext`y0$$], "/", ToString[$CellContext`iy$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 70}]]; $CellContext`y1Text$ = Graphics[ Text[ Style[ StringJoin[{"y1 : ", ToString[$CellContext`y0$$ + $CellContext`yw$$], "/", ToString[$CellContext`iy$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 90}]]; $CellContext`sText$ = Graphics[ Text[ Style[ StringJoin[{"sum : ", ToString[$CellContext`ias$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 110}]]; $CellContext`aText$ = Graphics[ Text[ Style[ StringJoin[{"ave : ", ToString[$CellContext`iaa$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 130}]]; $CellContext`mText$ = Graphics[ Text[ Style[ StringJoin[{"max : ", ToString[$CellContext`iam$]}], Hue[$CellContext`legendHue$$], 18], {$CellContext`ix$ - 150, $CellContext`iy$ - 150}]]; Show[$CellContext`ig$, $CellContext`rg$, $CellContext`fnText$, \ $CellContext`x0Text$, $CellContext`x1Text$, $CellContext`y0Text$, \ $CellContext`y1Text$, $CellContext`sText$, $CellContext`aText$, \ $CellContext`mText$]], "Specifications" :> {{{$CellContext`x0$$, 10, "x start"}, 1, 640, 1}, {{$CellContext`xw$$, 50, "x width"}, 1, 640, 1}, {{$CellContext`y0$$, 10, "y start"}, 1, 480, 1}, {{$CellContext`yw$$, 50, "y width"}, 1, 480, 1}, {{$CellContext`frameNumber$$, 1, "frame number"}, 1, 147, 1}, {{$CellContext`legendHue$$, 0.9, "legend color"}, 0, 1, 0.01}, {{$CellContext`aoiHue$$, 0.9, "area color"}, 0, 1, 0.01}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{683., {391., 397.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{3.527102473652164*^9, 3.527102628982773*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"r", " ", "=", " ", RowBox[{"videoData", "[", RowBox[{ "\"\\"", ",", "\"\\"", ",", "288", ",", "50", ",", "59", ",", "50"}], "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.5267556351437893`*^9, 3.526755639949149*^9}, { 3.526756491054833*^9, 3.526756491430386*^9}, {3.527101975241119*^9, 3.5271019806206083`*^9}, 3.527102252968178*^9}], Cell[BoxData[ RowBox[{"Export", "[", RowBox[{ "\"\\"\ ", ",", RowBox[{"Transpose", "[", "r", "]"}], ",", "\"\\""}], "]"}]], "Input",\ CellChangeTimes->{{3.526764751677548*^9, 3.526764759682597*^9}, { 3.526764799906095*^9, 3.526764829528962*^9}, {3.526764861538349*^9, 3.5267648624494877`*^9}, {3.526764913612342*^9, 3.526764918606991*^9}}], Cell[BoxData[ RowBox[{"r", "[", RowBox[{"[", "3", "]"}], "]"}]], "Input", CellChangeTimes->{{3.527102065588174*^9, 3.527102073106615*^9}, { 3.527102146794462*^9, 3.527102147906188*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{"r", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.527102158440338*^9, 3.527102167537327*^9}}], Cell[BoxData[ GraphicsBox[{{}, {Hue[0.67, 0.6, 0.6], PointBox[CompressedData[" 1:eJxd1V9MjWEcB/CDNidrScJBh8OipLWiCOGJ/I0khZKcEjK2XDBM47Wdpjas tWxYtjM7F25sbVxkna3Xaq2ZSxflT1464iJbrE2bLvD7/r4uTtvp2afv+32e 87697/ssq20oPTXd5XK1/f38G/EzvvXfb5M2aPQPMpq4IbVbRquJTsBY8Vad JKMd+07tgWe9VydjzPug9mGsHFYvxzjTUafI6Ev/oV4p48DT+AI4LcrpYmfZ XHWGOFKepM4U306dp84Sl4XpbHHjw/nqNeKQe4F6LfIQnSNuTfOoc8Xhu/Q6 8ZWP9Poo54nfBBaqN4gD/fRG5IsXqTeJg9V0vnjsAb0ZfYfegvM1i9VbMV8F bdB/pLbgmO/MC8TJv5jD/pPJmm8TTzSpLfh+L/PtuB4jzOGSuV7NCzG/V23B KauY7xBP1TOH3S+Y7xR7wsyj7NolDo0zh/OXLtF8t7gxV23BhaeZ70F+izk8 eIf5Xnzfc8zhyQHmReKMCHP49m/m+7Ced6nm8Pl4tWu/OPCLfXhqNvNizL+e fbgwk/kBzLeCOdx1lnmJOLxHbeC+Gh4P599T23DcFfYPYn3OZ+AL19iHnRvs w+Ez7JeKO++wD2c1sR9lGw4/Zv+Q+EmQfXjyJvtwygb24QhzV5k4UMA+7Cln H7b/nz88Ucd+udjdwD4crGcfLitlH3aK2D8sLsxhP8oWXMLvZ8Ndcewfwfwu 9uF6N/twX7fePzZ8MY/331HkX/R9YWC7O1H7cF2uPv82HHOV/QpxZ5vawM5l 3q9wXibXhztmsF8pbn+mz6eB3b18XmHTo7bhwAU+38fECavZh/1x7MMdMezD oWG+n6pwPl1qAzfTFmwXq234eSr7x8VpQ3p9DJzcyfclPNjA6weHsvl+rRZH 8tmHv33V/4cFT11X27Ank+/3E5j/le4XBh5rVltwVZnahvvGuP/4sV6L2gdn JaoNPNmu+50f3vdT90crykE4pl/3UxueiFU78Hkv9+MaHD+q95sP7kqYo+vD ra+n6fqwiR81WB8OeiNwEPa3jMA2bCeqHT3+5WfYVSuj75LaBzvZagObnk/m D7rRRe0= "]]}, {}}, AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948], Axes->True, AxesOrigin->{0, 0}, ImageSize->{594., Automatic}, PlotRange->{{0., 146.}, {0., 518319.}}, PlotRangeClipping->True, PlotRangePadding->{ Scaled[0.02], Scaled[0.02]}]], "Output", CellChangeTimes->{3.527102519450205*^9}] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{991, 712}, WindowMargins->{{53, Automatic}, {Automatic, 0}}, ShowSelection->True, FrontEndVersion->"8.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (February 23, \ 2011)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[579, 22, 114, 1, 76, "Title"], Cell[696, 25, 102, 1, 46, "Subtitle"], Cell[801, 28, 219, 3, 30, "Text"], Cell[1023, 33, 1461, 33, 118, "Input"], Cell[2487, 68, 356, 5, 30, "Text"], Cell[2846, 75, 15331, 358, 583, "Input"], Cell[18180, 435, 906, 12, 277, "Text"], Cell[19089, 449, 7721, 164, 508, "Input"], Cell[26813, 615, 92, 1, 27, "Input"], Cell[CellGroupData[{ Cell[26930, 620, 145, 2, 46, "Subtitle"], Cell[CellGroupData[{ Cell[27100, 626, 502, 9, 27, "Input"], Cell[27605, 637, 8541, 168, 805, "Output"] }, Open ]], Cell[36161, 808, 474, 10, 27, "Input"], Cell[36638, 820, 432, 9, 27, "Input"], Cell[37073, 831, 192, 4, 27, "Input"], Cell[CellGroupData[{ Cell[37290, 839, 179, 4, 27, "Input"], Cell[37472, 845, 1520, 32, 376, "Output"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)