6. Special SQW
information from sqw objects and files
sqw
or dnd
objects in memory are normal MATLAB objects, so they can be converted into structure for analysis.
The objects contain complex information including service information, so converting them into structure may return
a lot of unnecessary and unclear information. This is why MATLAB normally warns you against applying struct
function to an object.
To return full essential information about Horace objects in memory, one may use to_struct
method.
Majority of Horace objects are serializable
objects, which means they may be converted into linear sequence of
bytes and reconstruct from this sequence.
to_struct
method is used for converting object into a structure containing information, sufficient for recovering
sqw
ordnd
object from this information.Number of additional commands exist for extracting information essential for physical problem or some special purposes.
Note
The commands described here work on object in memory and return information about part of the object, placed in memory. If they applied to a file-backed object or object which would not fit memory, they return different forms of references to the part of the information remained in file.
6.1. head
Gets the principal information about binary .sqw
or .dnd
file at the location given
in filename
or in the object, specified as input.
If the option '-full'
is used, then the full set of header information,
rather than just the principal header, is returned. Equivalent usage forms are:
info = head(filename[,'-full']);
info = head(obj,[,'-full']);
info = obj.head(['-full']);
where obj
is an sqw
or dnd
object.
If applied to file, the main use of this function is to determine whether or not the file contains
an sqw
or a dnd
object. It also returns general information about the contents of the
this object, i.e. data ranges, number of pixels in sqw
file etc., whatever developers decided
most important for user to know about correspondent object.
6.1.1. legacy equivalents of head
Number of methods were used in the past to retrieve information similar to the information returned by head
function.
These methods are still available and work as before repeating the operations, performed by head
function.
These methods are: head_horace
, head_dnd
and head_sqw
. Internally these methods are interfaces to head
function.
6.2. xye
Extract the bin centres, intensity and standard errors from an sqw or dnd object.
S = xye(object);
The output is a structure with fields:
S.x
- vector of bin centres if a 1D object, or cell array of vectors containing the bin centres along each axis if 2D, 3D or 4D objectS.y
- array of intensitiesS.e
- array of estimated error on the intensities
6.3. save_xye
Save an sqw
or dnd
object to an ascii format file at the location
filename
.
save_xye(object, filename);
The format of the ascii file for an n-dimensional dataset is n columns of co-ordinates along each of the axes, plus one column of signal and another column of error (standard deviation).