Changeset 2087
- Timestamp:
- Dec 8, 2015 6:02:57 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r2084 r2087 285 285 else: 286 286 reader = clss[1]() # create an import instance 287 readerlist.append(reader) 287 if reader.UseReader: 288 readerlist.append(reader) 288 289 except AttributeError: 289 290 print 'Import_'+errprefix+': Attribute Error '+str(filename) -
trunk/GSASIIIO.py
r2083 r2087 1331 1331 ''' 1332 1332 pass 1333 1333 1334 UseReader = True # in __init__ set value of self.UseReader to False to skip use of current importer 1334 1335 def __init__(self, 1335 1336 formatName, -
trunk/docs/source/imports.rst
r2068 r2087 60 60 method when ``strictExtension`` is False. 61 61 * ``formatName``: a string to be used in the menu. Should be short. 62 * ``longFormatName``: a longer string to be used to describe the format in help. 62 * ``longFormatName``: a longer string to be used to describe the 63 format in help. 64 65 Note that if an importer detects a condition which prevents its use, 66 for example because a required Python package is not present, it can 67 set the value of ``self.UseReader`` to False. Another possible use for 68 this would be an importer that requires a network connection to a 69 remote site. Setting ``self.UseReader`` to False must be done in the 70 ``__init__`` method and will prevent the 71 importer from being used or included in the expected menu. 63 72 64 73 Reader() -
trunk/docs/source/index.rst
r2027 r2087 32 32 * NumPy (http://docs.scipy.org/doc/numpy/reference/), 33 33 * SciPy (http://docs.scipy.org/doc/scipy/reference/), 34 * matplotlib (http://matplotlib.org/contents.html) 35 * PIL or Pillow (https://pillow.readthedocs.org) and 34 * matplotlib (http://matplotlib.org/contents.html) and 36 35 * PyOpenGL (http://pyopengl.sourceforge.net/documentation) 37 36 38 These packages are not distributed as part of the Python standard 37 Two packages are used by some parts of the code, but are not required: 38 * PIL (http://www.pythonware.com/products/pil/) or Pillow (https://pillow.readthedocs.org). This is used to save 39 and read certain types of images. 40 * h5py is the HDF5 support package. This is (not surprisingly) required 41 to import images from HDF5 files. If this library is not present, 42 the HDF5 importer(s) will not appear in the import menu and a 43 warning message appears on GSAS-II startup. 44 45 Note that the packages listed above are not distributed as part of the Python standard 39 46 library and must be obtained separately (or in a bundled Python 40 package such as the Enthought Python Distribution/Canopy or 41 Continuum.io's anaconda). The PyOpenGL package will be installed into 47 package such as the Enthought Inc.'s Canopy or 48 Continuum.io's anaconda; we also use the older Enthought Python 49 Distribution). 50 One exception is the PyOpenGL package. This will be installed into 42 51 Python by GSAS-II if not found, so it does not need to be included in 43 52 the Python bundle, but the setuptools package -
trunk/imports/G2img_HDF5.py
r2081 r2087 17 17 18 18 import numpy as np 19 import h5py20 19 import GSASIIIO as G2IO 21 20 import GSASIIpath 22 21 GSASIIpath.SetVersionNumber("$Revision: $") 23 22 24 class H df5_Reader(G2IO.ImportImage):23 class HDF5_Reader(G2IO.ImportImage): 25 24 '''Routine to read a HD5 image, typically from APS Sector 6. 26 25 B. Frosik/SDM. Initial version. … … 30 29 31 30 def __init__(self): 32 print 'start' 31 # check if HDF5 library is present, if not importer cannot be used 32 try: 33 import h5py 34 except: 35 self.UseReader = False 36 print 'HDF5 Reader skipped because h5py library not installed' 33 37 super(self.__class__,self).__init__( # fancy way to self-reference 34 38 extensionlist=('.hdf5','.hd5','.h5','.hdf'), … … 39 43 40 44 def ContentsValidator(self, filepointer): 41 '''no test at this time 42 ''' 45 '''test by using the HDF5 open 46 ''' 47 import h5py 43 48 try: 44 49 # the following does not work, filepointer is not a filename … … 52 57 '''Read using HDF5 file reader, :func:`ReadData` 53 58 ''' 59 import h5py 54 60 imagenum = kwarg.get('blocknum') 55 61 if imagenum is None: imagenum = 1 … … 73 79 74 80 def visit(self, f): 81 import h5py 75 82 def func(name, dset): 76 83 datakeyword = 'data'
Note: See TracChangeset
for help on using the changeset viewer.