Module Expr Str Import alias identifier Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Dict Str Str Str Dict Str Str Str NameLoad Dict Str Str Str NameLoad Dict Str Str Str NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr ListLoad Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Raise Call AttributeLoad NameLoad attr BinOpAdd Str Str If UnaryOpNot NameLoad body Raise Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd Str Str Str Assign NameStore ListLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad keyword SubscriptLoad NameLoad ExtSlice Slice Index Num keyword SubscriptLoad NameLoad ExtSlice Slice Index Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad ListComp NameLoad comprehension NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad Index Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Dict For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad BinOpAdd NameLoad NameLoad If CompareNotEq NameLoad Num body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad With Call NameLoad BinOpAdd NameLoad NameLoad Str NameStore body For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpAdd Call AttributeLoad Str attr ListLoad Call NameLoad NameLoad Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Str Assign NameStore Call NameLoad NameLoad TryExcept body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Num Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword Num keyword Num keyword Num keyword NameLoad keyword NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore SubscriptLoad ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad Index Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad With Call NameLoad BinOpAdd NameLoad Str Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad With Call NameLoad BinOpAdd NameLoad Str Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListComp ListLoad NameLoad comprehension NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListComp ListLoad Num comprehension NameStore Call NameLoad Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad keyword Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr ListComp ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr comprehension NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad keyword Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr ListComp Call AttributeLoad Str attr ListComp Call NameLoad NameLoad comprehension NameStore NameLoad comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr ListComp Call NameLoad NameLoad comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A 
.. module:: cosmo_hammer
    :synopsis: Invoke the Cosmo Hammer
.. moduleauthor:: Benjamin Audren <benjamin.audren@epfl.ch>

This module interface Monte Python with the CosmoHammer, available
`publicly <http://www.astro.ethz.ch/refregier/research/Software/cosmohammer>`_
and developped by Joel Akeret and Sebastian Seehars, who helped me a lot
creating this interface.

