Пример #1
0
def set_noise(data, **kwargs):
    """Set the noise level

    This method calculates the noise standard deviation using the median
    absolute deviation (MAD) of the input data and adds it to the keyword
    arguments.

    Parameters
    ----------
    data : np.ndarray
        Input noisy data (3D array)

    Returns
    -------
    dict Updated keyword arguments

    """

    # It the noise is not already provided calculate it using the MAD
    if isinstance(kwargs['noise_est'], type(None)):
        kwargs['noise_est'] = sigma_mad(data)

    print ' - Noise Estimate:', kwargs['noise_est']
    kwargs['log'].info(' - Noise Estimate: ' + str(kwargs['noise_est']))

    return kwargs
Пример #2
0
def get_sigma_map(data, opt=None):

    # Get wavelet residuals.
    wavelet_residuals = call_mr_transform(data, opt=opt, remove_files=True)

    # Return sigma map.
    return np.array([sigma_mad(a) * np.ones(data.shape) for a in
                     wavelet_residuals])
Пример #3
0
def get_sigma(data):
    return stats.sigma_mad(data) / fake_data_norm