Example #1
0
    def calc_model(self):
        lines = lines_from_f26(self.opt.f26)
        wa = self.spec[self.i].wa
        dw = np.median(np.diff(wa))
        print 'finding tau'
        if self.opt.wadiv is not None:
            dw1 = dw / self.opt.wadiv
            wa1 = np.arange(wa[0], wa[-1] + 0.5 * dw1, dw1)
            tau, ticks = find_tau(wa1, lines, self.opt.atom,
                                  logNthresh_LL=self.opt.logNthresh_LL)
        else:
            tau, ticks = find_tau(wa, lines, self.opt.atom,
                                  logNthresh_LL=self.opt.logNthresh_LL)

        model = np.exp(-tau)
        # if we want to calculate the optical depth per line,
        # do it here.

        if self.opt.wadiv is not None:
            model, _ = process_Rfwhm(self.opt.Rfwhm, wa1, model, [])
        else:
            model, _ = process_Rfwhm(self.opt.Rfwhm, wa, model, [])

        if self.opt.wadiv is not None:
            model = np.interp(wa, wa1, model)

        self.models[self.i] = model
        self.ticks = ticks
        self.model = model
Example #2
0
    def calc_model(self):
        lines = lines_from_f26(self.opt.f26)
        lines = [l for l in lines if l[0] not in ('__', '<>')]
        wa = self.spec[self.i].wa
        dw = np.median(np.diff(wa))
        print('finding tau')
        if self.opt.wadiv is not None:
            dw1 = dw / self.opt.wadiv
            wa1 = np.arange(wa[0], wa[-1] + 0.5 * dw1, dw1)
            tau, ticks = find_tau(wa1, lines, self.opt.atom,
                                  logNthresh_LL=self.opt.logNthresh_LL)
        else:
            tau, ticks = find_tau(wa, lines, self.opt.atom,
                                  logNthresh_LL=self.opt.logNthresh_LL)

        model = np.exp(-tau)
        # if we want to calculate the optical depth per line,
        # do it here.

        if self.opt.wadiv is not None:
            model, _ = process_Rfwhm(self.opt.Rfwhm, wa1, model, [])
        else:
            model, _ = process_Rfwhm(self.opt.Rfwhm, wa, model, [])

        if self.opt.wadiv is not None:
            model = np.interp(wa, wa1, model)

        #self.apply_zero_offsets()

        self.models[self.i] = model
        self.ticks = ticks
        self.model = model
Example #3
0
    def convolve_LSF(self):
        print 'convolving'
        if self.opt.wadiv is not None:
            self.model, models = process_Rfwhm(self.opt.Rfwhm, self.wa1,
                                               self.model, [])
        else:
            self.model, models = process_Rfwhm(self.opt.Rfwhm, self.wa,
                                               self.model, [])

        if self.opt.wadiv is not None:
            self.model = np.interp(self.wa, self.wa1, self.model)
            #self.models = [np.interp(wa, self.wa1, m) for m in self.models]
        print 'done!'
Example #4
0
    def convolve_LSF(self):
        print 'convolving'
        if self.opt.wadiv is not None:
            self.model, _ = process_Rfwhm(
                self.opt.Rfwhm, self.wa1, self.model, [])
        else:
            self.model, _ = process_Rfwhm(
                self.opt.Rfwhm, self.wa, self.model, [])

        if self.opt.wadiv is not None:
            self.model = np.interp(self.wa, self.wa1, self.model)
            #self.models = [np.interp(wa, self.wa1, m) for m in self.models]
        print 'done!'