GENIE-V2 Emulation and Data I/O

There is a understandably a certain amount of confusion as to what constitutes Open GENIE itself and what is effectively provided for users of the ISIS facility who are upgrading from the GENIE-V2 program. This section of the reference manual documents routines and facilities which have been added to Open GENIE for users of GENIE-V2, they are in general not essential to using Open GENIE but may be a convenient starting point for accessing single spectra/scan data. Several of the standard Open GENIE commands commands also work in concert with these commands to aid compatiblity. For example, the Get() command will still take notice of a default input file selected using the GENIE-V2 disk, directory, instrument and extension defaults.

The Genie I/O system maintains several internal variables that control:

The current input file
The current output file
The current disk
The current directory
The current instrument
The current file extension

Current values may be viewed by using Show() commands, and changed by using the Set() commands.

The GENIE-V2 compatibility commands are listed below.

Assign Select a run for input by giving the ISIS run number
Cfn Construct the full filename from run number and defaults
Groupbins Groups histogram bins by averaging contents
Jump Similar to the System() command.
Keep Similar to the Hardcopy() command.
S Identical to the Get() command.
Scatmode Return GENIE-V2 Energy mode description
Set Set user defined defaults
Setpar GENIE-V2 style parameter setting for the Units() command
Show Show user defined defaults and system variables

Command Reference

Assign()

Select a run for input by giving the ISIS run number

ASSIGN p1=Integer Selects the default run for input with the S() command.

example:

	# Select run 2004 and read in a spectrum
	>> Assign 2004
	>> w=s(2)		# 2nd Spectrum

Note: Assign nnn is equivalent to Set/File/Input Cfn(nnn)

Assign

The assign command is designed to allow a shorthand of specifying the ISIS run number to select the input file to read from. Essentially it concatenates the defaults for disk, directory, instrument and extension and then makes the resultant file the default file. It is based on the Cfn() command.

Parameters:

P1 (Integer)

An existing ISIS run number. Before this can make sense, the disk, directory, instrument and extension defaults must have been set up with the appropriate Set() commands.

Cfn()

Construct the full filename from run number and defaults

CFN [number=Integer] [name=String] Construct a full path name for the given run or file number.

example:

	>> Set/Disk "IRIS$DISK0:"
	>> Set/Dir "[IRSMGR.DATA]"
	>> Set/Inst "IRS"
	>> Set/Ext ".RAW"
	>> printn Cfn(345)
	IRIS$DISK0:[IRSMGR.DATA]IRS00345.RAW
	>> printn Cfn("special.dat")
	IRIS$DISK0:[IRSMGR.DATA]SPECIAL.DAT

Note: Cfn() adds the appropriate number of 0s for ISIS raw file names.

Cfn

The Cfn() function provides the formatting necessary to convert between integer run numbers and full file names by making use of previously set defaults. The run number conversion is ISIS file name specific however using Cfn() with a file name is general (note that on Unix systems, there is no need to specify the Disk default).

Parameters:

Number (Integer)

Integer run number which is automatically converted to a zero padded string before concatenation into a file name.

Name (String)

A complete filename but without any path (ie Disk/Directory) specification.

RESULT = (String)

A fully constructed file name which be used to access the data.

Groupbins()

Groups histogram bins by averaging the bin contents.

GROUPBINS wksp=Workspace nbin=Integer [undef=Real] Group bins in a GENIE-V2 format workspace.
GROUPBINS() xarray=Realarray yarray=Realarray earray=Realarray nbin=Integer [undef=Real] Group bins in a spectrum given X, X, and E arrays.

example:

	# Group the bins in a workspace by tens.
	>> work = s(1)
	>> Groupbins work 10 undef=0.0

Note: Undef gives a value to assume when undefined elements are met during the averaging process.

Groupbins

The Groupbins() function provides a way of reducing (in a fairly simple manner) a spectrum with large number of bins. The process is a simple and averages every "nbin" bins by replacing the group of bins with a single new bin. The process is less sophisticated than the Rebin() command and is usually used before displaying a large spectrum graphically to achieve a degree of smoothing.

The first form of the command takes a workspace and modifies the binning to return a re-binned result or to change the original workspace.

