Algorithm
The endPoint function requires a single data frame containing a minimum
of two columns: a column containing a time index and a column containing
isotope signal counts. This data frame is supplied to the function as
the argument detectDf with the time index column specified astimeCol and the isotope signal column specified assignalCol . Any element that is abundant within the target but
is scarce in the surrounding medium could be used to detect the ablate
through endpoint time. In a case study below, we use “Ca44” containing
the 44Ca isotope counts per second as the signalCol as
this is abundant within the foraminifera test but is not present in high
quantities in the glass slide used for mounting.
The algorithm of the endPoint function first calculates a simple moving
average over the isotope counts, with the number of points in the moving
average controlled by the smoothing argument. This smoothed
isotope count signal is then scaled between 0 – 1 to convert to
relative changes that works across all time resolved acquisition data
sources. A larger amount of smoothing reduces the variance between
adjacent data points, averaging out any signal spikes and therefore
flattening the signal against time curve. A flatter time resolved
profile curve gives greater distinction between the elevated signal of
desired target ablation and the lower signal of the undesired under- or
adjacent- target surface.
Using smoothing to de-spike and flatten the signal during the time of
elevated signal reduces the magnitude of variance over time and
therefore reduces the likelihood of a false positive detection in a
change of ablated material composition, which is used as part of the
detection in later steps of the algorithm. Over-smoothing the signal
reduces the distinction from a sudden signal drop to a shallower gradual
drop between the higher on-target and the lower off-target signal
intensities that the algorithm uses to detect that the laser is no
longer ablating the desired target causing a delayed detection.
Over-smoothing can be identified manually using the visualisation tools
by comparing the black and blue lines.
Next the algorithm calculates the number of data points per time step in
the data frame supplied. The temporal resolution of the data can affect
how sensitive the algorithm is to the rate of scaled signal change. The
algorithm uses a moving window to calculate the rate of change in signal
against time. Higher temporal resolution data can result in a smoother
decline in isotope signal across the default time window causing a
delayed endpoint detection, therefore using a wider time window captures
a larger magnitude signal drop. The algorithm uses the largest magnitude
of negative rate of isotope signal change to identify that the laser is
no longer on the desired target. Without a rapid signal drop, for
example if the laser did not fully ablate through target or no mineral
boundary was crossed then the algorithm will return the final
observation in the provided data frame and a warning message is
displayed to encourage use of the manual validation tools to check the
results. The number of data points used as the width of the moving
window is controlled by the dt argument.
Once the algorithm has identified the largest magnitude of negative rate
of signal change, the corresponding time stamp is identified. As the
largest signal drop occurs shortly after the laser has ablated through
the sample or crossed a boundary, it is necessary to also remove the
data that occurs between the final data point when the laser was on
target and the largest signal drop. This elapsed time is calculated by
dividing the moving window width by the number of data points per time
step and is subtracted from the signal change time stamp. This earliest
time stamp is when the laser was last ablating on the desired target and
is returned as a numeric value in the returned data frame.
library(lablaster)
endPoint(detectDf, timeCol = ”Time”, signalCol = ”Ca44”, smoothing = 5,
dt = 10, profile = ”FALSE”, timeUnits = ”seconds”)
Visualisation of the blast through
algorithm
The endPoint function additionally provides visualisation tools into the
mechanism of the algorithm. The smoothed scaled signal, rate of change
and inferred bounds on the geochemical target are useful for diagnosing
the real-life efficacy. A ggplot2 object is generated when theprofile argument is set to TRUE. If the profile argument is
TRUE, then the time units of the analysis are also required and
specified with the timeUnits argument.
Returned values
The endPoint function returns a single data frame containing the values
calculated.
$startTime contains the earliest timestep in the supplied time resolved
acquisition as a numerical value.
$endTime contains the last timestep before the laser ablated through
the carbonate shell as described above.
$df contains the supplied data frame with the same structure but
containing only the rows that occur between the startTime and endTime.
$profile contains a visualisation of the endpoint mechanism as
described above. This is only available if a profile was generated using
profile = ”TRUE”.