Difference between revisions of "Input and Output Functions"

From LIBISIS
Jump to navigation Jump to search
m
Line 10: Line 10:
 
* The following files would all be acceptable ASCII files   
 
* The following files would all be acceptable ASCII files   
  
<pre> title = plots1 xaxis = wavelength yaxis = signal  
+
<pre>title = plots1 xaxis = wavelength yaxis = signal  
 
490.2 30000
 
490.2 30000
 
491.2 31923
 
491.2 31923
492.2 40000
+
492.2 40000</pre>
</pre>
 
  
 
Represents a three point dataset with 0 error
 
Represents a three point dataset with 0 error
  
<pre> title = plots1 xaxis = wavelength yaxis = signal  
+
<pre>title = plots1 xaxis = wavelength yaxis = signal  
 
490.2 30000 300
 
490.2 30000 300
 
491.2 31923 300  
 
491.2 31923 300  
 
492.2 40000 250
 
492.2 40000 250
493.2
+
493.2</pre>
</pre>
 
  
 
Represents a 3 column histogram dataset with error data
 
Represents a 3 column histogram dataset with error data
  
<pre> 490.2,30000,300
+
<pre>490.2,30000,300
 
491.2,31923,300
 
491.2,31923,300
 
492.2,40000,250
 
492.2,40000,250
Line 34: Line 32:
  
 
Will represent the same 3 column histogram dataset with error data.
 
Will represent the same 3 column histogram dataset with error data.
 +
  
 
* When files are '''written''' by libisis a header is written at the top of the file with the following information  
 
* When files are '''written''' by libisis a header is written at the top of the file with the following information  
  
<pre> name = dataset name
+
<pre>name = dataset name
    title = dataset title  
+
title = dataset title  
    signal_units = dataset s axis label  
+
signal_units = dataset s axis label  
    x_units = dataset x axis label
+
x_units = dataset x axis label
    x_distribution = 1
+
x_distribution = 1
  
 
x1 s1 e1
 
x1 s1 e1
 
x2 s2 e2  
 
x2 s2 e2  
...
+
...</pre>
  
</pre>
+
where the header information is taken from the dataset being written.
  
where the header information is taken from the dataset being written.
 
  
 
* To read and write ASCII files in the format specified by the file or dataset use
 
* To read and write ASCII files in the format specified by the file or dataset use
  
 
''' >> read_ascii('filename')'''
 
''' >> read_ascii('filename')'''
 +
 
''' >> write_ascii(dataset,'filename')'''
 
''' >> write_ascii(dataset,'filename')'''
 +
  
 
if no filename is given then the user will be prompted to locate the file.  
 
if no filename is given then the user will be prompted to locate the file.  
 +
  
 
=== Point Data ===  
 
=== Point Data ===  
 
One can force the written or read ASCII file to be in the form of point data by using the commands
 
One can force the written or read ASCII file to be in the form of point data by using the commands
 +
  
 
''' >> read_points('filename')
 
''' >> read_points('filename')
 +
 
''' >> write_points(dataset, 'filename') '''
 
''' >> write_points(dataset, 'filename') '''
 +
  
 
=== Histogram Data ===
 
=== Histogram Data ===
Line 68: Line 72:
  
 
''' >> read_hist('filename') '''
 
''' >> read_hist('filename') '''
 +
 
''' >> write_hist(dataset, 'filename') '''
 
''' >> write_hist(dataset, 'filename') '''
 +
  
 
== RAW Files ==
 
== RAW Files ==
  
 
RAW files come directly from instruments and can also be read into Libisis. Data can then be extracted from the RAW file to form an [[IXTdataset_1d]] or an [[IXTdataset_2d]] object.  
 
RAW files come directly from instruments and can also be read into Libisis. Data can then be extracted from the RAW file to form an [[IXTdataset_1d]] or an [[IXTdataset_2d]] object.  
 +
  
 
* To read in a rawfile (in the form of an [[IXTraw_file]] object) use the command  
 
* To read in a rawfile (in the form of an [[IXTraw_file]] object) use the command  
  
 
''' >> rawfile1 = IXTraw_file('filename') '''
 
