norm.py 804 Bytes
Newer Older
JGlombitza's avatar
JGlombitza committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import numpy as np

def NormCenter(time):
    u = np.isnan(time)
    time -= np.nanmean(time, axis=1)[:,np.newaxis]
    time /= np.nanstd(time)
    time[u] = 0
    try:
        time = time.reshape(time.shape[0],11,11)
    except:
        time = time.reshape(time.shape[0],9,9)
    return time

def NormPhysicalEnergylog10(time):
    u = np.isnan(time)
JGlombitza's avatar
v1.2    
JGlombitza committed
16
    time[np.less(time,0)] = 0
JGlombitza's avatar
JGlombitza committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    time[~u] = np.log10(time[~u]-np.nanmin(time)+1.0)
    time /= np.nanstd(time)
    time[u] = 0
    try:
        time = time.reshape(time.shape[0], 9, 9)
    except:
        time = time.reshape(time.shape[0], 11,11)
    return time

def NormPhysicalTimeTracelog10(signal, log_dir="."):
    signal[signal<0] = 0
    x = np.arange(80)
    signal = np.log10(signal + 1)
    signal[np.isnan(signal)] = 0
    return signal