Changeset 3828
- Timestamp:
- Feb 22, 2019 9:35:29 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIIO.py ¶
r3825 r3828 38 38 import cPickle 39 39 else: 40 import _pickle as cPickle40 import pickle as cPickle 41 41 import sys 42 42 import re -
TabularUnified trunk/GSASIIdataGUI.py ¶
r3826 r3828 30 30 import cPickle 31 31 else: 32 import _pickle as cPickle 32 try: 33 import _pickle as cPickle 34 except: 35 print('Warning: failed to import the optimized Py3 pickle (_pickle)') 36 import pickle as cPickle 33 37 import numpy as np 34 38 import numpy.ma as ma -
TabularUnified trunk/GSASIIscriptable.py ¶
r3822 r3828 563 563 strtypes = (str,unicode) 564 564 else: 565 import _pickle as cPickle565 import pickle as cPickle 566 566 strtypes = (str,bytes) 567 567 import imp … … 3210 3210 'SampleAbs', 'center', 'ellipses', 'linescan', 3211 3211 'pixelSize', 'range', 'ring', 'rings', 'size', ], 3212 'dict': ['vary list'],3212 'dict': ['varyList'], 3213 3213 } 3214 3214 '''Defines the items known to exist in the Image Controls tree section … … 3271 3271 if arg in self.data['Image Controls']: 3272 3272 return self.data['Image Controls'][arg] 3273 print(self.findControl('')) 3273 3274 raise Exception('arg {} not defined in G2Image.getControl'.format(arg)) 3274 3275 … … 3373 3374 print('file {} read into {}'.format(filename,self.name)) 3374 3375 3376 def getVary(self,*args): 3377 '''Return the refinement flag(s) for Image Controls parameter(s) 3378 in the current image. 3379 If the parameter is not found, an exception is raised. 3380 3381 :param str arg: the name of a refinement parameter in the 3382 varyList for the image. The name should be one of 3383 'dep', 'det-X', 'det-Y', 'dist', 'phi', 'tilt', or 'wave' 3384 :param str arg1: the name of a parameter (dict entry) as before, 3385 optional 3386 3387 3388 :returns: a list of bool value(s) 3389 ''' 3390 res = [] 3391 for arg in args: 3392 if arg in self.data['Image Controls']['varyList']: 3393 res.append(self.data['Image Controls']['varyList'][arg]) 3394 else: 3395 raise Exception('arg {} not defined in G2Image.getVary'.format(arg)) 3396 return res 3397 3398 def setVary(self,arg,value): 3399 '''Set a refinement flag for Image Controls parameter in the 3400 current image. 3401 If the parameter is not found an exception is raised. 3402 3403 :param str arg: the name of a refinement parameter in the 3404 varyList for the image. The name should be one of 3405 'dep', 'det-X', 'det-Y', 'dist', 'phi', 'tilt', or 'wave' 3406 :param str arg: the name of a parameter (dict entry) in the 3407 image. The parameter must be found in :data:`ControlList` 3408 or an exception is raised. 3409 :param value: the value to set the parameter. The value is 3410 cast as the appropriate type from :data:`ControlList`. 3411 ''' 3412 if arg in self.data['Image Controls']['varyList']: 3413 self.data['Image Controls']['varyList'][arg] = bool(value) 3414 else: 3415 raise Exception('arg {} not defined in G2Image.setVary'.format(arg)) 3416 3375 3417 def Recalibrate(self): 3376 3418 '''Invokes a recalibration fit (same as Image Controls/Calibration/Recalibrate … … 3379 3421 This may produce a better result if run more than once. 3380 3422 ''' 3423 LoadG2fil() 3381 3424 ImageZ = GetCorrImage(Readers['Image'],self.proj,self) 3382 3425 G2img.ImageRecalibrate(None,ImageZ,self.data['Image Controls'],self.data['Masks']) -
TabularUnified trunk/docs/source/imports.rst ¶
r3823 r3828 4 4 Imports are implemented by deriving a class from 5 5 :class:`GSASIIobj.ImportPhase`, :class:`GSASIIobj.ImportStructFactor`, 6 :class:`GSASIIobj.ImportPowderData` 7 or :class:`GSASIIIO.ImportPowderData` (which are in turn 6 :class:`GSASIIobj.ImportPowderData` , 7 :class:`GSASIIobj.ImportSmallAngleData`, 8 :class:`GSASIIobj.ImportReflectometryData`, 9 :class:`GSASIIobj.ImportPDFData`, 10 or :class:`GSASIIobj.ImportImage` (which are in turn 8 11 derived from :class:`GSASIIobj.ImportBaseclass`) 9 12 to implement import of … … 11 14 Module file names (`G2phase_`, `G2pwd_` and `G2sfact_`, etc.) are used to 12 15 determine which menu an import routine should be placed into. (N.B. this 13 was an unnecessary choice; this could be done from the class used.) 14 15 This list may not include all currently defined formats, since modules 16 may be loaded from anywhere in the path. 16 naming was an unnecessary choice; importer types could be determined 17 from the base class.) 18 19 Most importers are listed below by type (provided this documentation is 20 up to date), but note that since modules 21 may be loaded from anywhere in the path, your installation could have 22 locally-defined importers as well. 17 23 18 24 .. _import_routines: … … 22 28 23 29 When writing a import routine, one should create a new class derived 24 from :class:`GSASIIIO.ImportPhase`, :class:`GSASIIIO.ImportStructFactor` 25 or :class:`GSASIIIO.ImportPowderData`. As described below, 30 from 31 :class:`GSASIIobj.ImportPhase`, :class:`GSASIIobj.ImportStructFactor`, 32 :class:`GSASIIobj.ImportPowderData` , 33 :class:`GSASIIobj.ImportSmallAngleData`, 34 :class:`GSASIIobj.ImportReflectometryData`, 35 :class:`GSASIIobj.ImportPDFData`, 36 or :class:`GSASIIobj.ImportImage`. As described below, 26 37 all these classes will implement 27 38 an ``__init__()`` and a ``Reader()`` method, and most will supply a 28 39 ``ContentsValidator()`` method, too. 29 See the :class:`~GSASIIIO.ImportPhase`, 30 :class:`~GSASIIIO.ImportStructFactor`, 31 :class:`~GSASIIIO.ImportPowderData` 32 or :class:`~GSASIIIO.ImportImage` class documentation 40 See the appropriate class documentation 33 41 for details on what values each type of ``Reader()`` should set. 34 42 … … 112 120 113 121 If the file cannot be read, the ``Reader`` routine should 114 return False or raise an :class:`GSASII IO.ImportBaseclass.ImportException`122 return False or raise an :class:`GSASIIobj.ImportBaseclass.ImportException` 115 123 exception. (Why either? Sometimes an exception is the easiest way to 116 124 bail out of a called routine.) Place text in `self.errors` and/or use:: … … 173 181 called. 174 182 175 Note that :meth:`GSASII IO.ImportBaseclass.CIFValidator` is a ContentsValidator183 Note that :meth:`GSASIIobj.ImportBaseclass.CIFValidator` is a ContentsValidator 176 184 for validating CIF files. 177 185 … … 300 308 ----------------------------------------------------- 301 309 Image import routines are classes derived from 302 :class:`GSASII IO.ImportImage`.310 :class:`GSASIIobj.ImportImage`. 303 311 See :ref:`Writing a Import Routine<import_routines>` for general 304 312 information on importers and the :class:`GSASIIobj.ImportImage` for … … 340 348 :members: 341 349 350 .. automodule:: G2img_SFRM 351 :members: 352 342 353 PDF Import Routines 343 354 ----------------------------------------------------- -
TabularUnified trunk/exports/G2export_CIF.py ¶
r3800 r3828 635 635 for histogram in sorted(phasedict['Histograms']): 636 636 if histogram.startswith("HKLF"): continue # powder only 637 if not self.Phases[phasenam]['Histograms'][histogram]['Use']: continue 637 638 Histogram = self.Histograms.get(histogram) 638 639 if not Histogram: continue -
TabularUnified trunk/imports/G2img_GE.py ¶
r3473 r3828 127 127 import cPickle 128 128 else: 129 import _pickle as cPickle129 import pickle as cPickle 130 130 import time 131 131 more = False -
TabularUnified trunk/imports/G2phase_GPX.py ¶
r3310 r3828 21 21 import cPickle 22 22 else: 23 import _pickle as cPickle23 import pickle as cPickle 24 24 import random as ran 25 25 import GSASIIobj as G2obj -
TabularUnified trunk/imports/G2pwd_GPX.py ¶
r3136 r3828 18 18 import cPickle 19 19 else: 20 import _pickle as cPickle20 import pickle as cPickle 21 21 import numpy as np 22 22 import GSASIIobj as G2obj -
TabularUnified trunk/testDeriv.py ¶
r3826 r3828 28 28 import StringIO 29 29 else: 30 import _pickle as cPickle30 import pickle as cPickle 31 31 import io as StringIO 32 32 import cProfile,pstats
Note: See TracChangeset
for help on using the changeset viewer.