''' >> rawfile1 = IXTraw_file('filename') '''
 +
  
 
* To read data into an [[IXTdataset_1d]] object use the command
 
* To read data into an [[IXTdataset_1d]] object use the command
Line 83: Line 91:
  
 
where spectrum_number is the spectrum which is required.  
 
where spectrum_number is the spectrum which is required.  
 +
  
 
* to read multiple runs into an [[IXTdataset_2d]] object use the command
 
* to read multiple runs into an [[IXTdataset_2d]] object use the command
Line 88: Line 97:
 
''' >> dataset_2d = getspectra(rawfile1, [start:end]) '''
 
''' >> dataset_2d = getspectra(rawfile1, [start:end]) '''
  
where start and end are the initial and final spectrum to include in the dataset_2d
+
where start and end are the initial and final spectrum to include in the dataset_2d.
 +
 
 +
 
  
 
''' example: '''
 
''' example: '''

Revision as of 12:24, 17 March 2008

ASCII Files

  • IXTdataset_1d objects may be stored in ASCII files.
  • These files may contain x and y data or x, s, error data in a 2 or 3 column format.
  • Column 1 will be x values, column 2 will be s values and if available column 3 will be error values, if not available then error is assumed to be 0.
  • Any information at the start or end of the file that is not in a 2 or 3 column format is ignored (for instance, header information may be stored here).
  • Columns may be separated by commas, tabs, or spaces.
  • ASCII files may contain point or histogram data, the x column in histogram data will have one more value than the s and e columns.
  • The following files would all be acceptable ASCII files
title = plots1 xaxis = wavelength yaxis = signal 
490.2 30000
491.2 31923
492.2 40000

Represents a three point dataset with 0 error

title = plots1 xaxis = wavelength yaxis = signal 
490.2 30000 300
491.2 31923 300 
492.2 40000 250
493.2

Represents a 3 column histogram dataset with error data

490.2,30000,300
491.2,31923,300
492.2,40000,250
493.2

Will represent the same 3 column histogram dataset with error data.


  • When files are written by libisis a header is written at the top of the file with the following information
name = dataset name
title = dataset title 
signal_units = dataset s axis label 
x_units = dataset x axis label
x_distribution = 1

x1 s1 e1
x2 s2 e2 
...

where the header information is taken from the dataset being written.


  • To read and write ASCII files in the format specified by the file or dataset use

>> read_ascii('filename')

>> write_ascii(dataset,'filename')


if no filename is given then the user will be prompted to locate the file.


Point Data

One can force the written or read ASCII file to be in the form of point data by using the commands


>> read_points('filename')

>> write_points(dataset, 'filename')


Histogram Data

One can force the written or read ASCII file to be in the form of histogram data by using the commands

>> read_hist('filename')

>> write_hist(dataset, 'filename')


RAW Files

RAW files come directly from instruments and can also be read into Libisis. Data can then be extracted from the RAW file to form an IXTdataset_1d or an IXTdataset_2d object.


  • To read in a rawfile (in the form of an IXTraw_file object) use the command

>> rawfile1 = IXTraw_file('filename')


>> dataset = getspectrum(rawfile1, spectrum_number)

where spectrum_number is the spectrum which is required.


  • to read multiple runs into an IXTdataset_2d object use the command

>> dataset_2d = getspectra(rawfile1, [start:end])

where start and end are the initial and final spectrum to include in the dataset_2d.


example:

 >> rawfile1 = IXTraw_file('c:/RAWfiles/HET15958');
>> nsp = geti(rawfile1,'nsp1');
>> d2a = getspectra(rawfile1, [1:nsp]);
>> d1a = getspectrum(rawfile1, 25); 

this will load all spectra from the HET15958 raw file contained in the folder c:/RAWfiles into an IXTdataset_2d object called d2a and load spectrum 25 into an IXTdataset_1d object name d1a.

  • Other information is contained in the rawfile, see IXTraw_file documentation for more information.

Other Formats

Data may be read from other formats including Nexus. IXTrunfile is an object that contains all information about a run. Some of this information may be exported to a dataset for data manipulation and plotting. see the IXTrunfile documentation for further information.