aboutsummaryrefslogtreecommitdiff
path: root/processing/outlier.py
diff options
context:
space:
mode:
authorBlaise Thompson <blaise@untzag.com>2018-04-16 08:45:36 -0500
committerBlaise Thompson <blaise@untzag.com>2018-04-16 08:45:36 -0500
commit3671f4e2c92f28319e9c8e44071604e98d8d783f (patch)
treeeaf532281be6a18d51587d769c59b2482c5ed0e1 /processing/outlier.py
parent1df434357600bcae9d11f20a3062cb915704979a (diff)
2018-04-16 08:45
Diffstat (limited to 'processing/outlier.py')
-rw-r--r--processing/outlier.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/processing/outlier.py b/processing/outlier.py
new file mode 100644
index 0000000..520aa60
--- /dev/null
+++ b/processing/outlier.py
@@ -0,0 +1,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)