-
-
Save tom-perkins/998caf72095c54258571 to your computer and use it in GitHub Desktop.
Example of desired output from Pascal Manuel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy | |
import matplotlib as mpl | |
#runno_list=[32644,32645,32646,32647,32648,32649,32650,32651,32652,32653,32654,32655,32656,32657,32658,32659,32660,32661,32662,32663,32664,32665,32666,32667,32668,32669,32671,32674,32677,32678,32679,32680] | |
#temp_list=[1.5,2.5,5.0,7.5,10,12.5,15,17.5,20.0,22.5,25.0,27.5,30.0,32.5,35.0,37.5,39,40.5,42.0,43.5,45.0,46.5,48.0,49.5,51.0,52.5,60.0,75.0,105.0,115.0,125.0,135.0] | |
runno_list=[23481,23482,23483,23484,23485,23486,23487,23488,23489,23490,23491,23492,23493,23494,23495,23496,23497,23498,23499,23500,23501,23502,23503,23504,23505,23506,23507,23508,23509,23510,23511] | |
temp_list=[1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,10.0,15.0,20.0,25.0,30.0,35.0,40.0,45.0,48.0,49.5,51.0,52.5,60.0,67.5,75.0,85.0,90.0,95.0,100.0,105.0,115.0,125.0,135.0] | |
print len(runno_list) | |
print len(temp_list) | |
def create_sample_group(n_items): | |
to_group = list() | |
for runno in runno_list: | |
name = str(runno)+'-2' | |
to_group.append(name) | |
group = GroupWorkspaces(InputWorkspaces=','.join(to_group)) | |
return group | |
ws = create_sample_group(runno_list) | |
CropWorkspace(InputWorkspace=ws,OutputWorkspace=ws,Xmin=1.8,Xmax=10.0) | |
def make_graph(group_ws,temp_list): | |
sample = group_ws[0] | |
X = sample.readX(0) | |
#print len(X) | |
Y = temp_list | |
Z = (np.histogram(sample.readX(0)), group_ws.size()) | |
X, Y = np.meshgrid(X, Y) | |
z_arrays = list() | |
for ws in group_ws: | |
z_arrays.append(ws.readY(0)) | |
print len(z_arrays[1]) | |
Z = np.array(z_arrays) | |
print X.shape,Y.shape,Z.shape | |
# fig = plt.figure() | |
#ax = fig.gca(projection='3d') | |
# ax=Axes3D(fig) | |
# surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, | |
# linewidth=0, antialiased=False) | |
plt.imshow(Z, vmin=Z.min(), vmax=Z.max(), origin='lower', | |
extent=[X.min(), X.max(), Y.min(), Y.max()],aspect='auto') | |
#ax.set_zlim(-1.01, 1.01) | |
#ax.zaxis.set_major_locator(LinearLocator(10)) | |
#ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) | |
# fig.colorbar(surf, shrink=0.5, aspect=5) | |
plt.show() | |
ws = create_sample_group(runno_list) | |
gui_cmd(make_graph, ws,temp_list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list_bk=["-1_10","-2_9","-3_8","-4_7","-5_6"] | |
list_bk=["-1","-2","-3","-4","-5"] | |
for n in list_bk: | |
print n | |
for runno in range(23481,23519): | |
for bank in list_bk: | |
LoadGSS(Filename='C:/Users/mp43/Dropbox/GdCrO3/'+str(runno)+str(bank)+'raw-0.gss', OutputWorkspace=str(runno)+str(bank)) | |
ConvertUnits(InputWorkspace=str(runno)+str(bank), OutputWorkspace=str(runno)+str(bank), Target='dSpacing') | |
ConvertToPointData(InputWorkspace=str(runno)+str(bank), OutputWorkspace=str(runno)+str(bank)) #use when you want to do surface plots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import matplotlib as mpl | |
#runno_list=[32644,32645,32646,32647,32648,32649,32650,32651,32652,32653,32654,32655,32656,32657,32658,32659,32660,32661,32662,32663,32664,32665,32666,32667,32668,32669,32671,32674,32677,32678,32679,32680] | |
#temp_list=[1.5,2.5,5.0,7.5,10,12.5,15,17.5,20.0,22.5,25.0,27.5,30.0,32.5,35.0,37.5,39,40.5,42.0,43.5,45.0,46.5,48.0,49.5,51.0,52.5,60.0,75.0,105.0,115.0,125.0,135.0] | |
runno_list=[23481,23482,23483,23484,23485,23486,23487,23488,23489,23490,23491,23492,23493,23494,23495,23496,23497,23498,23499,23500,23501,23502,23503,23504,23505,23506,23507,23508,23509,23510,23511] | |
temp_list=[1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,10.0,15.0,20.0,25.0,30.0,35.0,40.0,45.0,48.0,49.5,51.0,52.5,60.0,67.5,75.0,85.0,90.0,95.0,100.0,105.0,115.0,125.0,135.0] | |
print len(runno_list) | |
print len(temp_list) | |
def create_sample_group(n_items): | |
to_group = list() | |
for runno in runno_list: | |
name = str(runno)+'-2' | |
to_group.append(name) | |
group = GroupWorkspaces(InputWorkspaces=','.join(to_group)) | |
return group | |
ws = create_sample_group(runno_list) | |
CropWorkspace(InputWorkspace=ws,OutputWorkspace=ws,Xmin=1.8,Xmax=10.0) | |
def make_graph(group_ws,temp_list): | |
sample = group_ws[0] | |
X = sample.readX(0) | |
#print len(X) | |
Y = temp_list | |
Z = (np.histogram(sample.readX(0)), group_ws.size()) | |
X, Y = np.meshgrid(X, Y) | |
z_arrays = list() | |
for ws in group_ws: | |
z_arrays.append(ws.readY(0)) | |
print len(z_arrays[1]) | |
Z = np.array(z_arrays) | |
print X.shape,Y.shape,Z.shape | |
fig = plt.figure() | |
#ax = fig.gca(projection='3d') | |
ax=Axes3D(fig) | |
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, | |
linewidth=0, antialiased=False) | |
#ax.set_zlim(-1.01, 1.01) | |
#ax.zaxis.set_major_locator(LinearLocator(10)) | |
#ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) | |
fig.colorbar(surf, shrink=0.5, aspect=5) | |
plt.show() | |
ws = create_sample_group(runno_list) | |
gui_cmd(make_graph, ws,temp_list) |
Added the file load_data.py
from Pascal via email:
Here is the accompanying script for loading the data.
Note the ConvertToPointData in there to convert from histo.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From email: