Esempio n. 1
0
    def read(self):

        with open(self.filename) as in_:
            self.version = int(io_helpers.skip_commentlines(in_))
            self.minw = float(io_helpers.skip_commentlines(in_))
            self.maxw = float(io_helpers.skip_commentlines(in_))
            self.minf = float(io_helpers.skip_commentlines(in_))
            self.maxf = float(io_helpers.skip_commentlines(in_))
            self.minx = float(io_helpers.skip_commentlines(in_))
            self.maxx = float(io_helpers.skip_commentlines(in_))
            self.miny = float(io_helpers.skip_commentlines(in_))
            self.maxy = float(io_helpers.skip_commentlines(in_))

            self.sigma_par_.read(in_)
            self.sigma_errors_.read(in_)
            self.h2_par_.read(in_)
            self.h2_errors_.read(in_)
            self.h3_par_.read(in_)
            self.h3_errors_.read(in_)
            self.exp_par_.read(in_)
            self.exp_errors_.read(in_)
            size = float(io_helpers.skip_commentlines(in_))
            i = 0
            while i < size:
                amp = ma.FVector()
                amp.read(in_)
                self.amplitudes.append(amp)
                i += 1
Esempio n. 2
0
    def read(self):

        with open(self.filename) as in_:
            self.version = int(io_helpers.skip_commentlines(in_))
            self.minw = float(io_helpers.skip_commentlines(in_))
            self.maxw = float(io_helpers.skip_commentlines(in_))
            self.minf = float(io_helpers.skip_commentlines(in_))
            self.maxf = float(io_helpers.skip_commentlines(in_))
            self.minx = float(io_helpers.skip_commentlines(in_))
            self.maxx = float(io_helpers.skip_commentlines(in_))
            self.miny = float(io_helpers.skip_commentlines(in_))
            self.maxy = float(io_helpers.skip_commentlines(in_))

            self.wave_par_.read(in_)
            self.wave_errors_.read(in_)
            self.fiber_par_.read(in_)
            self.fiber_errors_.read(in_)
            self.x_par_.read(in_)
            self.x_errors_.read(in_)
            self.y_par_.read(in_)
            self.y_errors_.read(in_)
            self.fy_par_.read(in_)
            self.fy_errors_.read(in_)
            self.reference_wavelength_ = \
                float(io_helpers.skip_commentlines(in_))
            self.reference_w_.read(in_)
            self.reference_f_.read(in_)
            self.wave_offsets_.read(in_)
            self.x_offsets_.read(in_)
Esempio n. 3
0
    def __init__(self, filename):

        _vdict = {14: Distortion_14, 17: Distortion_14}

        in_ = open(filename)
        fileversion = int(io_helpers.skip_commentlines(in_))
        in_.close()

        if fileversion not in _vdict:
            raise IOError('Unsupported version of Distortion file!')

        self._cls = _vdict[fileversion](filename)
Esempio n. 4
0
    def __init__(self, filename):

        _vdict = {
            16: FiberModel_16,
            17: FiberModel_16,
            18: FiberModel_18,
            19: FiberModel_19,
            21: FiberModel_21,
            22: FiberModel_22
        }

        with open(filename) as in_:
            fileversion = int(io_helpers.skip_commentlines(in_))

        if fileversion not in _vdict:
            raise IOError('Unsupported version of Fibermodel file!')

        self._cls = _vdict[fileversion](filename)
Esempio n. 5
0
    def read(self):

        with open(self.filename) as in_:
            self.version = int(io_helpers.skip_commentlines(in_))
            self.minw = float(io_helpers.skip_commentlines(in_))
            self.maxw = float(io_helpers.skip_commentlines(in_))
            self.minf = float(io_helpers.skip_commentlines(in_))
            self.maxf = float(io_helpers.skip_commentlines(in_))
            self.minx = float(io_helpers.skip_commentlines(in_))
            self.maxx = float(io_helpers.skip_commentlines(in_))
            self.miny = float(io_helpers.skip_commentlines(in_))
            self.maxy = float(io_helpers.skip_commentlines(in_))

            self.sigma_par_.read(in_)
            self.sigma_errors_.read(in_)
            self.h2_par_.read(in_)
            self.h2_errors_.read(in_)
            self.h3_par_.read(in_)
            self.h3_errors_.read(in_)
            self.exp_par_.read(in_)
            self.exp_errors_.read(in_)
            for i in range(0, 4):
                val = float(io_helpers.skip_commentlines(in_))
                self.powerlaw_wings.append(val)
            size = int(io_helpers.skip_commentlines(in_))
            i = 0
            while i < size:
                amp = BSpline()
                amp.read(in_)
                self.amplitudes.append(amp)
                i += 1

        self.profile = gauss1D_H(self.powerlaw_wings)
Esempio n. 6
0
def test_skip_comment(lines, first_line):
    line = ioh.skip_commentlines(six.StringIO(lines))
    assert line == first_line