Timer unit: 1e-06 s
Total time: 14.8587 s
File: /Users/patrykattc/projects/git/public/machine-learning/notebook-performance/slow_example.py
Function: reallySlowGenerateTimeSeriesData at line 5
Line # Hits Time Per Hit % Time Line Contents
==============================================================
5 def reallySlowGenerateTimeSeriesData(seconds,samples_per_second):
6 """Generate synthetic data"""
7
8 1 4.0 4.0 0.0 time = []
9 1 1.0 1.0 0.0 signal = []
10
11 # generate signal
12 1 0.0 0.0 0.0 sample_time = 0
13 3601 1802.0 0.5 0.0 for s in range(seconds):
14 3603600 1659755.0 0.5 11.2 for sps in range(samples_per_second):
15 3600000 2084958.0 0.6 14.0 sample_time += 1/samples_per_second
16 3600000 2220094.0 0.6 14.9 noise = random.random()
17 3600000 1993574.0 0.6 13.4 scaled_noise = -1 + (noise * 2)
18 3600000 3059636.0 0.8 20.6 sample = math.sin(2*math.pi*10*sample_time) + scaled_noise
19 3600000 1981189.0 0.6 13.3 time.append(sample_time)
20 3600000 1857710.0 0.5 12.5 signal.append(sample)
21
22 # return time and signal
23 1 1.0 1.0 0.0 return [time,signal]