Skip to content

Commit

Permalink
bugfix (#52)
Browse files Browse the repository at this point in the history
* ignore soundfile for pytest

* fix bu in test routine

* don't check sound level

* add testing for filters

* change filter documentation

* import re

* change filters to filter in documentation

* change f_lower to low_cutoff

* remove brownnoise

* ignore build

* adding filter doc

* ignore build

* ignore build

* ignore build

* removing _build folder

* convert tabs to spaces

* debug calibrate

* remove time_windows from test

* remove matlabdoc builder

* add matlabdoc builder to requirements

* remove matlabdoc

* resolve some warnings

* syntax fixes

* .

* test recording

* add play method

* do test

* move test folder one level up

* addplotting code in the .rst file

* one mire plotting example

* add filter docu

* add example for equalization filter

* fix plotting

* fix plotting

* remove pyplots folder

* debug plotting

* ignoring cached scripts

* simplify plot_tf

* change header

* remake intro

* add reference for spectral features

* move audiogram to examples

* add some references

* add fft filter test

* chnage header

* merge

* fix reference

* add psychoacoustics test

* integrate mmn in Trialsequence class

* for mmn sequence n_reps = n_trials

* condition numbers start at 1

* condtions start at 1

* rename function to oddball, encode deviant as 0

* change oddball to deviant_indices

* deviants should work now

* make random permutation if n_conds = 1

* give correct trialnr

* write response in list of lists

* make list of None elementrs fro response

* make list of None for response

* add deviants to n conditions

* fix bug

* trial sequence should always be a list

* dont insert empty array to avoid warning

* add test routines

* more tests

* fix bug when loading sequence

* fix import order

* copy _init_ from upstream

* all functions except curses now tested

* fix syntax error

* use uniform syntax for plotting

* add hrtf tests

* add h5netcdf

* add SoundFile

* add 	sudo apt-get install sndfile-tools

* fix syntax

* separate system and python dependencies

* fix syntax error

* return condition in __next__

* fix bug in deviant list generation

* in self.data change None to -999 to avoid error when writing json files

* make triallist python int

* syntax error

* return 0 in __next__() when trial is deviant

* resolve type error

* never modify anything in place, remove copy_channel

* fix syntax error

* remove copychannel, add am method

* changing doku

* overhaul of the psychoacoustics documentation

* fix flake8 error

* fix syntax error

* fix assertion error

* remove redundant function

* writing stuff

* add bibliography

* change paper

* new paper version

* new unittests for Trialsequence + debugging

* debug variable name

* convert trials to list

* raise error when condition is a string but not a file

* add method for saving and loading pickle files and rename to LoadSave_mixin

* when writing JSON, catch value AND type errors

* when making a Trialsequence instance from a file, try to load JSON, catch exception and then load pickle

* catch JSONDecodeError when loading trialsequence from file

* JSON decode error is part of json module

* fix indentation error

* change class names and add docstrings

* rename classes according to python conventions

* removing attributes this_trial_n and this_rep_n from trialsequence

* adding docstrings

* add docstrings

* adding docstrings

* docstrings

* move simulate_response to mixin

* refactoring docstrings

* debug test_psychoacoustics

* avoid endless loop when computing deviant indices

* enable plotting to axis when plotting an "image"

* change plotting routine to avoid timeout when pytesting

* add docstrings

* change nchannels to n_channels and nsamples to n_samples

* change Signal.resize to return a new instance

* changed the crossfade function to deal with multiple inputs (still a BUG)

* dont transpose array if data array is empty

* add unit test for crossfading

* docstrings

* add test for frames and frametimes

* finished docstring overhaul

* add tests for signal.py

* add test routine for generating and reading/writing sound

* add test for power law noise

* add tests for binaural cues

* pack get and set envelope into one function

* change envelope and itd/ild to get/set scheme

* add docstrings for binaural generator functions

* adding tests for band filters

* finish filter class refractor

* dont use unittest class

* debug test_tone

* add type in docstring

* negative ild means sound to the left

* add test for loading/saving filters

* add test routines for externalize and interaural level spectrum

* add the interaural level spectrum file to gitignore

* add test for making HRTF instances

* overhaul hrtf docstrings & tests

* resolve some TODOs

* remove normalise argument

* debuging tests

* debug endless loop

* debig test_envelope

* debug assertion errors

* debug assertion errors

* change filter n_samples

* debug assertion error

* renamed the n_ parameters

* debug sound docs

* implement writing objects to resultsfile

* debugging docs

* debug save results file

* add import statements to docs

* debug tests

* debug test frames

* add default level, changel handling of default sampling rate

* hide default level and samplerate variables

* remove conditions from setup dependencies

* remove level argument from all functions

* add SoudCard

* remove soundfile

* remove soundcard from setup.py

* install pulseaudio

* debug

* remove SounCard from pipeline

* debug test

* debug

* debug get_future_trial

* improve documentation

* uninstall soundcard after setup.py

* add soundcard to requirements

* say yes to pip uninstall

* fix some warnings from pytest

* add error message if libsndfile is not installed

* add data_path function

* change usage of data_path in docs

* Update paper.bib

* Update paper.bib

* dont print every iteration in Trialsequence.transitions

* some small fixes in psychoacoustics docs

* catch h5py warning when loading sofa file

* change docstrings for proper sphinx rendering

* add level argument to generator methods

* add kemar

* remove all plot kwargs and add kwargs to spectrogram

* debug binaural.externalize

* debug hrtf plot_tf

* make assert condition more liberal

* add example for sequential application of filters

* counts vs probabilities

* debug setting 'length' in equalizing_filterbank

* debug syntax

Co-authored-by: Marc <[email protected]>
  • Loading branch information
OleBialas and DrMarc authored Apr 21, 2022
1 parent c9f7a55 commit 54b1800
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion slab/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def equalizing_filterbank(reference, sound, length=1000, bandwidth=1/8, low_cuto
filts = numpy.zeros((length, sound.n_channels))
for chan in range(sound.n_channels):
gain = [1] + list(amp_diffs[:, chan])
filt = Filter.band(frequency=list(center_freqs), gain=gain, samplerate=reference.samplerate, fir=True)
filt = Filter.band(frequency=list(center_freqs), gain=gain, samplerate=reference.samplerate, fir=True, length=length)
filts[:, chan] = filt.data.flatten()
return Filter(data=filts, samplerate=reference.samplerate, fir=True)

Expand Down
3 changes: 3 additions & 0 deletions tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def test_center_freqs():

def test_equalization():
for i in range(10):
length = numpy.random.randint(1000, 5000)
low_cutoff = numpy.random.randint(20, 2000)
high_cutoff = numpy.random.randint(10000, 20000)
sound = slab.Sound.pinknoise(samplerate=44100)
filt = slab.Filter.band(frequency=[100., 800., 2000., 4300., 8000., 14500., 18000.],
gain=[0., 1., 0., 1., 0., 1., 0.], samplerate=sound.samplerate)
Expand Down

0 comments on commit 54b1800

Please sign in to comment.