Ignore:
Timestamp:
Jan 5, 2014 9:22:22 AM (8 years ago)
Author:
toby
Message:

fixup number formatting; update produced doc files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sphinxdocs/build/html/_modules/G2phase_GPX.html

    r1168 r1183  
    5353<span class="c"># -*- coding: utf-8 -*-</span>
    5454<span class="c">########### SVN repository information ###################</span>
    55 <span class="c"># $Date: 2013-10-25 14:24:22 -0500 (Fri, 25 Oct 2013) $</span>
     55<span class="c"># $Date: 2013-12-16 10:43:01 -0600 (Mon, 16 Dec 2013) $</span>
    5656<span class="c"># $Author: toby $</span>
    57 <span class="c"># $Revision: 1123 $</span>
     57<span class="c"># $Revision: 1168 $</span>
    5858<span class="c"># $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/imports/G2phase_GPX.py $</span>
    59 <span class="c"># $Id: G2phase_GPX.py 1123 2013-10-25 19:24:22Z toby $</span>
     59<span class="c"># $Id: G2phase_GPX.py 1168 2013-12-16 16:43:01Z toby $</span>
    6060<span class="c">########### SVN repository information ###################</span>
    6161<span class="sd">&#39;&#39;&#39;</span>
     
    6767
    6868<span class="sd">&#39;&#39;&#39;</span>
    69 <span class="c"># Routines to import Phase information from GSAS-II .gpx files</span>
     69<span class="kn">import</span> <span class="nn">sys</span>
    7070<span class="kn">import</span> <span class="nn">cPickle</span>
    7171<span class="kn">import</span> <span class="nn">GSASIIIO</span> <span class="kn">as</span> <span class="nn">G2IO</span>
    7272<span class="kn">import</span> <span class="nn">GSASIIstrIO</span> <span class="kn">as</span> <span class="nn">G2stIO</span>
    7373<span class="kn">import</span> <span class="nn">GSASIIpath</span>
    74 <span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1123 $&quot;</span><span class="p">)</span>
     74<span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1168 $&quot;</span><span class="p">)</span>
    7575
    7676<div class="viewcode-block" id="PhaseReaderClass"><a class="viewcode-back" href="../imports.html#G2phase_GPX.PhaseReaderClass">[docs]</a><span class="k">class</span> <span class="nc">PhaseReaderClass</span><span class="p">(</span><span class="n">G2IO</span><span class="o">.</span><span class="n">ImportPhase</span><span class="p">):</span>
     
    8383            <span class="n">longFormatName</span> <span class="o">=</span> <span class="s">&#39;GSAS-II project (.gpx file) import&#39;</span>
    8484            <span class="p">)</span>
     85       
    8586<div class="viewcode-block" id="PhaseReaderClass.ContentsValidator"><a class="viewcode-back" href="../imports.html#G2phase_GPX.PhaseReaderClass.ContentsValidator">[docs]</a>    <span class="k">def</span> <span class="nf">ContentsValidator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filepointer</span><span class="p">):</span>
    86         <span class="c"># if the 1st section can&#39;t be read as a cPickle file, it can&#39;t be!</span>
     87        <span class="s">&quot;Test if the 1st section can be read as a cPickle block, if not it can&#39;t be .GPX!&quot;</span>
    8788        <span class="k">try</span><span class="p">:</span>
    8889            <span class="n">cPickle</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">filepointer</span><span class="p">)</span>
    8990        <span class="k">except</span><span class="p">:</span>
     91            <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="s">&#39;This is not a valid .GPX file. Not recognized by cPickle&#39;</span>
    9092            <span class="k">return</span> <span class="bp">False</span>
    91         <span class="k">return</span> <span class="bp">True</span></div>
     93        <span class="k">return</span> <span class="bp">True</span>
     94</div>
    9295<div class="viewcode-block" id="PhaseReaderClass.Reader"><a class="viewcode-back" href="../imports.html#G2phase_GPX.PhaseReaderClass.Reader">[docs]</a>    <span class="k">def</span> <span class="nf">Reader</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">filename</span><span class="p">,</span><span class="n">filepointer</span><span class="p">,</span> <span class="n">ParentFrame</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">**</span><span class="n">unused</span><span class="p">):</span>
     96        <span class="sd">&#39;&#39;&#39;Read a phase from a .GPX file. Does not (yet?) support selecting and reading</span>
     97<span class="sd">        more than one phase at a time.&#39;&#39;&#39;</span>
    9398        <span class="k">try</span><span class="p">:</span>
    9499            <span class="n">phasenames</span> <span class="o">=</span> <span class="n">G2stIO</span><span class="o">.</span><span class="n">GetPhaseNames</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
    95100        <span class="k">except</span><span class="p">:</span>
     101            <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="s">&#39;Reading of phase names failed&#39;</span>
    96102            <span class="k">return</span> <span class="bp">False</span>
    97103        <span class="k">if</span> <span class="ow">not</span> <span class="n">phasenames</span><span class="p">:</span>
     104            <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="s">&#39;No phases found in &#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
    98105            <span class="k">return</span> <span class="bp">False</span>            <span class="c"># no blocks with coordinates</span>
    99         <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">phasenames</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="c"># no choices</span>
     106        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">phasenames</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="c"># one block, no choices</span>
    100107            <span class="n">selblk</span> <span class="o">=</span> <span class="mi">0</span>
    101108        <span class="k">else</span><span class="p">:</span>                       <span class="c"># choose from options                </span>
     
    105112                <span class="n">title</span><span class="o">=</span> <span class="s">&#39;Select a phase from the list below&#39;</span><span class="p">,</span>
    106113                <span class="p">)</span>
    107             <span class="k">if</span> <span class="n">selblk</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span> <span class="k">return</span> <span class="bp">False</span> <span class="c"># User pressed cancel</span>
     114            <span class="k">if</span> <span class="n">selblk</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
     115                <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="s">&#39;No phase selected&#39;</span>
     116                <span class="k">return</span> <span class="bp">False</span> <span class="c"># User pressed cancel</span>
    108117        <span class="k">try</span><span class="p">:</span>
    109118            <span class="bp">self</span><span class="o">.</span><span class="n">Phase</span> <span class="o">=</span> <span class="n">G2stIO</span><span class="o">.</span><span class="n">GetAllPhaseData</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span><span class="n">phasenames</span><span class="p">[</span><span class="n">selblk</span><span class="p">])</span>
     
    112121            <span class="k">return</span> <span class="bp">True</span>
    113122        <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">detail</span><span class="p">:</span>
    114             <span class="kn">import</span> <span class="nn">sys</span>
     123            <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="s">&#39;Error reading selected phase&#39;</span>
     124            <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">+=</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">  &#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">detail</span><span class="p">)</span>
    115125            <span class="k">print</span> <span class="bp">self</span><span class="o">.</span><span class="n">formatName</span><span class="o">+</span><span class="s">&#39; error:&#39;</span><span class="p">,</span><span class="n">detail</span> <span class="c"># for testing</span>
    116126            <span class="k">print</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span> <span class="c"># for testing</span>
Note: See TracChangeset for help on using the changeset viewer.