In [1]:
import ptmcmc
import numpy as np

In [2]:
b=ptmcmc.boundary()
print(b.show())
print(b.getDomainLimits())
print(b.enforce(0))
b=ptmcmc.boundary('limit','limit',-1,1)
print(b.show())
print(b.getDomainLimits())
print(b.enforce(0))
print(b.enforce(1.1))


b'(-inf,inf)'
(-inf, inf)
True
b'[-1,1]'
(-1.0, 1.0)
True
False

In [3]:
help(ptmcmc)


Help on module ptmcmc:

NAME
    ptmcmc

CLASSES
    builtins.object
        Options
        boundary
        likelihood
        sampler
        state
        stateSpace
    
    class Options(builtins.object)
     |  Class for handling options for program subcomponents. 
     |  
     |  For wrapped C++ code the options are passed down into the C++ optioned interface.
     |  Options not processed in the C++ code are presumed to be handled at the python level.
     |  Options defined by python native code are processed, stored and accessed here.
     |  
     |  Methods defined here:
     |  
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __reduce__ = __reduce_cython__(...)
     |  
     |  __setstate__ = __setstate_cython__(...)
     |  
     |  add(...)
     |  
     |  parse(...)
    
    class boundary(builtins.object)
     |  Define boundary options for a parameter space dimension.
     |  
     |  Options are: 'open'=no limit, 'limit'=closed at value, 'reflect'=reflect around value, 'wrap'=wrap at value, onto other end
     |  
     |  Methods defined here:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __reduce__ = __reduce_cython__(...)
     |  
     |  __setstate__ = __setstate_cython__(...)
     |  
     |  enforce(...)
     |  
     |  getDomainLimits(...)
     |  
     |  show(...)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __pyx_vtable__ = <capsule object NULL>
    
    class likelihood(builtins.object)
     |  User should define a class to inherit from this one overriding evaluate_log()
     |  
     |  Methods defined here:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __reduce__ = __reduce_cython__(...)
     |  
     |  __setstate__ = __setstate_cython__(...)
     |  
     |  basic_setup(...)
     |  
     |  draw_from_prior(...)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __pyx_vtable__ = <capsule object NULL>
    
    class sampler(builtins.object)
     |  Methods defined here:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __reduce__ = __reduce_cython__(...)
     |  
     |  __setstate__ = __setstate_cython__(...)
     |  
     |  addOptions(...)
     |  
     |  initialize(...)
     |  
     |  run(...)
     |  
     |  setup(...)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __pyx_vtable__ = <capsule object NULL>
    
    class state(builtins.object)
     |  Define the parameter state.
     |  
     |  Methods defined here:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __reduce__ = __reduce_cython__(...)
     |  
     |  __setstate__ = __setstate_cython__(...)
     |  
     |  getSpace(...)
     |  
     |  get_params(...)
     |  
     |  get_string(...)
     |  
     |  show(...)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __pyx_vtable__ = <capsule object NULL>
    
    class stateSpace(builtins.object)
     |  Define the parameter state space.
     |  
     |  Methods defined here:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __reduce__ = __reduce_cython__(...)
     |  
     |  __setstate__ = __setstate_cython__(...)
     |  
     |  requireIndex(...)
     |  
     |  set_bound(...)
     |  
     |  set_names(...)
     |  
     |  show(...)
     |  
     |  size(...)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __pyx_vtable__ = <capsule object NULL>

FUNCTIONS
    resetRNGseed(...)

DATA
    __test__ = {}

FILE
    /Users/jgbaker/Projects/StellarAstronomy/TessSLB/src/LightCurveCode/ptmcmc/cython/ptmcmc.cpython-36m-darwin.so



In [4]:
sp=ptmcmc.stateSpace(dim=2)
sp.set_names(['a','b',])
sp.set_bound('a',ptmcmc.boundary('limit','limit',-1,1))
sp.set_bound('b',ptmcmc.boundary('wrap','wrap',-np.pi,np.pi))
print(sp.show())


StateSpace:(dim=2)
  a in [-1,1]
  b in w[-3.14159,3.14159)w


In [5]:
print(sp.requireIndex('b'))


1

In [6]:
print(ptmcmc.boundary('wrap','wrap',-np.pi,np.pi).show())
sp=ptmcmc.stateSpace(pars={'a':ptmcmc.boundary('limit','limit',-1,1),'b':ptmcmc.boundary('limit','limit',-1,1)})
s=ptmcmc.state(sp,[10,.2])
s.show()


b'w[-3.14159,3.14159)w'
Out[6]:
'(\n  a = 10\n  b = 0.2\n)\n'

In [7]:
class trivial(ptmcmc.likelihood):
    def __init__(self):
        sp=ptmcmc.stateSpace(pars={'a':ptmcmc.boundary('limit','limit',-1,1),'b':ptmcmc.boundary('limit','limit',-1,1)})
        self.basic_setup(sp, ['uni','uni'], [0,0], [1,1])
    def evaluate_log(self,state):return 0

In [8]:
like=trivial()
s0=like.draw_from_prior()
s0.show()
like0=like.evaluate_log(s0)
print(like0)


0

In [9]:
help(trivial)


Help on class trivial in module __main__:

class trivial(ptmcmc.likelihood)
 |  User should define a class to inherit from this one overriding evaluate_log()
 |  
 |  Method resolution order:
 |      trivial
 |      ptmcmc.likelihood
 |      builtins.object
 |  
 |  Methods defined here:
 |  
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  evaluate_log(self, state)
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from ptmcmc.likelihood:
 |  
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.
 |  
 |  __reduce__ = __reduce_cython__(...)
 |  
 |  __setstate__ = __setstate_cython__(...)
 |  
 |  basic_setup(...)
 |  
 |  draw_from_prior(...)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from ptmcmc.likelihood:
 |  
 |  __pyx_vtable__ = <capsule object NULL>


In [ ]: