aboutsummaryrefslogtreecommitdiff
path: root/processing/outlier.py
blob: 520aa601251e26481585891c5d0474c56b2e36ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
### import ####################################################################


import os 

import numpy as np

import matplotlib.pyplot as plt

import WrightTools as wt 


### define ####################################################################


directory = os.path.dirname(__file__)
google_drive_directory = wt.kit.get_path_matching('Google Drive')

### workspace #################################################################


# get data
p = os.path.join(google_drive_directory, 'MX2', 'CMDS', '2017-01-15', '2017-01-18', '2', '000 [wm=w1, d1]', '000.data')
d = wt.data.from_PyCMDS(p)
d.convert('eV')

# clean up axes
d.axes[0].name = 'w1'
d._update()
d.transpose()
d.flip('d1')

# turn into DT/T
d.divide(d, 'signal_diff', 'signal_mean')
d.signal_diff.znull = 0
d.signal_diff.signed = True

# trim
if True:
    # higher factors are more permissive
    d.trim('signal_diff', w1=6, d1=0, replace='nan', factor=3)
    d.trim('signal_diff', w1=6, d1=0, replace='nan', factor=3)

# heal
if False:
    d.heal('signal_diff')

# plot
a = wt.artists.mpl_2D(d)
a.plot(contours=0)