I/O utility functions
Saves any number of curves to various formats: Specfile, CSV, txt or npy. All curves must have the same number of points and share the same x values.
Parameters: |
|
---|
When saving to Specfile format, each curve is saved as a separate scan with two data columns (x and y).
CSV and txt formats are similar, except that the txt format allows user defined header and footer text blocks, whereas the CSV format has only a single header line with columns labels separated by field delimiters and no footer. The txt format also allows defining a record separator different from a line break.
The npy format is written with numpy.save and can be read back with numpy.load. If xlabel and ylabels are undefined, data is saved as a regular 2D numpy.ndarray (contatenation of x and y). If both xlabel and ylabels are defined, the data is saved as a numpy.recarray after being transposed and having labels assigned to columns.
numpy.savetxt backport of header and footer arguments from numpy=1.7.0.
See numpy.savetxt help: http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.savetxt.html
Saves one curve to a SpecFile.
The curve is saved as a scan with two data columns. To save multiple curves to a single SpecFile, call this function for each curve by providing the same file handle each time.
Parameters: |
|
---|---|
Returns: | None if close_file is True, else return the file handle. |
Return a simple string representation of a HDF5 tree structure.
Parameters: |
|
---|---|
Returns: | String representation of an HDF5 tree structure |
Group names and dataset representation are printed preceded by a number of tabulations corresponding to their depth in the tree structure. Datasets are represented as h5py.Dataset objects.
Example:
>>> print(h5ls("Downloads/sample.h5"))
+fields
+fieldB
<HDF5 dataset "z": shape (256, 256), type "<f4">
+fieldE
<HDF5 dataset "x": shape (256, 256), type "<f4">
<HDF5 dataset "y": shape (256, 256), type "<f4">
Note
This function requires h5py to be installed.
Load a file as an h5py.File-like object.
Format supported: - h5 files, if h5py module is installed - Spec files if SpecFile module is installed - a set of raster image formats (tiff, edf...) if fabio is installed
Parameters: | filename (str) – A filename |
---|---|
Raises: | IOError if the file can’t be loaded as an h5py.File like object |
Return type: | h5py.File |
Load a file as an h5py.File-like object.
Format supported: - h5 files, if h5py module is installed - Spec files if SpecFile module is installed
Deprecated since version 0.4: Use open(), or silx.io.open(). Will be removed in Silx 0.5.
Parameters: | filename (str) – A filename |
---|---|
Raises: | IOError if the file can’t be loaded as an h5py.File like object |
Return type: | h5py.File |
Returns the h5py class from an object.
If it is an h5py object or an h5py-like object, an h5py class is returned. If the object is not an h5py-like object, None is returned.
Parameters: | obj – An object |
---|---|
Returns: | An h5py object |
True is the object is an h5py.File-like object.
Parameters: | obj – An object |
---|