From 05670c60199a4c44efa58e551e824b76000a7a56 Mon Sep 17 00:00:00 2001 From: Yuanpeng Zhang Date: Tue, 4 Nov 2025 16:52:32 -0500 Subject: [PATCH 1/3] fix RMCProfile issues on macos --- GSASII/GSASIIphsGUI.py | 12 ++++++++++-- GSASII/GSASIIrmcGUI.py | 7 ++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/GSASII/GSASIIphsGUI.py b/GSASII/GSASIIphsGUI.py index 0d14960d..abfd973e 100644 --- a/GSASII/GSASIIphsGUI.py +++ b/GSASII/GSASIIphsGUI.py @@ -6388,8 +6388,12 @@ def RunRMCProfile(event): ascript_file = os.path.join(os.getcwd(), "runrmc.script") with open(ascript_file, 'w') as f: f.write('tell application "Terminal"\n') - f.write(f''' do script "echo 'Running RMCprofile'"\n''') + f.write(' if not (exists window 1) then\n') + f.write(f' do script "bash {script_file}"\n') + f.write(' else\n') f.write(f' do script "bash {script_file}" in window 1\n') + f.write(' end if\n') + f.write(' activate\n') f.write("end tell\n") subp.Popen(['osascript', ascript_file]) elif sys.platform.startswith("linux"): @@ -6607,8 +6611,12 @@ def OnViewRMC(event): generalData = data['General'] RMCPdict = data['RMC']['RMCProfile'] pName = generalData['Name'].replace(' ','_') + if sys.platform == "darwin": + wildcard = 'RMCProfile result csv files|' + pName + '*.csv' + '|All files|*.*' + else: + wildcard = 'RMCProfile result csv files|' + pName + '*.csv' dlg = wx.FileDialog(G2frame, "Choose any RMCProfile csv results file for "+pName+":", - defaultDir=G2frame.LastGPXdir,style=wx.FD_CHANGE_DIR,wildcard='RMCProfile result csv files|'+pName+'*.csv') + defaultDir=G2frame.LastGPXdir,style=wx.FD_CHANGE_DIR,wildcard=wildcard) if dlg.ShowModal() == wx.ID_OK: path = os.path.split(dlg.GetPath())[0] dlg.Destroy() diff --git a/GSASII/GSASIIrmcGUI.py b/GSASII/GSASIIrmcGUI.py index 3d7779c4..c76a7d39 100644 --- a/GSASII/GSASIIrmcGUI.py +++ b/GSASII/GSASIIrmcGUI.py @@ -226,13 +226,14 @@ def OnFileSel(event): style=wx.FD_OPEN ,wildcard=fil+'(*.*)|*.*') if dlg.ShowModal() == wx.ID_OK: fpath,fName = os.path.split(dlg.GetPath()) - if os.path.exists(fName): # is there a file by this name in the current directory? + if os.path.exists(os.path.join(G2frame.LastGPXdir,fName)): # is there a file by this name in the current directory? RMCPdict['files'][fil][0] = fName else: # nope, copy it # TODO: is G2frame.LastGPXdir the right choice here or # do I want the current working directory (same?) shutil.copy(dlg.GetPath(), os.path.join(G2frame.LastGPXdir,fName)) - if not os.path.exists(fName): # sanity check + RMCPdict['files'][fil][0] = fName + if not os.path.exists(os.path.join(G2frame.LastGPXdir,fName)): # sanity check print(f'Error: file {fName} not found in .gpx directory ({G2frame.LastGPXdir})') return G2frame.LastImportDir = fpath #set so next file is found in same place @@ -551,7 +552,7 @@ def OnSetVal(event): if 'Xray' in fil: nform = 1 Name = 'Xdata' - if Rfile and os.path.exists(Rfile): #incase .gpx file is moved away from G(R), F(Q), etc. files + 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 fileFormat = wx.ComboBox(G2frame.FRMC,choices=Formats[:nform],style=wx.CB_DROPDOWN|wx.TE_READONLY) fileFormat.SetStringSelection(RMCPdict['files'][fil][3]) Indx[fileFormat.GetId()] = fil From be46b38c2de9aa08b6eb26adbfd86c5b5876f00c Mon Sep 17 00:00:00 2001 From: Yuanpeng Zhang Date: Tue, 4 Nov 2025 23:15:10 -0500 Subject: [PATCH 2/3] fix the peak type name for rmcprofile --- GSASII/GSASIIpwd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GSASII/GSASIIpwd.py b/GSASII/GSASIIpwd.py index d1ff8bec..23926715 100644 --- a/GSASII/GSASIIpwd.py +++ b/GSASII/GSASIIpwd.py @@ -3431,7 +3431,7 @@ def MakeRMCPdat(PWDdata,Name,Phase,RMCPdict): dMin = refList[-1][4] gsasType = 'xray2' if 'T' in inst['Type'][1]: - gsasType = 'gsas3' + gsasType = 'gsas3_new' elif 'X' in inst['Type'][1]: XFF = G2elem.GetFFtable(Atseq) Xfl = open(Name+'.xray','w') From 8f2d1842a782dd8a9522272b770bba9d1b3b5f30 Mon Sep 17 00:00:00 2001 From: Yuanpeng Zhang Date: Tue, 4 Nov 2025 23:50:44 -0500 Subject: [PATCH 3/3] fix total scattering file path issue for rmcprofile --- .notes/.linenoteplus | 5 +++++ GSASII/GSASIIrmcGUI.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .notes/.linenoteplus diff --git a/.notes/.linenoteplus b/.notes/.linenoteplus new file mode 100644 index 00000000..d09e95c3 --- /dev/null +++ b/.notes/.linenoteplus @@ -0,0 +1,5 @@ +# The location of this `.linenoteplus` file determines +# the path to store and retrieve your notes. + +# To relocate your notes, simply move or rename +# the directory that contains this `.linenoteplus` file. \ No newline at end of file diff --git a/GSASII/GSASIIrmcGUI.py b/GSASII/GSASIIrmcGUI.py index c76a7d39..77c7da53 100644 --- a/GSASII/GSASIIrmcGUI.py +++ b/GSASII/GSASIIrmcGUI.py @@ -271,7 +271,7 @@ def OnPlotBtn(event): XY = np.empty((1,2)) while XY.shape[0] == 1: try: - XY = np.loadtxt(fileItem[0],skiprows=start) + XY = np.loadtxt(os.path.join(G2frame.LastGPXdir,fileItem[0]),skiprows=start) except ValueError: start += 1 if start > 500: #absurd number of header lines!