예제 #1
0
    def test_limits_trace_curves_to_xy_edges(self, diagonal_trace):
        spt = SpectralTrace(diagonal_trace)
        xy_edges = {"x_min": -25, "x_max": -15, "y_min": 10, "y_max": 20}
        mtcs_all = spt.get_trace_curves(0.015)
        mtcs_xy_limited = spt.get_trace_curves(0.015, xy_edges=xy_edges)

        assert len(mtcs_all) > len(mtcs_xy_limited)

        if PLOTS:
            for mtc in mtcs_xy_limited:
                plt.plot(mtc.x, mtc.y)
            spt.plot(spt.wave_min, spt.wave_max)
            plt.axhline(xy_edges["y_min"])
            plt.axhline(xy_edges["y_max"])
            plt.axvline(xy_edges["x_min"])
            plt.axvline(xy_edges["x_max"])
            plt.show()
예제 #2
0
    def test_mtc_distances_are_one_pixel_horiz_trace(self, horizontal_trace):
        spt = SpectralTrace(horizontal_trace)
        mtcs = spt.get_trace_curves(0.015)
        pix_cen_x = [mtc.header["CRVAL1D"] / 0.015 for mtc in mtcs]
        pix_cen_y = [mtc.header["CRVAL2D"] / 0.015 for mtc in mtcs]
        assert np.abs(np.average(np.diff(pix_cen_x))) == approx(1, rel=1e-5)

        if PLOTS:
            plt.plot(pix_cen_x, pix_cen_y)
            plt.show()
예제 #3
0
    def test_mtc_distances_are_one_pixel_diagonal_trace(self, diagonal_trace):
        # diagonal trace is 30 degrees off vertical
        spt = SpectralTrace(diagonal_trace)
        mtcs = spt.get_trace_curves(0.015)
        pix_cen_x = [mtc.header["CRVAL1D"] / 0.015 for mtc in mtcs]
        pix_cen_y = [mtc.header["CRVAL2D"] / 0.015 for mtc in mtcs]
        assert np.abs(np.average(np.diff(pix_cen_y))) == approx(1, rel=1e-5)

        if PLOTS:
            plt.plot(pix_cen_x, pix_cen_y, "o")
            plt.show()
예제 #4
0
    def test_no_same_angles_for_curved_trace(self, curved_trace):
        spt = SpectralTrace(curved_trace)
        mtcs = spt.get_trace_curves(0.015)
        rots = [mtc.meta["rotation"] for mtc in mtcs]
        shears = [mtc.meta["shear"] for mtc in mtcs]

        assert len(np.unique(rots)) == len(np.unique(np.diff(rots)))

        if PLOTS:
            plt.subplot(121)
            for mtc in mtcs[::100]:
                plt.plot(mtc.x, mtc.y)

            plt.subplot(122)
            plt.plot(rots)
            plt.plot(shears)

            plt.show()
예제 #5
0
 def test_mtc_are_one_pixel_removed_from_each_other(self, basic_trace):
     spt = SpectralTrace(basic_trace)
     mtcs = spt.get_trace_curves(0.015)
     pix_cen_x = [mtc.header["CRVAL1D"] / 0.015 for mtc in mtcs]
     pix_cen_y = [mtc.header["CRVAL2D"] / 0.015 for mtc in mtcs]
     assert np.average(np.diff(pix_cen_y)) == approx(1, rel=1e-5)