Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wmayner committed Jun 21, 2019
2 parents d29e93a + 528fa64 commit 7641560
Show file tree
Hide file tree
Showing 80 changed files with 590 additions and 399 deletions.
7 changes: 4 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[flake8]

ignore = F401

ignore = E203, E501, W503
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude =
__pycache__,
__pyphi_cache__,
Expand Down
20 changes: 5 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
__pycache__
.cache
.ropeproject
.venv
.env
.pythonrc*
.agignore
.projectile
**/*.pyc
.tox
.coverage
**/*.egg-info
**/*.log
**/*.BACKUP
.tox
pyphi/data/hamming_matrices/10.npy
__pyphi_cache__
dist
build
profiling
docs/_build
.coverage
htmlcov
results
html
env
profiling
benchmarks/pyphi_config.yml
profiling/pyphi_config.yml
benchmarks/env
benchmarks/results
ignore
.ignore
startup.py
my_requirements.txt
6 changes: 5 additions & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[settings]
line_length=80
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
indent=' '
default_section=THIRDPARTY
known_first_party=pyphi
Expand Down
77 changes: 77 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
exclude: '^$'
fail_fast: false
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v2.2.3
hooks:
- id: autopep8-wrapper
- id: check-added-large-files
- id: debug-statements
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: flake8
additional_dependencies: [
'flake8-blind-except',
'flake8-coding',
'flake8-comprehensions',
'flake8-debugger',
'flake8-deprecated',
'flake8-docstrings',
'flake8-meiqia',
'flake8-mutable',
'flake8-pep3101',
'flake8-print',
'flake8-quotes',
'flake8-string-format',
'flake8-tidy-imports',
'flake8-todo']
exclude: 'test_oauth.py'
- id: trailing-whitespace

- repo: https://github.com/ambv/black
rev: 19.3b0
hooks:
- id: black
name: black
description: 'Black: The uncompromising Python code formatter'
entry: black
language: python
language_version: python3
require_serial: true
types: [python]

# - repo: git@github.com:pre-commit/mirrors-yapf.git
# sha: v0.20.0
# hooks:
# - id: yapf
# exclude: 'migrations|settings|scripts'
# additional_dependencies: ['futures']
# args: ['--style=.style.yapf', '--parallel', '--in-place']

# - repo: git@github.com:FalconSocial/pre-commit-python-sorter.git
# sha: b57843b0b874df1d16eb0bef00b868792cb245c2
# hooks:
# - id: python-import-sorter
# args: ['--silent-overwrite']

# - repo: git@github.com:humitos/mirrors-docformatter.git
# sha: v0.0.1
# hooks:
# - id: docformatter
# args: ['--in-place', '--wrap-summaries=80', '--wrap-descriptions=80', '--pre-summary-newline', '--no-blank']

# - repo: git@github.com:humitos/mirrors-autoflake.git
# sha: v1.0
# hooks:
# - id: autoflake
# args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']

# - repo: git://github.com/guykisel/prospector-mirror
# sha: 'b27f281eb9398fc8504415d7fbdabf119ea8c5e1'
# hooks:
# - id: prospector
# # https://github.com/pre-commit/pre-commit/issues/178
# language: system
# args: ['--profile=prospector']
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ disable =
no-name-in-module,
no-self-use,
super-on-old-class,
bad-continuation,


[REPORTS]
Expand Down
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist: xenial

language: python

sudo: false
Expand All @@ -14,14 +16,15 @@ services:
- redis-server # port 6379 (default)

python:
- "3.4"
- "3.5"
- "3.6"
- 3.4
- 3.5
- 3.6
- 3.7

# Install packages
install:
- pip install --upgrade pip setuptools wheel
- pip install --only-binary=numpy numpy==1.14
- if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then pip install --only-binary=numpy numpy==1.15.4; else pip install --only-binary=numpy numpy==1.16.4; fi
- pip install --only-binary=scipy -r requirements.txt
- pip install coveralls
- pip freeze
Expand Down
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,49 @@
Changelog
=========

1.2.0
-----
_2019-06-21_

### Fixes

