Skip to content

Commit

Permalink
Merge 3361b47 into ae88990
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrewe committed Oct 26, 2018
2 parents ae88990 + 3361b47 commit 60965a1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/test_peakdetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_detect_peaks():

assert_raises(ValueError, pd.detect_peaks, data, -1.0)

assert_raises(IndexError, pd.detect_peaks, data, threshold, time[:len(time) / 2])
assert_raises(IndexError, pd.detect_peaks, data, threshold, time[:int(len(time) / 2)])

peaks, troughs = pd.detect_peaks(data, threshold)
assert_true(np.all(peaks == peak_indices),
Expand Down Expand Up @@ -106,7 +106,7 @@ def test_detect_dynamic_peaks():
assert_raises(ValueError, pd.detect_dynamic_peaks, data, threshold, min_thresh, -1.0, time,
pd.accept_peak_size_threshold)

assert_raises(IndexError, pd.detect_dynamic_peaks, data, threshold, min_thresh, 0.5, time[:len(time) / 2],
assert_raises(IndexError, pd.detect_dynamic_peaks, data, threshold, min_thresh, 0.5, time[:int(len(time) / 2)],
pd.accept_peak_size_threshold)

peaks, troughs = pd.detect_dynamic_peaks(data, threshold, min_thresh, 0.5, time,
Expand Down
2 changes: 1 addition & 1 deletion thunderfish/Auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import numpy as np
import wave
from scipy.signal import butter, filtfil
from scipy.signal import butter, filtfilt
try:
import matplotlib.pyplot as plt
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion thunderfish/fakefish.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def generate_pulsefish(frequency=100.0, samplerate=44100., duration=1., noise_st
data = np.random.randn(len(time)) * noise_std
period = 1.0/frequency
jitter_std = period * jitter_cv
first_pulse = np.max(pulse_duration, 3.0*jitter_std)
first_pulse = np.max([pulse_duration, 3.0*jitter_std])
pulse_times = np.arange(first_pulse, duration, period )
pulse_times += np.random.randn(len(pulse_times)) * jitter_std
pulse_indices = np.round(pulse_times * samplerate).astype(np.int)
Expand Down
3 changes: 1 addition & 2 deletions thunderfish/harmonicgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,9 @@ def fundamental_freqs(group_list):
list_of_list = False
for groups in group_list:
for harmonic_group in groups:
if hasattr(harmonic_group, 'shape'):
if len(np.shape(harmonic_group)) > 1:
list_of_list = True
break

if list_of_list:
fundamentals = []
for groups in group_list:
Expand Down
4 changes: 2 additions & 2 deletions thunderfish/time_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ def main(file_path, hobo_path, show_fish_plot=False, show_combined_fishes=False,
old_colors = False

for enu, folder in enumerate(sorted(folders)):
print folder
print(folder)
# load data
dat_file = False
fishes = False
Expand Down Expand Up @@ -2128,4 +2128,4 @@ def main(file_path, hobo_path, show_fish_plot=False, show_combined_fishes=False,
parser.add_argument('hobo_path', nargs='?', default='', type=str, help='folder containing the hobo datalogger files')

args = parser.parse_args()
main(args.file_path, args.hobo_path)
main(args.file_path, args.hobo_path)
4 changes: 2 additions & 2 deletions thunderfish/voronoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def random_points(self, n=None, poisson=True, mode='outer'):
nn = n
if poisson:
nn = np.random.poisson(n)
m = nn/2
m = nn//2
if m < 5:
m = 5
# get bounding box:
Expand Down Expand Up @@ -636,7 +636,7 @@ def random_points(self, n=None, poisson=True, mode='outer'):
elif mode == 'bbox':
points = np.vstack((points, newpoints[np.all(newpoints<max_bound, axis=1),:]))
else:
print('')
print('')
print('Voronoi.random_points(): unknown value "%s" for the mode parameter:' % mode)
print('Use one of the following values:')
print(' bbox: Place points within rectangular bounding box.')
Expand Down

0 comments on commit 60965a1

Please sign in to comment.