Droplet Source Data Form

Collect Raw Data

rawdata=(({{"Angle (°)", "Signal (mV)", "±", "Pick-Off (V)", Gain (mV nA)}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}}));

blankdata=(({{"Angle (°)", "Signal (mV)", "±", "Pick-Off (V)", Gain (mV nA)}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder]}}));

Process Raw Data

<<Graphics`MultipleListPlot`

rawdata = Select[rawdata, NumberQ[#1[[1]]] &];   
\(newdata = \({#1[\([1]\)], N[\(#1[\([2]\)]*#1[\([5]\)]\)\/#1[\([4]\)]], 
            N[\(#1[\([3]\)]*#1[\([5]\)]\)\/#1[\([4]\)]]} &\) /@ 
        rawdata; \  (*\ 
      Divide\ through\ by\ pick\ off\ and\ multiply\ by\ gain\ *) 
blankdata = 
      Select[blankdata, NumberQ[#1[\([1]\)]] &];\)
\(\(newblank = \({#1[\([1]\)], 
              N[\(#1[\([2]\)]*#1[\([5]\)]\)\/#1[\([4]\)]], 
              N[\(#1[\([3]\)]*#1[\([5]\)]\)\/#1[\([4]\)]]} &\) /@ 
          blankdata;\)
\)
\(\(finaldata = 
        Table[{If[newdata[\([i, 1]\)] == newblank[\([i, 1]\)], 
              newdata[\([i, 1]\)], "Error"], 
            newdata[\([i, 2]\)] - 
              newblank[\([i, 
                  2]\)], \@\(newdata[\([i, 3]\)]\^2 + newblank[\([i, 3]\)]\^2\)}, {i, 1, 
            Min[Length[newdata], 
              Length[newblank]]}];\)\)
\(\(finaldataerror = 
        Table[{{If[newdata[\([i, 1]\)] == newblank[\([i, 1]\)], 
                newdata[\([i, 1]\)], "Error"], 
              newdata[\([i, 2]\)] - newblank[\([i, 2]\)]}, 
            ErrorBar[\@\(newdata[\([i, 3]\)]\^2 + newblank[\([i, 3]\)]\^2\)]}, {i, 1, Min[Length[newdata], Length[newblank]]}];\)\)

Plot Adjusted Data

MultipleListPlot[finaldataerror,SymbolShape -> PlotSymbol[Box],Frame -> True,FrameLabel -> {StyleForm[
                    TraditionalForm["Angle (°)"], 
                    FontSize -> 14], 
                  StyleForm[
                    TraditionalForm["Intensity (arbitrary units)"], 
                    FontSize -> 14]},PlotLabel -> 
                StyleForm[TraditionalForm["Intensity vs. Angle"], 
                  FontSize -> 20]];

Export Data Table

filename = "data.txt";
Export["c:\\documents\\mschubmehl\\" <> filename, 
        finaldata, "Table"];

Import and Plot Results of Fit

\(\(bestfit = 
        Rest[Import["c:\documents\mschubmehl\bestfit.txt", "Table"]];\)\)

\(\(chidist = 
        Import["c:\documents\mschubmehl\chidist.txt", "Table"];\)\)

MultipleListPlot[finaldataerror,bestfit,SymbolShape -> {PlotSymbol[Box], None},Frame -> True,FrameLabel -> {StyleForm[
                  TraditionalForm["Angle (°)"], 
                  FontSize -> 14], 
                StyleForm[TraditionalForm["Intensity (arbitrary units)"], 
                  FontSize -> 14]},PlotLabel -> 
              StyleForm[
                TraditionalForm["Intensity vs. Angle: Data and Theory"], 
                FontSize -> 20],PlotJoined -> {False, True}];

ListPlot[chidist,PlotJoined -> True,Frame -> True,\(FrameLabel -> {StyleForm[
                  TraditionalForm["Size Parameter"], 
                  FontSize -> 14], 
                StyleForm[TraditionalForm[\*""\!\(χ\^2\)""], 
                  FontSize -> 14]}\),PlotLabel -> 
              StyleForm[TraditionalForm["Chi-squared vs Size Parameter"], 
                FontSize -> 20]];