This notebook imports SES images from a single directory and calculates the mean intensity of each image to get a relative measurement of how much sediment was between the light source and the camera. This essentially uses the SES as a transmissometer.

First get all the file names from a directory of images from Pulse 62.

fnames=FileNames["fluoro_ext*","/Volumes/ProjectLibrary/901027.SedimentationEventSensor/Deployments/Deployment.Data/Pulse_62/dep-2013.06.19-01-Pulse-62/fluoro_images"];

Length[fnames]

Check that we’re getting the files we want.

fnames[[;;3]]

fnames[[-3;;]]

Look at a sample image.

fnames[[82]]

image=Import[fnames[[82]]]

Total intensity sums the intensity of each pixel in the image, so the total is a large number.

totalIntensity=ImageMeasurements[image,"TotalIntensity"]

Mean intensity calculates the average intensity over the whole image. White pixels raise the mean, black pixels lower it.

totalIntensity=ImageMeasurements[image,"MeanIntensity"]

We can map the MeanIntensity measurement function over a number of images.

(*meanInts=ImageMeasurements[Import[fnames[[#]]],"MeanIntensity"]&/@Range[41,51]*)

Measure the mean intensity for all of the external light images.

(*meanInts=ImageMeasurements[Import[#],"MeanIntensity"]&/@fnames;*)

Save the data in a file so we don’t have to calculate them again. Use Get[filename] to retrieve the values from the file.

(*Save["/Volumes/ProjectLibrary/901027.SedimentationEventSensor/Data\ Analysis/Pulse\ 62/P62SESmeanInts.dat",meanInts];*)

meanInts=Get["/Volumes/ProjectLibrary/901027.SedimentationEventSensor/Data\ Analysis/Pulse\ 62/P62SESmeanInts.dat"];

ListPlot[meanInts,PlotRange->All]

We want to use the brightest image to establish our scale at 100%.

maxImg=First@First@Position[meanInts,Max@meanInts]

image=Import[fnames[[maxImg]]]

scale=Max[meanInts]

Scale all the brightnesses from 1 being the darkest to 0 being the brightest. This is now a proxy for the quantity of sediment on the sample slide.

scaledMeanInts=1-(meanInts/scale);

Max[scaledMeanInts]

ListPlot[scaledMeanInts,PlotRange->All]

ListPlot[scaledMeanInts 100,{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (days)","Pulse 62 SES Sediment Quantity"}}}]

laplot=DateListPlot[scaledMeanInts 100,{{2013,6,20,4,39,17},{2014,2,5,18,44,24}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Years 2013–2014)","Pulse 62 SES Sediment Quantity"}}}]

laplot=DateListPlot[LowpassFilter[scaledMeanInts 100,0.1],{{2013,6,20,4,39,17},{2014,2,5,18,44,24}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Years 2013–2014)","Pulse 62 SES Sediment Quantity\rLow-pass Filtered"}}}]

Clear[flux]

flux=Import["/Users/mcgill/Documents/My\ Projects/Sedimentation\ Event\ Sensor/P60_61\ Sed\ Trap\ Flux.csv"]

flux=Drop[flux,1]

flux=Drop[flux,-1]

flux[[All,{1,2}]]

dates=DateRange[{2012,6,10},{2012,11,8,12},{12,"Hour"}];

Length[dates]

SESP60=Partition[Riffle[dates,scaledMeanInts 100],2];

SESP60[[1;;10]]

plot1=DateListPlot[SESP60,ImagePadding->60,BaseStyle->{FontWeight->"Normal",FontSize->14},Frame->{True,True,True,False},FrameStyle->{Automatic,ColorData[1,1],Automatic,Automatic},FrameLabel->{{"Light Attenuation (%)",""},{"Time (month in 2012)","Pulse 60 SES Sediment Quantity"}},Joined->True,PlotRange->{{{2012,6,10},{2012,11,12}},{0,100}},ImageSize->Large]

plot2=DateListPlot[flux[[All,{1,2}]],PlotStyle->ColorData[1,11],PlotMarkers->{Automatic,Medium},ImagePadding->60,BaseStyle->{FontWeight->"Normal",FontSize->14},Axes->False,Frame->{False,False,False,True},FrameTicks->{None,None,None,All},FrameStyle->{Automatic,Automatic,Automatic,ColorData[1,11]},FrameLabel->{{"","Mass Flux (mg/(m^2)/day"},{"",""}},PlotRange->{{{2012,6,10},{2012,11,12}},{0,1000}},ImageSize->Large]

comboplot=Overlay[{plot1,plot2}]

Export["comboplot.pdf",comboplot]