Ignore:
Timestamp:
25/10/08 00:34:52 (4 years ago)
Author:
Paul Kienzle
Message:

python: repackaging (step 2). Refs #101.

Location:
trunk/bindings/python/nxs
Files:
1 added
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/bindings/python/nxs/napi.py

    r1120 r1121  
    123123.. _NAPI:  http://www.nexusformat.org/Application_Program_Interface 
    124124""" 
    125 __all__ = ['MAXNAMELEN','MAXPATHLEN','NeXus','open'] 
     125__all__ = ['UNLIMITED', 'MAXRANK', 'MAXNAMELEN','MAXPATHLEN','NeXus','open'] 
    126126 
    127127import sys, os, numpy, ctypes 
  • trunk/bindings/python/nxs/tree.py

    r1120 r1121  
    1414 
    1515    import nxs 
    16     tree = nxs.read('file.nxs')   # loads a structure from a file 
    17     nxs.write('copy.nxs', tree)   # saves a structure to a file 
     16    tree = nxs.load('file.nxs')   # loads a structure from a file 
     17    nxs.save('copy.nxs', tree)    # saves a structure to a file 
    1818    nxs.dir('copy.nxs')           # display the contents of a file 
    1919 
    2020 
    21 The tree returned from read() has an entry for each group, field and 
     21The tree returned from load() has an entry for each group, field and 
    2222attribute.  You can traverse the hierarchy using the names of the 
    2323groups.  For example, tree.Histogram1.instrument.detector.distance 
     
    6868retrieve them in meters using:: 
    6969    entry.instrument.detector.distance.nxdata_as('m') 
    70 See help for nxsunit for more details on the unit formats supported. 
     70See `nxs.unit` for more details on the unit formats supported. 
    7171 
    7272The slab interface to field data works by opening the file handle 
     
    108108to the data group and title is the title of the NXentry, if available. 
    109109 
    110 The read() and write() functions are implemented within a specialized 
    111 NeXus class which allows all the usual API functions.  You can subclass 
    112 this with your own definitions for NXgroup(), NXattr(), SDS() and NXlink() 
    113 if you want to change the nature of the tree.  The properties of these 
    114 classes are closely coupled to the behaviour of readfile/writefile so  
    115 refer to the source if you need to do this. 
     110The load() and save() functions are implemented within  
     111`nxs.tree.NeXusTree`, a subclass of `nxs.napi.NeXus` which allows  
     112all the usual API functions.  You can subclass NeXusTree with your 
     113own version that defines, e.g., a NXmonitor() method to return an 
     114NXmonitor object when an NXmonitor class is read.  Your NXmonitor 
     115class should probably be a subclass of NXgroup. 
     116 
     117You can also specialize the definitions for the basic types  
     118NXgroup(), NXattr(), SDS() and NXlink() if you want to make 
     119radical changes to the returned structure.  The properties of  
     120these classes are closely coupled to the behaviour of the readfile 
     121and writefile methods so refer to the source if you need to do this. 
    116122""" 
    117123__all__ = ['read', 'write', 'dir', 'NeXusTree'] 
     
    614620        else: 
    615621            units = None 
    616         self._converter = nxsunit.Converter(units) 
     622        self._converter = nxs.unit.Converter(units) 
    617623        self.nxslab = NXslab_context(file, path, self._converter) 
    618624 
  • trunk/bindings/python/nxs/unit.py

    r1120 r1121  
    4545""" 
    4646 
    47 __all__ = ['Converter'] 
    48  
    4947# TODO: Add udunits to NAPI rather than reimplementing it in python 
    5048# TODO: Alternatively, parse the udunits database directly 
     
    5553 
    5654from __future__ import division 
     55 
     56__all__ = ['Converter'] 
     57 
    5758import math 
    5859 
Note: See TracChangeset for help on using the changeset viewer.