Exemplo n.º 1
0
priors += [bxa.create_uniform_prior_for(srclevel)]
priors += [bxa.create_gaussian_prior_for(sphere.phoindex, 1.95, 0.15)]
priors += [bxa.create_uniform_prior_for(srcnh)]
if id2:
    priors += [bxa.create_uniform_prior_for(srclevel2)]
    parameters.append(srclevel2)
    priors += [bxa.create_uniform_prior_for(sphere2.phoindex)]
    parameters.append(sphere2.phoindex)
if id2:
    otherids = (id2, )
else:
    otherids = tuple()
if redshift_uncertain:
    priors.append(limited_0_10)
    parameters.append(redshift)
priorfunction = bxa.create_prior_function(priors=priors)
assert not numpy.isnan(
    calc_stat(id)), 'NaN on calc_stat, probably a bad RMF/ARF file for PC'
if id2:
    assert not numpy.isnan(
        calc_stat(id2)), 'NaN on calc_stat, probably a bad RMF/ARF file for WT'
print('running BXA ...')
outputfiles_basename = 'spherefit3_'
if not os.path.exists(outputfiles_basename + 'params.json'):
    bxa.nested_run(id,
                   otherids=otherids,
                   prior=priorfunction,
                   parameters=parameters,
                   resume=True,
                   verbose=True,
                   n_live_points=400,
f = invgauss.get_invgauss_func(numpy.log10(props['nhgal']), 0.15)

def limited_19_24(x):
	v = f(x)
	if v <= 19:
		v = 19
	if v >= 24:
		v = 24
	return v

priors = []
parameters = [srclevel, src.PhoIndex, srcnh, galnh]

import bxa.sherpa as bxa
priors += [bxa.create_uniform_prior_for(srclevel)]
priors += [bxa.create_uniform_prior_for(src.PhoIndex)]
priors += [bxa.create_uniform_prior_for(srcnh)]
priors += [limited_19_24] # galnh
priorfunction = bxa.create_prior_function(priors = priors)
print('running BXA ...')
bxa.nested_run(id, prior=priorfunction, parameters = parameters, 
	resume = True, verbose=True, 
	outputfiles_basename = 'superfit_')

exit()