Beispiel #1
0
moc=moc_routines.get_fitting_region(order,tiles[taskid-1])
priors[0].moc=moc
priors[0].cut_down_prior()
print('fitting '+ str(priors[0].nsrc)+' sources \n')
print('there are '+ str(priors[0].snpix)+' pixels')
print('fitting tile:'+str(tiles[taskid-1])+' order: '+str(order)+' of '+str(len(tiles))+' tiles')


from xidplus.stan_fit import MIPS
priors[0].prior_bkg(0.0,1)
priors[0].get_pointing_matrix()
#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)
Beispiel #2
0
                   ID=prior_cat['help_id'])  #Set input catalogue
prior250.prior_bkg(
    -5.0, 5)  #Set prior on background (assumes Gaussian pdf with mu and sigma)

centre = np.long((MIPS_psf[1].header['NAXIS1'] - 1) / 2)
radius = 20
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: