Ignore:
Timestamp:
May 4, 2017 4:06:25 PM (5 years ago)
Author:
vondreele
Message:

PWDR import now scriptable for single bank patterns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/imports/G2pwd_fxye.py

    r2817 r2820  
    1717import numpy as np
    1818import GSASIIobj as G2obj
    19 import GSASIIIO as G2IO
    2019import GSASIIpath
    2120GSASIIpath.SetVersionNumber("$Revision$")
     
    3231        self.clockWd = {}
    3332        self.TimeMap = {}
     33        self.dnames = []
    3434
    3535    # Validate the contents -- look for a bank line
    3636    def ContentsValidator(self, filepointer):
    37         'Validate by checking to see if the file has BANK lines'
     37        'Validrate by checking to see if the file has BANK lines & count them'
    3838        #print 'ContentsValidator: '+self.formatName
     39        nBanks= 0
     40        fname = ospath.basename(filepointer.name)
    3941        for i,line in enumerate(filepointer):
    4042            self.GSAS = True
     
    4648            if line[0] == '#': continue
    4749            if line[:4] == 'BANK':
    48                 return True
     50                self.dnames.append(fname+' '+''.join(line.split()[:2]))
     51                nBanks += 1
     52                continue
    4953            elif line[:7] == 'Monitor': continue
    5054            elif line [:8] == 'TIME_MAP':          #LANSCE TOF data
    51                 return True
    52             else:
    53                 self.errors = 'Unexpected information in line: '+str(i+1)
    54                 if all([ord(c) < 128 and ord(c) != 0 for c in str(line)]): # show only if ASCII
    55                     self.errors += '  '+str(line)
    56                 else:
    57                     self.errors += '  (binary)'
    58                 return False
     55                continue
     56#            else:
     57#                if not all(c in ' 0123456789.eE+-' for c in line[:-1]):
     58#                    self.errors = 'Unexpected information in line: '+str(i+1)
     59#                    self.errors += '  '+str(line)
     60#                    return False
     61        if nBanks:
     62            if not len(self.selections):
     63                self.selections = range(nBanks)
     64            return True
     65        self.errors = 'No BANK records found'
    5966        return False # no bank records
    6067
     
    322329            if self.repeatcount >= len(self.selections): self.repeat = False
    323330        else:                       # choose from options
    324             if not len(self.selections):    #use previous selection, otherwise...
    325                 self.selections = G2IO.MultipleBlockSelector(
    326                     Banks,
    327                     ParentFrame=ParentFrame,
    328                     title='Select Bank(s) to read from the list below',
    329                     size=(600,300),
    330                     header='Dataset Selector')
    331             if len(self.selections) == 0:
    332                 self.errors = 'No banks selected'
    333                 return False
    334331            selblk = self.selections[0] # select first in list
    335332            if len(self.selections) > 1: # prepare to loop through again
Note: See TracChangeset for help on using the changeset viewer.