-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path3inch_property_visual_peak_info.py
177 lines (149 loc) · 6 KB
/
3inch_property_visual_peak_info.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# -*- coding: utf-8 -*-
"""
Created on Wed July 13 2016
@author: fangren
"""
import numpy as np
import matplotlib.pyplot as plt
import glob
import os
from os.path import basename
import imp
plotTernary = imp.load_source("plt_ternary_save", "plotTernary.py")
path = 'C:\Research_FangRen\Data\July2016\CoVZr_ternary\masterfiles\low\plotting\\'
def twoD_visualize(path):
"""
create three lists for plotting: plate_x, plate_y, ROI1, ROI2, ROI3...
"""
for filename in glob.glob(os.path.join(path, '*.csv')):
# if basename(filename)[0] == '1':
print basename(filename)
data = np.genfromtxt(filename, delimiter=',', skip_header = 1)
plate_x = data[:,1]
plate_y = data[:,2]
ROI1 = data[:,15]
ROI2 = data[:,16]
ROI3 = data[:,17]
ROI5 = data[:,19]
crystallinity = metal1 = data[:,51]
texture = metal1 = data[:,53]
metal1 = data[:,54]
metal2 = data[:,55]
metal3 = data[:,56]
# peak_num = data[:,58]
peak_position = data[:,57]
peak_width = data[:,58]
peak_intensity = data[:,59]
return plate_x, plate_y, ROI1, ROI2, ROI3, ROI5, crystallinity, texture, metal1, metal2, metal3, peak_position, peak_width, peak_intensity
# return plate_x, plate_y, ROI1, ROI2, ROI3, ROI5, crystallinity, texture, metal1, metal2, metal3, peak_num
plate_x, plate_y, ROI1, ROI2, ROI3, ROI5, crystallinity, texture, metal1, metal2, metal3, peak_position, peak_width, peak_intensity = twoD_visualize(path)
#plate_x, plate_y, ROI1, ROI2, ROI3, ROI5, crystallinity, texture, metal1, metal2, metal3, peak_num = twoD_visualize(path)
area = [500]*len(plate_x)
#plt.figure(1, figsize = (12, 9))
#plt.title('Cobalt beta')
#plt.scatter(plate_y, plate_x, c = ROI3, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
#plt.savefig(path+'Cobalt beta.png')
#
#plt.figure(2, figsize = (12, 9))
#plt.title('Chromium alpha Valladium beta')
#plt.scatter(plate_y, plate_x, c = ROI5, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
#plt.savefig(path+'Chromium alpha Valladium beta.png')
#
#plt.figure(3, figsize = (12, 9))
#plt.title('Cobalt Iron alpha')
#plt.scatter(plate_y, plate_x, c = ROI2, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
#plt.savefig(path+'Cobalt and Iron alpha.png')
#
#
#plt.figure(4, figsize = (12, 9))
#plt.title('Vanadium alpha')
#plt.scatter(plate_y, plate_x, c = ROI1, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
##plt.clim((500, 900))
#plt.savefig(path+'Vanadium alpha.png')
#
#plt.figure(5, figsize = (12, 9))
#plt.title('peak position')
#plt.scatter(plate_y, plate_x, c = peak_position, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
#plt.savefig(path+'peak position.png')
#
#plt.figure(6, figsize = (12, 9))
#plt.title('peak width')
#plt.scatter(plate_y, plate_x, c = peak_width, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
#plt.savefig(path+'peak width.png')
#
#plt.figure(7, figsize = (12, 9))
#plt.title('peak intensity')
#plt.scatter(plate_y, plate_x, c = peak_intensity, s = area, marker = 's')
#plt.colorbar()
#plt.xlim((-36, 36))
#plt.ylim((-36, 36))
#plt.xlabel('plate_y')
#plt.ylabel('plate_x(flat)')
#plt.savefig(path+'peak intensity.png')
ternary_data = np.concatenate(([metal1],[metal2],[metal3],[peak_width]), axis = 0)
ternary_data = np.transpose(ternary_data)
plotTernary.plt_ternary_save(ternary_data, tertitle='', labelNames=('Co','V','Zr'), scale=100,
sv=True, svpth=path, svflnm='peak_width_ternary',
cbl='Scale', vmin = 0.13, vmax = 0.406, cmap='jet_r', cb=True, style='h')
labels = []
for pw in peak_width:
if pw < 0.16:
label = 3
elif pw > 0.26:
label = 1
else:
label = 2
labels.append(label)
ternary_data = np.concatenate(([metal1],[metal2],[metal3],[labels]), axis = 0)
ternary_data = np.transpose(ternary_data)
plotTernary.plt_ternary_save(ternary_data, tertitle='', labelNames=('Co','V','Zr'), scale=100,
sv=True, svpth=path, svflnm='glass_or_crystal',
cbl='Scale', vmin = 0.2, vmax = 3.2, cmap='jet', cb=True, style='h')
ternary_data = np.concatenate(([metal1],[metal2],[metal3],[peak_intensity]), axis = 0)
ternary_data = np.transpose(ternary_data)
plotTernary.plt_ternary_save(ternary_data, tertitle='', labelNames=('Co','V','Zr'), scale=100,
sv=True, svpth=path, svflnm='peak_intensity_ternary',
cbl='Scale', vmin=137, vmax=1420, cmap='jet', cb=True, style='h')
ternary_data = np.concatenate(([metal1],[metal2],[metal3],[peak_position]), axis = 0)
ternary_data = np.transpose(ternary_data)
plotTernary.plt_ternary_save(ternary_data, tertitle='', labelNames=('Co','V','Zr'), scale=100,
sv=True, svpth=path, svflnm='peak_position_ternary',
cbl='Scale', vmin=2.51, vmax=3.14, cmap='jet', cb=True, style='h')
##
#ternary_data = np.concatenate(([metal1],[metal2],[metal3],[peak_num]), axis = 0)
#ternary_data = np.transpose(ternary_data)
#
#plotTernary.plt_ternary_save(ternary_data, tertitle='', labelNames=('Co','V','Zr'), scale=100,
# sv=True, svpth=path, svflnm='peak_num',
# cbl='Scale', vmin = 1, vmax = 40, cmap='jet', cb=True, style='h')
plt.close("all")