Exemple #1
0
#priors[0].upper_lim_map()

#priors[0].prior_flux_upper=(priors[0].prior_flux_upper-10.0+0.02)/np.max(priors[0].prf)

fit=MIPS.MIPS_24(priors[0],iter=1000)

posterior=xidplus.posterior_stan(fit,priors)

outfile=output_folder+'Tile_'+str(tiles[taskid-1])+'_'+str(order)

posterior=xidplus.posterior_stan(fit,priors)
xidplus.save(priors,posterior,outfile)
      
post_rep_map=postmaps.replicated_maps(priors,posterior,nrep=2000)
Bayes_P24=postmaps.Bayes_Pval_res(priors[0],post_rep_map[0])
cat=catalogue.create_MIPS_cat(posterior, priors[0], Bayes_P24)
kept_sources=moc_routines.sources_in_tile([tiles[taskid-1]],order,priors[0].sra,priors[0].sdec)
kept_sources=np.array(kept_sources)
cat[1].data=cat[1].data[kept_sources]
outfile=output_folder+'Tile_'+str(tiles[taskid-1])+'_'+str(order)

cat.writeto(outfile+'_MIPS24_cat.fits',overwrite=True)

Bayesian_Pval=postmaps.make_Bayesian_pval_maps(priors[0],post_rep_map[0])
wcs_temp=wcs.WCS(priors[0].imhdu)
ra,dec=wcs_temp.wcs_pix2world(priors[0].sx_pix,priors[0].sy_pix,0)
kept_pixels=np.array(moc_routines.sources_in_tile([tiles[taskid-1]],order,ra,dec))
Bayesian_Pval[np.invert(kept_pixels)]=np.nan

Bayes_24_map=postmaps.make_fits_image(priors[0],Bayesian_Pval)
Bayes_24_map.writeto(outfile+'_MIPS_24_Bayes_Pval.fits',overwrite=True)
Exemple #2
0
prior250.set_prf(
    MIPS_psf[1].data[centre - radius:centre + radius + 1,
                     centre - radius:centre + radius + 1] / 1.0E6,
    np.arange(0, 41 / 2.0, 0.5), np.arange(0, 41 / 2.0, 0.5)
)  #requires PRF as 2d grid, and x and y bins for grid (in pixel scale)

prior250.get_pointing_matrix()

from xidplus.stan_fit import MIPS, SPIRE
fit = MIPS.MIPS_24(prior250, iter=1000)

posterior = xidplus.posterior_stan(fit, [prior250])
priors = [prior250]

import xidplus.catalogue as cat
MIPS_cat = cat.create_MIPS_cat(posterior, priors[0], 0)
MIPS_cat = Table.read(MIPS_cat)

mask = [MIPS_cat['help_id'][i] in ids for i in range(len(MIPS_cat))]
MIPS_cat = MIPS_cat[mask]

if os.path.exists(
        'data/fir/MIPS_no_lofar/xidplus_run_{}'.format(taskid)) == True:
    ()
else:
    os.mkdir('data/fir/MIPS_no_lofar/xidplus_run_{}'.format(taskid))

xidplus.save(
    [prior250], posterior,
    'data/fir/MIPS_no_lofar/xidplus_run_{}/lofar_xidplus_fir_{}'.format(
        taskid, taskid))