- Fixed a bug introduced into `pyphi.utils.load_data()` by a breaking change
in recent versions of NumPy that caused an error on import.
- Fixed a bug where changing `config.PRECISION` dynamically did not change
`constants.EPSILON`, causing some comparisons that relied on
`constants.EPSILON` to not reflect the new precision.
- Changing `config.FS_CACHE_DIRECTORY` and `config.FS_CACHE_VERBOSITY` now
causes a new `joblib.Memory` cache to be created. Previously, changing these
options dynamically had no effect.
- Made test suite compatible with stricter usage of `pytest` fixtures
required by recent versions of `pytest`.

### API additions

- Added `pyphi.tpm.reconstitute_tpm()`.

### API changes

- Renamed `pyphi.partition.partition_registry` to
`pyphi.partition.partition_types`.
- Renamed `pyphi.distance.bld()` to `pyphi.distance.klm()`.
- Fixed the connectivity matrix of the `def
disjunction_conjunction_network()`.
- Removed `'expanded_*_reperotire'` attributes of JSON-serialized `Concept`s.

### Config

- Added the `WELCOME_OFF` option to turn off the new welcome message.

### Documentation

- Added documentation for the `partition_types` registry.
- Added documentation for the filesystem and database caches.


1.1.0
-----
_2018-05-30_

### Fixes

Expand All @@ -15,6 +56,7 @@ Changelog
- Made model hashes deterministic (6b59061). This fixes an issue with the Redis
MICE cache in which cached values were not shared between processes and
program invokations.
- Fixed the connectivity matrix in `examples.disjunction_conjunction.network()`.

### API additions

Expand Down
2 changes: 1 addition & 1 deletion INSTALLATION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Now that we're using our shiny new Python versions, it is highly recommended to
set up a **virtual environment** in which to install PyPhi. Virtual
environments allow different projects to isolate their dependencies from one
another, so that they don't interact in unexpected ways. Please see `this guide
<http://docs.python-guide.org/page/dev/virtualenvs/>`__ for more information.
<http://docs.python-guide.org/dev/virtualenvs/>`__ for more information.

To do this, you must install ``virtualenvwrapper``, a `tool for manipulating
virtual environments <http://virtualenvwrapper.readthedocs.org/>`__. This tool
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ build-dist: clean-dist

clean-dist:
rm -rf $(dist_dir)

clean:
rm -rf **/__pycache__
57 changes: 39 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@
PyPhi is a Python library for computing integrated information (𝚽), and the
associated quantities and objects.

**If you use this code, please cite the manuscript:**
**If you use this code, please cite the paper:**

---

