Changeset 4198


Ignore:
Timestamp:
Dec 9, 2019 2:30:49 PM (3 years ago)
Author:
toby
Message:

doc improvements; new scripting options (rev. sequential & set background file)

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r4184 r4198  
    15311531        the active histogram being exported.
    15321532        '''
     1533        self.G2frame.CheckNotebook()
    15331534        self.parmDict = {}
    15341535        self.sigDict = {}
  • trunk/GSASIIdataGUI.py

    r4195 r4198  
    417417################################################################################
    418418class GSASII(wx.Frame):
    419     '''Define the main GSAS-II frame and its associated menu items
    420     '''
     419    '''Define the main GSAS-II frame and its associated menu items.
     420
     421    :param parent: reference to parent application
     422
     423    '''               
    421424    def MenuBinding(self,event):
    422425        '''Called when a menu is clicked upon; looks up the binding in table
     
    438441   
    439442    def _Add_FileMenuItems(self, parent):
     443        '''Add items to File menu
     444        '''
    440445        item = parent.Append(wx.ID_ANY,'&Open project...\tCtrl+O','Open a GSAS-II project file (*.gpx)')           
    441446        self.Bind(wx.EVT_MENU, self.OnFileOpen, id=item.GetId())
     
    471476       
    472477    def _Add_DataMenuItems(self,parent):
     478        '''Add items to Data menu
     479        '''
    473480        # item = parent.Append(
    474481        #     help='',id=wx.ID_ANY,
     
    577584       
    578585    def PreviewFile(self,filename):
    579         'confirm we have the right file'
     586        'utility to confirm we have the right file'
    580587        fp = open(filename,'r')
    581588        rdmsg = u'File '+ filename +u' begins:\n\n'
  • trunk/GSASIIobj.py

    r4136 r4198  
    1616as provides misc. support routines.
    1717
    18 Constraints Tree Item
    19 ----------------------
    20 
    2118.. _Constraints_table:
    2219
     
    2421   single: Constraints object description
    2522   single: Data object descriptions; Constraints
     23
     24Constraints Tree Item
     25----------------------
    2626
    2727Constraints are stored in a dict, separated into groups.
     
    9797      :math:`newvar = m_1 \\times var_1 + m_2 \\times var_2 + ...`
    9898
    99 Covariance Tree Item
    100 --------------------
    101 
    10299.. _Covariance_table:
    103100
     
    105102   single: Covariance description
    106103   single: Data object descriptions; Covariance
     104
     105Covariance Tree Item
     106--------------------
    107107
    108108The Covariance tree item has results from the last least-squares run. They
     
    140140=============  ===============  ====================================================
    141141
    142 Phase Tree Items
    143 ----------------
    144 
    145142.. _Phase_table:
    146143
     
    148145   single: Phase object description
    149146   single: Data object descriptions; Phase
     147
     148Phase Tree Items
     149----------------
    150150
    151151Phase information is stored in the GSAS-II data tree as children of the
     
    297297==========  ===============  ====================================================
    298298
    299 Rigid Body Objects
    300 ------------------
    301 
    302299.. _RBData_table:
    303300
     
    305302   single: Rigid Body Data description
    306303   single: Data object descriptions; Rigid Body Data
     304
     305Rigid Body Objects
     306------------------
    307307
    308308Rigid body descriptions are available for two types of rigid bodies: 'Vector'
     
    345345==========  ===============  ====================================================
    346346
    347 Space Group Objects
    348 -------------------
    349 
    350347.. _SGData_table:
    351348
     
    353350   single: Space Group Data description
    354351   single: Data object descriptions; Space Group Data
     352
     353Space Group Objects
     354-------------------
    355355
    356356Space groups are interpreted by :func:`GSASIIspc.SpcGroup`
     
    416416
    417417
    418 Atom Records
    419 ------------
    420 
    421418.. _Atoms_table:
    422419
     
    425422   single: Data object descriptions; Atoms record
    426423
     424Atom Records
     425------------
    427426
    428427If ``phasedict`` points to the phase information in the data tree, then
     
    455454==============   ====================================================
    456455
    457 Drawing Atom Records
    458 --------------------
    459 
    460456.. _Drawing_atoms_table:
    461457
     
    464460   single: Data object descriptions; Drawing atoms record
    465461
     462Drawing Atom Records
     463--------------------
    466464
    467465If ``phasedict`` points to the phase information in the data tree, then
     
    493491==============   ====================================================
    494492
    495 Powder Diffraction Tree Items
    496 -----------------------------
    497 
    498493.. _Powder_table:
    499494
     
    501496   single: Powder data object description
    502497   single: Data object descriptions; Powder Data
     498
     499Powder Diffraction Tree Items
     500-----------------------------
    503501
    504502Every powder diffraction histogram is stored in the GSAS-II data tree
     
    627625======================  ===============  ====================================================
    628626
    629 Powder Reflection Data Structure
    630 --------------------------------
    631 
    632627.. _PowderRefl_table:
    633628
     
    635630   single: Powder reflection object description
    636631   single: Data object descriptions; Powder Reflections
     632
     633Powder Reflection Data Structure
     634--------------------------------
    637635
    638636For every phase in a histogram, the ``Reflection Lists`` value is a dict
     
    656654==========  ====================================================
    657655
    658 Single Crystal Tree Items
    659 -------------------------
    660 
    661656.. _Xtal_table:
    662657
     
    664659   single: Single Crystal data object description
    665660   single: Data object descriptions; Single crystal data
     661
     662Single Crystal Tree Items
     663-------------------------
    666664
    667665Every single crystal diffraction histogram is stored in the GSAS-II data tree
     
    714712======================  ===============  ====================================================
    715713
    716 Single Crystal Reflection Data Structure
    717 ----------------------------------------
    718 
    719714.. _XtalRefl_table:
    720715
     
    722717   single: Single Crystal reflection object description
    723718   single: Data object descriptions; Single Crystal Reflections
     719
     720Single Crystal Reflection Data Structure
     721----------------------------------------
    724722
    725723For every single crystal a histogram, the ``'Data'`` item contains
     
    744742==========  ====================================================
    745743
    746 Image Data Structure
    747 --------------------
    748 
    749744.. _Image_table:
    750745
     
    752747   image: Image data object description
    753748   image: Image object descriptions
     749
     750Image Data Structure
     751--------------------
    754752
    755753Every 2-dimensional image is stored in the GSAS-II data tree
     
    871869======================  ======================  ====================================================
    872870
     871.. _parmDict_table:
     872
     873.. index::
     874   single: Parameter dictionary
     875
    873876Parameter Dictionary
    874877-------------------------
    875 
    876 .. _parmDict_table:
    877 
    878 .. index::
    879    single: Parameter dictionary
    880878
    881879The parameter dictionary contains all of the variable parameters for the refinement.
  • trunk/GSASIIscriptable.py

    r4187 r4198  
    486486\                     type                  The background model, e.g. 'chebyschev'
    487487\                     refine                The value of the refine flag, boolean
    488 \                     no. coeffs            Number of coefficients to use, integer
     488\                     'no. coeffs'          Number of coefficients to use, integer
    489489\                     coeffs                List of floats, literal values for background
    490490\                     FixedPoints           List of (2-theta, intensity) values for fixed points
    491 \                     fit fixed points      If True, triggers a fit to the fixed points to
     491\                     'fit fixed points'    If True, triggers a fit to the fixed points to
    492492                                            be calculated. It is calculated when this key is
    493493                                            detected, regardless of calls to refine.
    494                       peaks                 Specifies a set of flags for refining
     494\                     peaks                 Specifies a set of flags for refining
    495495                                            background peaks as a nested list. There may
    496496                                            be an item for each defined background peak
     
    18141814
    18151815class G2Project(G2ObjectWrapper):   
    1816     """Represents an entire GSAS-II project.
     1816    """Represents an entire GSAS-II project. The object contains these
     1817    class variables:
     1818
     1819     * G2Project.filename: contains the .gpx filename
     1820     * G2Project.names: contains the contents of the project "tree" as a list
     1821       of lists. Each top-level entry in the tree is an item in the list. The
     1822       name of the top-level item is the first item in the inner list. Children
     1823       of that item, if any, are subsequent entries in that list.
     1824     * G2Project.data: contains the entire project as a dict. The keys
     1825       for the dict are the top-level names in the project tree (initial items
     1826       in the G2Project.names inner lists) and each top-level item is stored
     1827       as a dict.
     1828
     1829         * The contents of Top-level entries will be found in the item
     1830           named 'data', as an example, ``G2Project.data['Notebook']['data']``
     1831
     1832         * The contents of child entries will be found in the item
     1833           using the names of the parent and child, for example
     1834           ``G2Project.data['Phases']['NaCl']``
    18171835
    18181836    :param str gpxfile: Existing .gpx file to be loaded. If nonexistent,
     
    30213039            * cycles: the maximum number of cycles (returns int)
    30223040            * sequential: the histograms used for a sequential refinement as a list
    3023               of histogram names or an empty list when in non-sequential mode.
     3041              of histogram names or an empty list when in non-sequential mode.
     3042            * Reverse Seq: returns True or False. True indicates that fitting of the
     3043              sequence of histograms proceeds in reversed order.
    30243044            * seqCopy: returns True or False. True indicates that results from
    30253045              each sequential fit are used as the starting point for the next
     
    30353055        elif control == 'sequential':
    30363056            return self.data['Controls']['data']['Seq Data']
     3057        elif control == 'Reverse Seq':
     3058            return self.data['Controls']['data']['Reverse Seq']
    30373059        elif control in self.data['Controls']['data']:
    30383060            return self.data['Controls']['data'][control]
     
    30593081              the starting point for the next. After each fit is is set to False.
    30603082              Ignored for non-sequential fits.
     3083            * Reverse Seq: when True, sequential refinement is performed on the
     3084              reversed list of histograms.
    30613085
    30623086        .. seealso::
     
    30673091        elif control == 'seqCopy':
    30683092            self.data['Controls']['data']['Copy2Next'] = bool(value)
     3093        elif control == 'Reverse Seq':
     3094            self.data['Controls']['data']['Reverse Seq'] = bool(value)
    30693095        elif control == 'sequential':
    30703096            histlist = []
     
    32913317
    32923318class G2PwdrData(G2ObjectWrapper):
    3293     """Wraps a Powder Data Histogram."""
     3319    """Wraps a Powder Data Histogram.
     3320    The object contains these class variables:
     3321
     3322        * G2PwdrData.proj: contains a reference to the :class:`G2Project`
     3323          object that contains this histogram
     3324        * G2PwdrData.name: contains the name of the histogram
     3325        * G2PwdrData.data: contains the histogram's associated data in a dict,
     3326          as documented for the :ref:`Powder Diffraction Tree<Powder_table>`.
     3327          The actual histogram values are contained in the 'data' dict item,
     3328          as documented for Data.
     3329
     3330    """
    32943331    def __init__(self, data, proj, name):
    32953332        self.data = data
     
    35873624        return self['data'][0].get('wR')
    35883625
     3626    def _decodeHist(self,hist):
     3627        '''Convert a histogram reference to a histogram name string
     3628        '''
     3629        if isinstance(hist, G2PwdrData):
     3630            return hist.name
     3631        elif hist in [h.name for h in self.proj.histograms()]:
     3632            return hist
     3633        elif type(hist) is int:
     3634            return self.proj.histograms()[hist].name
     3635        else:
     3636            raise G2ScriptException("Invalid histogram reference: "+str(hist))
     3637       
     3638    def set_background(self, key, value):
     3639        '''Set background parameters (this serves a similar function as in
     3640        :meth:`set_refinements`, but with a simplified interface).
     3641
     3642        :param str key: a string that defines the background parameter that will
     3643           be changed. Must appear in the table below.
     3644
     3645           =================   ==============   ===========================================
     3646           key name            type of value     meaning of value
     3647           =================   ==============   ===========================================
     3648           fixedHist           int, str,         reference to a histogram in the current
     3649                               None or           project or None to remove the reference.
     3650                               G2PwdrData       
     3651           fixedFileMult       float             multiplier applied to intensities in
     3652                                                 the background histogram where a value
     3653                                                 of -1.0 means full subtraction of
     3654                                                 the background histogram.
     3655           =================   ==============   ===========================================
     3656
     3657        :param value: a value to set the selected background parameter. The meaning
     3658           and type for this parameter is listed in the table above.
     3659
     3660        '''
     3661        bkgPrms, bkgDict = self.data['Background']
     3662        if key == 'fixedHist':
     3663            if value is None:
     3664                bkgDict['background PWDR'][0] = ''
     3665                return
     3666            bkgDict['background PWDR'][0] = self._decodeHist(value)
     3667        elif key == 'fixedFileMult':
     3668            bkgDict['background PWDR'][1] = float(value)
     3669        else:
     3670            raise ValueError("Invalid key in set_background:", key)
     3671       
    35893672    def set_refinements(self, refs):
    35903673        """Sets the histogram refinement parameter 'key' to the specification 'value'.
     
    39184001class G2Phase(G2ObjectWrapper):
    39194002    """A wrapper object around a given phase.
     4003    The object contains these class variables:
     4004
     4005        * G2Phase.proj: contains a reference to the :class:`G2Project`
     4006          object that contains this phase
     4007        * G2Phase.name: contains the name of the phase
     4008        * G2Phase.data: contains the phases's associated data in a dict,
     4009          as documented for the :ref:`Phase Tree items<Phase_table>`.
    39204010
    39214011    Author: Jackson O'Donnell (jacksonhodonnell .at. gmail.com)
     
    50245114    calls to :meth:`G2Project.add_image` or :meth:`G2Project.images`.
    50255115    Scripts will not use ``G2Image()`` to call :meth:`G2Image.__init__` directly.
     5116    The object contains these class variables:
     5117
     5118        * G2Image.proj: contains a reference to the :class:`G2Project`
     5119          object that contains this image
     5120        * G2Image.name: contains the name of the image
     5121        * G2Image.data: contains the image's associated data in a dict,
     5122          as documented for the :ref:`Image Data Structure<Image_table>`.
    50265123
    50275124    Example use of G2Image:
  • trunk/docs/source/conf.py

    r3000 r4198  
    1818    #def __getattr__(cls, name):
    1919    #    return wx()
    20     Menu = Panel = Dialog = CheckBox = Choice = ComboBox = object
     20    Frame = Menu = Panel = Dialog = CheckBox = Choice = ComboBox = object
    2121    Button = PyValidator = TextCtrl = TreeCtrl = object
    2222    DEFAULT_DIALOG_STYLE = RESIZE_BORDER = CENTRE = OK = CANCEL = True
Note: See TracChangeset for help on using the changeset viewer.