Skip to content

Commit 2b86391

Browse files
committed
new importer for extended microED data & modify reflection display to show it
1 parent d9dbfea commit 2b86391

3 files changed

Lines changed: 63 additions & 1 deletion

File tree

GSASII/GSASIIplot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Note that documentation for GSASIIplot.py has been moved
66
# to file docs/source/GSASIIplot.rst
77

8-
from __future__ import division, print_function
98
import copy
109
import math
1110
import sys

GSASII/GSASIIpwdGUI.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7431,6 +7431,9 @@ def MakeReflectionTable(phaseName):
74317431
if 'T' in Inst['Type'][0]:
74327432
colLabels = ['H','K','L','flag','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','ExtC','wave','tbar']
74337433
Types += 2*[wg.GRID_VALUE_FLOAT+':10,3',]
7434+
elif 'E' in Inst['Type'][0]:
7435+
colLabels = ['H','K','L','flag','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','ExtC','Nexp','Zpos']
7436+
Types += [wg.GRID_VALUE_LONG,wg.GRID_VALUE_FLOAT+':10,3',]
74347437
if Super:
74357438
colLabels.insert(3,'M')
74367439
else:

GSASII/imports/G2sfact.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,66 @@ def Reader(self,filename, ParentFrame=None, **unused):
361361
except:
362362
return False
363363

364+
class SHELX4ED_ReaderClass(G2obj.ImportStructFactor):
365+
'Routines to import F**2, sig(F**2), exp# & Z-pos reflections from a Shelx HKLF 4 microED file'
366+
def __init__(self):
367+
if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus
368+
formatName = 'HKLF 4ed'
369+
longFormatName = 'Shelx HKLF 4ed [hkl, Fo2, sig(Fo2), exp#, Z-pos] Structure factor text file'
370+
else:
371+
formatName = u'Shelx HKLF 4ed F\u00b2'
372+
longFormatName = u'Shelx HKLF 4ed [hkl, Fo\u00b2, sig(Fo\u00b2), exp#, Z-pos] Structure factor text file'
373+
super(self.__class__,self).__init__( # fancy way to self-reference
374+
extensionlist=('.hkl','.HKL'),
375+
strictExtension=False,
376+
formatName=formatName,
377+
longFormatName=longFormatName)
378+
379+
def ContentsValidator(self, filename):
380+
'Make sure file contains the expected columns on numbers'
381+
return True
382+
# return ColumnValidator(self, filepointer)
383+
384+
def Reader(self,filename, ParentFrame=None, **unused):
385+
'Read the file'
386+
try:
387+
fp = open(filename,'r')
388+
for line,S in enumerate(fp):
389+
self.errors = ' Error reading line '+str(line+1)
390+
if S[0] == '#': continue #ignore comments, if any
391+
try: # use a simple split if possible
392+
items = S.split()
393+
if len(items) > 5:
394+
h,k,l,Fo,sigFo,Nexp,Zpos = items[:7]
395+
else:
396+
h,k,l,Fo,sigFo = items[:5]
397+
Nexp = '0'
398+
Zpos = '0.'
399+
h,k,l = [int(h),int(k),int(l)]
400+
except: # but sometimes if no space between k & F
401+
# need to use some fixed formatting
402+
h,k,l = S[:12].split()
403+
h,k,l = [int(h),int(k),int(l)]
404+
Fo,sigFo = S[12:].split()[:2]
405+
if not any([h,k,l]):
406+
break
407+
Fo = float(Fo)
408+
sigFo = float(sigFo)
409+
Nexp = int(Nexp)
410+
Zpos = float(Zpos)
411+
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
412+
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1,Nexp,Zpos])
413+
#self.RefDict['FF'].append({}) # now done in OnImportSfact
414+
fp.close()
415+
self.errors = 'Error after reading reflections (unexpected!)'
416+
self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
417+
self.RefDict['Type'] = 'SEC'
418+
self.RefDict['Super'] = 0
419+
self.UpdateParameters(Type='SEC',Wave=0.02851) # histogram type
420+
return True
421+
except:
422+
return False
423+
364424
class M90_ReaderClass(G2obj.ImportStructFactor):
365425
'Routines to import F**2, sig(F**2) reflections from a JANA M90/M91 file'
366426
def __init__(self):

0 commit comments

Comments
 (0)