Difference between revisions of "Read or write to disk"

From Horace
Jump to: navigation, search
Line 20: Line 20:
  
 
This function writes the n-dimensional dataset <code>w_in</code> to a file specified by the string <code>filename</code>.
 
This function writes the n-dimensional dataset <code>w_in</code> to a file specified by the string <code>filename</code>.
 +
 +
 +
==save_xye==
 +
 +
Save data in an sqw or dnd dataset to an ascii file.
 +
 +
<pre>
 +
filename='C:\mprogs\my_ascii_file.txt';
 +
save_xye(w_in,filename);
 +
</pre>
 +
 +
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==
 
==head==

Revision as of 10:04, 9 October 2012

read

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

filename='C:\mprogs\myfile_d1d.dat';
w_read=read(sqw,filename);

In the example shown here w_read is a d1d object, since the data in myfile.dat originated from a d1d. In order to use this method a dummy sqw object must be supplied. You can create this dummy object separately, or just use the above example, since the command sqw with no arguments creates a dummy sqw object anyway.

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.