File: numpy_example.py

package info (click to toggle)
python-memory-profiler 0.61-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 540 kB
  • sloc: python: 2,220; makefile: 33
file content (22 lines) | stat: -rw-r--r-- 398 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import scipy.signal


@profile
def create_data():
    ret = []
    for n in range(70):
        ret.append(np.random.randn(1, 70, 71, 72))
    return ret


@profile
def process_data(data):
    data = np.concatenate(data)
    detrended = scipy.signal.detrend(data, axis=0)
    return detrended


if __name__ == "__main__":
    data1 = create_data()
    data2 = process_data(data1)