Mayner WGP, Marshall W, Albantakis L, Findlay G, Marchman R, Tononi G (2017).
[PyPhi: A toolbox for integrated
information](https://arxiv.org/abs/1712.09644). arXiv:1712.09644 \[q-bio.NC\].
Mayner WGP, Marshall W, Albantakis L, Findlay G, Marchman R, Tononi G. (2018)
[PyPhi: A toolbox for integrated information
theory](https://doi.org/10.1371/journal.pcbi.1006343). PLOS Computational
Biology 14(7): e1006343. <https://doi.org/10.1371/journal.pcbi.1006343>

---

The manuscript is available at <https://arxiv.org/abs/1712.09644>.


## Usage, Examples, and API documentation

Expand Down Expand Up @@ -113,25 +112,47 @@ before installing the requirements:
sudo apt-get install python3-dev python3-scipy python3-numpy
```

### Developing on Windows

If you're just looking for an editable install, pip may work better than the conda develop utility included in the conda-build package. When using pip on Windows, the build of pyemd may fail. The simplest solution to this is to obtain pyemd through conda.

```bash
conda create -n pyphi_dev
conda activate pyphi_dev
conda install -c wmayner pyemd
cd path/to/local/editable/copy/of/pyphi
pip install -e .
```

Unfortunately, pip isn't great at managing the DLLs that some packages (especially scipy) rely on. If you have missing DLL errors, try reinstalling the offending package (here, scipy) with conda.

```bash
conda activate pyphi_dev
pip uninstall scipy
conda install scipy
```

## Credit

### Please cite these papers if you use this code:

Mayner WGP, Marshall W, Albantakis L, Findlay G, Marchman R, Tononi G (2017).
[PyPhi: A toolbox for integrated
information](https://arxiv.org/abs/1712.09644). arXiv:1712.09644 \[q-bio.NC\].
Mayner WGP, Marshall W, Albantakis L, Findlay G, Marchman R, Tononi G. (2018)
[PyPhi: A toolbox for integrated information
theory](https://doi.org/10.1371/journal.pcbi.1006343). PLOS Computational
Biology 14(7): e1006343. <https://doi.org/10.1371/journal.pcbi.1006343>

```
@article{mayner2017pyphi,
title={PyPhi: A toolbox for integrated information},
author={Mayner, William, Gerald Paul AND Marshall, William AND
Albantakis, Larissa AND Findlay, Graham AND
Marchman, Robert AND Tononi, Giulio},
journal={arXiv:1712.09644 [q-bio.NC]},
year={2017},
month={12},
url={https://arxiv.org/abs/1712.09644}
@article{mayner2018pyphi,
title={PyPhi: A toolbox for integrated information theory},
author={Mayner, William GP and Marshall, William and Albantakis, Larissa and Findlay, Graham and Marchman, Robert and Tononi, Giulio},
journal={PLoS Computational Biology},
volume={14},
number={7},
pages={e1006343},
year={2018},
publisher={Public Library of Science},
doi={10.1371/journal.pcbi.1006343},
url={https://doi.org/10.1371/journal.pcbi.1006343}
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/caching.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../CACHING.rst
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

# General information about the project.
project = 'PyPhi'
copyright = '2014--2017 {}'.format(__author__)
copyright = '2014--2018 {}'.format(__author__)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -121,7 +121,10 @@
.. |big_phi_max| replace:: :math:`\Phi^{\textrm{max}}`
.. |small_phi| replace:: :math:`\varphi`
.. |small_phi > 0| replace:: :math:`\varphi > 0`
.. |small_phi = 0| replace:: :math:`\varphi = 0`
.. |small_phi_max| replace:: :math:`\varphi^{\textrm{max}}`
.. |small_phi = 1/6| replace:: :math:`\varphi = \frac{1}{6}`
.. |small_phi = 1/10| replace:: :math:`\varphi = \frac{1}{10}`
.. |big_alpha| replace:: :math:`\mathcal{A}`
.. |big_alpha > 0| replace:: :math:`\mathcal{A} > 0`
.. |alpha| replace:: :math:`\alpha`
Expand Down Expand Up @@ -150,8 +153,6 @@
.. |(AB / DE) x (∅ / C)| replace:: :math:`\frac{AB}{DE} \times \frac{\varnothing}{C}`
.. |(A / CD) x (∅ / E)| replace:: :math:`\frac{A}{CD} \times \frac{\varnothing}{E}`
.. |(∅ / C) x (A / D)| replace:: :math:`\frac{\varnothing}{C} \times \frac{A}{D}`
.. |small_phi = 1/6| replace:: :math:`\varphi = \frac{1}{6}`
.. |small_phi = 1/10| replace:: :math:`\varphi = \frac{1}{10}`
.. |t| replace:: :math:`t`
.. |t-1| replace:: :math:`t-1`
.. |t+1| replace:: :math:`t+1`
Expand All @@ -168,6 +169,8 @@
.. |N| replace:: :math:`N`
.. |n x n| replace:: :math:`N \times N`
.. |2^n x 2^n| replace:: :math:`2^N \times 2^N`
.. |2^m x 2| replace:: :math:`2^m \times 2`
.. |m| replace:: :math:`m`
.. |i| replace:: :math:`i`
.. |j| replace:: :math:`j`
.. |i,jth| replace:: :math:`(i,j)^{\textrm{th}}`
Expand Down
12 changes: 8 additions & 4 deletions docs/examples/actual_causation.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Actual Causation
================

This section demonstrates how to use PyPhi to evaluate actual causation as
This section demonstrates how to use PyPhi to evaluate actual causation, as
described in

`Albantakis L, Marshall W, Hoel E, Tononi G (2017). What caused what? An
irreducible account of actual causation. arXiv:1708.06716 [cs.AI]
<https://arxiv.org/abs/1708.06716>`_.
Albantakis L, Marshall W, Hoel E, Tononi G (2019).
What Caused What? A quantitative Account of Actual Causation Using
Dynamical Causal Networks.
*Entropy*, 21 (5), pp. 459.
`<https://doi.org/10.3390/e21050459>`_

First, we'll import the modules we need:

>>> import pyphi
>>> from pyphi import actual, config, Direction
Expand Down
Loading

0 comments on commit 7641560

Please sign in to comment.