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 60.

fnames=FileNames["*","/Volumes/PBC/SES/Pulse\ 60/Images"];

Length[fnames]

We need to find which images use the external light versus the internal ring light.

fnames[[300;;310]]

The first 304 images use the external light.

fnames[[82]]

image=Import[fnames[[200]]]

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[fnames[[#]]],"MeanIntensity"]&/@Range[1,304];

ListPlot[meanInts[[1;;304]],PlotRange->All]

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

image=Import[fnames[[304]]]

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,{DataRange->{0,152},PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},FrameLabel->{{"Light Attenuation (%)",""},{"Time (days)","SES Sediment Quantity"}}}]

laplot=DateListPlot[scaledMeanInts 100,{{2012,6,10},Automatic,{0,0,0,12,0,0}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},FrameLabel->{{"Light Attenuation (%)",""},{"Time (month in 2012)","SES Sediment Quantity"}}}]

Clear[flux]

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

flux=Import["/Users/mcgill/Documents/My\ Projects/Pelagic-Benthic\ Coupling/Pulse\ 60/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,PlotStyle->RGBColor[0,0,0.7],ImagePadding->60,BaseStyle->{FontWeight->"Normal",FontSize->14},Frame->{True,True,True,False},FrameStyle->{Automatic,RGBColor[0,0,0.7],Automatic,Automatic},FrameLabel->{{"Light Attenuation (%)",""},{"Time (month in 2012)","SES Sediment Quantity"}},Joined->True,PlotRange->{{{2012,6,10},{2012,11,12}},{0,100}},ImageSize->Large]

plot2=DateListPlot[flux[[All,{1,2}]],PlotStyle->RGBColor[0.7,0,0],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,RGBColor[0.7,0,0]},FrameLabel->{{"","Mass Flux (mg/(m^2)/day"},{"",""}},Joined->False,PlotRange->{{{2012,6,10},{2012,11,12}},{0,1000}},ImageSize->Large]

comboplot=Overlay[{plot1,plot2}]

Export["newcomboplot.pdf",comboplot]