Frequency Tools¶
Function for getting the decorrelated noise power spectrum starting from the noise covariance matrix.
- Parameters:
cov (instance of QChannelCovariance) --
channel (int indicating which channel to decorrelate) --
side_channels (list of ints indicating what channels to use in the decorrelation) --
- Returns:
array with the decorrelated power spectrum
- pydiana.tools.frequency_tools.make_NEP(ap, an, ADC2Amp=None, fs=None, CalibConst=None)[source]¶
Function for calculating the noise equivalent power.
- Parameters:
ap (tuple with the average pulse in ADC counts) --
an (noise abs(FFT)^2) --
ADC2Amp (Conversion from the ADC values to signal amplitude value (if not given defaults to 1)) --
fs (sampling frequency in Hz (if not given defaults to 1)) --
CalibConst (calibration constant for passing from Amp-unit to eV. Disabled if ADC2Amp not provided) --
- Returns:
Frequencies: in Hz if sampling freq is provided NEP: in Watts/Hz^0.5 if ADC2Amp,CalibConst and sampling freq are provided
- pydiana.tools.frequency_tools.make_NEP_plot(ap, an, ADC2Amp=None, fs=None, CalibConst=None, unitAmp=None, showplot=True, log_x=True, log_y=True)[source]¶
Function for plotting NEP calculated from average pulse and average noise
- Parameters:
ap (tuple with the average pulse in ADC counts) --
an (noise abs(FFT)^2) --
ADC2Amp (Conversion from the ADC values to signal amplitude value (if not given defaults to 1)) --
fs (sampling frequency in Hz (if not given defaults to 1)) --
CalibConst (calibration constant for passing from Amp-unit to eV. Disabled if ADC2Amp not provided) --
unitAmp (string with the amplitude unit of the signal (defaults to mV). It is used only if calib const is not provided.) --
showplot (boolean for enabling plot showing) -- log_x: boolean for using log scale on x axis log_y: boolean for using log scale on y axis
- Returns:
Figure instance with NEP plot
- pydiana.tools.frequency_tools.make_PSD(traces, window='cosine', fs=1, ADC2unit=1)[source]¶
Function for making the power spectral density of traces with windowing. It will also convert the trace from ADC to a specified unit.
- Parameters:
traces (2D array with the traces) --
window (see https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.get_window.html#scipy.signal.get_window) --
fs (sampling frequency) --
ADC2unit (float with the conversion value from ADC units to a wanted unit like mV) --
- Returns:
2D array with the periodogram 1D array with the corresponding frequencies
- pydiana.tools.frequency_tools.make_PSD_from_FFT(an, fs=1, conv=1)[source]¶
Function for calculating and plotting Power Spectral Density from the absolute values of the FFT
- Parameters:
an (array with the abs(fft)) --
fs (sampling frequency (defaults to 1).) --
conv (normalization conversion for the amplitude of the FFT (defaults to 1)) --
- Returns:
x (array with frequency bins)
y (array with frequency bin height)
- pydiana.tools.frequency_tools.make_PSD_plot(an, fs=None, conv=None, unitf=None, unitA=None, usesqrt=False, showplot=False)[source]¶
Function for calculating and plotting Power Spectral Density from the absolute values of the FFT
- Parameters:
an (array with the abs(fft)) --
fs (sampling frequency (defaults to 1).) --
conv (normalization conversion for the amplitude of the FFT (defaults to 1)) --
unitf (string with the unit for the frequency axis (defaults to Hz)) --
unitA (string with the unit of the the abs(FFT) values (defaults to mV)) --
showplot (bool for enabling the plotting of the figure) --
- Return type:
Plotly figure with PSD
- pydiana.tools.frequency_tools.make_periodogram(traces, window='cosine', fs=1, ADC2unit=1)[source]¶
Function for making the periodogram of traces with windowing. It will also convert the trace from ADC to a specified unit.
- Parameters:
traces (2D array with the traces) --
window (see https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.get_window.html#scipy.signal.get_window) --
fs (sampling frequency) --
ADC2unit (float with the conversion value from ADC units to a wanted unit like mV) --
- Returns:
2D array with the periodogram 1D array with the corresponding frequencies
- pydiana.tools.frequency_tools.make_waterfall(traces, index=None, window='cosine', fs=None, ADC2unit=None, useSpacing=False, logx=False, logy=False, logz=False, xlab=None, ylab=None, unit='mV', fillwith='nan', colorscale='Turbo', zrange=None, showplot=True)[source]¶
Function for making the waterfall of the PSD of provided traces
- Parameters:
traces (2D array with the traces) --
index (1D array with the quantity with respect to which order the traces. If None the provided traces are not ordered) --
window (specifying windowing type for PSD. See make_window function) --
fs (sampling frequency) --
ADC2unit (conversion quantity from the unit of the traces to a specified unit) --
useSpacing (Switch for enabling correct spacing between the various PSD in the final waterfall. The spacing is based on the index array) --
logx (switch for enabling logscale on x axis) --
logy (switch for enabling logscale on y axis) --
logz (switch for enabling logscale on color-axis) --
xlab (label for the xaxis) --
ylab (label for the yaxis) --
unit (label of the unit of the traces after being multiplied with ADC2unit) --
fillwith (if useSpacing is enabled specifies how to fill the space between PSDs on the waterfall. If 'min' a value smaller of the minimum in the waterfall is used, if 'nan' the spaces are filled with NaNs) --
colorscale (string specifying the colorscale) --
zrange (if not None the PSD is saturated inside range) --
showplot (switch for enabling the showing of the plot) --
- Returns:
2D array with the waterfall 1D array with the frequencies 1D array with the indexes (which if useSpacing is enabled contained the 'missing' indexes of the empty spaces) go.Figure instance with the plot of the produced waterfall