| Home | Trees | Indices | Help |
|
|---|
|
|
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Class Variables | |
lib = <CDLL '/usr/local/lib/libNeXus.dylib', handle 115260 at
|
|
| Properties | |
|
Inherited from |
| Method Details |
Open the NeXus file returning a handle.
Raises RuntimeError if the file could not be opened, with the filename as part of the error message. Corresponds to NXopen(filename,mode,&handle)
|
|
Close the NeXus file associated with handle. Raises RuntimeError if file could not be opened. Corresponds to NXclose(&handle) |
Flush all data to the NeXus file. Raises RuntimeError if this fails. Corresponds to NXflush(&handle) |
Set the output format for the numbers of the given type (only applies to XML). Raises ValueError if this fails. Corresponds to NXsetnumberformat(&handle,type,format) |
Create the group nxclass:name. Raises RuntimeError if the group could not be created. Corresponds to NXmakegroup(handle, name, nxclass) |
Open a particular group '/path/to/group'. Paths can be relative to the currently open group. Raises ValueError. Corresponds to NXopenpath(handle, path) |
Open a particular group '/path/to/group', or the dataset containing the group if the path refers to a dataset. Paths can be relative to the currently open group. Raises ValueError. Corresponds to NXopengrouppath(handle, path) |
Open the group nxclass:name. Raises ValueError if the group could not be opened. Corresponds to NXopengroup(handle, name, nxclass) |
Close the currently open group. Raises RuntimeError if the group could not be closed. Corresponds to NXclosegroup(handle) |
Query the currently open group returning the tuple numentries, path, nxclass. The path consists of names of subgroups starting at the root separated by "/". Raises ValueError if the group could not be opened. Corresponds to NXgetgroupinfo(handle) |
Reset getnextentry to return the first entry in the group. Raises RuntimeError if this fails. Corresponds to NXinitgroupdir(handle) |
Return the next entry in the group as name,nxclass tuple. Raises RuntimeError if this fails, or if there is no next entry. Corresponds to NXgetnextentry(handle,name,nxclass,&storage). This function doesn't return the storage class for data entries since getinfo returns shape and storage, both of which are required to read the data. |
Iterator of entries.
This automatically opens the corresponding group/data for you, and closes it when you are done. Do not rely on any paths remaining open between entries as we restore the current path each time. This does not correspond to an existing NeXus API function, but instead combines the work of initgroupdir/getnextentry and open/close on data and group. |
Returns the tuple dimensions,type for the currently open dataset. Dimensions is an integer array whose length corresponds to the rank of the dataset and whose elements are the size of the individual dimensions. Storage type is returned as a string, with 'char' for a stored string, '[u]int[8|16|32]' for various integer values or 'float[32|64]' for floating point values. No support for complex values. Raises RuntimeError if this fails. Note that this is the recommended way to establish if you have a dataset open. Corresponds to NXgetinfo(handle, &rank, dims, &storage), but with storage converted from HDF values to numpy compatible strings, and rank implicit in the length of the returned dimensions. |
Open the named data set within the current group. Raises ValueError if could not open the dataset. Corresponds to NXopendata(handle, name) |
Close the currently open data set. Raises RuntimeError if this fails (e.g., because no dataset is open). Corresponds to NXclosedata(handle) |
Create a data element of the given type and shape. See getinfo for details on types. This does not open the data for writing. Set the first dimension to nxs.UNLIMITED, for extensible data sets, and use putslab to write individual slabs. Raises ValueError if it fails. Corresponds to NXmakedata(handle,name,type,rank,dims) |
Create a data element of the given dimensions and type. See getinfo for details on types. Compression mode is one of 'none', 'lzw', 'rle' or 'huffman'. chunks gives the alignment of the compressed chunks in the data file. There should be one chunk size for each dimension in the data. Defaults to mode='lzw' with chunk size set to the length of the fastest varying dimension. Raises ValueError if it fails. Corresponds to NXmakedata(handle,name,type,rank,dims). |
Return the data. If data is a string (1-D char array), a python string is returned. If data is a scalar (1-D numeric array of length 1), a python numeric scalar is returned. Raises RuntimeError if this fails. Corresponds to NXgetdata(handle, data) |
Get a slab from the data array. Offsets are 0-origin. Shape can be inferred from the data. Offset and shape must each have one entry per dimension. Raises ValueError if this fails. Corresponds to NXgetslab(handle,data,offset,shape) |
Write data into the currently open data block. Raises ValueError if this fails. Corresponds to NXputdata(handle, data) |
Put a slab into the data array. Offsets are 0-origin. Shape can be inferred from the data. Offset and shape must each have one entry per dimension. Raises ValueError if this fails. Corresponds to NXputslab(handle,data,offset,shape) |
Reset the getnextattr list to the first attribute. Raises RuntimeError if this fails. Corresponds to NXinitattrdir(handle) |
Returns the number of attributes for the currently open group/data object. Do not call getnextattr() more than this number of times. Raises RuntimeError if this fails. Corresponds to NXgetattrinfo(handl, &n) |
Returns the name, length, and data type for the next attribute. Call getattrinfo to determine the number of attributes before calling getnextattr. Data type is returned as a string. See getinfo for details. Length is the number of elements in the attribute. Raises RuntimeError if NeXus returns ERROR or EOD. Corresponds to NXgetnextattr(handle,name,&length,&storage) but with storage converted from HDF values to numpy compatible strings. Note: NeXus API documentation seems to say that length is the number of bytes required to store the entire attribute. |
Returns the value of the named attribute. Requires length and data type from getnextattr to allocate the appropriate amount of space for the attribute. Corresponds to NXgetattr(handle,name,data,&length,&storage) |
Saves the named attribute. The attribute value is a string or a scalar. Raises ValueError if the attribute could not be saved. Corresponds to NXputattr(handle,name,data,length,storage) Note length is the number of elements to write rather than the number of bytes to write. |
Iterate over attributes.
This automatically reads the attributes of the group/data. Do not change the active group/data while processing the list. This does not correspond to an existing NeXus API function, but combines the work of attrinfo/initattrdir/getnextattr/getattr. |
Return the id of the current group so we can link to it later. Raises RuntimeError Corresponds to NXgetgroupID(handle, &ID) |
Return the id of the current data so we can link to it later. Raises RuntimeError Corresponds to NXgetdataID(handle, &ID) |
Link the previously captured group/data ID into the currently open group. Raises RuntimeError Corresponds to NXmakelink(handle, &ID) |
Link the previously captured group/data ID into the currently open group, but under a different name. Raises RuntimeError Corresponds to NXmakenamedlink(handle,name,&ID) |
Return True of ID1 and ID2 point to the same group/data. This should not raise any errors. Corresponds to NXsameID(handle,&ID1,&ID2) |
If the current node is a linked to another group or data, then open the group or data that it is linked to. Note: it is unclear how can we tell if we are linked, other than perhaps the existence of a 'target' attribute in the current item. Raises RuntimeError Corresponds to NXopensourcegroup(handle) |
Returns the item which the current item links to, or None if the current item is not linked. This is equivalent to scanning the attributes for target and returning it if target is not equal to self. This does not correspond to an existing NeXus API function, but combines the work of attrinfo/initattrdir/getnextattr/getattr. |
Return the filename for the current file. This may be different from the file that was opened (file.filename) if the current group is an external link to another file. Raises RuntimeError if this fails. Corresponds to NXinquirefile(&handle,file,len) |
Return the filename for the external link if there is one, otherwise return None. Corresponds to NXisexternalgroup(&handle,name,nxclass,file,len) |
Return the filename for the external link if there is one, otherwise return None. Corresponds to NXisexternalgroup(&handle,name,nxclass,file,len) |
Print the structure of a NeXus file from the current node. TODO: Break this into a tree walker and a visitor. |
| Class Variable Details |
lib
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Mar 17 14:21:50 2009 | http://epydoc.sourceforge.net |