Пример #1
0
def test_subsample_q_02(scan2d_from_nxs_01: Scan2D):
    """
    Make sure that we can set just an upper bound. Note that this dataset goes
    from 0.025Å to 0.06Å
    """
    q_max = 0.04

    assert max(scan2d_from_nxs_01.q_vectors) > q_max
    scan2d_from_nxs_01.subsample_q(q_max=q_max)
    assert max(scan2d_from_nxs_01.q_vectors) <= q_max
Пример #2
0
def test_subsample_q_03(scan2d_from_nxs_01: Scan2D):
    """
    Make sure that we can set a lower bound. Note that this dataset goes from
    0.025Å to 0.06Å.
    """
    q_min = 0.04

    assert min(scan2d_from_nxs_01.q_vectors) < q_min
    scan2d_from_nxs_01.subsample_q(q_min=q_min)
    assert min(scan2d_from_nxs_01.q_vectors) >= q_min
Пример #3
0
def test_subsample_q_04(scan2d_from_nxs_01: Scan2D):
    """
    Test that we can set both lower and upper bounds.
    """
    q_min = 0.032
    q_max = 0.051

    scan2d_from_nxs_01.subsample_q(q_min, q_max)

    assert min(scan2d_from_nxs_01.q_vectors) >= q_min
    assert max(scan2d_from_nxs_01.q_vectors) <= q_max
Пример #4
0
def test_subsample_q_01(scan2d_from_nxs_01: Scan2D):
    """
    Make sure subsample_q deletes the appropriate things. Because it just calls
    remove_data_points, which has already been tested extensively in test_data,
    we only need to check a couple of values to make sure the right qs have been
    deleted an we know that all the other attributes will have been handled
    correctly.
    """
    original_len = len(scan2d_from_nxs_01.theta)
    # Defaults shouldn't change anything.
    scan2d_from_nxs_01.subsample_q()
    assert len(scan2d_from_nxs_01.theta) == original_len