Changeset 1006


Ignore:
Timestamp:
Jul 22, 2013 8:57:37 PM (9 years ago)
Author:
toby
Message:

fix Bob's bug when multiple HKL files are read; pickup shelx spacegroup in CIF; improve file read error messages

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1000 r1006  
    362362            primaryReaders = []
    363363            secondaryReaders = []
    364             for reader in readerlist:
    365                 flag = reader.ExtensionValidator(filename)
     364            for r in readerlist:
     365                flag = r.ExtensionValidator(filename)
    366366                if flag is None:
    367                     secondaryReaders.append(reader)
     367                    secondaryReaders.append(r)
    368368                elif flag:
    369                     primaryReaders.append(reader)
     369                    primaryReaders.append(r)
    370370            if len(secondaryReaders) + len(primaryReaders) == 0:
    371371                self.ErrorDialog('No Format','No matching format for file '+filename)
     
    437437                        break # success reading
    438438                else:
    439                     self.ErrorDialog('Read Error','No reader is able to read from file '+filename+msg)
     439                    if reader:
     440                        self.ErrorDialog('Read Error','The '+ rd.formatName+
     441                                         ' reader was not able to read file '+filename+msg)
     442                    else:
     443                        self.ErrorDialog('Read Error','No reader is able to read file '+filename+msg)
    440444            except:
    441445                import traceback
     
    22472251
    22482252        :param str PWDRname: a powder histogram name as obtained from
    2249           :mod:`GSASIIstruct.GetHistogramNames`
     2253          :meth:`GSASIIstruct.GetHistogramNames`
    22502254
    22512255        :returns: PWDRdata = powder data dictionary with
     
    22742278        :param str HKLFname: a single crystal histogram name as obtained
    22752279          from
    2276           :mod:`GSASIIstruct.GetHistogramNames`
     2280          :meth:`GSASIIstruct.GetHistogramNames`
    22772281
    22782282        :returns: HKLFdata = single crystal data list of reflections
     
    22902294    def GetPhaseData(self):
    22912295        '''Returns a list of defined phases. Used only in GSASIIgrid
    2292         Note routine :mod:`GSASIIstruct.GetPhaseData` also exists.
     2296        Note routine :meth:`GSASIIstruct.GetPhaseData` also exists.
    22932297        '''
    22942298        phaseData = {}
     
    23442348    class ViewParmDialog(wx.Dialog):
    23452349        '''Window to show all parameters in the refinement.
    2346         Called from :mod:`OnViewLSParms`
     2350        Called from :meth:`OnViewLSParms`
    23472351        '''
    23482352        def __init__(self,parent,title,parmDict):
  • trunk/GSASIIIO.py

    r981 r1006  
    16821682    '''Defines a base class for the reading of files with tables
    16831683    of structure factors
     1684
     1685    Note that the default controls are stored in self.Controls and the
     1686    default instrument parameters are stored in self.Parameters.
     1687    These can be changed, but any changes will be the defaults for all
     1688    subsequent uses of the :class:`ImportStructFactor` derived classes
     1689    until :meth:`InitControls` and :meth:`InitParameters` are
     1690    called. Probably better to use :meth:`UpdateControls` and
     1691    :meth:`UpdateControls` (adding new args if needed) to change
     1692    values.
    16841693    '''
    16851694    def __init__(self,formatName,longFormatName=None,extensionlist=[],
     
    16891698
    16901699        # define contents of Structure Factor entry
     1700        self.InitParameters()
     1701        self.InitControls()
     1702        self.RefList = []
     1703       
     1704    def InitControls(self):
     1705        'initialize the controls structure'
    16911706        self.Controls = { # dictionary with plotting controls
    16921707            'Type' : 'Fosq',
     
    17001715            'log-lin' : 'lin',
    17011716            }
    1702         self.Parameters = [ # list with data collection parameters
    1703             ('SXC',0.70926),
    1704             ['SXC',0.70926],
    1705             ['Type','Lam']
    1706             ]
    1707         self.RefList = []
     1717
     1718    def InitParameters(self):
     1719        'initialize the instrument parameters structure'
     1720        Lambda = 0.70926
     1721        HistType = 'SXC'
     1722        self.Parameters = [{'Type':[HistType,HistType], # create the structure
     1723                            'Lam':[Lambda,Lambda]
     1724                            }, {}]
    17081725
    17091726    def UpdateParameters(self,Type=None,Wave=None):
    1710         HistType = self.Parameters[0][0]
    1711         HistWave = self.Parameters[0][1]
     1727        'Revise the '
    17121728        if Type is not None:
    1713             HistType = Type
     1729            self.Parameters[0]['Type'] = [Type,Type]
    17141730        if Wave is not None:
    1715             HistWave = Wave
    1716         self.Parameters = [{'Type':[HistType,HistType],'Lam':[HistWave,HistWave]},{}]  # overwrite entire list
     1731            self.Parameters[0]['Lam'] = [HistWave,HistWave]
    17171732           
    17181733    def UpdateControls(self,Type='Fosq',FcalcPresent=False):
  • trunk/GSASIIphsGUI.py

    r1001 r1006  
    7373    '''Create the data display window contents when a phase is clicked on
    7474    in the man (data tree) window.
    75     Called only from :mod:`GSASIIgrid.MovePatternTreeToGrid`,
    76     which in turn is called from :mod:`GSASII.GSASII.OnPatternTreeSelChanged`
     75    Called only from :meth:`GSASIIgrid.MovePatternTreeToGrid`,
     76    which in turn is called from :meth:`GSASII.GSASII.OnPatternTreeSelChanged`
    7777    when a tree item is selected.
    7878
  • trunk/imports/G2phase_CIF.py

    r850 r1006  
    113113                        choice[-1] += fmt % cif.get_number_with_esd(
    114114                            cf[blknm].get(key))[0]
    115                     sg = cf[blknm].get("_symmetry_space_group_name_H-M")
     115                    sg = cf[blknm].get("_symmetry_space_group_name_H-M",'')
     116                    if not sg: sg = cf[blknm].get("_space_group_name_H-M_alt",'')
    116117                    if sg: choice[-1] += ', (' + sg.strip() + ')'
    117118                selblk = self.PhaseSelector(
     
    127128                blk = cf[str_blklist[selblk]]
    128129                E = True
    129                 SpGrp = blk.get("_symmetry_space_group_name_H-M")
    130                 # try normalizing the space group, see if we can pick the space group out of a table
     130                SpGrp = blk.get("_symmetry_space_group_name_H-M",'')
     131                if not SpGrp:
     132                    SpGrp = blk.get("_space_group_name_H-M_alt",'')
     133                # try normalizing the space group, to see if we can pick the space group out of a table
    131134                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
    132135                if SpGrpNorm:
     
    136139                    E,SGData = G2spc.SpcGroup(SpGrp)
    137140                if E:
    138                     self.warnings += 'ERROR in space group symbol '+SpGrp
    139                     self.warnings += '\nAre there spaces separating axial fields?\n\nError msg: '
    140                     self.warnings += G2spc.SGErrors(E)
     141                    if not SpGrp:
     142                        self.warnings += 'No space group name was found in the CIF.'
     143                        self.warnings += '\nThe space group has been set to "P 1". '
     144                        self.warnings += "Change this in phase's General tab."
     145                    else:
     146                        self.warnings += 'ERROR in space group symbol '+SpGrp
     147                        self.warnings += '\nThe space group has been set to "P 1". '
     148                        self.warnings += "Change this in phase's General tab."
     149                        self.warnings += '\nAre there spaces separating axial fields?\n\nError msg: '
     150                        self.warnings += G2spc.SGErrors(E)
    141151                    SGData = G2IO.SGData # P 1
    142152                self.Phase['General']['SGData'] = SGData
Note: See TracChangeset for help on using the changeset viewer.