Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Likelihood from config file #17

Merged
merged 29 commits into from
Jun 20, 2018
Merged

Conversation

cdcapano
Copy link
Collaborator

Have likelihood evaluator class be initialized from the config file. This also moves waveform generation set up into the LikelihoodEvaluator's from_config function. This is the first step to moving the sampler initialization parameters into the config file, to eventually allow for more sampling engines.

The only change to the ini file is you now need:

[likelihood]
name = gaussian

in the config file, and the likelihood option is removed from gwin. This will also allow for specifying parameters for the likelihood class in the config file. For instance, you will be able to specify the mean and covariance for the test_normal likelihood class.

I've also added a DataBasedLikelihoodEvaluator class to make the separation between the analytic likelihoods and the likelihoods that use data / a waveform generator cleaner.

I'm not crazy about the names of the classes (never really did like LikelihoodEvaluator), and I know this has caused some people confusion. Suggestions for better class names are welcome.

Marking as work in progress, as still have to finish and test. Also, #14 should be merged first; then I'll update this patch accordingly.

@pep8speaks
Copy link

pep8speaks commented Apr 11, 2018

Hello @cdcapano! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on June 06, 2018 at 14:37 Hours UTC

@cdcapano
Copy link
Collaborator Author

@duncanmmacleod That "pep8 speaks" thing is going to make PRs difficult to read. Is there any information in there that's not in code climate? If not, can we quiet that?

@ahnitz
Copy link
Member

ahnitz commented Apr 11, 2018 via email

@coveralls
Copy link

coveralls commented May 23, 2018

Pull Request Test Coverage Report for Build 119

  • 57 of 129 (44.19%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-1.3%) to 39.214%

Changes Missing Coverage Covered Lines Changed/Added Lines %
gwin/option_utils.py 2 5 40.0%
gwin/likelihood.py 55 124 44.35%
Files with Coverage Reduction New Missed Lines %
gwin/likelihood.py 1 60.64%
Totals Coverage Status
Change from base Build 113: -1.3%
Covered Lines: 998
Relevant Lines: 2545

💛 - Coveralls

@cdcapano
Copy link
Collaborator Author

Ok, I think this is ready for review now.

@cdcapano cdcapano removed the request for review from duncanmmacleod May 28, 2018 08:58
@cdcapano
Copy link
Collaborator Author

@cmbiwer @vivienr poke

@cdcapano
Copy link
Collaborator Author

cdcapano commented Jun 4, 2018

@vivienr @cmbiwer poke x 2

def _call_global_likelihood(*args, **kwds):
return _global_instance(*args, **kwds) # pylint:disable=not-callable


# XXX: import the following from pycbc.distributions once PR #2123 has made
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #2123 has been merged into the latest release, so we could just import it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vivienr Done. @duncanmmacleod Since this requires the latest release of pycbc, I've added version requirements for pycbc to setup.py and requirements.txt.


In this case, the :py:class:`gwin.likelihood.GaussianLikelihood` would be used.
Examples of using this likelihood class on a BBH injection and on GW150914 are
given below. Any name that starts with ``test_`` is an analytic test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While not really within this PR, we could add here an example on how to use simulated noise?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BBH example is on simulated noise. See lines 396 and 397 of gwin.rst.

@cmbiwer
Copy link
Contributor

cmbiwer commented Jun 4, 2018

Hey, sorry. I don't have a problem with this PR. But I'll leave it unreviewed by me since I see Vivien has some comments/review.

@cdcapano
Copy link
Collaborator Author

cdcapano commented Jun 6, 2018

@vivienr Ok, I think I addressed all of the issues.

Copy link
Contributor

@vivienr vivienr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks !

@cdcapano cdcapano merged commit 40a4de2 into gwastro:master Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants