Skip to content

4. ALPSS Program Workflow

Jake Diamond edited this page Jun 11, 2024 · 9 revisions

Import Data

The first step in ALPSS is to import the necessary data. ALPSS provides the capability to only import a certain domain of time in your signal, increasing program speed by ignoring unnecessary parts of the voltage signal. ALPSS has only been tested importing .txt files with time in column 1 and voltage in column 2. I expect that the import would work fine for a .csv, but this has not been tested.

Locate Region of Interest (ROI)

Locating the region of interest (ROI) is perhaps the most import part of ALPSS. This is done by finding where the spall signal intersects with the carrier band in the binary spectrogram (binarization is performed using Otsu's method, which maximizes the inter-class variance of two groups of pixels). The point of intersection is taken as the "signal start time" and the ROI window is extended around the start time according to user input parameters. The signal start time also marks where ALPSS will begin to filter out the carrier frequency. If the ROI is not selected correctly then nothing else can happen correctly. I have found that the method currently implemented is generally effective for the types of signals we usually see. But more robust methods will have to be developed in the future.

Signal Isolation

Isolating the spall signal consists of two different filtering steps. The first is a band pass filter that zeros the power of all frequencies outside the frequency range of interest specified by the user. This eliminates high frequency noise as well as other noise below the frequency of the carrier band. The second step is to apply a Gaussian notch filter to eliminate the carrier band after the spall signal has started.

Velocity Calculation

Calculation of the velocity is done by differentiating the phase angle of the voltage signal. Information on the derivation of the this process can be found in Mallick et al. Differentiation is done using the 9-point central difference method. After differentiation the signal must be smoothed, for which a Gaussian weighted moving average is used. The user may modify the function to use the smoothing method of their choice, but I have found the Gaussian weighted moving average to work the best in smoothing noise without overly smearing the shock front. Moving median smoothing also works well but is not implemented in ALPSS.

Instantaneous Uncertainty Analysis

The estimated instantaneous velocity uncertainty for all points in the velocity trace is calculated analytically using Eq. (6) in the paper here. In this equation, $f_s$ is the signal sample rate, $\tau$ is the characteristic analysis timescale, $\sigma$ is the standard deviation of the noise in the voltage signal, and $A$ is the instantaneous voltage amplitude. The value of $\frac{\sigma}{A}$ is called the noise fraction. In ALPSS, the noise $\sigma$ is calculated by fitting a perfect sinusoid to a portion of the standing carrier signal. This fitted sine wave is assumed to be the "true" carrier signal and the residuals between the fitted sine and the measured voltage signal are taken to be noise. The standard deviation of the noise (fitting residuals) is $\sigma$ and is constant. The distribution of the noise should be Gaussian for most cases. The signal amplitude $A$ is calculated after all of the filtering is completed. The filtered voltage signal has its top and bottom envelopes extracted and interpolated. At each time point, the instantaneous amplitude $A$ is calculated as half the difference between the top and bottom envelopes. Since $\sigma$ is constant and $A$ varies in time with the filtered voltage amplitude, ALPSS calculates the signal noise fraction for every point in time. It is important to note that this noise fraction is only an estimate and is a best-case limiting value. For a discussion on how close uncertainties get to their limiting values in real analyses, see the paper by Dolan here.

Spall Analysis

In order to calculate the spall strength and strain rate ALPSS must have the peak and pullback velocities from the velocity trace. The peak velocity is taken to be global maximum velocity of the signal. The pullback velocity is the velocity difference between the peak and the local minimum that immediately follows. The local minimum is found using the native scipy peak finding function. Following the first local minimum after the global maximum, ALPSS also locates the following local maximum. This point can be used for calculations involving the damage growth rate, but these types of calculations are not currently implemented in ALPSS.

Global Uncertainty Analysis

To calculate the global uncertainties in the spall strength and strain rate ALPSS follows the method of Mallick et al., which uses the first-order second moment of contributing underlying uncertainties to compute the overall uncertainty. This method requires the user to input several underlying values of uncertainty and should refer to Mallick et al. for a discussion of these values.

Plotting and Saving

Upon completion of the run ALPSS outputs a figure that shows plots for each sub function of the program. This allows the user to quickly assess the accuracy of an analysis or visually diagnose issue when they arise. If the user chooses, ALPSS will also save six files. These files are a plot of the final figure, a table of the function inputs used for the run, the noisy velocity trace, the smoothed velocity trace, the filtered voltage data, and a table of final results. Note, when saving is enabled the program will automatically overwrite any files with the same name in the output directory.

Error Handling

In a case where ALPSS throws an error the program is passed to an exception block where a plot of the imported voltage data and its spectrogram will be displayed along with the error traceback. If even that fails the program will display only the error traceback. For example, if using the sample file and the input t_after is changed to 1500e-9 (exceeding the window of imported data) the following traceback and plot will be displayed:

ValueError: x and y must have same first dimension, but have shapes (87224,) and (87021,)