status_text, 1)

    @pyqtSlot()
    def setbzN(self):
        '''Set the column density or redshift from the box
        '''
        if self.update is False:
            return
        idx = self.get_sngl_sel_sys()
        if idx is None:
            return
        # NHI
        try:
            self.abssys_widg.all_abssys[idx].NHI = (
                float(self.Nwidget.box.text()))
        except:
            self.abssys_widg.all_abssys[idx].NHI = 20.
        if self.abssys_widg.all_abssys[idx].NHI > 40:  # Max
            self.abssys_widg.all_abssys[idx].NHI = 40.
            self.Nwidget.set_text(40.)
        # z
        try:
            self.abssys_widg.all_abssys[idx].limits._z = (
                float(self.zwidget.box.text()))
        except:
            self.abssys_widg.all_abssys[idx].limits._z = 2.
        # b-value
        try:
            self.abssys_widg.all_abssys[idx].bval = (float(self.bwidget.box.text()))*u.km/u.s
        except:
            self.abssys_widg.all_abssys[idx].bval = 10 * u.km/u.s
        if self.abssys_widg.all_abssys[idx].bval < (1*u.km/u.s):
            self.abssys_widg.all_abssys[idx].bval = (1*u.km/u.s)
        self.abssys_widg.all_abssys[idx].comment = (
            self.Cwidget.box.text())
        # Update the lines
        for iline in self.abssys_widg.all_abssys[idx].lls_lines:
            iline.setz(self.abssys_widg.all_abssys[idx].zabs)
            iline.attrib['N'] = 10**self.abssys_widg.all_abssys[idx].NHI * u.cm**-2
            iline.attrib['b'] = self.abssys_widg.all_abssys[idx].bval
        # Update the rest
        '''
        self.update_model()
        self.draw()
        '''

    def update_boxes(self):
        """Update Nbz boxes"""
        idx = self.get_sngl_sel_sys()
        if idx is None:
            return
        # z
        self.update = False  # Avoids a bit of an internal loop
        self.zwidget.box.setText(
            self.zwidget.box.frmt.format(
                self.abssys_widg.all_abssys[idx].zabs))
        # N
        self.Nwidget.box.setText(
            self.Nwidget.box.frmt.format(
                self.abssys_widg.all_abssys[idx].NHI))
        # b
        self.bwidget.box.setText(
            self.bwidget.box.frmt.format(
                self.abssys_widg.all_abssys[idx].bval.value))
        # Comment
        self.Cwidget.box.setText(
            self.Cwidget.box.frmt.format(
                self.abssys_widg.all_abssys[idx].comment))
        # Rest-frame too
        self.spec_widg.show_restframe = False
        self.spec_widg.rest_z = self.abssys_widg.all_abssys[idx].zabs
        self.update = True


    def update_conti(self):
        """Update continuum
        """
        cflux = self.base_continuum * self.conti_dict['Norm']
        # Double tilt
        if 'piv_wv2' in self.conti_dict.keys():
            lowwv = self.continuum.wavelength.value < self.conti_dict['piv_wv2']
            self.continuum.flux[lowwv] = (cflux[lowwv] * (self.continuum.wavelength.value[lowwv]/
                                            self.conti_dict['piv_wv2'])**self.conti_dict['tilt2'])
            self.continuum.flux[~lowwv] = (cflux[~lowwv] * (self.continuum.wavelength.value[~lowwv]/
                                            self.conti_dict['piv_wv'])**self.conti_dict['tilt'])
        else:
            #QtCore.pyqtRemoveInputHook()
            #pdb.set_trace()
            #QtCore.pyqtRestoreInputHook()
            self.continuum.flux = (cflux * (self.continuum.wavelength.value/
                    self.conti_dict['piv_wv'])**self.conti_dict['tilt'])
        if self.lls_model is not None:
            self.full_model.flux = self.lls_model * self.continuum.flux
        else:
            self.spec_widg.model = self.continuum
        # For plotting
        #self.spec_widg.spec.co = self.continuum.flux.value

    def update_model(self):
        '''Update absorption model '''
        from linetools.analysis import voigt as lav

        if len(self.abssys_widg.all_abssys) == 0:
            self.lls_model = None
            self.spec_widg.model = None
            return
        '''
        # Regenerate (in case we have switched between multiple spectra)
        if self.spec_widg.spec.nspec > 1:
            self.full_model = XSpectrum1D.from_tuple((
                self.spec_widg.spec.wavelength,np.ones(len(self.spec_widg.spec.wavelength))))
        '''
        # use finer wavelength array to resolve absorption features.
        wa = self.full_model.wavelength
        # Angstroms
        # should really make this a constant velocity width array instead.
        if not self.skip_wveval:
            wa1 = np.arange(wa[0].value, wa[-1].value, self.dw) * wa.unit
        else:
            wa1 = wa
        all_tau_model = igmlls.tau_multi_lls(wa1,
           self.abssys_widg.all_abssys, skip_wveval=self.skip_wveval)

        # Loop on forest lines
        for forest in self.all_forest:
            tau_Lyman = lav.voigt_from_abslines(wa1, forest.lines,
                ret='tau', skip_wveval=self.skip_wveval)
            all_tau_model += tau_Lyman

        # Flux and smooth
        flux = np.exp(-1. * all_tau_model)
        if self.smooth > 0:
            if not self.skip_wveval:
                mult = np.median(np.diff(wa.value)) / self.dw
                flux = lsc.convolve_psf(flux, self.smooth * mult)
            else:
                flux = lsc.convolve_psf(flux, self.smooth)
        if not self.skip_wveval:
            self.lls_model = np.interp(wa.value, wa1.value, flux)
        else:
            self.lls_model = flux

        # Finish
        self.full_model.flux = self.lls_model * self.continuum.flux
        # Over-absorbed
        try:
            self.spec_widg.bad_model = np.where( (self.lls_model < 0.7) &
                (self.full_model.flux < (self.spec_widg.spec.flux-
                    self.spec_widg.spec.sig*1.5)))[0]
        except:
            pass
        # Model
        self.spec_widg.model = self.full_model



    def get