def testLOSResponse(sp, dtype): starts = np.random.randn(len(sp.shape), 10) ends = np.random.randn(len(sp.shape), 10) sigma_low = 1e-4 * np.random.randn(10) sigma_ups = 1e-5 * np.random.randn(10) op = ift.LOSResponse(sp, starts, ends, sigma_low, sigma_ups) ift.extra.consistency_check(op, dtype, dtype)
def testLOSResponse(sp, dtype): starts = np.random.randn(len(sp.shape), 10) ends = np.random.randn(len(sp.shape), 10) sigma_low = 1e-4 * np.random.randn(10) sigma_ups = 1e-5 * np.random.randn(10) _check_repr(ift.LOSResponse(sp, starts, ends, sigma_low, sigma_ups))
def random_tomography_response(position_space, lines_of_sight=100): starts = list(np.random.uniform(0, 1, (lines_of_sight, 2)).T) ends = list(np.random.uniform(0, 1, (lines_of_sight, 2)).T) return ift.LOSResponse(position_space, starts=starts, ends=ends)
A = ift.SLAmplitude(**dct) # Build the operator for a correlated signal power_distributor = ift.PowerDistributor(harmonic_space, power_space) vol = harmonic_space.scalar_dvol**-0.5 xi = ift.ducktape(harmonic_space, None, 'xi') correlated_field = ht(vol*power_distributor(A)*xi) # Alternatively, one can use: # correlated_field = ift.CorrelatedField(position_space, A) # Apply a nonlinearity signal = ift.sigmoid(correlated_field) # Build the line-of-sight response and define signal response LOS_starts, LOS_ends = random_los(100) if mode == 0 else radial_los(100) R = ift.LOSResponse(position_space, starts=LOS_starts, ends=LOS_ends) signal_response = R(signal) # Specify noise data_space = R.target noise = .001 N = ift.ScalingOperator(noise, data_space) # Generate mock signal and data mock_position = ift.from_random('normal', signal_response.domain) data = signal_response(mock_position) + N.draw_sample() # Minimization parameters ic_sampling = ift.GradientNormController(iteration_limit=100) ic_newton = ift.GradInfNormController( name='Newton', tol=1e-7, iteration_limit=35)