bsmart.scans.Diver

Diver scan

author:
  1. Goodsell

Some code adapted from PyMultiNest

Uses the Diver library from: https://diver.hepforge.org

You will have to install that library yourself, there is no cmake and, at least on my machine, at least one of the parameters in the makefile needed modifying

Requires:

Diver (built with MPI if required) [Optional] mpi4py (for MPI operation)

For variables we require a range, e.g.:

"Variables": {
    "lambda": { "RANGE": [0.01,1.0] }
    },

Various possibilities for likelihood functions are provided: GAUSS, BIAS, SIGMA, USER, or “OFF” for observables that should not be taken into account for the likelihood calculation (but the user wants to retain them in the summary file for other purposes). These are set by providing e.g.:

"Observables": {
    "mh" : { "SLHA": ["MASS", [25]], "SCALING": "GAUSS",
            "MEAN": 125.0,
            "VARIANCE":3.0
              }

or “SCALING”:”BIAS”, or “SCALING”:”OFF”

It is not necessary to specify the scaling explicitly: gaussian is taken by default

If you want to use your own likelihood function then add it as a tool, set the scaling to OFF for all observables except for the output of that tool, which you can set to “USER”

NB we compute LogLikelihoods here and subtract them all from zero to get a MinusLogLikelihood.

We take a uniform prior on all variables. This could be easily modified if there are convenient choices.

The Diver output files are stored in RunName/Diver

It is up to you to read them!!!

The raw points will as usual be retained in the Spectrum_Files directory if so desired, and merged if “Merge Results” is True:

"Setup" : {
    "Type" : "Diver",
    "Merge Results" : "True",
    "DiverLib": '/path/to/Diver/lib'
    ...
}

NB DiverLib just points to the lib directory. On linux machines we will use libdiver.so

Can run either with or without MPI:

For MPI runs, you should run

mpiexec -n <ncores> BSMArt <json file>

or, slightly safer:

mpiexec -n <ncores> python3 -m mpi4py BSMArt <json file>

We use the routine cdiver from cwrapper.f90:

subroutine cdiver(minusloglike_in, nPar, lowerbounds, upperbounds, path, nDerived, nDiscrete, discrete,  &
                                      partitionDiscrete, maxciv, maxgen, NP, nF, F, Cr, lambda, current, expon,              &
                                      bndry, jDE, lambdajDE,  convthresh, convsteps, removeDuplicates, doBayesian, prior_in, &
                                      maxNodePop, Ztolerance, savecount, resume, outputSamples, init_population_strategy,    &
                                      discard_unfit_points, max_initialisation_attempts, max_acceptable_value, seed,         &
                                      context, verbose) bind(c)

    use iso_c_binding, only: c_int, c_bool, c_double, c_char, c_funptr, c_ptr, C_NULL_CHAR
    use de, only: diver

    integer, parameter :: maxpathlen = 300

    type(c_funptr),  intent(in), value :: minusloglike_in, prior_in
    type(c_ptr),     intent(inout)     :: context
    integer(c_int),  intent(in), value :: nPar, nDerived, nDiscrete, maxciv, maxgen, NP, nF, bndry, convsteps, savecount, verbose
    integer(c_int),  intent(in), value :: init_population_strategy, max_initialisation_attempts, seed
    integer(c_int),  intent(in), target:: discrete(nDiscrete)
    logical(c_bool), intent(in), value :: partitionDiscrete, current, expon, jDE, lambdajDE, removeDuplicates, doBayesian, resume
    logical(c_bool), intent(in), value :: outputSamples, discard_unfit_points
    real(c_double),  intent(in), value :: Cr, lambda, convthresh, maxNodePop, Ztolerance, max_acceptable_value
    real(c_double),  intent(in)        :: lowerbounds(nPar), upperbounds(nPar), F(nF)
    character(kind=c_char,len=1), dimension(maxpathlen), intent(in) :: path

There are therefore loads of obscure parameters to deal with. Gah.

Information

BSMArt Name: Diver

Requires:
  • numpy

  • mpi4py

Settings:

  • DiverLib: Path to Diver library

  • RunName: Name of the run

  • Convergence Threshold: Float

  • Max Civilisations: Int

  • Verbose: Int

  • Number of parameters: Int

  • NP: Int

class bsmart.scans.Diver.NewScan(inputs, log)[source]

Bases: Scan

Scanner class for Diver Scans

likelihoodfns

self.likelihoodfns=[]

for o in self.inputs[‘Observables’]:

#self.header.append(o) obs=self.inputs[‘Observables’][o] scaling=’GAUSS’ if ‘SCALING’ in obs:

scaling=obs[‘SCALING’]

if ‘MEAN’ in obs:

tmean = obs[‘MEAN’]

else:

tmean=0.0

if ‘VARIANCE’ in obs:

tvar = obs[‘VARIANCE’]

else:

tvar = 0.0

self.likelihoodfns.append(FuncMe(scaling,tmean,tvar))

postprocess(Point, observables, data_point, temp_dir, log, lock=None)[source]

return the likelihood; we won’t get this far if the point failed to be generated

run()[source]
bsmart.scans.Diver.interrupt_handler(recvsignal, frame)[source]