Read or write to disk

From Horace
Revision as of 19:02, 16 January 2019 by Toby Perring (Talk | contribs)

Jump to: navigation, search

read

Function that reads sqw data from a binary file that was written using save.

filename='C:\mprogs\myfile.dat';
w_read=read_horace(filename);

In the example shown here w_read will contain an sqw object or d1d,d2d,...d4d object depending on the contents of the file. (Here the example data file has deliberately been chosen to have an ambiguous extension. Normally you would save an object to a file with the conventional extension for the object in question: .sqw, .d1d, .d2d, .d3d, .d4d.)

filename='C:\mprogs\myfile.sqw';
w_read=read_sqw(filename);

In the example shown here w_read is an sqw object, since the data in myfile.sqw originated from a cut created using cut_sqw with option '-pix'.

filename='C:\mprogs\myfile.d1d';
w_read=read_sqw(filename);

In the example shown here w_read is an d1d object, since the data in myfile.d1d originated from a cut created using cut_sqw with option '-nopix'.

save

Function that applies to all dimensionalities of datasets.

filename='C:\mprogs\myfile.dat';
save(w_in,filename);

This function writes the n-dimensional dataset w_in to a file specified by the string filename.


save_xye

Save data in an sqw or dnd dataset to an ascii file.

filename='C:\mprogs\my_ascii_file.txt';
save_xye(w_in,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 (variance).


head

Display a summary of a file containing sqw/dnd information.

filename='C:\mprogs\myfile.sqw'
h=head(sqw,filename)

The first argument is a dummy sqw/dnd object, as used in the read command. The information contained in the output h is the same as that obtained from an sqw/dnd object when using the command display (see below). The data given are things like original filename, dimensionality of the data, lattice parameters, data ranges, etc. Type

display(sqw)

for a full list for a dummy object.


display

display(w_in)

This function displays header information about the dataset w_in, which can be either a dnd or sqw object.