Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecation warnings from 0.7.0 #306

Merged
merged 7 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion elephant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
gpfa)

try:
from . import pandas_bridge
from . import asset
from . import spade
except ImportError:
Expand Down
14 changes: 0 additions & 14 deletions elephant/spike_train_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,6 @@ def interval_generator_refractory(size):
return spiketrain


def homogeneous_poisson_process_with_refr_period(rate,
refr_period=2. * pq.ms,
t_start=0.0 * pq.ms,
t_stop=1000.0 * pq.ms,
as_array=False):
warnings.warn("homogeneous_poisson_process_with_refr_period() function is "
"deprecated and will be deleted in v0.8.0 release. Use "
"homogeneous_poisson_process(refractory_period=...) instead",
DeprecationWarning)
return homogeneous_poisson_process(rate=rate, t_start=t_start,
t_stop=t_stop, as_array=as_array,
refractory_period=refr_period)


def inhomogeneous_poisson_process(rate, as_array=False,
refractory_period=None):
"""
Expand Down
19 changes: 0 additions & 19 deletions elephant/test/test_spike_train_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,25 +288,6 @@ def test_invalid(self):
# no units provided for refractory_period
self.assertRaises(ValueError, hpp, rate=rate, refractory_period=2)

def test_deprecated_homogeneous_poisson_process_with_refr_period(self):
# TODO: remove in v0.8.0
rate = 10 * Hz
t_start = 17 * ms
t_stop = 2 * s
refractory_period = 3 * ms
np.random.seed(28)
spiketrain = stgen.homogeneous_poisson_process(
rate=rate, t_start=t_start, t_stop=t_stop,
refractory_period=refractory_period)
np.random.seed(28)
spiketrain_depr = stgen.homogeneous_poisson_process_with_refr_period(
rate=rate, refr_period=refractory_period, t_start=t_start,
t_stop=t_stop
)
assert_array_almost_equal(spiketrain_depr.times, spiketrain.times)
self.assertAlmostEqual(spiketrain_depr.t_start, spiketrain.t_start)
self.assertAlmostEqual(spiketrain_depr.t_stop, spiketrain.t_stop)


class InhomogeneousPoissonProcessTestCase(unittest.TestCase):
def setUp(self):
Expand Down
11 changes: 0 additions & 11 deletions elephant/test/test_unitary_event_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,6 @@ def setUp(self):
[0, 1, 1, 1, 1],
[1, 1, 0, 1, 0]]])

@unittest.skipUnless(python_version_major == 3, "assertWarns requires 3.2")
def test_deprecated_N(self):
n_patterns = 10
m = np.random.randint(low=0, high=2, size=(n_patterns, 2))
with self.assertWarns(DeprecationWarning):
# check *args
h = ue.hash_from_pattern(m, n_patterns)
with self.assertWarns(DeprecationWarning):
# check **kwargs
h = ue.hash_from_pattern(m, N=n_patterns)

def test_hash_default(self):
m = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 0],
[1, 0, 1], [0, 1, 1], [1, 1, 1]])
Expand Down
27 changes: 0 additions & 27 deletions elephant/unitary_event_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

import sys
import warnings
from functools import wraps

import neo
import numpy as np
Expand All @@ -66,26 +65,6 @@
from elephant.utils import is_binary


def decorate_deprecated_N(func):
@wraps(func)
def decorated_func(*args, **kwargs):
N = None
if 'N' in kwargs:
N = kwargs.pop('N')
elif len(args) > 1 and isinstance(args[1], int):
args = list(args)
N = args.pop(1)
if N is not None:
warnings.warn("'N' is deprecated in '{func_name}' and will be "
"removed in the next Elephant release. Now 'N' is "
"extracted from the data shape.".format(
func_name=func.__name__), DeprecationWarning)
return func(*args, **kwargs)

return decorated_func


@decorate_deprecated_N
def hash_from_pattern(m, base=2):
"""
Calculate for a spike pattern or a matrix of spike patterns
Expand Down Expand Up @@ -208,7 +187,6 @@ def inverse_hash_from_pattern(h, N, base=2):
return m


@decorate_deprecated_N
def n_emp_mat(mat, pattern_hash, base=2):
"""
Count the occurrences of spike coincidence patterns in the given spike
Expand Down Expand Up @@ -267,7 +245,6 @@ def n_emp_mat(mat, pattern_hash, base=2):
return N_emp, indices


@decorate_deprecated_N
def n_emp_mat_sum_trial(mat, pattern_hash):
"""
Calculate empirical number of observed patterns, summed across trials.
Expand Down Expand Up @@ -336,7 +313,6 @@ def n_emp_mat_sum_trial(mat, pattern_hash):
return N_emp, idx_trials


@decorate_deprecated_N
def _n_exp_mat_analytic(mat, pattern_hash):
"""
Calculates the expected joint probability for each spike pattern
Expand All @@ -357,7 +333,6 @@ def _n_exp_mat_analytic(mat, pattern_hash):
return np.prod(pmat, axis=0) * float(mat.shape[1])


@decorate_deprecated_N
def _n_exp_mat_surrogate(mat, pattern_hash, n_surr=1):
"""
Calculates the expected joint probability for each spike pattern with spike
Expand All @@ -374,7 +349,6 @@ def _n_exp_mat_surrogate(mat, pattern_hash, n_surr=1):
return N_exp_array


@decorate_deprecated_N
def n_exp_mat(mat, pattern_hash, method='analytic', n_surr=1):
"""
Calculates the expected joint probability for each spike pattern.
Expand Down Expand Up @@ -682,7 +656,6 @@ def _winpos(t_start, t_stop, winsize, winstep, position='left-edge'):
return ts_winpos


@decorate_deprecated_N
def _UE(mat, pattern_hash, method='analytic_TrialByTrial', n_surr=1):
"""
Return the default results of unitary events analysis
Expand Down