spym.io.rhksm4
¶
Package Contents¶
Functions¶
load (sm4file) |
This method load data and metadata from an RHK .sm4 file. |
to_dataset (sm4file, scaling=True) |
This method load an RHK .sm4 file into an xarray Dataset. |
to_nexus (sm4file, filename=None, **kwargs) |
This method convert an RHK .sm4 file into a NeXus file. |
-
spym.io.rhksm4.
load
(sm4file)¶ This method load data and metadata from an RHK .sm4 file.
- Args:
- sm4file: the name of the .sm4 file to be loaded
- Returns:
- a container for the pages in the .sm4 file with their data and metadata
- Examples:
f = rhksm4.load(‘/path/to/file.sm4’) # load the file
p0 = f[0] # assign first page in the file p0.label # returns page label name p0.data # returns page data as a numpy array p0.attrs # returns page metadata as a dictionary
-
spym.io.rhksm4.
to_dataset
(sm4file, scaling=True)¶ This method load an RHK .sm4 file into an xarray Dataset.
The xarray package is required.
- Args:
sm4file: the name of the .sm4 file to be loaded scaling: if True convert data to physical units (default),
if False keep data in ADC units- Returns:
- an xarray Dataset
- Examples:
ds = rhksm4.to_dataset(‘/path/to/file.sm4’)
ds <xarray.Dataset>
ds.IDxxxxx <xarray.DataArray>
-
spym.io.rhksm4.
to_nexus
(sm4file, filename=None, **kwargs)¶ This method convert an RHK .sm4 file into a NeXus file.
The nxarray package is required.
- Args:
sm4file: the name of the .sm4 file to be converted filename: (optional) path of the NeXus file to be saved.
If not provided, a NeXus file is saved in the same folder of the .sm4 file.**kwargs: any optional argument accepted by nexus NXdata.save() method
- Returns:
- nothing
- Examples:
- rhksm4.to_nexus(‘/path/to/file.sm4’)