Skip to content

Commit

Permalink
Merge pull request #77 from baccuslab/rename
Browse files Browse the repository at this point in the history
Renames upsample_stim and downsample_stim
  • Loading branch information
bnaecker committed Nov 15, 2016
2 parents 287ad99 + 913a9f1 commit 3594831
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyret/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
'filtertools',
]

__version__ = '0.4.5'
__version__ = '0.4.6'

from pyret import *
6 changes: 3 additions & 3 deletions pyret/stimulustools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import numpy as np
from pyret.utils import flat2d

__all__ = ['upsample_stim', 'downsample_stim', 'slicestim',
__all__ = ['upsample', 'downsample', 'slicestim',
'cov', 'rolling_window', 'flat2d']


def upsample_stim(stim, upsample_factor, time=None):
def upsample(stim, upsample_factor, time=None):
"""
Upsample the given stimulus by the given factor.
Expand Down Expand Up @@ -60,7 +60,7 @@ def upsample_stim(stim, upsample_factor, time=None):
return stim_us, time_us


def downsample_stim(stim, downsample_factor, time=None):
def downsample(stim, downsample_factor, time=None):
"""
Downsample the given stimulus by the given factor.
Expand Down
10 changes: 5 additions & 5 deletions tests/test_stimulustools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ def test_resampling_1d():
dt = 0.1
stim = np.random.randn(stim_size,)
time = np.arange(stim_size) * dt
stim_us, time_us = stimulustools.upsample_stim(
stim_us, time_us = stimulustools.upsample(
stim, resample_factor, time=time)
stim_ds, time_ds = stimulustools.downsample_stim(
stim_ds, time_ds = stimulustools.downsample(
stim_us, resample_factor, time=time_us)

assert np.all(stim == stim_us[::resample_factor]), 'Upsampling failed'
assert np.all(stim == stim_ds), 'Downsampling failed'

_, time_us = stimulustools.upsample_stim(stim, resample_factor)
_, time_us = stimulustools.upsample(stim, resample_factor)
assert time_us is None

def test_resampling_2d():
Expand All @@ -35,9 +35,9 @@ def test_resampling_2d():
dt = 0.1
stim = np.random.randn(*stim_size)
time = np.arange(stim_size[0]) * dt
stim_us, time_us = stimulustools.upsample_stim(
stim_us, time_us = stimulustools.upsample(
stim, resample_factor, time=time)
stim_ds, time_ds = stimulustools.downsample_stim(
stim_ds, time_ds = stimulustools.downsample(
stim_us, resample_factor, time=time_us)

assert np.all(stim == stim_us[::resample_factor, ...]), 'Upsampling failed'
Expand Down

0 comments on commit 3594831

Please sign in to comment.