Commit 27db7e27 authored by Andreas Theodosiou's avatar Andreas Theodosiou 🐧

Merge branch 'snr2coh' into 'develop'

 Add function to calculate the coherence from the SNR

See merge request !2
parents f799e686 cd12c48a
"""Module that aid in the simulation of Interferometric SAR."""
from drama.performance.insar.snr2coh import coh_m
"""Function that calculates the correlation coefficient as a function
of signal-to-noise ratio."""
import numpy as np
def coh_m(snr_1, snr_2=None, decibel=False):
"""coh_m calculates the correlation coefficient, also called
the coherence, from finite SNR.
Parameters
----------
snr_1 : ndarray
Signal-to-noise ratio of first interferometric channel
snr_2 : ndarray
Signal-to-noise ratio of second interferometric channel
(Default value = None)
decibel : bool
True if values are given in dB (Default value = False)
Returns
-------
ndarray
correlation coefficient
"""
if snr_2 is None:
snr_2 = snr_1
if decibel is False:
correlation_coefficient = 1.0 / np.sqrt(
np.dot(1 + 1.0 / snr_1, 1 + 1.0 / snr_2)
)
else:
correlation_coefficient = 1.0 / np.sqrt(
(1.0 + 10.0 ** -(snr_1 / 10.0)) * (1 + 10.0 ** -(snr_2 / 10.0))
)
return correlation_coefficient
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment