Plotting Scattering Transforms
1D Plotting Functions
ScatteringPlotsExt.plotZerothLayer1D — Function
plotZerothLayer1D(sf; title="Zeroth Layer", saveTo=nothing, index=1)Function that plots the zeroth layer of the scattering transform at a specified example index.
ScatteringPlotsExt.plotFirstLayer1DSingleWavelet — Function
plotFirstLayer1DSingleWavelet(j, origLoc, origSig; title="First Layer", saveTo=nothing, index=1)The variable j specifies which wavelet results to plot from the first layer, index specifies which example in the batch to plot, origLoc is the ScatteredOut object containing the scattering transform results, and origSig is the original input signal. It also includes heatmaps of the gradient wavelet in both the spatial and frequency domains.
ScatteringPlotsExt.gifFirstLayer1D — Function
gifFirstLayer1D(origLoc, origSig; fps=2, title="First Layer", saveTo=nothing, index=1)Function to create a GIF visualizing all wavelets in the first layer across space for each example in the batch. The variable origLoc is the ScatteredOut object containing the scattering transform results, index specifies which example in the batch to plot, origSig is the original input signal, saveTo specifies the file path to save the GIF, and fps sets the frames per second for the GIF animation. If saveTo is provided, the GIF is saved to that file path. The default fps is set to 2 frames per second.
ScatteringPlotsExt.plotFirstLayer1DAll — Function
plotFirstLayer1DAll(origLoc, origSig; title="First Layer", saveTo=nothing, index=1, cline=:darkrainbow)Function that plots all first layer gradient wavelets for a specific example signal index across space, along with the original signal. It also includes heatmaps of the gradient wavelets in both the spatial and frequency domains. The variable index specifies which example in the batch to plot, origLoc is the ScatteredOut object containing the scattering transform results, origSig is the original input signal, and saveTo is the file path to save the plot.
ScatteringPlotsExt.plotFirstLayer1D — Function
plotFirstLayer1D(stw, St; title="First Layer", saveTo=nothing, index=1)Function that creates a heatmap of the first layer scattering transform results at a specified example index. The variable stw is the scattered output, St is the scattering transform object, saveTo is the file path to save the plot, and index specifies which example in the batch to plot.
ScatteringPlotsExt.plotSecondLayer1DSpecificPath — Function
plotSecondLayer1DSpecificPath(stw, St, firstLayerWaveletIndex, secondLayerWaveletIndex, original; saveTo=nothing, index=1)stw is the scattered output, St is the scattering transform object, firstLayerWaveletIndex and secondLayerWaveletIndex specify the path to plot, original is the original signal, and index specifies which example in the batch to plot. This function creates a plot showing the original signal and the scattering result for the specified path. It also displays the mean frequencies associated with the selected wavelets. Finally, it displays the log-power norm of the second layer signal for the specified path. This value is used elsewhere to create heatmaps of the second layer scattering results.
ScatteringPlotsExt.gifSecondLayer1DSubset — Function
gifSecondLayer1DSubset(stw, St, firstLayerWavelets, secondLayerWavelets, original; fps=2, saveTo=nothing, index=1)Create a GIF visualizing the second layer scattering results for specified subsets of wavelets from the first and second layers. The variables firstLayerWavelets and secondLayerWavelets are arrays containing the indices of the wavelets to be visualized from the first and second layers, respectively. For example, to visualize all the wavelets from the first layer with respect to a specific wavelet from the second layer, you can set firstLayerWavelets = 1:size(stw[1], 2) and secondLayerWavelets = k, where k is the index of the desired second layer wavelet. Once again, the index parameter specifies which example in the batch to plot. It defaults to the first example in the batch. If saveTo is not provided, the GIF is saved to "tmp.gif".
ScatteringPlotsExt.plotSecondLayer1DFixAndVary — Function
plotSecondLayer1DFixAndVary(stw, St, firstLayerWavelets, secondLayerWavelets; fps=2, saveTo=nothing, index=1)Create a GIF visualizing slices of the second layer scattering results by fixing one layer's wavelet and varying the other layer's wavelet. The variables firstLayerWavelets and secondLayerWavelets are arrays containing the indices of the wavelets to be visualized from the first and second layers, respectively. If firstLayerWavelets contains only one index, the function fixes that wavelet and varies the second layer wavelets, and vice versa. If saveTo is not provided, the GIF is saved to "tmp.gif".
ScatteringPlotsExt.plotSecondLayer1D — Function
plotSecondLayer1D(stw, St; saveTo=nothing, index=1, title="Second Layer results", xVals=-1, yVals=-1, logPower=true, toHeat=nothing, c=cgrad(:viridis, [0,.9]), threshold=0, linePalette=:greys, minLog=NaN, kwargs...)TODO fix the similarity of these names. xVals and yVals give the spacing of the grid, as it doesn't seem to be done correctly by default. xVals gives the distance from the left and the right as a tuple, while yVals gives the distance from the top and the bottom, also as a tuple. Default values are xVals = (.037, .852), yVals = (.056, .939), or if you have no title, use xVals = (.0105, .882), yVals = (.056, .939) If you have no colorbar, set xVals = (.0015, .997), yVals = (.002, .992) In the case that arbitrary space has been introduced, if you have a title, use xVals = (.037, .852), yVals = (.056, .939), or if you have no title, use xVals = (.0105, .882), yVals = (.056, .939)
ScatteringPlotsExt.jointPlot1D — Function
jointPlot1D(thingToPlot, thingName, cSymbol, St, origSig; saveTo=nothing, sharedColorScaling=:exp, targetExample=1, δt=1000, freqigdigits=3, sharedColorbar=false, allPositive=false, logPower=false)Create a joint plot visualizing the zeroth, first, and second layer scattering results for a specified example. The variable thingToPlot is a tuple containing the scattering results for the zeroth, first, and second layers, thingName is the title for the plot, cSymbol specifies the color gradient to use, and St is the scattering transform object. The function allows for various customization options, including shared color scaling, target example selection, frequency digit rounding, and additional plotting options. In this implementation, targetExample is the same as index in other functions, specifying which example in the batch to plot. Finally, origSig is the original input signal to be displayed alongside the scattering results.
2D Plotting Functions
ScatteringPlotsExt.plotOriginalSignal2D — Function
plotOriginalSignal2D(origSig; color=:grays, saveTo=nothing, index=1)Function that plots the original signal origSig and saves it to a desired location.
ScatteringPlotsExt.plotZerothLayer2D — Function
plotZerothLayer2D(sf; color=:grays, saveTo=nothing, index=1)Function that plots the zeroth layer of the scattering transform at a specified example index.
ScatteringPlotsExt.plotFirstLayer2DSingleWavelet — Function
plotFirstLayer2DSingleWavelet(j, sf, origSig; color=:grays, saveTo=nothing, index=1)The variable j specifies which wavelet results to plot from the first layer, index specifies which example in the batch to plot, sf is the ScatteredOut object containing the scattering transform results, and origSig is the original input signal.
ScatteringPlotsExt.visualizeFirstLayer2D — Function
visualizeFirstLayer2D(sf; color=:grays, index=1)Helper function that creates a grid of heatmaps visualizing all the first layer gradient wavelets across space for a specified example index. The variable sf is the ScatteredOut object containing the scattering transform results, index specifies which example in the batch to plot, and color sets the color gradient for the heatmaps. The function organizes the heatmaps in a grid format, where each row corresponds to a different scale of the wavelets, and each column corresponds to a different channel (e.g., real and imaginary parts).
ScatteringPlotsExt.plotFirstLayer2D — Function
plotFirstLayer2D(sf; color=:grays, saveTo=nothing, index=1)Function that creates a heatmap of the first layer scattering transform results at a specified example index. The variable sf is the scattered output, saveTo is the file path to save the plot, and index specifies which example in the batch to plot. The user can also specify the color gradient for the heatmap using the color argument.
ScatteringPlotsExt.plotFirstLayer2DAll — Function
plotFirstLayer2DAll(sf, origSig; saveTo=nothing, index=1, color=:grays)Function that plots all first layer gradient wavelets for a specific example signal index across space, along with the original signal. The variable index specifies which example in the batch to plot, sf is the ScatteredOut object containing the scattering transform results, origSig is the original input signal, and saveTo is the file path to save the plot.
ScatteringPlotsExt.plotSecondLayer2DSingleWavelet — Function
plotSecondLayer2DSingleWavelet(j, sf, origSig; color=:grays, saveTo=nothing, index=1)The variable j specifies which wavelet results to plot from the second layer, index specifies which example in the batch to plot, sf is the ScatteredOut object containing the scattering transform results, and origSig is the original input signal.
ScatteringPlotsExt.visualizeSecondLayer2D — Function
visualizeSecondLayer2D(sf; color=:grays, index=1)Function that creates a grid of heatmaps visualizing all the second layer gradient wavelets across space for a specified example index. The variable sf is the ScatteredOut object containing the scattering transform results, index specifies which example in the batch to plot, and color sets the color gradient for the heatmaps. The function organizes the heatmaps in a grid format, where each row corresponds to a different scale of the second layer wavelets, and each column corresponds to a different channel (e.g., real and imaginary parts).
ScatteringPlotsExt.plotSecondLayer2D — Function
plotSecondLayer2D(sf; color=:grays, saveTo=nothing, index=1)Function that creates a grid of heatmaps visualizing all the second layer scattering transform results at a specified example index. The variable sf is the ScatteredOut object, saveTo is the file path to save the plot, index specifies which example in the batch to plot, and color sets the color gradient. The grid rows correspond to second layer scales/channels and columns to first layer scales/channels.