Skip to content

Commit 28e2b9f

Browse files
Add files via upload
1 parent 29c5b0f commit 28e2b9f

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

event72_functions.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Fry May 20 13:37:06 2022
4+
5+
@author: ronjaebner
6+
7+
definitions of functions for model of the 7.2 collaboration
8+
9+
"""
10+
import numpy as np
11+
from numpy import pi
12+
13+
14+
15+
def find_ampl_base_neu(data, idx0, T, dt, t_vec):
16+
# Amplitude calculated by (max-min)/2 within one period (moving window)
17+
# Baseline calculated by (max+min)/2 within one period (moving window)
18+
prec = 10000
19+
Period = T
20+
TimeStep = dt
21+
FrameStep = Period/TimeStep*(2/11)
22+
FrameWidth = Period/TimeStep
23+
i_end = len(t_vec)- FrameWidth
24+
i = idx0 + 0.5*FrameWidth
25+
a_t=np.zeros_like(t_vec)
26+
b_t=np.zeros_like(t_vec)
27+
t =np.zeros_like(t_vec)
28+
29+
while i<i_end:
30+
int_0 = int(i- 0.5*FrameWidth)
31+
int_1 = int(i+ 0.5*FrameWidth)
32+
#
33+
a_t[int(i)] = prec*(max(data[int_0:int_1]) - min(data[int_0:int_1]))/2
34+
b_t[int(i)] = prec*(max(data[int_0:int_1]) + min(data[int_0:int_1]))/2
35+
t[int(i)] = i
36+
#
37+
i+=FrameStep
38+
##
39+
A_t = a_t[t != 0]/prec
40+
B_t = b_t[t != 0]/prec
41+
T = t[t != 0]*dt/1000
42+
return A_t, B_t , T
43+
44+
def safe_matrices(var,name_dir, scn_name, name_var):
45+
name_file= (name_dir + '72event_' + scn_name
46+
+ "_"+ name_var)
47+
np.savetxt(name_file, var,delimiter=",")
48+
return

0 commit comments

Comments
 (0)