# Path: nested_sampling/utils/result.py
# class Result(dict):
#     """ Represents the optimization result.
# 
#     Attributes
#     ----------
#     x : ndarray
#         The solution of the optimization.
#     success : bool
#         Whether or not the optimizer exited successfully.
#     status : int
#         Termination status of the optimizer. Its value depends on the
#         underlying solver. Refer to `message` for details.
#     message : str
#         Description of the cause of the termination.
#     fun, jac, hess : ndarray
#         Values of objective function, Jacobian and Hessian (if available).
#     nfev, njev, nhev : int
#         Number of evaluations of the objective functions and of its
#         Jacobian and Hessian.
#     nit : int
#         Number of iterations performed by the optimizer.
#     maxcv : float
#         The maximum constraint violation.
# 
#     Notes
#     -----
#     There may be additional attributes not listed above depending of the
#     specific solver. Since this class is essentially a subclass of dict
#     with attribute accessors, one can see which attributes are available
#     using the `keys()` method.
#     """
#     def __getattr__(self, name):
#         try:
#             return self[name]
#         except KeyError:
#             raise AttributeError(name)
# 
#     __setattr__ = dict.__setitem__
#     __delattr__ = dict.__delitem__
# 
#     def __repr__(self):
#         if self.keys():
#             m = max(map(len, list(self.keys()))) + 1
#             return '\n'.join([k.rjust(m) + ': ' + repr(v)
#                               for k, v in self.items()])
#         else:
#             return self.__class__.__name__ + "()"


import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.pyplot as plt
from nested_sampling.utils.result import Result
from harmonic import vector_random_uniform_hypersphere
    from harmonic import Harmonic
    #radius is a scalar corresponding to the max distance from the centre
    E = Emax
    if Eground is not None:
        E -= Eground
    
    radius = np.sqrt(2. * Emax)
    x = vector_random_uniform_hypersphere(ndim) * radius
    
    if kappa_sqrt is not None:
        x /= kappa_sqrt
    
    if x0 is not None:
        x += x0

    return x
    

class HarmonicSampler(object):
    """this class generates random configurations subject to a maximum energy
    """
    
    def __init__(self, potential, ndim):
        self.potential = potential
        self.ndim = ndim
    
    def __call__(self, x0, stepsize, Emax, energy, seed=None):
        return self.get_random_configuration(Emax)  
            
    def get_random_configuration(self, Emax):
        """return a configuration drawn uniformly with energy less than Emax"""

# Path: nested_sampling/utils/result.py
# class Result(dict):
#     """ Represents the optimization result.
# 
#     Attributes
#     ----------
#     x : ndarray
#         The solution of the optimization.
#     success : bool
#         Whether or not the optimizer exited successfully.
#     status : int
#         Termination status of the optimizer. Its value depends on the
#         underlying solver. Refer to `message` for details.
#     message : str
#         Description of the cause of the termination.
#     fun, jac, hess : ndarray
#         Values of objective function, Jacobian and Hessian (if available).
#     nfev, njev, nhev : int
#         Number of evaluations of the objective functions and of its
#         Jacobian and Hessian.
#     nit : int
#         Number of iterations performed by the optimizer.
#     maxcv : float
#         The maximum constraint violation.
# 
#     Notes
#     -----
#     There may be additional attributes not listed above depending of the
#     specific solver. Since this class is essentially a subclass of dict
#     with attribute accessors, one can see which attributes are available
#     using the `keys()` method.
#     """
#     def __getattr__(self, name):
#         try:
#             return self[name]
#         except KeyError:
#             raise AttributeError(name)
# 
#     __setattr__ = dict.__setitem__
#     __delattr__ = dict.__delitem__
# 
#     def __repr__(self):
#         if self.keys():
#             m = max(map(len, list(self.keys()))) + 1
#             return '\n'.join([k.rjust(m) + ': ' + repr(v)
#                               for k, v in self.items()])
#         else:
#             return self.__class__.__name__ + "()"


# Path: nested_sampling/models/harmonic_nowalk.py
import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.pyplot as plt
from nested_sampling.utils.result import Result
from harmonic import vector_random_uniform_hypersphere
    from harmonic import Harmonic

    #radius is a scalar corresponding to the max distance from the centre
    E = Emax
    if Eground is not None:
        E -= Eground
    
    radius = np.sqrt(2. * Emax)
    x = vector_random_uniform_hypersphere(ndim) * radius
    
    if kappa_sqrt is not None:
        x /= kappa_sqrt
    
    if x0 is not None:
        x += x0

    return x
    

class HarmonicSampler(object):
    """this class generates random configurations subject to a maximum energy
    """
    
    def __init__(self, potential, ndim):
        self.potential = potential
        self.ndim = ndim
    
    def __call__(self, x0, stepsize, Emax, energy, seed=None):
        return self.get_random_configuration(Emax)  
            
    def get_random_configuration(self, Emax):
        """return a configuration drawn uniformly with energy less than Emax"""

        res = Result()