Skip to content
Snippets Groups Projects
Commit 6ca5572b authored by Moritz Huebner's avatar Moritz Huebner
Browse files

Moritz Huebner: Made imports python 3 compatible.

parent cfe611f5
No related branches found
No related tags found
No related merge requests found
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
.version
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# Idea
/.idea
*.idea
*.idea*
#.txt files
#*.txt
# Images
*.jpg
*.png
# Output directories
**/outdir
\ No newline at end of file
MIT License
Copyright (c) 2018 Paul D. Lasky
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[![pipeline status](https://git.ligo.org/Monash/tupak/badges/master/pipeline.svg)](https://git.ligo.org/Monash/tupak/commits/master)
[![coverage report](https://monash.docs.ligo.org/tupak/coverage_badge.svg)](
https://monash.docs.ligo.org/tupak/htmlcov/)
# Tupak
Fulfilling all your gravitational wave dreams.
## Example
To get started with `tupak`, we have a few examples and tutorials:
1. [Examples of injecting and recovering data](https://git.ligo.org/Monash/tupak/tree/master/examples/injection_examples)
* [A basic tutorial](https://git.ligo.org/Monash/tupak/blob/master/examples/injection_examples/basic_tutorial.py)
* [Create your own source model](https://git.ligo.org/Monash/tupak/blob/master/examples/injection_examples/create_your_own_source_model.py)
* [Create your own time-domain source model](https://git.ligo.org/Monash/tupak/blob/master/examples/injection_examples/create_your_own_time_domain_source_model.py)
* [How to specify the prior](https://git.ligo.org/Monash/tupak/blob/master/examples/injection_examples/how_to_specify_the_prior.py)
* [Using a partially marginalized likelihood](https://git.ligo.org/Monash/tupak/blob/master/examples/injection_examples/marginalized_likelihood.py)
2. [Examples using open data](https://git.ligo.org/Monash/tupak/tree/master/examples/open_data_examples)
* [Analysing the first Binary Black hole detection, GW150914](https://git.ligo.org/Monash/tupak/blob/master/examples/open_data_examples/GW150914.py)
3. [Notebook-style tutorials](https://git.ligo.org/Monash/tupak/tree/master/examples/tutorials)
* [Comparing different samplers](https://git.ligo.org/Monash/tupak/blob/master/examples/tutorials/compare_samplers.ipynb)
* [Visualising the output](https://git.ligo.org/Monash/tupak/blob/master/examples/tutorials/visualising_the_results.ipynb)
## Installation
`tupak` is developed to work with both Python 2.7+ and Python 3+. In the
following, we assume you have a working python installation, [python
pip](https://packaging.python.org/tutorials/installing-packages/#use-pip-for-installing),
and [git](https://git-scm.com/).
### Install tupak
Clone the repository, install the requirements, and then install `tupak`.
```bash
$ git clone git@git.ligo.org:Monash/tupak.git
$ cd tupak/
$ pip install -r requirements.txt
$ python setup.py install
```
Once you have run these steps, you have `tupak` installed. You can now try to
run the examples. However, for many gravitational-wave related examples you'll
also need to install `lalsuite`.
### Install lalsuite
We recommend you install `lalsuite` the simple way:
```bash
$ pip install lalsuite.
```
If this doesn't work, or you prefer to, you can also install from source.
Head to
[https://git.ligo.org/lscsoft/lalsuite](https://git.ligo.org/lscsoft/lalsuite)
to check you have an account and SSH keys set up. Then,
```bash
$ git lfs install # you may need to install git-lfs first
$ git clone git@git.ligo.org:lscsoft/lalsuite.git
$ cd lalsuite
$ ./00boot
$ ./configure --prefix=${HOME}/lalsuite-install --disable-all-lal --enable-swig --enable-lalsimulation
$ make; make install
```
Warning: in the configure line here, we have disabled everything except
lalsimulation. If you need other modules, see `./configure --help`.
### Install pymultinest
If you want to use the `pymultinest` sampler, you first need the
MultiNest library to be installed to work properly. The full instructions can
be found [here](https://johannesbuchner.github.io/PyMultiNest/install.html). We
have also written [a shortened tl;dr here](./TLDR_MULTINEST.md).
## Tests and coverage
We have a variety of tests which can be found in the `tests` directory. You
can find a [current coverage report for master
here.](https://monash.docs.ligo.org/tupak/htmlcov/).
#!/usr/bin/env python
from distutils.core import setup
import subprocess
# Write a version file containing the git hash and info
try:
git_log = subprocess.check_output(
['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8')
git_diff = (subprocess.check_output(['git', 'diff', '.'])
+ subprocess.check_output(
['git', 'diff', '--cached', '.'])).decode('utf-8')
if git_diff == '':
status = '(CLEAN) ' + git_log
else:
status = '(UNCLEAN) ' + git_log
except subprocess.CalledProcessError:
status = "NO VERSION INFORMATION"
version_file = '.version'
with open('tupak/' + version_file, 'w+') as f:
f.write(status)
setup(name='tupak',
version='0.1',
packages=['tupak'],
package_dir={'tupak': 'tupak'},
package_data={'tupak': ['noise_curves/*.txt', 'prior_files/*.txt',
version_file]}
)
......@@ -9,7 +9,7 @@ FILL IN THE REST
"""
from __future__ import print_function, division
from __future__ import print_function, division, absolute_import
# import local files, utils should be imported first
from . import utils
......@@ -22,7 +22,7 @@ from . import result
from . import sampler
from . import conversion
# import a few oft-used functions and classes to simplify scripts
from likelihood import Likelihood, GravitationalWaveTransient
from waveform_generator import WaveformGenerator
from sampler import run_sampler
# import a few often-used functions and classes to simplify scripts
from .likelihood import Likelihood, GravitationalWaveTransient
from .waveform_generator import WaveformGenerator
from .sampler import run_sampler
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment