示例#1
0
    def updatePlots(self, model, reset=False):
        bulge_flux, disk_flux = create_model_images(model, self.flux.shape, self.psf)
        model_flux = bulge_flux + disk_flux
        
        x0 = model.x0.value - 1.0
        y0 = model.y0.value - 1.0
        pa, ell = ellipse_params(self.flux, x0, y0)
        pa = (90.0 + pa) * np.pi / 180.0
        ba = 1.0 - ell
        bins = np.arange(30)
        r = bins[:-1] + 0.5 
        
        obs_r = radialProfile(self.flux, bins, x0, y0, pa, ba, rad_scale=1.0)
        obs_r = np.log10(obs_r)

        mod_r = radialProfile(model_flux, bins, x0, y0, pa, ba, rad_scale=1.0)
        mod_r = np.log10(mod_r)

        bulge_r = radialProfile(bulge_flux, bins, x0, y0, pa, ba, rad_scale=1.0)
        bulge_r = np.log10(bulge_r)

        disk_r = radialProfile(disk_flux, bins, x0, y0, pa, ba, rad_scale=1.0)
        disk_r = np.log10(disk_r)

        obs_im = np.log10(self.flux)
        mod_im = np.log10(model_flux)
        res_im = obs_im - mod_im

        if reset:
            self.plotPanel.reset(self.plotTitle, obs_im, mod_im, res_im, r, obs_r, mod_r, bulge_r, disk_r)
        else:
            self.plotPanel.update(obs_im, mod_im, res_im, r, obs_r, mod_r, bulge_r, disk_r)
示例#2
0
 def loadModel(self, model_file):
     if not path.exists(model_file):
         logger.warn('Initial model file not found (%s), guessing one. ' % model_file)
         x0 = (self.flux.shape[1] / 2.0) + 1.0
         y0 = (self.flux.shape[0] / 2.0) + 1.0
         pa, ell = ellipse_params(self.flux, x0, y0)
         r = distance(self.flux.shape, x0, y0, pa, ell)
         r = np.ma.array(r, mask=self.flux.mask)
         hlr = r50(self.flux, r)
         I_e = self.flux.max() * 0.1
         r_e = 0.5 * hlr
         n = 2.0
         I_0 = self.flux.max() * 0.1
         h = 1.0 * hlr
         model = BDModel()
         model.wl = 5635.0
         model.x0.setValue(x0)
         model.x0.setLimitsRel(10, 10)
         model.y0.setValue(y0)
         model.y0.setLimitsRel(10, 10)
         
         model.disk.I_0.setValue(I_0)
         model.disk.I_0.setLimits(0.0, 10.0 * I_0)
         model.disk.h.setValue(h)
         model.disk.h.setLimits(0.0, 5.0 * hlr)
         model.disk.PA.setValue(pa)
         model.disk.PA.setLimits(0.0, 180.0)
         model.disk.ell.setValue(ell)
         model.disk.ell.setLimits(0.0, 1.0)
     
         model.bulge.I_e.setValue(I_e)
         model.bulge.I_e.setLimits(1e-33, 3.0 * I_e)
         model.bulge.r_e.setValue(r_e)
         model.bulge.r_e.setLimits(1e-33, 2.5 * r_e)
         model.bulge.n.setValue(n, vmin=1.0, vmax=5.0)
         model.bulge.PA.setValue(pa)
         model.bulge.PA.setLimits(0.0, 180.0)
         model.bulge.ell.setValue(ell)
         model.bulge.ell.setLimits(0.0, 1.0)
         
         return model
     else:
         return BDModel.load(model_file)
示例#3
0
res_vmax = residual_range

ax = plt.subplot(gs[0,2])
im = ax.imshow(residual_im, vmin=res_vmin, vmax=res_vmax, cmap='RdBu')
plt.colorbar(im, ax=ax)
ax.set_xticks([])
ax.set_yticks([])
ax.set_title(u'Resíduo')


ax = plt.subplot(gs[1,:])
bins = np.arange(0, 32)
bins_c = bins[:-1]
y0 = initial_model.y0.value - 1
x0 = initial_model.x0.value - 1
pa_i, ell_i = ellipse_params(total_im, x0, y0)
pa_i = (90.0 + pa_i) * np.pi / 180.0
ba_i = 1.0 - ell_i

