Beispiel #1
0
def test_footprint_correction_02(scan2d_from_nxs_01: Scan2D):
    """
    Do a really naive footprint correction assuming a step function beam.
    Enforce that this is the same as our fancy correction, to within 10%.
    (Note: they are actually about 10% out from each other).
    """

    # 100 micron beam.
    beam_width = 100e-6
    # 1 mm sample.
    sample_size = 1e-3

    intensities_0 = np.copy(scan2d_from_nxs_01.intensity)
    intensities_e_0 = np.copy(scan2d_from_nxs_01.intensity_e)

    beam_size_on_sample = beam_width / \
        np.sin(np.radians(scan2d_from_nxs_01.theta))

    incident_beam_fraction = sample_size / beam_size_on_sample

    test_intensities = intensities_0 / incident_beam_fraction
    test_intensities_e = intensities_e_0 / incident_beam_fraction

    scan2d_from_nxs_01.footprint_correction(beam_width, sample_size)
    for i, test_intensity in enumerate(test_intensities):
        assert test_intensity == pytest.approx(scan2d_from_nxs_01.intensity[i],
                                               0.1)

    for i, test_intensity_e in enumerate(test_intensities_e):
        assert test_intensity_e == pytest.approx(
            scan2d_from_nxs_01.intensity_e[i], 0.1)
Beispiel #2
0
def test_footprint_correction_01(scan2d_from_nxs_01: Scan2D):
    """
    Makes sure that the footprint correction acually does something for a
    reasonable beam FWHM and a small (1mm) sample.
    """
    # 100 micron beam.
    beam_width = 100e-6
    # 1 mm sample.
    sample_size = 1e-3
    intensities_0 = np.copy(scan2d_from_nxs_01.intensity)
    intensities_e_0 = np.copy(scan2d_from_nxs_01.intensity_e)
    scan2d_from_nxs_01.footprint_correction(beam_width, sample_size)

    assert (intensities_0 != scan2d_from_nxs_01.intensity).all()
    assert (intensities_e_0 != scan2d_from_nxs_01.intensity_e).all()