Skip to content

Commit

Permalink
Merged audit with master
Browse files Browse the repository at this point in the history
  • Loading branch information
lcgraham committed May 15, 2015
2 parents 22a0415 + 7beb7ef commit abc3f52
Show file tree
Hide file tree
Showing 72 changed files with 5,105 additions and 1,767 deletions.
107 changes: 94 additions & 13 deletions bet/Comm.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,123 @@
# Copyright (C) 2014-2015 Lindley Graham and Steven Mattis

"""
This module provides a workaround for people without mpi4py installed
This module provides a workaround for people without mpi4py installed
to run BET.
"""

class comm_for_no_mpi4py:

class comm_for_no_mpi4py(object):

"""
Provides a fake MPI.COMM_WORLD implementation so that the user need not
install mpi4py.
"""

def __init__(self):
"""
Initialization
"""
pass

def Get_size(self):
"""
:rtype: int
:returns: 1
"""
return 1

def Get_rank(self):
return 0
def allgather(self,val):
"""
:rtype: int
:returns 0
"""
return 0

def allgather(self, val):
"""
:param object val: object to allgather
:rtype: object
:returns: val
"""
return val
def allreduce(self,val1, op=None):

def allreduce(self, val1, op=None):
"""
:param object val1: object to allreduce
:rtype: object
:returns: val1
"""
return val1
def bcast(self,val, root=0):
return val
def Allgather(self,val):

def bcast(self, val, root=0):
"""
:param object val: object to broadcast
:param int root: 0
:rtype: object
:returns: val
"""
return val
def Allreduce(self,val1, val2, op=None):

def Allgather(self, val):
"""
:param object val: object to Allgather
:rtype: object
:returns: val
"""
return val

def Allreduce(self, val1, val2, op=None):
"""
:param object val1: object to Allreduce
:param object val2: object to Allreduce
:param op: None
:rtype: object
:returns: val1
"""
return val1
def Bcast(self,val, root=0):

def Bcast(self, val, root=0):
"""
:param object val: object to gather
:param int root: 0
:rtype: object
:returns: val
"""
return val

def Scatter(self, val1, val2, root=0):
"""
:param object val1: object to Scatter
:param object val2: object to Scatter
:param int root: 0
:rtype: object
:returns: val1
"""
return val1

class MPI_for_no_mpi4py:

class MPI_for_no_mpi4py(object):

"""
Provides a fake MPI implementation so that the user need not install
mpi4py.
"""

def __init__(self):
"""
Initialization
"""
self.SUM = None
self.DOUBLE = float
self.INT = int

self.BOOL = bool

try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
except ImportError:
MPI = MPI_for_no_mpi4py()
comm = comm_for_no_mpi4py()

size = comm.Get_size()
rank = comm.Get_rank()
2 changes: 2 additions & 0 deletions bet/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Copyright (C) 2014-2015 Lindley Graham and Steven Mattis

__all__ = ['sampling', 'calculateP', 'postProcess', 'loadBalance', 'util','Comm']
20 changes: 13 additions & 7 deletions bet/calculateP/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
r"""
This subpackage provides classes and methods for calulating the probability
measure :math:`P_{\Lambda}`.
# Copyright (C) 2014-2015 Lindley Graham and Steven Mattis

* :mod:`~bet.calculateP.calculateP` provides methods for approximating probability
densities
* :mod:`~bet.calculateP.simpleFunP` provides methods for creating simple function
approximations of probability densisties
r"""
This subpackage provides classes and methods for calulating the
probability measure :math:`P_{\Lambda}`.
* :mod:`~bet.calculateP.calculateP` provides methods for approximating
probability densities
* :mod:`~bet.calculateP.simpleFunP` provides methods for creating simple
function approximations of probability densisties
* :mod:`~bet.calculateP.voronoiHistogram` provides methods for creating the
generating points for cells that define a regular grid for use by
:meth:`numpy.histogramdd` and for determining their volumes, etc. This
module is only for use by :mod:`~bet.calculateP.simpleFunP`.
"""
__all__ = ['calculateP', 'simpleFunP', 'voronoiHistogram']
Loading

0 comments on commit abc3f52

Please sign in to comment.