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

fnames=FileNames["StaM_7301_SESext*","/Volumes/ProjectLibrary/901027.SedimentationEventSensor/Deployments/Deployment.Data/Pulse_73/dep-2020.10.28-05-Pulse-73-7301/fluoro_images"];

Length[fnames]

Check that we’re getting the files we want.

fnames[[;;3]]

fnames[[-3;;]]

Look at a sample image.

fnames[[182]]

image=Import[fnames[[182]]]

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["P73meanInts.dat",meanInts];*)

meanInts=Get["P73meanInts.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},FrameLabel->{{"Light Attenuation (%)",""},{"Sample Number","Pulse 73 SES Sediment Quantity"}}}]

laplot=DateListPlot[scaledMeanInts 100,{{2020,10,28,22,6,55},{2021,10,9,18,16,10}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Years 2020–2021)","Pulse 73 SES Sediment Quantity"}}}]

laplot=DateListPlot[LowpassFilter[scaledMeanInts 100,0.1],{{2020,10,28,22,6,55},{2021,10,9,18,16,10}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Years 2020–2021)","Pulse 73 SES Sediment Quantity\rLow-pass Filtered"}}}]

Find the lowpass filter cutoff frequency in samples per day if (Subscript[ω, c]) = 0.1 and sample rate is 12 samples per day.

fc=(0.1/(2 Pi)) 12

Find the cutoff period in days.

(1/fc)

Plot the data with a dynamic lowpass cutoff frequency.

Manipulate[DateListPlot[LowpassFilter[scaledMeanInts 100,omega],{{2020,10,28,22,6,55},{2021,10,9,18,16,10}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Years 2020–2021)","Pulse 73 SES Sediment Quantity\rLow-pass Filtered"}}}],{omega,0.01,Pi}]