The second form of the command takes X, Y, and E data arrays where the E and Y arrays are of the same length and the X array is one element longer (for the extra bin boundary). The result is a workspace containing just the rebinned X, Y and E arrays. The original arrays are unaffected.

Parameters:

Wksp (Workspace)

Any workspace W containing a histogram stored in arrays in W.X, W.Y and W.E. Bin grouping does not work on a two dimensional workspace.

Nbin (Integer)

Number of bins to group together.

Undef (Real) [ default = 0.0 ]

Because Open GENIE allows arrays to contain undefined elements, it is possible that the user may wish to set any undefined elements to a specific value before the bin grouping is carried out (usually zero).

Xarray, Yarray, Earray (Realarray)

These are the three arrays representing the histogram to be grouped. The Xarray parameter specifies the histogram bin boundaries, the Yarray parameter the data values and the E array parameter the Error values for the Y array.

RESULT = (Workspace)

Either the bin-grouped input workspace or a new workspace created to hold just the histogram arrays. Which ever form of the command is used, the resultant workspace will have X, Y and E fields.

Jump()

Similar to the System() command.

JUMP/S acommand=String Execute one operating system command
JUMP/P   Create an operating system session within Open GENIE

example:

	# Use Jump/s to print a file
	>> Jump/S "print/q=sys$lsr0 genie.ps"

Note: For new programs use the System() command.

Jump/S

This executes a single operating system command (eg "print") from within Open GENIE. Jump does not return a status so it is preferable to use the System() command.

Parameters:

Acommand (String)

The command and parameters (if any) to execute.

Jump/P

Jumps of of Open GENIE into a terminal session but keeps Open GENIE running in the background. To return to Open GENIE type "exit" on Unix or "logout" on VMS.

Keep()

The keep command is no longer supported. Use Hardcopy() for saving graphics and the Getcursor() and Asciifile() commands for retrieving and storing peak location data.

Keep

The Keep/Hardcopy command has been superceeded by the Hardcopy() command for saving graphics.

The other keep commands (originally used for storing peak information) can now be specified as simple procedures using the Getcursor() command to get the co-ordinate data and the Asciifile() command to write the data in any format into an ASCII formatted file.

S()

Get data, now identical to the Get() command. See Get/Help

S

The S() command now behaves identially to the Get() command but it is kept as an alias for consistency.

Scatmode()

Return GENIE-V2 Energy mode description

SCATMODE [emode=Integer] Returns a string giving the meaning of the emode value.

example:

	# Get a description from an emode value of 1
	>> printn Scatmode(1)
	inelastic (direct geometry)

Scatmode

Simply provides a textual description to translate the numeric value of this parameter.

Parameters:

Emode (Integer)

Emode value (0, 1 or 2)

RESULT = (String)

String description of the instrument energy mode.

Set()

Set user defined defaults.

SET/DISK value=String Select the default disk
SET/DIR value=String Select the default directory
SET/INST value=String Select the default instrument short name
SET/EXT value=String Select the default file extension
SET/FILE
[/INPUT]
[/OUTPUT]
value=String Set the default input or output files

example:

	# Change the file for saving data to
	>> Set/file/output "Mydat.in3"

Note: Set/File/Input is the default for Set/File

Set/File

Allows selection of the default file for input or ouput. This new Open GENIE command overrides the older commands listed below which set parts of the path individually. The full pathname for the file must be supplied when Set/File is being used but once set, both the Get() and Put() commands will accept the Input/Output files as defaults.

Parameters:

/Input

Sets the default file for input

/Output

Sets the default file for output

Value (String)

The full pathname for the default input or output file.

Set/Disk

Sets the default disk for the input file. This is not needed on Unix systems but can be useful on VMS or Wiindows/NT.

Parameters:

Value (String)

The full disk name (or disk logical name on VMS - eg "USER$DISK:" )

Set/Dir

Sets the default directory for the input file.

Parameters:

Value (String)

The full directory path for the file. (e.g. [TFXA.DATA] on VMS or /home/user/bob/ on Unix)

Set/Inst

Sets the default instrument short name. This is an ISIS specific three letter abbreviation for the instrument name which constitutes part of the file name.

