Skip to content

Commit

Permalink
Don't copy numpy array
Browse files Browse the repository at this point in the history
  • Loading branch information
edeno committed Jun 5, 2018
1 parent b9ac6d4 commit ee76735
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ripple_detection/detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def Kay_ripple_detector(time, LFPs, speed, sampling_frequency,
'''
not_null = np.all(pd.notnull(LFPs), axis=1) & pd.notnull(speed)
LFPs, speed, time = (
LFPs.copy()[not_null], speed.copy()[not_null], time.copy()[not_null])
LFPs, speed, time = LFPs[not_null], speed[not_null], time[not_null]

filtered_lfps = np.stack(
[filter_ripple_band(lfp, sampling_frequency) for lfp in LFPs.T])
Expand Down Expand Up @@ -118,8 +117,7 @@ def Karlsson_ripple_detector(time, LFPs, speed, sampling_frequency,
'''
not_null = np.all(pd.notnull(LFPs), axis=1) & pd.notnull(speed)
LFPs, speed, time = (
LFPs.copy()[not_null], speed.copy()[not_null], time.copy()[not_null])
LFPs, speed, time = LFPs[not_null], speed[not_null], time[not_null]

candidate_ripple_times = []
for lfp in LFPs.T:
Expand Down Expand Up @@ -189,8 +187,7 @@ def Roumis_ripple_detector(time, LFPs, speed, sampling_frequency,
'''
not_null = np.all(pd.notnull(LFPs), axis=1) & pd.notnull(speed)
LFPs, speed, time = (
LFPs.copy()[not_null], speed.copy()[not_null], time.copy()[not_null])
LFPs, speed, time = LFPs[not_null], speed[not_null], time[not_null]
filtered_lfps = [filter_ripple_band(lfp, sampling_frequency)
for lfp in LFPs.T]
filtered_lfps = [np.sqrt(gaussian_smooth(
Expand Down

0 comments on commit ee76735

Please sign in to comment.