raise ValueError, "detector=%s not understood"%arg ############################################################################### ####################### initialize network and priors ######################## nfreqs = len(freqs) ndet = len(detectors) print 'Number of detectors = ', ndet if opts.verbose: print "building prior objects" if opts.time: to = time.time() hprior_amplitudes, hprior_means, hprior_covariance = priors.hpri_neg4(len_freqs=nfreqs, seg_len=seg_len, num_pol=num_pol, num_gaus=num_gaus) hprior = priors.hPrior(freqs=freqs, means=hprior_means, covariance=hprior_covariance, amplitudes=hprior_amplitudes, num_gaus=num_gaus, num_pol=num_pol) angprior = priors.angPrior(nside_exp=nside_exp) if opts.verbose and opts.time: print "\t", time.time()-to if opts.verbose: print "building network" if opts.time: to=time.time() network = utils.Network(detectors=[detectors[i] for i in detectors], freqs=freqs, Np = num_pol) if opts.verbose: print network if opts.time: print "\t", time.time()-to fig = plt.figure()
print "building angPrior" if opts.time: to = time.time() nside_exp=config.getint("angPrior","nside_exp") prior_type=config.get("angPrior","prior_type") angPrior_kwargs={} if prior_type=="uniform": pass elif prior_type=="antenna_pattern": angPrior_kwargs["frequency"]=config.getfloat("angPrior","frequency") angPrior_kwargs["exp"]=config.getfloat("angPrior","exp") else: raise ValueError, "prior_type=%s not understood"%prior_type angprior = priors.angPrior(nside_exp, prior_type=prior_type, network=network, **angPrior_kwargs) if opts.time: print "\t", time.time()-to #================================================= ### build hprior #================================================= if opts.verbose: print "\n----------------------------------\n" print "building hPrior" if opts.time: to = time.time() pareto_a=config.getfloat("hPrior","pareto_a") n_gaus_per_dec=config.getfloat("hPrior","n_gaus_per_dec")
file_obj.close() #================================================= # PRIORS #================================================= import priors print "hPrior" to=time.time() pareto_means, pareto_covariance, pareto_amps = priors.pareto(a, n_freqs, n_pol, variances) hprior_obj = priors.hPrior(freqs, pareto_means, pareto_covariance, amplitudes=pareto_amps, n_gaus=n_gaus, n_pol=n_pol, byhand=True) print "\t", time.time()-to print "angPrior" to=time.time() angprior_obj = priors.angPrior(nside_exp, prior_type=prior_type) print "\t", time.time()-to #================================================= # POSTERIORS #================================================= import posteriors print "posterior.__init__()" to=time.time() posterior_obj = posteriors.Posterior(network=network, hPrior=hprior_obj, angPrior=angprior_obj, seglen=seglen, data=None) print "\t", time.time()-to print "posterior.set_theta_phi()" to=time.time() posterior_obj.set_theta_phi()