Parameters:

Value (String)

The instrument short name (e.g. IRS)

Set/Ext

Sets the default file extension for the input file. This is not needed on Unix systems but needs specifying on VMS.

Parameters:

Value (String)

The full file extension (e.g. ".RAW")

Setpar()

GENIE-V2 style T-O-F parameter setting for the Units() command.

SETPAR wksp=Workspace [l1=Real] [l2=Real] [tt=Real] [em=Integer] [ef=Real] [d=Real] [t=String] Set time of flight parameters
[/R]   Take angles to be values in radians

example:

	# Set a value of two-theta that was not in the raw data file
	>> w = s(1)
	>> Setpar w tt=50.0
	>> wd = Units:d(w)

Note: Could probably be done more easily by assignment (i.e. w.twotheta = 50.0)

Setpar

The Setpar() command emulates the GENIE-V2 command which set Time-of-Flight parameters for a workspace so that the Units() command could be used. Open GENIE behaves differently, in that it will read the parameters from a data file automatically when reading spectra. Setpar() can be used however to fix parameters which had an incorrect or default value in the raw file. Note that the problem is trivial in Open GENIE anyway because the correct values can simply be assigned to the appropriate workspace field by using GCL (as in the note above).

Parameters:

/R

Interpret the two theta angle as a value given in radians.

L1 (Real)

Primary flight path (m)

L2 (Real)

Secondary flight path (m)

Tt (Real)

Two theta angle in degrees by default.

Em (Integer)

Selects the energy mode of the instrument affects how the "Ef" fixed energy parameter is interpreted by the Units() command.

0 = Elastic
1 = Inelastic (Direct geometry)
2 = Inelastic (Indirect geometry)

Ef (Real)

Fixed energy value (meV)

D (Real)

The hold off time (delta) in microseconds.

T (String)

Workspace title string.

Show()

Set user defined defaults and system variables.

SHOW/DEFAULTS   Show all I/O defaults
SHOW/PAR wksp=Workspace Show parameters set by Setpar()
SHOW/DATA wksp=Workspace Emulate GENIE-V2 show data command
SHOW/CONST   Show all the constants in Open GENIE
SHOW/PROC   Show all the procedures in Open GENIE
SHOW/TYPE   Show all the types in Open GENIE
SHOW/VAR   Show all the variables in Open GENIE
[/SYS]   Show system variables as well

example:

	# Check the I/O defaults
	>> Show/defaults
	Current default disk = EVS$DISK0:
	Current default directory = [EVSDATA]
	Current default instrument = EVS
	Current default extension = .RAW
	Current default input = EVS$DISK0:[EVSDATA]EVS00456.RAW
	Current default output =

Note: The current default input file can be altered by Assign() or Set/File/Input

Show/Defaults

Shows all the current I/O defaults. Note that the GENIE-V2 disk, directory, instrument and extension defaults will only change the default input file when the Assign() command is used. The Get() and S() commands both use whatever the default input file specifies.

Show/Par

Prints the values set in a workspace by the Setpar() command. This is only kept for compatibility with GENIE-V2, in Open GENIE all values can be printed directly out of the workspace (eg printn work.twotheta).

Parameters:

Wksp (Workspace)

The workspace being inspected.

Show/Data

Emulates the GENIE-V2 "show data" command by printing all the data from the workspace to the terminal screen. If a long workspace is printed to the screen by mistake Control-C can be used to stop the printout! If similar data is required in a file, use the Open GENIE Asciifile/Writefree command.

Parameters:

Wksp (Workspace)

The workspace being inspected.

Show/Const

Display all the constants currently defined within the Open GENIE session (including pre-defined constants such as colours).

Parameters:

/Sys

Show system constants as well (all these begin with an "_")

Show/Proc

Display all the procedures currently defined within the Open GENIE session (including their help text)

Parameters:

/Sys

Show system procedures as well (all these begin with an "_")

Show/Type

Display all the workspace types currently defined within the Open GENIE session.

Parameters:

/Sys

Show system types as well (all these begin with an "_")

Show/Var

Display all the variables currently defined within the Open GENIE session.

Parameters:

/Sys

Show system variables as well (all these begin with an "_")