Skip to content

Commit

Permalink
V: 0.35.dev0; require Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Feb 19, 2021
1 parent c7de961 commit a5fbbe2
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ env:
matrix:
include:
- os: osx # https://github.com/travis-ci/travis-ci/issues/2312
python: 3.7
python: 3.8
sudo: false
env: CONDA_OS="MacOSX" KMP_DUPLICATE_LIB_OK=TRUE CC=g++ CXX=g++
- os: linux
python: 3.7
python: 3.8
sudo: false
env: CONDA_OS="Linux"
addons: {apt: {packages: [libwebkitgtk-dev]}}
- os: linux
python: 3.8
python: 3.9
sudo: false
env: CONDA_OS="Linux"
addons: {apt: {packages: [libwebkitgtk-dev]}}
Expand Down
2 changes: 1 addition & 1 deletion eelbrain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
from .fmtxt import Report


__version__ = '0.34.dev0'
__version__ = '0.35.dev0'
34 changes: 12 additions & 22 deletions eelbrain/_data_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
from copy import copy, deepcopy
import fnmatch
from functools import partial
from itertools import chain, product, repeat, zip_longest
from itertools import chain, combinations, product, repeat, zip_longest
from keyword import iskeyword
from math import ceil, floor, log
from numbers import Integral, Number
Expand Down Expand Up @@ -7364,11 +7364,11 @@ def head(self, n=10):
return self.as_table(cases=n)

# checking model properties
def check(self, v=True):
def check(self):
"Shortcut to check linear independence and orthogonality"
return self.lin_indep(v) + self.orthogonal(v)
return self.lin_indep() + self.orthogonal()

def lin_indep(self, v=True):
def lin_indep(self):
"Check the Model for linear independence of its factors"
msg = []
ne = len(self.effects)
Expand All @@ -7379,31 +7379,21 @@ def lin_indep(self, v=True):
e2 = self.effects[j]
x = np.hstack((codes[i], codes[j]))
if rank(x) < x.shape[1]:
if v:
errtxt = "Linear Dependence Warning: {0} and {1}"
msg.append(errtxt.format(e1.name, e2.name))
msg.append(f"Linear Dependence Warning: {e1.name} and {e2.name}")
return msg

def orthogonal(self, v=True):
def orthogonal(self):
"Check the Model for orthogonality of its factors"
msg = []
ne = len(self.effects)
codes = [e.as_effects for e in self.effects]
for i in range(ne):
for j in range(i + 1, ne):
ok = True
e1 = self.effects[i]
e2 = self.effects[j]
e1e = codes[i]
e2e = codes[j]
for i1 in range(e1.df):
for i2 in range(e2.df):
dotp = np.dot(e1e[:, i1], e2e[:, i2])
if dotp != 0:
ok = False
# allok = False
if v and (not ok):
for i, j in combinations(range(ne), 2):
e1 = self.effects[i]
e2 = self.effects[j]
for i1, i2 in product(range(e1.df), range(e2.df)):
if np.dot(codes[i][:, i1], codes[j][:, i2]) != 0:
msg.append(f"Not orthogonal: {e1.name} and {e2.name}")
break
return msg

def _parametrize(self, method='effect'):
Expand Down
6 changes: 2 additions & 4 deletions eelbrain/_io/tests/test_pickle.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from eelbrain import datasets, load
from eelbrain._utils import IS_OSX
from eelbrain.testing import assert_dataobj_equal, file_path


def test_pickle():
ds = datasets.get_uts()

decimal = None if IS_OSX else 15
ds_2 = load.unpickle(file_path('uts-py2.pickle'))
assert_dataobj_equal(ds_2, ds, decimal)
assert_dataobj_equal(ds_2, ds, 15)
ds_3 = load.unpickle(file_path('uts-py3.pickle'))
assert_dataobj_equal(ds_3, ds, decimal)
assert_dataobj_equal(ds_3, ds, 15)
6 changes: 2 additions & 4 deletions eelbrain/tests/test_ndvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,14 @@ def test_find_intervals():
def test_find_peaks():
scalar = Scalar('scalar', range(9))
time = UTS(0, .1, 12)
v = NDVar(np.zeros((9, 12)), (scalar, time))
v = NDVar.zeros((scalar, time))
wsize = [0, 0, 1, 2, 3, 2, 1, 0, 0]
for i, s in enumerate(wsize):
if s:
v.x[i, 5 - s: 5 + s] += np.hamming(2 * s)

peaks = find_peaks(v)
x, y = np.where(peaks.x)
assert_array_equal(x, [4])
assert_array_equal(y, [5])
assert_array_equal(np.where(peaks.x), ([4, 4], [4, 5]))


def test_frequency_response():
Expand Down
6 changes: 3 additions & 3 deletions env-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: eeldev
channels:
- conda-forge
dependencies:
- python >= 3.7
- python >= 3.8
- pip
- twine
- libblas=*=*mkl # openblas produces incorrect results for ICA in iMac Pro
Expand All @@ -14,7 +14,7 @@ dependencies:
- numpy
- scipy >= 1.3
- numba
- matplotlib-base >= 3, <3.1 # https://github.com/matplotlib/matplotlib/issues/15410
- matplotlib-base >= 3.3.4 # https://github.com/matplotlib/matplotlib/issues/15410
- pyarrow
- pillow
- psutil
Expand All @@ -31,7 +31,7 @@ dependencies:
- colormath >= 2.1
- tqdm >= 4.40
- keyring >= 5
- wxpython >= 4.0.3
- wxpython >= 4.0.3, < 4.1 # double install of libraries
# building
- setuptools >= 17
- cython
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
build:
image: latest
python:
version: 3.7
version: 3.8
pip_install: true
requirements_file: readthedocs_requirements.txt
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
author_email='christianbrodbeck@nyu.edu',
license='BSD (3-clause)',
long_description=DESC,
python_requires='>=3.7',
python_requires='>=3.8',
setup_requires=[
"numpy >= 1.11",
"cython >= 0.21",
Expand All @@ -84,8 +84,8 @@
'tqdm >= 4.8',
],
'full': [
'numpy >= 1.8',
'scipy >= 0.17',
'numpy >= 1.20',
'scipy >= 1.3',
'matplotlib >= 2.1',
],
'plot.brain': [
Expand Down

0 comments on commit a5fbbe2

Please sign in to comment.