Manipulating data from SQW files
From Horace
Contents |
cut_sqw
There are various different forms of input for this function, the purpose of which is to take data from an SQW file and turn it into a n-dimensional cut which can be plotted, manipulated, etc. The "compulsory" inputs are given as follows:
cut = cut_sqw (data_source, proj, p1_bin, p2_bin, p3_bin)
data_source is a string giving the full filename (including path) of the input SQW file.
proj is a Matlab structure array containing information about the axes you wish to use to view the data. Because each point in the SQW file is labelled with h, k, and l (the reciprocal lattice vectors), and energy, it is possible, if you wish, to redefine the co-ordinate system with one of your choosing. For example you may wish to view the data in terms of (h,h,0)/(h,-h,0)/(0,0,l). This is distinct from the vectors u and v that are specified in gen_sqw, which describe how the crystal is oriented with respect to the spectrometer and are determined by the physical orientation of your sample.
The proj array has several fields. proj.u is a 3-component vector of the form (h,k,l) which specifies the first viewing axis. proj.v is another 3-component vector of the same type which specifies the second viewing axis. The program then automatically calculates the third viewing axes to be the cross product of the first two. The 4th axis is always energy and need not be specified. An offset for all cuts can be provided in the field proj.uoffset, which is a 4-component vector. For example you may wish to make the origin of all your plots (2,1,0), in which case proj.uoffset=[2,1,0,0] would be written. Finally you can specify proj.type, which is a string denoting whether each of the 3 Q-axes should be displayed in inverse Angstroms or in r.l.u. For example, if we wanted the first two Q-components to be in r.l.u. and the third to be in inverse Angstroms we would have proj.type='rra'. You can optionally supply names for the various axes by specifying proj.lab1='labelname' and so on.
The inputs p1_bin etc. can have 3 different forms. If a single number (scalar) is given then that axis will be a plot axis and the bin width will be the number you specify, and the lower and upper limits will be determined by the extent of the data. If you specify a vector with 3 components then that axis will be a plot axis with the first and last components specifying the lower and upper limits of data to be cut, and the middle component specifies the bin width. If you specify a vector with 2 components then the signal will be integrated over that axis between limits specified by the two components of the vector.
Optional arguments are provided as follows:
cut = cut_sqw (data_source, proj, p1_bin, p2_bin, p3_bin, p4_bin, '-nopix', filename)
p4_bin specifies the binning / integration along the energy axis. In addition to the forms listed above for Q-axes, it is also possible to specify a binning of 0 for the energy axis only. In this case the energy binning that was specified when the raw data were converted into SPE format by Homer is used. The option '-nopix' means that the individual pixel information contributing to the resulting data is NOT retained (at present the default is to retain it, resulting in an output that is an sqw object, whereas using '-nopix' gives a dnd output). The filename optional argument is a string specifying a full filename (including path) for the data to be stored, in addition to being stored in the Matlab workspace.
head_sqw
info=head_sqw(filename);
This is a function to give the header information in an SQW file, whose full filename is given by the argument filename.
read_sqw
output=read_sqw(filename);
This is a function to read SQW data from a file. Note that in this context we mean an n-dimensional dataset, which includes pixel information, that has been saved to file. This could be either a full SQW file, or an sqw dataset that has been saved to file. The object output will be an sqw object.
save
save(object,filename)
Saves the SQW object or dnd object object from the Matlab workspace into the file specified by filename.