Giter VIP home page Giter VIP logo

skyarea's Introduction

Sky Areas
=========

Computing credible areas and p-values for MCMC samples on the sky
using a clustered-kernel-density estimate (similar to X-Means).

See the project documentation at http://skyarea.readthedocs.io

The code is released under the MIT license; see the LICENSE file for
more information.

skyarea's People

Contributors

farr avatar lpsinger avatar vitale82 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

skyarea's Issues

Variable referenced before assignment in 3D KDE

I occasionally get this traceback:

/home/user/local/lib/python2.7/site-packages/sky_area/sky_area_clustering.py:632: RuntimeWarning: divide by zero encountered in log
  return np.sum(np.log(self.posterior(pts))) - nparams/2.0*np.log(self.kde_pts.shape[0])
Traceback (most recent call last):
  File "/home/user/local/bin/run_sky_area.py", line 170, in <module>
    skypost3d = sac.Clustered3DKDEPosterior(np.column_stack((data['ra'], data['dec'], data['dist'])))
  File "/home/user/local/lib/python2.7/site-packages/sky_area/sky_area_clustering.py", line 581, in __init__
    self._set_up_optimal_k()
  File "/home/user/local/lib/python2.7/site-packages/sky_area/sky_area_clustering.py", line 295, in _set_up_optimal_k
    bic = self._set_up_optimal_kmeans(k, self.ntrials)
  File "/home/user/local/lib/python2.7/site-packages/sky_area/sky_area_clustering.py", line 343, in _set_up_optimal_kmeans
    self._set_up_kmeans(k, means=best_means, assign=best_assign)
UnboundLocalError: local variable 'best_means' referenced before assignment

Looking at the _set_up_kmeans function, the immediate cause is probably that bic evaluates to np.NINF on every loop iteration. Strictly speaking, it's also possible that the loop count ntrials is zero and the loop body never runs, but this is unlikely because ntrials seems to come straight from the program's command line arguments.

This is event 317140 from the 2016 scenario in the first2years paper.

I'll set the random seed to a fixed value from now on so that the results are reproducible.

Release for ER10

It slipped my mind, but we need a release for ER10 in order to pick up the HDF5 support. Would you please generate v0.2?

No such module: plotutils

The plotutils module that is imported in process_areas is missing. What package does it come from?

How to calculate bic when points are dropped due to degenerate clusters?

When we search over the number of clusters k over n points with dimensionality d, it often occurs that there are degenerate clusters that contain fewer than d distinct points. When this happens, we have to discard the degenerate clusters. What is the correct way to count degenerate clusters in the BIC? Should the discarded points be counted in the numerator? Should the discarded degrees of freedom be counted in the denominator? Right now, we are counting both.

Dependencies are broken

Through the lalinference import, this code seems to require LALSuite. This is neither mentioned in the README nor docs/index.rst.

Additionally, setup.py specifies glue in install_requires. When installing with pip, it installs this glue. Based on their descriptions, I'm pretty sure the intent is to use this LIGO glue instead, but I also don't see any references to it, so I'm not sure that dep is even required.

Few issues

Hi Will,

I'm just new of github, thus I'm not sure how everything works. In particular I'm not sure I can push myself to the repo. Thus for the moment I'm just opening a ticket.

Working with the latest version of the code I do see occasional errors like:

Traceback (most recent call last):
  File "/home/salvatore.vitale/lalsuites/skyPP/bin/run_sky_area.py", line 150, in <module>
    inj.simulation_id, inj.longitude, inj.latitude)
  File "/home/salvatore.vitale/lalsuites/skyPP/bin/run_sky_area.py", line 58, in save_areas
    areas = skypost.sky_area(levels)
  File "/home/salvatore.vitale/lalsuites/skyPP/sky_area/sky_area_clustering.py", line 510, in sky_area
    post_levels = [self.greedy_posteriors[int(round(cl*self.ranking_pts.shape[0]))] for cl in cls]
IndexError: index out of bounds

Something else (minor):

  1. The code fails to read sim_inspiral table since load_finename is not give a ContentHandler. I can easily push a fix for this, if I have the rights.
  2. That may just be me not setting the env variables properly, but the following fails for me (in run_sky_area.py)

import sky_area.sky_area_clustering as sac

I had to change it in

import sky_area_clustering as sac

Cheers,
salvo

Create release for LIGO ER9

Hey Will. Would you please tag a release for ER9? I'm thinking of packaging this up as a deb and an rpm so that it gets installed cluster-wide. I see that you have set the version of the package to 1.0, but I suggest being much more conservative and starting with 0.1. So I'd suggest setting version='0.1' in setup.py and then creating a v0.1 release tag on GitHub. I can take care of the rest.

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.