modules/utils.py
def measure(x, noise_snr=40, tau=100):
    ''' Realistic sensor measurement with readout and photon noise

        Inputs:
            noise_snr: Readout noise in electron count
            tau: Integration time. Poisson noise is created for x*tau.
                (Default is 100)

        Outputs:
            x_meas: x with added noise
    '''
    x_meas = np.copy(x)

    noise = pow(10, -noise_snr/20)*np.random.randn(x_meas.size).reshape(x_meas.shape)

    # First add photon noise, provided it is not infinity
    if tau != float('Inf'):
        x_meas = x_meas*tau

        x_meas[x > 0] = np.random.poisson(x_meas[x > 0])
        x_meas[x <= 0] = -np.random.poisson(-x_meas[x <= 0])

        x_meas = (x_meas + noise)/tau

    else:
        x_meas = x_meas + noise

    return x_meas
 Realistic sensor measurement with readout and photon noise

        Inputs:
            noise_snr: Readout noise in electron count
            tau: Integration time. Poisson noise is created for x*tau.
                (Default is 100)

        Outputs:
            x_meas: x with added noise
    
Realistic sensor measurement with readout and photon noise
Inputs:
noise_snr: Readout noise in electron count
tau: Integration time. Poisson noise is created for x*tau.

x with added noise
Realistic sensor measurement with readout and photon noise Inputs : noise_snr : Readout noise in electron count tau : Integration time . Poisson noise is created for x * tau . x with added noise
def measure(x, noise_snr=40, tau=100):
    x_meas = np.copy(x)
    noise = pow(10, -noise_snr/20)*np.random.randn(x_meas.size).reshape(x_meas.shape)
    if tau != float('Inf'):
        x_meas = x_meas*tau
        x_meas[x > 0] = np.random.poisson(x_meas[x > 0])
        x_meas[x <= 0] = -np.random.poisson(-x_meas[x <= 0])
        x_meas = (x_meas + noise)/tau
    else:
        x_meas = x_meas + noise
    return x_meas
def measure ( x , noise_snr = 40 , tau = 100 ) : x_meas = np . copy ( x ) noise = pow ( 10 , - noise_snr / 20 ) * np . random . randn ( x_meas . size ) . reshape ( x_meas . shape ) if tau != float ( 'Inf' ) : x_meas = x_meas * tau x_meas [ x > 0 ] = np . random . poisson ( x_meas [ x > 0 ] ) x_meas [ x <= 0 ] = - np . random . poisson ( - x_meas [ x <= 0 ] ) x_meas = ( x_meas + noise ) / tau else : x_meas = x_meas + noise return x_meas
Realistic sensor measurement with readout and photon noise
Inputs:
noise_snr: Readout noise in electron count
tau: Integration time.
Realistic sensor measurement with readout and photon noise Inputs : noise_snr : Readout noise in electron count tau : Integration time .
''' Realistic sensor measurement with readout and photon noise

        Inputs:
            noise_snr: Readout noise in electron count
            tau: Integration time. Poisson noise is created for x*tau.
                (Default is 100)

        Outputs:
            x_meas: x with added noise
    ''' # First add photon noise, provided it is not infinity
x
noise_snr
tau