The link between the two codes is that some functions have been added to the
classes defined in Monte Python, so that they can become CoreModules and
LikelihoodModules of CosmoHammer. Mostly, all the important classes in Monte
Python (:class:`Data` <data.Data>, Class and :class:`Likelihood`
<likelihood_class.Likelihood>)

 N/A numpy np N/A os N/A warnings N/A logging N/A io_mp N/A sampler cosmoHammer.likelihood.chain.LikelihoodComputationChain LikelihoodComputationChain cosmoHammer.sampler.CosmoHammerSampler CosmoHammerSampler cosmoHammer.util.SampleFileUtil SampleFileUtil N/A CH_subfolder CH N/A CH_separator - N/A name_arguments .arguments N/A name_chain chain_CH__sampling.txt N/A CH_prefix CH_ N/A CH_user_arguments N/A walkersRatio burninIterations sampleIterations N/A help type Number of walkers int N/A help type Number of burnin phase iterations int N/A help type Number of sample iterations int run N/A N/A cosmo data command_line N/A N/A N/A 
    Sample with the CosmoHammer

     N/A parameter_names N/A N/A data get_mcmc_parameters N/A varying N/A N/A is_flat is_bound N/A N/A sampler check_flat_bound_priors N/A data mcmc_parameters parameter_names N/A N/A is_flat N/A N/A N/A N/A io_mp ConfigurationError N/A The Cosmo Hammer is only available with flat  priors. Sorry! N/A N/A is_bound N/A N/A N/A N/A io_mp ConfigurationError N/A N/A The Cosmo Hammer is only available for bound  parameters. Set reasonable bounds for them in the ".param" file. N/A params N/A N/A parameter parameter_names N/A N/A N/A N/A params append N/A N/A N/A data mcmc_parameters N/A parameter N/A initial N/A params N/A N/A np array params N/A CH_folder N/A N/A N/A os path join N/A command_line folder CH_subfolder N/A N/A N/A N/A N/A os path exists CH_folder N/A N/A N/A N/A os makedirs CH_folder N/A chain N/A LikelihoodComputationChain min N/A params N/A N/A N/A 1 max N/A params N/A N/A N/A 2 N/A N/A N/A chain addCoreModule data N/A N/A N/A chain addCoreModule cosmo N/A likelihood N/A N/A N/A data lkl itervalues N/A N/A N/A N/A chain addLikelihoodModule likelihood N/A chain_name N/A N/A a N/A a N/A N/A N/A command_line folder split N/A N/A os path sep a N/A -1 N/A file_prefix N/A N/A N/A os path join N/A command_line folder CH_subfolder chain_name N/A N/A data CH_arguments N/A N/A arg CH_user_arguments N/A N/A value N/A getattr command_line N/A CH_prefix arg N/A N/A value -1 N/A N/A N/A N/A data CH_arguments N/A arg value N/A N/A open N/A file_prefix name_arguments w arg_file N/A N/A arg N/A data CH_arguments N/A N/A N/A N/A arg_file write N/A N/A N/A  =  join N/A N/A str arg N/A str N/A N/A data CH_arguments N/A arg N/A derived_util N/A DerivedUtil file_prefix N/A N/A N/A num_threads N/A int N/A N/A os environ N/A OMP_NUM_THREADS N/A N/A N/A KeyError N/A N/A N/A N/A warnings warn The environment variable OMP_NUM_THREADS is not set. To run the Cosmo Hammer meaningfully, you should better set it to something! Defaulting to 1 for now. N/A num_threads 1 N/A sampler_hammer N/A CosmoHammerSampler params params likelihoodComputationChain chain filePrefix file_prefix walkersRatio 50 burninIterations 10 sampleIterations 30 storageUtil derived_util threadCount num_threads N/A data CH_arguments N/A console_handler N/A N/A logging StreamHandler N/A N/A N/A console_handler setLevel N/A logging DEBUG N/A N/A N/A N/A N/A logging getLogger addHandler console_handler N/A N/A N/A sampler_hammer startSampling N/A from_CH_output_to_chains N/A N/A folder N/A N/A N/A 
    Translate the output of the Cosmo Hammer into Monte Python chains

    This function will be called by the module :mod:`analyze`.
     N/A chain_name N/A N/A a N/A a N/A N/A folder split N/A N/A os path sep a N/A -2 N/A base_name N/A N/A N/A os path join folder chain_name N/A N/A open N/A base_name .out r param_values_file N/A N/A chains N/A N/A np loadtxt param_values_file N/A N/A open N/A base_name prob.out r lkl_values_file N/A N/A lkl N/A N/A np loadtxt lkl_values_file N/A lkl N/A N/A np array N/A N/A elem N/A elem lkl N/A ones N/A N/A np array N/A N/A 1 N/A _ N/A range N/A len lkl N/A final N/A N/A np concatenate N/A ones lkl chains axis 1 N/A output_folder N/A N/A N/A os path join folder .. N/A output_chain_path N/A N/A N/A os path join output_folder name_chain N/A N/A N/A np savetxt output_chain_path final N/A DerivedUtil N/A SampleFileUtil N/A N/A 
    Extends the writing class from CosmoHammer to include derived parameters.
     persistValues N/A N/A self posFile probFile pos prob data N/A N/A N/A 
        Writes the walker positions and the likelihood to the disk
         N/A derived N/A N/A np array N/A N/A a N/A a N/A N/A elem itervalues N/A elem data N/A final N/A N/A np concatenate N/A pos derived axis 1 N/A N/A N/A posFile write N/A N/A join N/A N/A N/A join N/A N/A str q N/A q p N/A p final N/A N/A N/A posFile write N/A N/A N/A posFile flush N/A N/A N/A probFile write N/A N/A join N/A N/A str p N/A p prob N/A N/A N/A probFile write N/A N/A N/A probFile flush N/A N/A