Releases: nexpy/nexusformat
Releases · nexpy/nexusformat
Minor bug fixes
- Adds backup and restore functions to the NXroot group, allowing NeXus files to be saved to disk and recovered if necessary. By default, the backup is saved in the current directory with a randomized string added to the original filename, so that it is easy to clean up unneeded backups.
- Improves handling of missing axes.
- Fixes a bug in setting NXlinks to be the signal.
- Corrects an inconsistency in the way that the
axes
attributes are set by either NXdata group creation or using thenxaxes
property. - Improves output of string arrays when printing NeXus trees.
- Improves Python 3 compatibility.
Improve handling of Unicode strings
- Improves the handling of fixed-length strings that contain non-ASCII characters. These are now stored as byte strings within the NXfield.
- In Python 2, the NXfield returns an encoded byte string for printing, rather than a Unicode string. This prevents some Unicode encoding errors.
Improve initialization of large data sets
- New NXfield properties have been defined for HDF5 parameters, including compression, chunk sizes, fill values, and maximum shapes. These can be set at any time before the data is saved to an HDF5 file or before slabs are stored in core memory files (for large datasets that are filled as slabs after creation).
- Fixes a bug in Python 3 when storing lists of strings. These were converted to Numpy arrays of kind 'U', which h5py was unable to convert. Now, they are automatically converted to Numpy arrays of variable-length strings, using the special h5py object datatype. If fixed-length strings are required, a dtype of 'S' (or 'Sn' where
n
is the required length) should be used when creating the NXfield. - Provides better parsing of input parameters when creating an NXfield, e.g., the
maxshape
attribute is checked to ensure it is compatible with the NXfield shape.
Remove pyro directory
- There is no new functionality in this release. The pyro directory, which implemented a prototype for accessing NeXus files remotely, has now been moved into the nexpy/nxremote repository.
Projection averages
- Allows calls to the NXdata projection method to produce an average, i.e., the projection is divided by the number of summed bins.
- Fixes a problem with true division in Python 3. This also affects Python 2, when future division behavior is enabled.
Minor bug fixes
- Improves compatibility with Python 3 by ensuring unicode strings returned by NXobject property calls.
- Fixes a bug in the NXdata project function caused by stricter type-checking in Python 3.
Python 2/3 compatibility
- This is the first version compatible with both Python 2 and Python 3. It has been tested on v2.7, 3.3, 3.4, and 3.5. Python 2.7 and 3.3 are the minimum versions for Python 2 and 3, respectively.
- When used from a Python or IPython shell, this version should also be compatible with any Matplotlib backends, including PyQt5.
- Improves behavior for interactive plotting, i.e., it will respect the current Matplotlib interactive setting.
- Improves detection of plottable data within NXroot or NXentry groups.
Minor bug fix
- This fixes a bug, in which a NXfield that is stored within an existing NeXus file is copied to another group stored in memory, and then that group is copied back to the original file. If the NXfield is large, this caused the file to be closed before a file update is completed.
Various enhancements and bug fixes
- Linked items within a file can now have different names from their target. This restriction was lifted a few years ago.
- Added a compression filter setting, NX_COMPRESSION, which defaults to 'gzip'. This can be set using the nxsetcompression function, e.g.,
nxsetcompression('lzf')
. It can also be set to ‘None’. - Added a unicode encoding setting, NX_ENCODING, which defaults to 'utf-8'. This can be set using the nxsetencoding function, e.g.,
nxsetencoding('latin1')
. - The nexusformat package now uses variable length strings for storing all text fields using utf-8 (the h5py default), but fixed length strings in existing files could have a variety of encodings. If there is a decoding error when reading a string, nexusformat will see if 'latin1', the most common alternative, works. However, there is no guarantee that the correct encoding will be selected.
- The
nxtree
function has been renamednxdir
, to prevent clashes with the NeXpy GUI. - Improved handling of infinities when plotting.
- Improved copying of large datasets between files.
- Improved handling of singleton and reversed axes.
- Fixed a bug that caused a shift when slicing data whose axes are stored as bin boundaries rather than centers.
- Added a
__nonzero__
function to NXfield. Note that this means that if statements involving the NXfields will return False if all items are 0 and True otherwise.
Support for RGB(A) images
- Now supports plotting of RGB(A) image plots, with the new 'implot' method.
- Moved plot methods into NXdata class. This will allow plotting in NXmonitor and NXlog classes as well. If you attempt to plot another class, it will search for a valid NXdata group within its hierarchy.
- Individual NXfields also have a plot method. They will be plotted against default axes.
- Allow the plotting axes to be defined by an attribute array, as well as a single delimited string.
- Removed the NeXus version number from the file attributes when creating a new file. This version number used to refer to the C-API version, but that is no longer used.