Exemplo n.º 1
0
    def test_ignores_fields_outside_fov_boundary(self):
        src = so._combined_source(dx=[200, 200, 200])
        src.fields[0]["x"] += 200

        fov = _fov_197_202_um()
        fov.extract_from(src)

        assert len(fov.fields) == 0
Exemplo n.º 2
0
    def test_ignores_fields_outside_fov_boundary(self, basic_fov_header):

        src = _combined_source(dx=[200, 200, 200])
        src.fields[0]["x"] += 200

        the_fov = FieldOfView(basic_fov_header, (1, 2) * u.um, area=1 * u.m**2)
        the_fov.extract_from(src)

        assert len(the_fov.fields) == 0
Exemplo n.º 3
0
    def test_views_with_tables_and_images(self, basic_fov_header):
        src = _combined_source(im_angle=0,
                               weight=[1, 1, 1],
                               dx=[-2, 0, 0],
                               dy=[2, 2, 0])
        ii = src.fields[3].header["SPEC_REF"]
        flux = src.photons_in_range(1 * u.um, 2 * u.um, indexes=[ii]).value
        orig_sum = np.sum(src.fields[3].data) * flux

        the_fov = FieldOfView(basic_fov_header, (1, 2) * u.um, area=1 * u.m**2)
        the_fov.extract_from(src)
        view = the_fov.view()

        assert np.isclose(np.sum(the_fov.fields[1].data), orig_sum)
        assert np.isclose(np.sum(view), orig_sum + 36)
        assert np.sum(the_fov.fields[0]["flux"]) == approx(36)

        if PLOTS:
            plt.imshow(view.T, origin="lower", norm=LogNorm())
            plt.colorbar()
            plt.show()
def comb_src():
    return src._combined_source()
Exemplo n.º 5
0
def combined_source():
    return _combined_source()