tr = radialProfile(np.log10(total_im), bins, x0, y0, pa_i, ba_i)
mr = radialProfile(np.log10(model_im), bins, x0, y0, pa_i, ba_i)
br = radialProfile(np.log10(bulge_model_im), bins, x0, y0, pa_i, ba_i)
dr = radialProfile(np.log10(disk_model_im), bins, x0, y0, pa_i, ba_i)

ax.plot(bins_c, tr, 'k-', label='Observado')
ax.plot(bins_c, mr, 'k--', label='Modelo')
ax.plot(bins_c, br, 'r-', label='Bojo')
ax.plot(bins_c, dr, 'b-', label='Disco')
ax.set_xlabel(r'Raio $[\mathrm{arcsec}]$')
ax.set_ylabel(r'$\log$ Fluxo')
ax.set_xlim(0.0, 20.0)
示例#4
0
ax = plt.subplot(gs[0,1])
ax.imshow(np.log10(bulge_image), vmin=vmin, vmax=vmax)
ax.set_xticks([])
ax.set_yticks([])
ax.set_title(r'Bulge')

ax = plt.subplot(gs[0,2])
ax.imshow(np.log10(disk_image), vmin=vmin, vmax=vmax)
ax.set_xticks([])
ax.set_yticks([])
ax.set_title(r'Disk')

ax = plt.subplot(gs[1,:2])
bins = np.arange(0, 32)
bins_c = bins[:-1] + 0.5
pa, ell = ellipse_params(full_image, norm_x0, norm_y0)
pa = (90.0 + pa) * np.pi / 180.0
ba = 1.0 - ell
mr = radialProfile(np.log10(full_image), bins, norm_x0, norm_y0, pa, ba)
br = radialProfile(np.log10(bulge_image), bins, norm_x0, norm_y0, pa, ba)
dr = radialProfile(np.log10(disk_image), bins, norm_x0, norm_y0, pa, ba)
ax.plot(bins_c, mr, 'k-', label='Total')
ax.plot(bins_c, br, 'r-', label='Bulge')
ax.plot(bins_c, dr, 'b-', label='Disk')
ax.set_xlabel(r'Radius [arcsec]')
ax.set_ylabel(r'$\log$ flux (relative)')
ax.set_xlim(0.0, 30.0)
ax.set_ylim(-1.0, 1.1)
ax.legend(loc='upper right')

ax = plt.subplot(gs[1,2])
示例#5
0
ax = plt.subplot(gs[0,1])
ax.imshow(np.log10(bulge_image[index_norm]), vmin=vmin, vmax=vmax)
ax.set_xticks([])
ax.set_yticks([])
ax.set_title(r'Bulge')

ax = plt.subplot(gs[0,2])
ax.imshow(np.log10(disk_image[index_norm]), vmin=vmin, vmax=vmax)
ax.set_xticks([])
ax.set_yticks([])
ax.set_title(r'Disk')

ax = plt.subplot(gs[1,:])
bins = np.arange(0, 32)
bins_c = bins[:-1] + 0.5
pa, ba = ellipse_params(model_image[index_norm], norm_x0, norm_y0)
mr = radialProfile(np.log10(model_image[index_norm]), bins, norm_x0, norm_y0, pa, ba)
br = radialProfile(np.log10(bulge_image[index_norm]), bins, norm_x0, norm_y0, pa, ba)
dr = radialProfile(np.log10(disk_image[index_norm]), bins, norm_x0, norm_y0, pa, ba)
ax.plot(bins_c, mr, 'k-', label='Total')
ax.plot(bins_c, br, 'r-', label='Bulge')
ax.plot(bins_c, dr, 'b-', label='Disk')
ax.set_xlabel(r'Radius [arcsec]')
ax.set_ylabel(r'$\log$ flux (relative)')
ax.set_xlim(0.0, 30.0)
ax.set_ylim(-1.0, 1.1)
ax.legend(loc='upper right')

norm_I_e = norm_model.bulge.I_e.value
norm_r_e = norm_model.bulge.r_e.value
norm_n = norm_model.bulge.n.value