#!/usr/bin/env python
# coding: utf-8

import numpy as np


def compute_uncertainty(field, error, min_error=0.0, is_relative=True, instrument=None):

    if is_relative:
        error = error * field
        error[error < min_error] = min_error

    return error * np.random.randn(*field.shape)
