Esempio n. 1
0
 def _reference_xc_map(dp, vectors, upsample_factor, center, calibration):
     shifts = np.zeros_like(vectors, dtype=np.float64)
     for i, vector in enumerate(vectors):
         ref_disc = get_experimental_square(reference_dp, vector, square_size)
         expt_disc = get_experimental_square(dp, vector, square_size)
         shifts[i] = _conventional_xc(expt_disc, ref_disc, upsample_factor)
     return (((vectors + shifts) - center) * calibration)
Esempio n. 2
0
        def _lg_map(dp, vectors, square_size, center, calibration):
            shifts = np.zeros_like(vectors, dtype=np.float64)
            for i, vector in enumerate(vectors):
                expt_disc = get_experimental_square(dp, vector, square_size)
                shifts[i] = _new_lg_idea(expt_disc)

            return (((vectors + shifts) - center) * calibration)
        def _com_experimental_square(z, vector, square_size):
            """Wrapper for get_experimental_square that makes the non-zero
            elements symmetrical around the 'unsubpixeled' peak by zeroing a
            'spare' row and column (top and left).

            Parameters
            ----------
            z : np.array

            vector : np.array([x,y])

            square_size : int (even)

            Returns
            -------
            z_adpt : np.array
                z, but with row and column zero set to 0
            """
            # Copy to make sure we don't change the dp
            z_adpt = np.copy(
                get_experimental_square(z,
                                        vector=vector,
                                        square_size=square_size))
            z_adpt[:, 0] = 0
            z_adpt[0, :] = 0
            return z_adpt
Esempio n. 4
0
 def _check_bad_square_map(dp, vectors, square_size):
     bad_square = False
     for i, vector in enumerate(vectors):
         expt_disc = get_experimental_square(dp, vector, square_size)
         bad_square = check_bad_square(expt_disc)
         if bad_square:
             return True
     return False
Esempio n. 5
0
def test_failure_for_non_even_errors_get_experimental_square(exp_disc):
    square = get_experimental_square(exp_disc, [17, 19], 7)
Esempio n. 6
0
def test_experimental_square_size(exp_disc):
    square = get_experimental_square(exp_disc, [17, 19], 6)
    assert square.shape[0] == int(6)
    assert square.shape[1] == int(6)
Esempio n. 7
0
def test_failure_for_non_even_errors_get_experimental_square(exp_disc):
    with pytest.raises(ValueError,
                       match="'square_size' must be an even number"):
        square = get_experimental_square(exp_disc, [17, 19], 7)