RRI

This module realises a class, which contains basic signal processing methods for the range resolved interferometry.

All written methods are based on the theoretical base described in [1].

[1]: Thomas Kissinger, Thomas O.H. Charrett, and Ralph P. Tatam, “Range-resolved interferometric signal processing using sinusoidal optical frequency modulation,” Opt. Express 23, 9415-9431 (2015)

class openrri.rri.RRIModule(max_harmonics=2)

RRI class providing RRI signal processing methods.

add_harmonic(n)

Add properties for the n-th harmonic.

Parameters:

n (int) – Harmonic number

amplitude_correction(envelope_correction=False)

Perform amplitude correction on the provided data (loaded with load_data())

This function selects the ground sine and subtracts it from the signal to perform amplitude correction. While not the optimal method, it works automatically and is generally sufficient for most RRI applications.

Note

If alternative amplitude correction is desired, apply your own method and pass the data to load_data(). For those looking to correct the residual signal envelope, further correction using the Hilbert transform may be implemented additionally.

Parameters:

envelope_correction (bool) – when set to True, also applies envelope correction using the Hilbert transform

Returns:

Corrected data array

Return type:

numpy.ndarray

calc_map(dpca_min=20, dpca_max=150, dpca_res=1, sigma=0.05, phase_delay_min=80, phase_delay_max=110, phase_delay_res=0.1)

Calculate phase delay map.

Note

This possibly long-running method can be cancelled using cancel().

Parameters:
  • dpca_min (int) – demodulation phase carrier amplitude minimum

  • dpca_max (int) – demodulation phase carrier amplitude maximum

  • dpca_res (int) – map resolution in dpca axis

  • sigma (float) – window width parameter

  • phase_delay_min (int) – phase delay minimum

  • phase_delay_max (int) – phase delay maximum

  • phase_delay_res (float) – map resolution in phase delay axis

Returns:

phase delay range, dpca range, map values

Return type:

(numpy.ndarray, numpy.ndarray, numpy.ndarray)

calc_modulation_parameter(max_harmonic=2, cycles_to_process=10, plot_phase=False)

Calculates and prints modulation non-linearity parameters.

Parameters:
  • max_harmonic (int) – Maximum harmonic index to calculate. Default is 2, meaning only parameters of the second harmonic are calculated.

  • cycles_to_process (int) – Number of central modulation cycles of the reconstructed phase fed to the fit algorithm.

  • plot_phase (bool) – if True, plots the reconstructed and fitted modulation waveform.

Returns:

Fitted parameters

Return type:

lmfit.parameter.Parameters

cancel()
Cancels a long-running RRIModule method before it is finished. Currently supported methods:

cancel() is supposed to be called from another running thread.

demodulate_phase(range_channel, sigma=0.0225)

Demodulate phase at selected range channel (demodulation phase carrier amplitude)

Parameters:
  • range_channel (float) – Range channel

  • sigma (float) – Window width

Returns:

Phase

Return type:

numpy.ndarray

get_peak_positions(dpca_range=None, dpca_amp=None, threshold=10)

Calculate peak positions.

All range dependency values below the threshold, where threshold is defined as percentages of maximum amplitude, are set to None to avoid calculation of noise peaks.

If range dependency is not given to function, it will call get_range_view() to calculate the dependency.

Parameters:
  • dpca_range (numpy.ndarray) – dpca_values for which dpca_amp is calculated

  • dpca_amp (numpy.ndarray) – range dependency

  • threshold (float) – threshold in percentage of the maximum dpca_amp value

Returns:

peak positions

Return type:

list

get_range_view(dpca_min=1, dpca_max=150, res=1, sigma=0.05)

Calculate range view from dpca_min to dpca_max with resolution res.

Note

This possibly long-running method can be cancelled using cancel().

Parameters:
  • dpca_min (int) – demodulation phase carrier amplitude minimum

  • dpca_max (int) – demodulation phase carrier amplitude maximum

  • res (int) – resolution of the range view

  • sigma (float) – window width parameter

Returns:

demodulation phase carrier amplitude, range dependency

Return type:

(numpy.ndarray, numpy.ndarray)

property harm_amp

Amplitude of the first harmonic of frequency modulation

property harm_phase

Phase shift of the first harmonic of frequency modulation in degrees

is_cancelled()

Returns True if a long-running RRIModule method was recently cancelled.

Returns:

True, if cancelled, otherwise False

Return type:

bool

load_data(data_array)

Load data array in class instance variable

Parameters:

data_array (numpy.ndarray) – Data array

property mod_freq

Frequency of the main fast high amplitude modulation

property mod_table_length

Table length of the modulation output

property phase_shift

Phase delay

reset_cancel()

Decorator that resets the cancel event upon entry of the decorated function f.

Note

This decorator is not to be called directly.

Parameters:

f (callable) – decorated function

property sample_rate

Data sample rate