Skip to content

Commit 1b7aef0

Browse files
committed
improve dysnomia installation in response to #290
1 parent 4008519 commit 1b7aef0

4 files changed

Lines changed: 56 additions & 21 deletions

File tree

GSASII/GSASIIctrlGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5160,7 +5160,7 @@ def RightClickClear():
51605160
self.parmWin.Controls['LoggedVars'].remove(var)
51615161
else:
51625162
self.parmWin.Controls['LoggedVars'].append(var)
5163-
if GSASIIpath.GetConfigValue('debug'): print(self.parmWin.Controls['LoggedVars'])
5163+
#if GSASIIpath.GetConfigValue('debug'): print(self.parmWin.Controls['LoggedVars'])
51645164
self.parmWin.SendSizeEvent() # redraws the window
51655165
wx.CallAfter(RightClickClear)
51665166

GSASII/GSASIIdataGUI.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7321,9 +7321,9 @@ def _makemenu(): # routine to create menu when first used
73217321
self.MEMMenu.Append(menu=wx.Menu(title=''),title='Select tab')
73227322
self.MEMDataEdit = wx.Menu(title='')
73237323
self.MEMMenu.Append(menu=self.MEMDataEdit, title='Operations')
7324-
self.MEMDataEdit.Append(G2G.wxID_LOADDYSNOMIA,'Load from Dysnomia file','Load MEM info from Dysnomia file')
7325-
self.MEMDataEdit.Append(G2G.wxID_SAVEDYSNOMIA,'Save Dysnomia file','Save MEM info in Dysnomia file')
7326-
self.MEMDataEdit.Append(G2G.wxID_RUNDYSNOMIA,'Run Dysonmia','Run Dysnomia to make new Fobs map')
7324+
#self.MEMDataEdit.Append(G2G.wxID_LOADDYSNOMIA,'Load from Dysnomia file','Load MEM info from Dysnomia file')
7325+
#self.MEMDataEdit.Append(G2G.wxID_SAVEDYSNOMIA,'Save Dysnomia file','Save MEM info in Dysnomia file')
7326+
self.MEMDataEdit.Append(G2G.wxID_RUNDYSNOMIA,'Run Dysnomia','Run Dysnomia to make new Fobs map')
73277327
self.PostfillDataMenu()
73287328

73297329
#Phase / fullrmc & RMCprofile (Reverse Monte Carlo method) tab

GSASII/GSASIIphsGUI.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,8 +2392,8 @@ def OnDysnomia(event):
23922392
# G2frame.Bind(wx.EVT_MENU, lambda event:G2phsG2.OnLoadDysnomia(event,G2frame,data), id=G2G.wxID_LOADDYSNOMIA)
23932393
# G2frame.Bind(wx.EVT_MENU, lambda event:G2phsG2.OnSaveDysnomia(event,G2frame,data), id=G2G.wxID_SAVEDYSNOMIA)
23942394
# G2frame.Bind(wx.EVT_MENU, lambda event:G2phsG2.OnRunDysnomia(event,G2frame,data), id=G2G.wxID_RUNDYSNOMIA)
2395-
G2frame.Bind(wx.EVT_MENU, OnLoadDysnomia, id=G2G.wxID_LOADDYSNOMIA)
2396-
G2frame.Bind(wx.EVT_MENU, OnSaveDysnomia, id=G2G.wxID_SAVEDYSNOMIA)
2395+
# G2frame.Bind(wx.EVT_MENU, OnLoadDysnomia, id=G2G.wxID_LOADDYSNOMIA)
2396+
# G2frame.Bind(wx.EVT_MENU, OnSaveDysnomia, id=G2G.wxID_SAVEDYSNOMIA)
23972397
G2frame.Bind(wx.EVT_MENU, OnRunDysnomia, id=G2G.wxID_RUNDYSNOMIA)
23982398
G2frame.phaseDisplay.InsertPage(7,G2frame.MEMData,'Dysnomia')
23992399
Id = wx.NewId()
@@ -5854,25 +5854,45 @@ def OnReImport(event):
58545854

58555855
#### Dysnomia (MEM) Data page ##############################################################################
58565856

5857-
def OnLoadDysnomia(event):
5858-
print('Load MEM - might not be implemented')
5857+
# def OnLoadDysnomia(event):
5858+
# print('Load MEM - might not be implemented')
58595859

5860-
def OnSaveDysnomia(event):
5861-
print('Save MEM - might not be implemented')
5860+
# def OnSaveDysnomia(event):
5861+
# print('Save MEM - might not be implemented')
58625862

