def test_exposure_time_y(): walk_data = dict() walk_data['yinds'] = [[1, 1, 1, 1, 1]] walk_data['xinds'] = [[1, 2, 3, 4, 5]] walk_data['travel_times'] = [[2, 4, 6, 8, 10]] roi = np.zeros((6, 6)) roi[2:4, :] = 1 exp_times = particle_track.exposure_time(walk_data, roi) assert exp_times[0] == 4.0
def test_exposure_reenter(): walk_data = dict() walk_data['yinds'] = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]] walk_data['xinds'] = [[1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5]] walk_data['travel_times'] = [[2, 4, 6, 8, 10, 11, 12, 13, 14, 15, 16]] roi = np.zeros((6, 6)) roi[2:3, :] = 1 exp_times = particle_track.exposure_time(walk_data, roi) assert exp_times[0] == 3.0
else: params.diff_coeff = 1.0 # make particle particle = pt.Particles(params) # walk it particle.generate_particles(Np_tracer, seed_xloc, seed_yloc) for i in list(range(0, num_iter)): walk_data = particle.run_iteration() # get travel times associated with particles when they are at coord x=70 # use the exposure_time function to measure this roi = np.zeros_like(depth, dtype='int') roi[0:target_row, :] = 1 target_times = pt.exposure_time(walk_data, roi) # plot histogram plt.subplot(1, 2, dc + 1) n, bins, _ = plt.hist(target_times, bins=100, range=(200, 400), histtype='bar', density=True, color=[0.5, 0.5, 1, 0.5]) # plot expected travel time to row 70 plt.scatter(expected_time, np.max(n), s=75, c='green',