Changeset 5335


Ignore:
Timestamp:
Sep 18, 2022 11:02:46 AM (8 months ago)
Author:
toby
Message:

add MagCIF reading to scripting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIscriptable.py

    r5320 r5335  
    23602360        return self.histogram(histname)
    23612361   
    2362     def add_phase(self, phasefile, phasename=None, histograms=[], fmthint=None):
     2362    def add_phase(self, phasefile, phasename=None, histograms=[],
     2363                      fmthint=None, mag=False):
    23632364        """Loads a phase into the project from a .cif file
    23642365
     
    23722373          importers consistent with the file extension will be tried
    23732374          (equivalent to "guess format" in menu).
     2375        :param bool mag: Set to True to read a magCIF
    23742376
    23752377        :returns: A :class:`G2Phase` object representing the
     
    23842386        phasereader = phasereaders[0]
    23852387       
    2386         phasename = phasename or phasereader.Phase['General']['Name']
     2388        if phasereader.MPhase and mag:
     2389            phObj = phasereader.MPhase
     2390        else:
     2391            phObj = phasereader.Phase
     2392           
     2393        phasename = phasename or phObj['General']['Name']
    23872394        phaseNameList = [p.name for p in self.phases()]
    23882395        phasename = G2obj.MakeUniqueLabel(phasename, phaseNameList)
    2389         phasereader.Phase['General']['Name'] = phasename
     2396        phObj['General']['Name'] = phasename
    23902397
    23912398        if 'Phases' not in self.data:
    23922399            self.data[u'Phases'] = { 'data': None }
    23932400        assert phasename not in self.data['Phases'], "phase names should be unique"
    2394         self.data['Phases'][phasename] = phasereader.Phase
     2401        self.data['Phases'][phasename] = phObj
    23952402
    23962403        # process constraints, currently generated only from ISODISTORT CIFs
Note: See TracChangeset for help on using the changeset viewer.