Skip to content

Commit d4919a5

Browse files
committed
Merge remote-tracking branch 'remotes/origin/fix_rmcprofile_issues'
2 parents 2ef4fc1 + 8f2d184 commit d4919a5

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

.notes/.linenoteplus

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# The location of this `.linenoteplus` file determines
2+
# the path to store and retrieve your notes.
3+
4+
# To relocate your notes, simply move or rename
5+
# the directory that contains this `.linenoteplus` file.

GSASII/GSASIIphsGUI.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6388,8 +6388,12 @@ def RunRMCProfile(event):
63886388
ascript_file = os.path.join(os.getcwd(), "runrmc.script")
63896389
with open(ascript_file, 'w') as f:
63906390
f.write('tell application "Terminal"\n')
6391-
f.write(f''' do script "echo 'Running RMCprofile'"\n''')
6391+
f.write(' if not (exists window 1) then\n')
6392+
f.write(f' do script "bash {script_file}"\n')
6393+
f.write(' else\n')
63926394
f.write(f' do script "bash {script_file}" in window 1\n')
6395+
f.write(' end if\n')
6396+
f.write(' activate\n')
63936397
f.write("end tell\n")
63946398
subp.Popen(['osascript', ascript_file])
63956399
elif sys.platform.startswith("linux"):
@@ -6607,8 +6611,12 @@ def OnViewRMC(event):
66076611
generalData = data['General']
66086612
RMCPdict = data['RMC']['RMCProfile']
66096613
pName = generalData['Name'].replace(' ','_')
6614+
if sys.platform == "darwin":
6615+
wildcard = 'RMCProfile result csv files|' + pName + '*.csv' + '|All files|*.*'
6616+
else:
6617+
wildcard = 'RMCProfile result csv files|' + pName + '*.csv'
66106618
dlg = wx.FileDialog(G2frame, "Choose any RMCProfile csv results file for "+pName+":",
6611-
defaultDir=G2frame.LastGPXdir,style=wx.FD_CHANGE_DIR,wildcard='RMCProfile result csv files|'+pName+'*.csv')
6619+
defaultDir=G2frame.LastGPXdir,style=wx.FD_CHANGE_DIR,wildcard=wildcard)
66126620
if dlg.ShowModal() == wx.ID_OK:
66136621
path = os.path.split(dlg.GetPath())[0]
66146622
dlg.Destroy()

GSASII/GSASIIpwd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3431,7 +3431,7 @@ def MakeRMCPdat(PWDdata,Name,Phase,RMCPdict):
34313431
dMin = refList[-1][4]
34323432
gsasType = 'xray2'
34333433
if 'T' in inst['Type'][1]:
3434-
gsasType = 'gsas3'
3434+
gsasType = 'gsas3_new'
34353435
elif 'X' in inst['Type'][1]:
34363436
XFF = G2elem.GetFFtable(Atseq)
34373437
Xfl = open(Name+'.xray','w')

GSASII/GSASIIrmcGUI.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,14 @@ def OnFileSel(event):
226226
style=wx.FD_OPEN ,wildcard=fil+'(*.*)|*.*')
227227
if dlg.ShowModal() == wx.ID_OK:
228228
fpath,fName = os.path.split(dlg.GetPath())
229-
if os.path.exists(fName): # is there a file by this name in the current directory?
229+
if os.path.exists(os.path.join(G2frame.LastGPXdir,fName)): # is there a file by this name in the current directory?
230230
RMCPdict['files'][fil][0] = fName
231231
else: # nope, copy it
232232
# TODO: is G2frame.LastGPXdir the right choice here or
233233
# do I want the current working directory (same?)
234234
shutil.copy(dlg.GetPath(), os.path.join(G2frame.LastGPXdir,fName))
235-
if not os.path.exists(fName): # sanity check
235+
RMCPdict['files'][fil][0] = fName
236+
if not os.path.exists(os.path.join(G2frame.LastGPXdir,fName)): # sanity check
236237
print(f'Error: file {fName} not found in .gpx directory ({G2frame.LastGPXdir})')
237238
return
238239
G2frame.LastImportDir = fpath #set so next file is found in same place
@@ -270,7 +271,7 @@ def OnPlotBtn(event):
270271
XY = np.empty((1,2))
271272
while XY.shape[0] == 1:
272273
try:
273-
XY = np.loadtxt(fileItem[0],skiprows=start)
274+
XY = np.loadtxt(os.path.join(G2frame.LastGPXdir,fileItem[0]),skiprows=start)
274275
except ValueError:
275276
start += 1
276277
if start > 500: #absurd number of header lines!
@@ -551,7 +552,7 @@ def OnSetVal(event):
551552
if 'Xray' in fil:
552553
nform = 1
553554
Name = 'Xdata'
554-
if Rfile and os.path.exists(Rfile): #incase .gpx file is moved away from G(R), F(Q), etc. files
555+
if Rfile and os.path.exists(os.path.join(G2frame.LastGPXdir,Rfile)): #incase .gpx file is moved away from G(R), F(Q), etc. files
555556
fileFormat = wx.ComboBox(G2frame.FRMC,choices=Formats[:nform],style=wx.CB_DROPDOWN|wx.TE_READONLY)
556557
fileFormat.SetStringSelection(RMCPdict['files'][fil][3])
557558
Indx[fileFormat.GetId()] = fil

0 commit comments

Comments
 (0)