# priors = [{'z': GaussianPrior(float(sys.argv[3]), 0.05), 'HpsEW': UniformPrior(0., 100.)}, {'age': LogUniformPrior(1e8, 10e9)}] csp = CSP(sfh=None,dust=None) csp.param['metal'] = 0.02 # A spectral model consists of one or more composite stellar populations (i.e. with # star formation histories and dust attenuation), with a common redshift and # velocity dispersion. The velocity dispersion is neglected in this case (lsf=None) # due to the low resolution of the grism. Parameters for the whole model are # stored in the first dictionary in the 'priors' array (here only 'z'), and parameters # for the CSP (only one in this case) are stored in the second (here 'age' and 'metal'=Z/H). model = SpectrumModel(lsf=GaussianVelocityLSF(1000.), csp=[csp]) model.param['emsigma'] = 200. # Should be irrelevant since morphologically dominated. options = util.options() options.nlive = 100 # Num. live points for MultiNest options.poly_order = 1 # Allow the model to be divided by a polynomial. # of this order to flatten the continuum. options.individual_polynomials = False # Specify parts of the BC03 grid that we want to load (isochrones, IMF, metallicities) options.grid_path = os.environ['GRID_PATH']+"/Padova1994/salpeter/bc2003_hr_stelib_m[metal]_salp_ssp.ised" options.grid_param = ["metal"] options.grid_paramlabels = [["52", "62", "72"]] options.grid_paramvalues = [[0.008, 0.02, 0.05]] options.grid_paramlogint = [True] options.trim_wavelength = [3500., 10000.] options.air2vac = True # Set to True if model grid should be converted to vac. options.rescale_spectrum_errors = 1. # Convenient way to rescale errors if necessary. options.output_prefix = sys.argv[-1] # Where the output goes. options.age_lt_universe = True
'sigma': UniformPrior(50, 500) }, { 'amplitude1': LogGaussianPrior(1.0, 3.0), 'amplitude2': LogGaussianPrior(1.0, 3.0), 'amplitude3': LogGaussianPrior(1.0, 3.0), 'amplitude4': LogGaussianPrior(1.0, 3.0), 'amplitude5': LogGaussianPrior(1.0, 3.0), # 'amplitude6': LogGaussianPrior(1.0, 3.0), 'A_V': UniformPrior(0, 4), 'metal': GaussianPrior(0.02, 0.005) } ] # Various options options = util.options() options.evidence_tolerance = 0.50 options.nlive = 200 options.poly_order = 10 # let the spectrum shape be modulated # by a multiplicative polynomial options.filterfile = '/data/jcosmos/data/catalogs/uvista/uvista_photometry/FILTER.RES.v7.R300' options.grid_path = '/data/lib/stellarlib/bc03/models/Padova1994/chabrier/bc2003_hr_stelib_m[metal]_chab_ssp.ised' options.grid_param = ['metal'] options.grid_paramlabels = [['52', '62', '72']] options.grid_paramvalues = [[0.008, 0.02, 0.05]] options.grid_paramlogint = [True] # interpolate in log space over metallicity options.air2vac = True # Convert to vacuum wavelengths, since the data are in vacuum options.output_prefix = 'fit/pysf_102266' options.rescale_spectrum_errors = 1.3712 # multiply specerr.fits by this options.add_to_lnprob = 5000. options.age_lt_universe = False
os.listdir(modelpath)) problems = [] maxsat_files = [] sat_files = [] for m in models: problems.append(m[len("maxsat_"):-len(".als")]) maxsat_files.append(path.join(modelpath, m)) sat_files.append(path.join(modelpath, m.replace("maxsat", "sat"))) sat_files = sat_files if run_sat else None benchmark(problems, sat_files, maxsat_files, run_maxsat_one, run_maxsat_all, run_maxsat_part, run_maxsat_part_auto, timeout, repeat) if __name__ == "__main__": run_sat, run_maxsat_one, run_maxsat_all, run_maxsat_part, run_maxsat_part_auto, timeout, repeat, model, from_file = options( ) if model is None: outpath = path.join(os.getcwd(), "out") if path.exists(outpath): shutil.rmtree(outpath) os.mkdir(outpath) run(outpath, run_sat, run_maxsat_one, run_maxsat_all, run_maxsat_part, run_maxsat_part_auto, timeout, repeat) else: run_models(model, run_sat, run_maxsat_one, run_maxsat_all, run_maxsat_part, run_maxsat_part_auto, timeout, repeat)
if keys[pygame.K_DOWN]: if timer<=0: timer=10 if choix==4: choix=0 else: choix+=1 if keys[pygame.K_SPACE] and timerMenu<=0: if choix==0: game.play(screen,varOptions) timerMenu=50 elif choix==1: util.regles(screen) elif choix==2: varOptions = util.options(screen,varOptions) elif choix==3: util.credits(screen) elif choix==4: sys.exit() timer-=1 timerMenu-=1 screen.blit(background.image,background.rect) select.rect.centery = menuPos[choix] screen.blit(select.image,select.rect) pygame.display.flip() screen.blit