Git Product home page Git Product logo

sphere's Issues

Question: Additional Guidance on Using Sphere

Hi! I stumbled upon this package, and it looks great. For my application, I have spatial ellipses (lat/long, major/minor axes, orientation) on the globe representing locations of some entities. I want to map these ellipses to distributions on a sphere so I can sample from them. I'm struggling to understand how to map the parameters I have to one of the constructors you provide. Are you aware of any references that may help? I've tried Googling to no avail! Either way, thank you so much for this package!

Get HGM evaluation working

I've moved the HGM code from master into a new branch git checkout --track origin/hgm. At some point we should get that working.

Possibility to pass numpy random generator as argument in rvs

Hello! I am using your package to sample quaternions in non isotropic distributions, in particular Kent distribution.

I would like to suggest a small addition to make sampling from seeded generators easier by changing the class method rvs(self, n_samples=None) to rvs(self, n_samples=None,random_gen=None) by adding the possibility to pass a Numpy generator as argument like the model of the rvs_continuous class of scipy.stats.

For instance, if using scipy.stats:

    def _rvs_helper(self,random_gen=None):
        num_samples = 10000
        xs = gauss(0, 1).rvs((num_samples, 3),random_state=random_gen)
        xs = np.divide(xs, np.reshape(norm(xs, 1), (num_samples, 1)))
        lpvalues = self.log_pdf(xs, normalize=False)
        lfmax = self.log_pdf_max(normalize=False)
        shifted = lpvalues - lfmax
        return xs[uniform(0, 1).rvs(num_samples,random_state=random_gen) < np.exp(shifted)]

Where random_state is eitheir a None, int or numpy.random.generator .

another possibility if using numpy.random

from numpy.random import default_gen

# [...]

    def _rvs_helper(self,random_gen=None):
        num_samples = 10000
        if random_gen is None:
            random_gen = default_gen()
        xs = random_gen.normal(0, 1,(num_samples,3))
        xs = np.divide(xs, np.reshape(norm(xs, 1), (num_samples, 1)))
        lpvalues = self.log_pdf(xs, normalize=False)
        lfmax = self.log_pdf_max(normalize=False)
        shifted = lpvalues - lfmax
        return xs[random_gen.uniform(0, 1, num_samples) < np.exp(shift)] 

Thank you for your package !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.