Skip to content

Commit

Permalink
Merge pull request #546 from pints-team/i543-python-2-7-6
Browse files Browse the repository at this point in the history
Test on Python 2.7.6. Closes #546
  • Loading branch information
MichaelClerx authored Oct 31, 2018
2 parents 84b974b + cfe878b commit a698169
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ matrix:
env:
- PINTS_UNIT=true
if: type != cron
- python: "2.7.6"
env:
- PINTS_UNIT=true
if: type != cron
- python: "3.4"
env:
- PINTS_UNIT=true
Expand Down Expand Up @@ -50,10 +54,17 @@ matrix:
- python: "3.6"
if: type == cron

# command to install dependencies
# Install dependencies
# Note: Use pip (not apt-get) for Python dependencies
# Note: Only install normal dependencies for unit tests; these should be tested
# without the packages from -dev and -doc!
install:
- pip install --upgrade pip
- pip install .
- pip install -r requirements-dev.txt
- pip install -r requirements.txt
- if [[ $PINTS_DOCS == true ]]; then pip install -r requirements-docs.txt; fi;
- if [[ $PINTS_STYLE == true ]]; then pip install -r requirements-dev.txt; fi;
- if [[ $TRAVIS_EVENT_TYPE == 'cron' ]]; then pip install -r requirements-dev.txt; fi;
- if [[ $PINTS_COVER == true ]]; then pip install coverage codecov; fi;

before_script:
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ Note that these files must be kept in sync with

The requirements files link to each other, so that calling `$ pip install -r requirements-dev.txt` will install everything listed in `requirements.txt` and `requirements-docs.txt` as well.

It's always worth using an up-to-date version of pip. On older systems especially, having an up-to-date pip will prevent all kinds of version incompatibility issues:

```
$ pip install --upgrade pip
```

### Travis CI

All committed code is tested using [Travis CI](https://travis-ci.org/), tests are published on https://travis-ci.org/pints-team/pints.
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ You'll need the following requirements:
- Python 2.7 or Python 3.4+
- Python libraries: `cma` `numpy` `matplotlib` `scipy`

These will be installed automatically if you go to the directory you downloaded pints to, and run
These can easily be installed using `pip`. To do this, first make sure you have the latest version of pip installed:

```
$ pip install --upgrade pip
```

Then navigate to the path where you downloaded Pints to, and install both Pints and its dependencies by typing:

```
$ pip install .
Expand Down
8 changes: 6 additions & 2 deletions pints/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def independent(sigma, shape):
noisy_values = values + noise.independent(5, values.shape)
"""
# Don't test sigma/shape: handled by numpy for higher-dimensions etc.!

# Don't test sigma/shape: handled by numpy for higher-dimensions etc.!
return np.random.normal(0, sigma, shape)


Expand Down Expand Up @@ -75,7 +75,11 @@ def ar1(rho, sigma, n):
return np.array([])

# Generate noise
v = np.random.normal(0, sigma * np.sqrt(1 - rho**2), n)
s = sigma * np.sqrt(1 - rho**2)
if s == 0:
v = np.zeros(n)
else:
v = np.random.normal(0, s, n)
v[0] = np.random.rand()
for t in range(1, n):
v[t] += rho * v[t - 1]
Expand Down
2 changes: 1 addition & 1 deletion pints/tests/test_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_independent_noise(self):
self.assertRaises(ValueError, pn.independent, -1, clean.shape)

# Shape must be a nice shape (handled by numpy)
self.assertRaises(TypeError, pn.independent, 0, 'hello')
self.assertRaises(TypeError, pn.independent, 1, 'hello')

def test_ar1(self):

Expand Down

0 comments on commit a698169

Please sign in to comment.