Changeset 1115 for trunk/exports


Ignore:
Timestamp:
Oct 18, 2013 4:00:32 PM (8 years ago)
Author:
toby
Message:

rework exports for new types

Location:
trunk/exports
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_CIF.py

    r1102 r1115  
    15161516
    15171517        # the export process starts here
     1518        self.InitExport(event)
    15181519        # load all of the tree into a set of dicts
    15191520        self.loadTree()
    15201521        # create a dict with refined values and their uncertainties
    15211522        self.loadParmDict()
    1522         if self.SetupExport(event,                         # set export parameters
    1523                             AskFile=(self.mode=='simple')
    1524                             ): return
     1523        if self.ExportSelect(AskFile=(self.mode=='simple')):    # set export parameters
     1524            return
    15251525        # Someday: get restraint & constraint info
    15261526        #restraintDict = self.OverallParms.get('Restraints',{})
     
    18421842class ExportPhaseCIF(ExportCIF):
    18431843    '''Used to create a simple CIF of at most one phase. Uses exact same code as
    1844     :class:`ExportCIF` except that `self.mode` is set to "simple". Shows up in menu as
    1845     Quick CIF
     1844    :class:`ExportCIF` except that `self.mode` is set to "simple" in `self.InitExport`.
     1845    Shows up in menu as Quick CIF.
    18461846
    18471847    :param wx.Frame G2frame: reference to main GSAS-II frame
     
    18621862    '''Used to create a simple CIF containing diffraction data only. Uses exact same code as
    18631863    :class:`ExportCIF` except that `self.mode` is set to "simple" and `self.currentExportType`
    1864     is set to "single" or "powder" in `self.SetupExport`. Shows up in menus as Data-only CIF.
     1864    is set to "single" or "powder" in `self.InitExport`. Shows up in menus as Data-only CIF.
    18651865
    18661866    :param wx.Frame G2frame: reference to main GSAS-II frame
  • trunk/exports/G2export_PDB.py

    r1102 r1115  
    116116           
    117117        # the export process starts here
     118        self.InitExport(event)
    118119        # load all of the tree into a set of dicts
    119120        self.loadTree()
    120121        # create a dict with refined values and their uncertainties
    121122        self.loadParmDict()
    122         if self.SetupExport(event,AskFile=True):                         # set export parameters
     123        if self.ExportSelect(AskFile=True):    # set export parameters
    123124            return
    124125        for phasenam in self.phasenam:
     
    213214        '''
    214215        # the export process starts here
     216        self.InitExport(event)
    215217        # load all of the tree into a set of dicts
    216218        self.loadTree()
    217219        # create a dict with refined values and their uncertainties
    218220        self.loadParmDict()
    219         if self.SetupExport(event,AskFile=True):                       # set export parameters
     221        if self.ExportSelect(AskFile=True):    # set export parameters
    220222            return
    221223        for phasenam in self.phasenam:
  • trunk/exports/G2export_examples.py

    r1102 r1115  
    88# $Id$
    99########### SVN repository information ###################
    10 '''Code to demonstrate how export routines are created
     10'''Code to demonstrate how GSAS-II data export routines are created
    1111'''
    1212import os.path
     
    3030        super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__
    3131            G2frame=G2frame,
    32             formatName = 'text',
     32            formatName = 'Text file',
    3333            extension='.txt',
    3434            longFormatName = 'Export phase as text file'
     
    4141        '''
    4242        # the export process starts here
     43        self.InitExport(event)
    4344        # load all of the tree into a set of dicts
    4445        self.loadTree()
    4546        # create a dict with refined values and their uncertainties
    4647        self.loadParmDict()
    47         if self.SetupExport( # set export parameters
    48             event,                         
     48        if self.ExportSelect( # set export parameters
    4949            AskFile=True     # prompt the user for a file name
    5050            ): return
     
    114114        super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__
    115115            G2frame=G2frame,
    116             formatName = 'text',
     116            formatName = 'Text file',
    117117            extension='.txt',
    118118            longFormatName = 'Export powder data as text file'
     
    125125        '''
    126126        # the export process starts here
    127         # load all of the tree into a set of dicts
    128         self.loadTree()
    129         print 'Exporter',self.defaultSaveFile()
    130         if self.SetupExport( # set export parameters
    131             event,
     127        self.InitExport(event)
     128        # load all of the tree into a set of dicts
     129        self.loadTree()
     130        if self.ExportSelect( # set export parameters
    132131            AskFile=False # use the default file name
    133132            #AskFile=True
     
    136135        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
    137136        histblk = self.Histograms[hist]
    138         #inst = histblk['Instrument Parameters'][0]
    139         #hId = histblk['hId']
    140         #pfx = ':' + str(hId) + ':'
    141137        fmt = 2*"{:12.3f} " + "{:12.5f} " + 2*"{:12.3f} "
    142138        hfmt = 5*"{:>12s} "
     
    171167        '''Export a set of powder reflections as a text file
    172168        '''
    173         # load all of the tree into a set of dicts
    174         self.loadTree()
    175         if self.SetupExport( # set export parameters
    176             event,
     169        self.InitExport(event)
     170        # load all of the tree into a set of dicts
     171        self.loadTree()
     172        if self.ExportSelect( # set export parameters
    177173            AskFile=False # use the default file name
    178174            #AskFile=True
     
    204200        super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__
    205201            G2frame=G2frame,
    206             formatName = 'reflection list as text',
     202            formatName = 'Text file',
    207203            extension='.txt',
    208204            longFormatName = 'Export reflection list as a text file'
     
    215211        '''
    216212        # the export process starts here
    217         # load all of the tree into a set of dicts
    218         self.loadTree()
    219         if self.SetupExport( # set export parameters
    220             event,
     213        self.InitExport(event)
     214        # load all of the tree into a set of dicts
     215        self.loadTree()
     216        if self.ExportSelect( # set export parameters
    221217            AskFile=False # use the default file name
    222218            #AskFile=True
  • trunk/exports/G2export_shelx.py

    r1102 r1115  
    2626        super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__
    2727            G2frame=G2frame,
    28             formatName = 'SHELX',
     28            formatName = 'SHELX .ins',
    2929            extension='.ins',
    3030            longFormatName = 'Export phase as SHELX .ins file'
     
    3838        import re
    3939        # the export process starts here
     40        self.InitExport(event)
    4041        # load all of the tree into a set of dicts
    4142        self.loadTree()
    4243        # create a dict with refined values and their uncertainties
    4344        self.loadParmDict()
    44         if self.SetupExport(event,                         # set export parameters
    45                             AskFile=True
    46                             ): return
     45        if self.ExportSelect(  # set export parameters
     46            AskFile=True): return
    4747        for phasenam in self.phasenam:
    4848            phasedict = self.Phases[phasenam] # pointer to current phase info           
     
    5656            # title line
    5757            self.Write("TITL from "+str(self.G2frame.GSASprojectfile)+", phase "+str(phasenam))
    58             # get & write cell parameters
    59             pfx = str(phasedict['pId'])+'::'
    60             A,sigA = G2stIO.cellFill(pfx,phasedict['General']['SGData'],self.parmDict,self.sigDict)
    61             self.Write("CELL 0.5 {:.5f} {:.5f} {:.5f} {:.3f} {:.3f} {:.3f}".format(*G2lat.A2cell(A)))
     58            # get & write cell parameters
     59            cell,sig = self.GetCell(phasenam)
     60            self.Write("CELL 0.5 {:.5f} {:.5f} {:.5f} {:.3f} {:.3f} {:.3f}".format(*cell[:6]))
    6261            # Shelx lattice number
    6362            lattnum = {'P':1,'I':2,'R':2,'F':3,'A':4,'B':5,'C':6}.get(phasedict['General']['SGData']['SGLatt'],0)
Note: See TracChangeset for help on using the changeset viewer.