@@ -362,16 +362,16 @@ def Reader(self,filename, ParentFrame=None, **unused):
362362 return False
363363
364364class M90_ReaderClass (G2obj .ImportStructFactor ):
365- 'Routines to import F**2, sig(F**2) reflections from a JANA M90 file'
365+ 'Routines to import F**2, sig(F**2) reflections from a JANA M90/M91 file'
366366 def __init__ (self ):
367367 if 'linux' in sys .platform : # wx 3.0.0.0 on gtk does not like Unicode in menus
368368 longFormatName = 'JANA [hkl, Fo2, sig(Fo2)] Structure factor text file'
369369 else :
370370 longFormatName = u'JANA [hkl, Fo\u00b2 , sig(Fo\u00b2 )] Structure factor text file'
371371 super (self .__class__ ,self ).__init__ ( # fancy way to self-reference
372- extensionlist = ('.m90' ,'.M90 ' ),
372+ extensionlist = ('.m90' ,'.m91 ' ),
373373 strictExtension = False ,
374- formatName = u'JANA M90' ,
374+ formatName = u'JANA M90/1 ' ,
375375 longFormatName = longFormatName
376376 )
377377 self .Super = 0
@@ -380,17 +380,22 @@ def ContentsValidator(self, filename):
380380 'Discover how many columns are in the m90 file - could be 9-12 depending on satellites'
381381 numCols = 0
382382 fp = open (filename ,'r' )
383- for i ,line in enumerate (fp ):
384- if 'Data' in line :
385- startData = i
386- break
383+ startData = - 1
384+ if 'm90' in filename .lower ():
385+ for i ,line in enumerate (fp ):
386+ if 'Data' in line :
387+ startData = i
388+ break
387389 for i ,line in enumerate (fp ):
388390 if i > startData :
389391 numCols = max (numCols ,len (line .split ()))
390392 if i > startData + 20 :
391393 break
392394 fp .close ()
393- self .Super = numCols - 9 #= 0,1,2,or 3
395+ ncol = 9
396+ if 'm91' in filename .lower (): #JANA2000 file
397+ ncol = 8
398+ self .Super = numCols - ncol #= 0,1,2,or 3
394399 if self .Super > 1 :
395400 raise self .ImportException ("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry" )
396401 return True #ColumnValidator(self, filepointer)
@@ -402,6 +407,8 @@ def Reader(self,filename,filepointer, ParentFrame=None, **unused):
402407 for line ,S in enumerate (fp ):
403408 self .errors = ' Error reading line ' + str (line + 1 )
404409 if S [0 ] == '#' : continue #ignore comments, if any
410+ if S .strip () == '999' :
411+ break
405412 try :
406413 if self .Super == 0 :
407414 h ,k ,l ,Fo ,sigFo = S .split ()[:5 ]
@@ -431,6 +438,14 @@ def Reader(self,filename,filepointer, ParentFrame=None, **unused):
431438 self .RefDict ['RefList' ] = np .array (self .RefDict ['RefList' ])
432439 self .RefDict ['Type' ] = 'SXC'
433440 self .RefDict ['Super' ] = self .Super
441+ if 'm91' in filename :
442+ filename2 = filename .replace ('.m91' ,'.m50' )
443+ fp = open (filename2 )
444+ for line ,S in enumerate (fp ):
445+ if 'lambda' in S :
446+ wave = float (S .split ()[1 ])
447+ break
448+ fp .close ()
434449 self .UpdateParameters (Type = 'SXC' ,Wave = wave ) # histogram type
435450 return True
436451 except :
0 commit comments