58635863
def OnRunDysnomia(event):
58645864

5865-
path2GSAS2 = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
5866-
DYSNOMIA = os.path.join(path2GSAS2,'Dysnomia','Dysnomia64.exe')
5867-
DysData = data['Dysnomia']
5865+
if sys.platform == "win32":
5866+
binimage = 'Dysnomia64.exe'
5867+
else:
5868+
binimage = 'Dysnomia'
5869+
is_exe = lambda fpath: os.path.isfile(fpath) and os.access(fpath, os.X_OK)
58685870

5869-
if not os.path.exists(DYSNOMIA):
5870-
wx.MessageBox(''' Dysnomia is not installed. Please download it from
5871-
https://jp-minerals.org/dysnomia/en/
5872-
and install it at.'''+DYSNOMIA,
5873-
caption='Dysnomia not installed',style=wx.ICON_ERROR)
5871+
path2GSAS2 = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
5872+
pathlist = (GSASIIpath.path2GSAS2,
5873+
os.path.expanduser('~'),
5874+
os.path.expanduser(os.path.join('~','.GSASII')))
5875+
locations = []
5876+
for path in pathlist:
5877+
DYSNOMIA = os.path.join(path,'Dysnomia',binimage)
5878+
locations.append(DYSNOMIA)
5879+
if not os.path.exists(DYSNOMIA): continue
5880+
if is_exe(DYSNOMIA):
5881+
break
5882+
else:
5883+
print(f"File {binimage!r} not found."
5884+
f"\nThe following locations were checked:\n\t{'\n\t'.join(locations)}")
5885+
msg = f'''Dysnomia is not installed. Please download it from
5886+
https://jp-minerals.org/dysnomia/en/ and install the
5887+
downloaded directory (which includes file {binimage!r})
5888+
at one of the following locations:
5889+
\t{'\n\t'.join(pathlist)}'''
5890+
G2G.ShowWebPage("https://jp-minerals.org/dysnomia/en/",G2frame)
5891+
G2G.ShowScrolledInfo(G2frame,msg,header='Install Dysnomia',
5892+
width=350,height=150)
58745893
return
58755894

5895+
DysData = data['Dysnomia']
58765896
generalData = data['General']
58775897
Map = generalData['Map']
58785898
UseList = Map['RefList']
@@ -13145,8 +13165,8 @@ def FillMenus():
1314513165
# Dysnomia (MEM)
1314613166
if data['General']['doDysnomia']:
1314713167
FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.MEMMenu)
13148-
G2frame.Bind(wx.EVT_MENU,OnLoadDysnomia,id=G2G.wxID_LOADDYSNOMIA)
13149-
G2frame.Bind(wx.EVT_MENU,OnSaveDysnomia,id=G2G.wxID_SAVEDYSNOMIA)
13168+
#G2frame.Bind(wx.EVT_MENU,OnLoadDysnomia,id=G2G.wxID_LOADDYSNOMIA)
13169+
#G2frame.Bind(wx.EVT_MENU,OnSaveDysnomia,id=G2G.wxID_SAVEDYSNOMIA)
1315013170
G2frame.Bind(wx.EVT_MENU,OnRunDysnomia,id=G2G.wxID_RUNDYSNOMIA)
1315113171
# Stacking faults
1315213172
FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.LayerData)

docs/source/packages.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,22 @@ as part of the GSAS-II distribution and must be installed separately:
502502

503503
**Dysnomia**
504504
Computes enhanced Fourier maps with Maximum Entropy estimated
505-
extension of the reflection sphere. See https://jp-minerals.org/dysnomia/en/.
505+
extension of the reflection sphere. See
506+
https://jp-minerals.org/dysnomia/en/.
507+
The appropriate zip/dmg/tar file must be downloaded from that web
508+
site and the directory Dysnomia from that download must be placed
509+
in one of the following locations:
510+
511+
* the user's home directory (``~/.``),
512+
* the directory ``~/.GSASII`` or
513+
* the ``GSASII`` directory where GSAS-II has been installed
514+
(this will be where the GSAS-II Python files are found).
515+
516+
For Windows the home directory, ``~``, is usually
517+
taken from the USERPROFILE setting or a combination of HOMEPATH
518+
and HOMEDRIVE, so these directories will usually have form
519+
``C:\\Users\\YourUsername`` or
520+
``C:\\Users\\YourUsername\\.GSASII``.
506521

507522
**RMCProfile**
508523
Provides large-box PDF & S(Q) fitting. The GSAS-II interface was originally

0 commit comments

Comments
 (0)