예제 #1
0
    def _load_dists(self, dist_l, dist_r):
        '''Load the distortion files into :attr:`dists`

        Parameters
        ----------
        dist_l, dist_r : string
            Distortion file for the left and right spectrograph; at least one
            of them must be provided
        '''
        if not dist_r and not dist_l:
            raise ReconstructValueError('A distortion is needed to'
                                        ' quickreconstruct an image')
        if dist_l:
            self.dists['L'] = distortion.Distortion(dist_l)
        if dist_r:
            self.dists['R'] = distortion.Distortion(dist_r)
예제 #2
0
 def test_single_fiberprofile(self, datadir, fmod):
     if fmod.version >= 22:
         D = dist.Distortion(datadir.join('distortion_17.dist').strpath)
         assert abs(fmod.get_single_fiberprofile(100, 200, D) -
                    0.499776) < testprecision
         assert abs(fmod.get_single_fiberprofile(1000, 1500, D) -
                    0.549257) < testprecision
         assert abs(fmod.get_single_fiberprofile(1000, 3000, D) -
                    0.) < testprecision
예제 #3
0
 def test_single_fiberflux(self, datadir, fmod):
     if fmod.version >= 22:
         D = dist.Distortion(datadir.join('distortion_17.dist').strpath)
         assert abs(fmod.get_single_fiberflux(100, 200, D) -
                    0.532356) < testprecision
         assert abs(fmod.get_single_fiberflux(1000, 1500, D) -
                    0.59453) < testprecision
         assert abs(fmod.get_single_fiberflux(1000, 3000, D) -
                    0.) < testprecision
예제 #4
0
 def test_cumulative_fiberflux(self, datadir, fmod):
     if fmod.version >= 22:
         D = dist.Distortion(datadir.join('distortion_17.dist').strpath)
         assert abs(fmod.get_cumulative_fiberflux(100, 200, D) -
                    0.579471) < testprecision
         assert abs(fmod.get_cumulative_fiberflux(1000, 1500, D) -
                    0.59504) < testprecision
         assert abs(fmod.get_cumulative_fiberflux(1000, 3000, D) -
                    0.) < testprecision
예제 #5
0
 def test_write(self, dist, tmpdir):
     if dist.version >= 14:
         dname = tmpdir.strpath + '/test.dist'
         dist.writeto(dname)
         D = distortion.Distortion(dname)
         assert dist.version == D.version
         assert np.isclose(dist.maxx, D.maxx)
         assert np.isclose(dist.wave_par_.data, D.wave_par_.data).all()
         assert np.isclose(dist.reference_w_.data,
                           D.reference_w_.data).all()
         assert np.isclose(dist.reference_wavelength_,
                           D.reference_wavelength_)
예제 #6
0
 def test_single_fiberflux_fiber(self, datadir, fmod):
     if fmod.version >= 22:
         D = dist.Distortion(datadir.join('distortion_17.dist').strpath)
         assert abs(
             fmod.get_single_fiberflux_fiber(100, 200, 204, D) -
             0.53198) < testprecision
         assert abs(
             fmod.get_single_fiberflux_fiber(1000, 1500, 62, D) -
             0.59448) < testprecision
         assert abs(
             fmod.get_single_fiberflux_fiber(100, 200, 203, D) -
             0.00018) < testprecision
         assert abs(
             fmod.get_single_fiberflux_fiber(1000, 1500, 63, D) -
             0.00031) < testprecision
         assert abs(
             fmod.get_single_fiberflux_fiber(1000, 3000, 63, D) -
             0.0) < testprecision
예제 #7
0
 def test_single_fiberprofile_fiber(self, datadir, fmod):
     if fmod.version >= 22:
         D = dist.Distortion(datadir.join('distortion_17.dist').strpath)
         assert abs(
             fmod.get_single_fiberprofile_fiber(100, 200, 204, D) -
             0.499428) < testprecision
         assert abs(
             fmod.get_single_fiberprofile_fiber(1000, 1500, 62, D) -
             0.549209) < testprecision
         assert abs(
             fmod.get_single_fiberprofile_fiber(100, 200, 203, D) -
             0.000167601) < testprecision
         assert abs(
             fmod.get_single_fiberprofile_fiber(1000, 1500, 63, D) -
             0.000292374) < testprecision
         assert abs(
             fmod.get_single_fiberprofile_fiber(1000, 3000, 63, D) -
             0.0) < testprecision
예제 #8
0
 def test_wrong_version(self, datadir):
     with pytest.raises(IOError):
         distortion.Distortion(datadir.join('distortion_12.dist').strpath)
예제 #9
0
def dist(datadir, request):
    'return a distortion object'
    return distortion.Distortion(datadir.join(request.param).strpath)