ffta package

Subpackages

Pixel

class ffta.pixel.Pixel(signal_array, params={}, can_params={}, fit=True, pycroscopy=False, method='hilbert', fit_form='product', filter_amplitude=False, filter_frequency=False, recombination=False, trigger=None, total_time=None, sampling_rate=None, roi=None)
amplitude_filter()

Filters the drive signal out of the amplitude response

analyze()

Analyzes the pixel with the given method.

Returns

tuple (tfp, shift, inst_freq) WHERE float tfp is time from trigger to first-peak, in seconds. float shift is frequency shift from trigger to first-peak, in Hz. array_like inst_freq is instantenous frequency of the signal in format (n_points,)

apply_window()

Applies the window given in parameters.

average()

Averages signals.

calculate_amplitude()

Calculates the amplitude of the analytic signal. Uses pre-filter signal to do this.

calculate_cwt(f_center=None, verbose=False, optimize=False, fit=False, calc_phase=False)

Calculate instantaneous frequency using continuous wavelet transfer

wavelet specified in self.wavelet. See PyWavelets CWT documentation

Parameters
  • f_center

  • verbose (bool, optional) –

  • optimize (bool, optionals) – Currently placeholder for iteratively determining wavelet scales

  • fit (bool, optional) – Whether to curve-fit for ridge finding or use parabolic approximation

  • calc_phase – Calculates teh Phase (not usually needed)

:type calc_phase : bool, optional

calculate_inst_freq()

Calculates the first derivative of the phase using Savitzky-Golay filter.

calculate_nfmd(calc_phase=False, override_window=True, verbose=False)

Nonstationary Fourier Mode Decomposition Approach

Parameters
  • calc_phase (bool, optional) – Calculates the Phase (not usually needed)

  • override_window (bool, optional) – Automatically adjusts window to be integer number of cycles

  • verbose (bool, optional) – Console feedback

calculate_phase(correct_slope=True)

Gets the phase of the signal and correct the slope by removing the drive phase.

Parameters

correct_slope (bool, optional) –

calculate_power_dissipation()

Calculates the power dissipation using amplitude, phase, and frequency and the Cleveland eqn (see DOI:10.1063/1.121434)

calculate_stft(nfft=200, calc_phase=False)

Sliding FFT approach

Parameters
  • nfft (int) – Length of FFT calculated in the spectrogram. More points gets much slower but the longer the FFT the finer the frequency bin spacing

  • calc_phase (bool, optional) – Calculates teh Phase (not usually needed)

check_drive_freq()

Calculates drive frequency of averaged signals, and check against the given drive frequency.

dwt_denoise()

Uses DWT to denoise the signal prior to processing.

find_tfp()

Calculate tfp and shift based self.fit_form and self.fit selection

fir_filter()

Filters signal with a FIR bandpass filter.

frequency_filter()

Filters the instantaneous frequency around DC peak to remove noise Uses self.filter_bandwidth for the frequency filter

frequency_harmonic_filter(width=5)

Filters the instantaneous frequency to remove noise Defaults to DC and then every multiple harmonic up to sampling

Parameters

width (int, optional) – Size of the boxcar around the various peaks

generate_inst_freq(timing=False, dc=True)

Generates the instantaneous frequency

Parameters

timing (bool, optional) – prints the time to execute (for debugging)

Returns

tuple (inst_freq, amplitude, phase) WHERE array_like inst_freq is instantaneous frequency of the signal. in the format (n_points,) [type] amplitude is… [type] phase is…

hilbert()

Analytical signal and calculate phase/frequency via Hilbert transform

hilbert_transform()

Gets the analytical signal doing a Hilbert transform.

iir_filter()

Filters signal with two Butterworth filters (one lowpass, one highpass) using filtfilt. This method has linear phase and no time delay.

phase_lock()

Phase-locks signals in the signal array. This also cuts signals.

plot(newplot=True, fit=True)

Quick visualization of best_fit and cut.

Parameters
  • newplot (bool, optional) – generates a new plot (True) or plots on existing plot figure (False)

  • fit (bool, opttional) – Overlays fit on the instantaneous frequency image

remove_dc(dc_width=10000.0, plot=False)

Removes DC components from each signal using FFT.

Parameters
  • dc_width (float, optional) –

  • plot (bool, optional) –

restore_signal()

Restores the signal length and position of trigger to original values.

set_drive()

Calculates drive frequency of averaged signals

update_parm(**kwargs)

Update the parameters, see ffta.pixel.Pixel for details on what to update e.g. to switch from default Hilbert to Wavelets, for example

Parameters

kwargs

Line

analyze_pixel

Created on Wed Jan 22 12:35:38 2020

@author: Raj

ffta.analyze_pixel.analyze_pixel(ibw_file, param_file)

Analyzes a single pixel

:param path to *.ibw file :type ibw_file: str

Parameters

param_file (str) – path to parameters.cfg file

Returns

The pixel object read and analyzed

Return type

Pixel