예제 #1
0
def test_find_probe_loc_from_frontwall_real(theta_deg):
    """Test move_probe_on_Oxy() with a 10 element linear points1"""
    standoff = -10.0

    numelements = 10

    # Setup: a 2-element points1
    probe = Probe.make_matrix_probe(numelements, 0.1, 1, 0.0, 1e6)

    locations_pcs = probe.locations

    # The point O(0., 0., 0.) is the 'centre' of the points1 (geometrical centre)
    assert np.allclose(np.mean(locations_pcs, axis=0), 0.0)

    # rotate and shift points1:
    locations_gcs = locations_pcs @ g.rotation_matrix_y(
        np.deg2rad(theta_deg)).T
    locations_gcs[:, 2] += standoff

    # empty fmc data
    tx, rx = arim.ut.fmc(numelements)
    time = Time(0.0, 1.0, 50)
    scanlines = np.zeros((len(tx), len(time)))
    frame = Frame(scanlines, time, tx, rx, probe,
                  ExaminationObject(Material(1.0)))

    # Distance to surface: orthogonal projection on Oxy
    distance_to_surface = np.full(len(tx), np.nan)
    distance_to_surface[tx == rx] = -locations_gcs[tx[tx == rx], 2]

    frame = reg.move_probe_over_flat_surface(frame, distance_to_surface)
    out_locations = frame.probe.locations

    assert np.allclose(out_locations, locations_gcs)
예제 #2
0
def test_detect_surface_from_extrema():
    probe = Probe.make_matrix_probe(3, 1.0, 1.0, 0.0, 1e6)

    time = Time(10.0, 1.0, 50)

    tx = np.array([0, 0, 1, 1, 2, 2])
    rx = np.array([0, 1, 1, 0, 2, 0])

    scanlines = np.random.uniform(high=10.0, size=(len(tx), len(time)))

    times_to_surface_expected = np.array([25.0, 26.0, 27.0, 28.0, 29.0, 30.0])

    for (i, t) in enumerate(times_to_surface_expected):
        scanlines[i, time.closest_index(t)] = t

    frame = Frame(scanlines, time, tx, rx, probe,
                  ExaminationObject(Material(1.0)))

    times_to_surface = reg.detect_surface_from_extrema(frame)

    assert np.allclose(times_to_surface, times_to_surface_expected)