Skip to content

Commit 057467d

Browse files
committed
Merge branch 'release/0.8.0'
2 parents 40c5303 + ff0360d commit 057467d

File tree

115 files changed

+9754
-3790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+9754
-3790
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ node_modules
99
**/*.egg-info
1010
**/*.log
1111
**/*.BACKUP
12+
pyphi/data/hamming_matrices/10.npy
1213

1314
__pyphi_cache__
1415
dist
@@ -17,5 +18,6 @@ docs/_build
1718
github-docs
1819
.coverage
1920
htmlcov
20-
profiling
2121
results
22+
html
23+
env

.travis.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
language: python
22

3-
# Provide a mongod process on port 27017 (default)
4-
services: mongodb
3+
sudo: false
4+
5+
# Setup databases
6+
services:
7+
- mongodb # port 27017 (default)
8+
- redis-server # port 6379 (default)
59

610
python:
711
- "3.4"
@@ -16,8 +20,8 @@ before_install:
1620
- conda update --yes conda
1721
# The next couple lines fix a crash with multiprocessing on Travis and are
1822
# not specific to using Miniconda
19-
- sudo rm -rf /dev/shm
20-
- sudo ln -s /run/shm /dev/shm
23+
# - sudo rm -rf /dev/shm
24+
# - sudo ln -s /run/shm /dev/shm
2125

2226
# Install packages
2327
install:
@@ -27,9 +31,14 @@ install:
2731
- pip freeze
2832

2933
# Run tests
30-
script: coverage run --source=pyphi -m py.test
34+
script: coverage run --source=pyphi -m py.test --slow
3135

3236
after_success: coveralls
3337

3438
notifications:
35-
- email: false
39+
email: false
40+
slack:
41+
rooms:
42+
secure: "C6PSvK/FEmyD+S71VVzS29NZpD9CFI/f3UMjc6i08xYHjFNMZUplfHyUqNLNqgVVBsKR1En4B8ryuriEnM8wwZzCVdxjh7HDsx8aNE2z1XG5tkqoRP4ppNfqNaYRoMcSZFW89DfVNbIVDM11wKXL7/YnRCmlJy0p1NtKzlncXCM="
43+
on_success: never
44+
on_failure: always

CHANGELOG.md

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,148 @@
11
Changelog
22
=========
33

4+
0.8.0
5+
------------------
6+
_2016-02-06_
7+
8+
### API changes
9+
- Mechanisms and purviews are now passed to all functions and methods in node
10+
index form (e.g. `(0, 1, 3)`). Previously, many functions took these
11+
arguments as `Node` objects. Since nodes belong to a specific `Subsystem` it
12+
was possible to pass nodes from one subsystem to another subsystem's methods,
13+
leading to incorrect results.
14+
- `constellation_distance` no longer takes a `subsystem` argument because
15+
concepts in a constellation already reference their subsystems.
16+
- Moved `utils.cut_mechanism_indices` and `utils.mechanism_split_by_cut` to
17+
to `Cut.all_cut_mechanisms` and `Cut.splits_mechanism`, respectively;
18+
moved `utils.cut_mice` to `Mice.damaged_by_cut`.
19+
- `Concept.__eq__`: when comparing concepts for equality, we no longer directly
20+
check equality of their subsystems. Concept equality is now defined as
21+
follows:
22+
- Same φ
23+
- Same mechanism node indices cause/effect purview node indices
24+
- Same mechanism state
25+
- Same cause/effect repertoires
26+
- Same networks
27+
This allows two concepts to be equal when _e.g._ the only difference between
28+
them is that one's subsystem is a superset of the other's subsystem.
29+
- `Concept.__hash__`: the above notion of concept equality is also implemented
30+
for concept hashing, so two concepts that differ only in that way will have
31+
the same hash value.
32+
- Disabled concept caching; removed the `config.CACHE_CONCEPTS` option.
33+
34+
### API Additions
35+
- Added `config.READABLE_REPRS` to control whether `__reprs__` of PyPhi models
36+
default to using pretty string formatting.
37+
- Added a `Constellation` object.
38+
- Added `utils.submatrix` and `utils.relevant_connections` functions.
39+
- Added the `macro.effective_info` function.
40+
- Added the `utils.state_of` function.
41+
- Added the `Subsystem.proper_state` attribute. This is the state of the
42+
subsystem's nodes, rather than the entire network state.
43+
- Added an optional Redis-backed cache for Mice objects. This is enabled with
44+
`config.REDIS_CACHE` and configured with `config.REDIS_CONFIG`.
45+
- Enabled parallel concept evaluation with `config.PARALLEL_CONCEPT_EVALUATION`.
46+
47+
### Fixes
48+
- `Concept.eq_repertoires` no longer fails when the concept has no cause or
49+
effect.
50+
- Fixed the `Subsystem.proper_state` attribute.
51+
52+
### Refactor
53+
- Subsystem Mice and cause/effect repertoire caches; Network purview caches.
54+
Cache logic is now handled by decorators and custom cache objects.
55+
- Block reducibility tests and Mice connection computations.
56+
- Rich object comparisons on phi-objects.
57+
58+
### Documentation
59+
- Updated documentation and examples to reflect node-to-index conversion.
60+
61+
62+
0.7.5
63+
------------------
64+
_2015-11-02_
65+
66+
### API changes
67+
- Subsystem states are now validated rather than network states. Previously,
68+
network states were validated, but in some cases there can be a
69+
globally-impossible network state that is locally possible for a subsystem
70+
(or vice versa) when considering the subsystem's TPM, which is conditioned
71+
on the external nodes (i.e., background conditions). It is now impossible to
72+
create a subsystem in an impossible state (a `StateUnreachableError` is
73+
thrown), and accordingly no 𝚽 values are calculated for such subsystems; this
74+
may change results from older versions, since in some cases the calculated
75+
main complex was in fact in an impossible. This functionality is enabled by
76+
default but can be disabled via the `VALIDATE_SUBSYSTEM_STATES` option.
77+
78+
79+
0.7.4
80+
------------------
81+
_2015-10-12_
82+
83+
### Fixes
84+
- Fixed a caching bug where the subsystem's state was not included in its hash
85+
value, leading to collisions.
86+
87+
88+
0.7.3
89+
------------------
90+
_2015-09-08_
91+
92+
### API changes
93+
- Heavily refactored the `pyphi.json` module and renamed it to `pyphi.jsonify`.
94+
95+
96+
0.7.2
97+
------------------
98+
_2015-07-01_
99+
100+
### API additions
101+
- Added `convert.nodes2state` function.
102+
- Added `constrained_nodes` keyword argument to `validate.state_reachable`.
103+
104+
### API changes
105+
- Concept equality is now more permissive. For two concepts to be considered
106+
equal, they must only have the same φ, the same mechanism and purviews (in
107+
the same state), and the same repertoires.
108+
109+
110+
0.7.1
111+
------------------
112+
_2015-06-30_
113+
114+
### API additions
115+
- Added `purviews`, `past_purviews`, `future_purviews` keyword arguments to
116+
various concept-calculating methods. With these, the purviews that are
117+
considered in the concept calculation can be restricted.
118+
119+
### API changes
120+
- States are now associated with subsystems rather than networks. Functions in
121+
the `compute` module that operate on networks now also take a state.
122+
123+
### Fixes
124+
- Fixed a bug in `compute._constellation_distance_emd` where partitioned
125+
concepts were unable to be moved to the null concept for the EMD calculation.
126+
In some cases, the partitioned system has *greater* ∑φ than the unpartitioned
127+
system; therefore it must be possible for the φ of partitioned-constellation
128+
concepts to be moved to the null concept, not just vice versa.
129+
- Fixed a bug in `compute._constellation_distance_emd` where it was possible to
130+
move concepts around within their own constellation; the distance matrix now
131+
disallows any such intraconstellation paths. This is important because in
132+
some cases paths from a concept in one constellation to a concept the other
133+
can actually be shorter if a detour is taken through a different concept in
134+
the same constellation.
135+
- Fixed a bug in `validate.state_reachable` where network states were
136+
incorrectly validated.
137+
- `macro.emergence` now always returns a macro-network, even when 𝚽 = 0.
138+
- Fixed a bug in `repr(Network)` where the perturbation vector and connectivity
139+
matrix were switched.
140+
141+
### Documentation
142+
- Added example describing “magic cuts” that, counterintuitively, can create
143+
more concepts.
144+
- Updated existing documentation to the new subsystem-state association.
145+
4146

5147
0.7.0
6148
------------------
@@ -9,7 +151,7 @@ _2015-05-08_
9151
### API additions
10152
- `pyphi.macro` provides several functions to analyze networks over different
11153
spatial scales.
12-
- `.convert.conditionally_independent(tpm)` checks if a TPM is conditionally
154+
- `convert.conditionally_independent(tpm)` checks if a TPM is conditionally
13155
independent.
14156

15157
### API changes

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include README.rst LICENSE.md requirements.txt pyphi_config.yml
1+
include README.rst LICENSE.md requirements.txt pyphi_config.yml redis.conf

README.rst

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
.. image:: https://zenodo.org/badge/4651/wmayner/pyphi.png
22
:target: http://dx.doi.org/10.5281/zenodo.15787
3-
:alt: Zenodo DOI
3+
:alt: Zenodo DOI badge
44

55
.. image:: https://travis-ci.org/wmayner/pyphi.svg?branch=master
66
:target: https://travis-ci.org/wmayner/pyphi
7-
:alt: Travis build
7+
:alt: Travis build badge
88

9-
.. image:: https://coveralls.io/repos/wmayner/pyphi/badge.png?branch=master
9+
.. image:: https://coveralls.io/repos/wmayner/pyphi/badge.svg?branch=master&service=github
1010
:target: https://coveralls.io/r/wmayner/pyphi?branch=master
11-
:alt: Coveralls.io
11+
:alt: Coveralls.io badge
1212

13-
*************************
14-
PyPhi: |phi| for Python 3
15-
*************************
13+
***********************
14+
PyPhi: |phi| for Python
15+
***********************
1616

1717
PyPhi is a Python 3 library for computing integrated information (|phi|), and
1818
the associated quantities and objects.
@@ -62,12 +62,12 @@ Detailed installation guide for Mac OS X
6262
`See here <https://github.com/wmayner/pyphi/blob/develop/INSTALLATION.md>`_.
6363

6464

65-
Optional: caching with a database
65+
Optional: caching with MongoDb
6666
`````````````````````````````````
6767

6868
PyPhi stores the results of |Phi| calculations as they're computed in order to
6969
avoid expensive re-computation. These results can be stored locally on the
70-
filesystem (the default setting), or in a full-fledged database.
70+
filesystem (the default setting), or in a full-fledged database.
7171

7272
Using the default caching system is easier and works out of the box, but using
7373
a database is more robust.
@@ -87,6 +87,27 @@ You can also check out MongoDB's `Getting Started guide
8787
`manual <http://docs.mongodb.org/manual/>`_.
8888

8989

90+
Optional: caching with Redis
91+
`````````````````````````````
92+
93+
PyPhi can also use Redis as a fast in-memory global LRU cache to store Mice
94+
objects, reducing the memory load on PyPhi processes.
95+
96+
`Install Redis <http://redis.io/download>`_. The `redis.conf` file provided with
97+
PyPhi includes the minimum settings needed to run Redis as an LRU cache:
98+
99+
.. code:: bash
100+
101+
redis-server /path/to/pyphi/redis.conf
102+
103+
Once the server is running you can enable Redis caching by setting
104+
``REDIS_CACHE: true`` in your ``pyphi_config.yml``.
105+
106+
**Note:** PyPhi currently flushes the connected Redis database at the start of
107+
every execution. If you are running Redis for another application be sure PyPhi
108+
connects to its own Redis server.
109+
110+
90111
Contributing
91112
~~~~~~~~~~~~
92113

benchmarks/asv.conf.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
// The version of the config file format. Do not change, unless
3+
// you know what you are doing.
4+
"version": 1,
5+
6+
// The name of the project being benchmarked
7+
"project": "PyPhi",
8+
9+
// The project's homepage
10+
"project_url": "https://github.com/wmayner/pyphi",
11+
12+
// The URL or local path of the source code repository for the
13+
// project being benchmarked
14+
"repo": "..",
15+
16+
// List of branches to benchmark. If not provided, defaults to "master"
17+
// (for git) or "tip" (for mercurial).
18+
"branches": ["develop"], // for git
19+
20+
// The DVCS being used. If not set, it will be automatically
21+
// determined from "repo" by looking at the protocol in the URL
22+
// (if remote), or by looking for special directories, such as
23+
// ".git" (if local).
24+
"dvcs": "git",
25+
26+
// The tool to use to create environments. May be "conda",
27+
// "virtualenv" or other value depending on the plugins in use.
28+
// If missing or the empty string, the tool will be automatically
29+
// determined by looking for tools on the PATH environment
30+
// variable.
31+
"environment_type": "virtualenv",
32+
33+
// the base URL to show a commit for the project.
34+
"show_commit_url": "http://github.com/wmayner/pyphi/",
35+
36+
// The Pythons you'd like to test against. If not provided, defaults
37+
// to the current version of Python used to run `asv`.
38+
// "pythons": ["2.7", "3.3"],
39+
40+
// The matrix of dependencies to test. Each key is the name of a
41+
// package (in PyPI) and the values are version numbers. An empty
42+
// list indicates to just test against the default (latest)
43+
// version.
44+
// "matrix": {
45+
// "numpy": ["1.6", "1.7"]
46+
// },
47+
48+
// The directory (relative to the current directory) that benchmarks are
49+
// stored in. If not provided, defaults to "benchmarks"
50+
"benchmark_dir": "benchmarks",
51+
52+
// The directory (relative to the current directory) to cache the Python
53+
// environments in. If not provided, defaults to "env"
54+
"env_dir": "env",
55+
56+
57+
// The directory (relative to the current directory) that raw benchmark
58+
// results are stored in. If not provided, defaults to "results".
59+
"results_dir": "results",
60+
61+
// The directory (relative to the current directory) that the html tree
62+
// should be written to. If not provided, defaults to "html".
63+
//"html_dir": "html",
64+
65+
// The number of characters to retain in the commit hashes.
66+
// "hash_length": 8,
67+
68+
// `asv` will cache wheels of the recent builds in each
69+
// environment, making them faster to install next time. This is
70+
// number of builds to keep, per environment.
71+
// "wheel_cache_size": 0
72+
}

benchmarks/benchmarks/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)