SANS2015

Treatment of ILL SANS data 1974-2015-20..

The programs here have been in regular use for more than forty years, and have
helped standardise measurement procedures necessary to extract high quality
corrected data objectively.  Input is from ASCII files where the format has
been stylised and stable since 1982, which unifies treatment from the different
instruments, ranging from D11 (1974 onwards) through D17, D16, D22, and D33.
The NeXus data format at present is most easily rationalised by converting it
back into these files with the utility programs described here, allowing all
these data from the archives (1974 on) to the present to use data matching the
resolution of the instruments, and be easy to read and compare.  For the user
the ascii data files represent a superset of parameters useful for data treatment;
the utilities included here allow extra information to be added in to that
read from the NeXus files (simple modification of the configuration files
of nxs2as (D11index.nxf, D22index.nxf etc) offer some future-proofing as the
NeXus files are updated. 

Past sets of measurements always included calibrations using the same instrument
configurations used for the samples, and can hence still be examined and
retreated.  The calibration measurements also served to show that the
instruments were working as expected.  Though they consumed valuable beam time
this has contributed to the reliability of derived data.  Indeed the ability to
compare such measurements from different experiments has been very useful in
monitoring overall instrument stability.  

The resulting treated data files include a one-step history of their origins;
this helps considerably in tracing problem data.  Simple resolution information is 
also included with the data.


Latest additions (November 2015)

NeXus/HDF5 data files
The utility programs metnxs, nx_names, nxs2as,runnex, h5nopp, h5pp have been 
added to the distributions to maintain compatibility with the main archive of
ascii (text) data files.  These are described in the note nxshdf.html included
here.

Fitting and plotting programs now display error bars

New fitting programs include hs2, hs2m  for monodisperse hard spheres and
second scattering.  plfi will replot from fitfun plot files

spod16 will search for spots on sequences of D16 data.

rawsum will sum rawdata files

updated fitting programs: mshell, ssqfun

Colin now will create either ILL standard 1d data files or canSAS
standard XML files or both.  If only canSAS XML files are required 
only a limited number of metadata items need to be set.

rreg and Xreg
The regrouping programs such as rnils and snils now include options
for saving the regrouping parameters in a named file (eg abcd.rrg).
The command line program rreg can reread these data and perform regrouping
on raw data as rnils. Xreg is a GUI version.  This enables specific
configurations of regrouping parameters to be used on the data without
re-entering the values.  If no regrouping file is given the default
used is SASVAL.PAR.

Command line

rreg first_run last_run [regrouping_file_name] [log_file_name] 




Recent changes

The original program set worked without problems on Windows2000
and WindowsXP.  After 2008 some problems arose on certain configurations 
of Windows Vista, which never became very popular.  The running environment
on Windows7 posed additional constraints and the programs here have been
modified to continue to run on both newer systems;  any feedback on
these systems will be gratefully received.  

To offer improved performance with these newer systems the concept of a 
raw data cache has been introduced.  Any compressed data read by xplots
is decompressed and retained in a cache directory (by default cashas in
the working directory).  When xplots terminates the contents are
deleted.  This allows the raw data to be examined rapidly in ascending
and descending sequences.  It has always been considered to be very
helpful to view all raw data before treatment; this reduces
incidence of later anomalies.  If SAS_CACHE environment variable
is set to (say) sasraw, then this directory will be used to store
the uncompressed data which will be retained after xplots terminates.

All raw data programs look in sequence for uncompressed files, either
in SAS_DATA_PATH or SAS_CACHE before attempting to decompress a
compressed data file from SAS_DATA_PATH.  Hence the raw data in the
cache may be re-used several times; it is up to the user to monitor
the space used by the cached files.

Attempts to use current ActiveState versions of Tcl/Tk have not been 
comletely successful, while Gordon Chaffee's NT version of Tcl/TK still 
seems to resolve most problems.

Since the Linux and MacOSX versions were compiled using gfortran I
have checked that all programs compile and run using the MinGW-gfortran.
The system library constraints are more severe than with the elderly
MinGW-g77 compiler when building portable programs, hence all 
programs here have been built with g77.  The libraries included here
do however include both g77 and gfortran versions for those wishing
to use routines to add to the programs here.  A short note 
PROGRAMMING.txt has some helpful information.
 


[ Windows: These programs have been created using MinGW and
are all in the program directory sasprogdir.

Copis of current libraries, built with g77 (v3.42) and
gfortran (v4.3) are included.  A short note on using these may 
be found in PROGRAMMING.txt ] 

Some newer programs test use of "plugins" which allow
novel data formats to be added without rebuilding
programs (see Adding_plug.pdf).

Some test data are in testdata.
Some regrouped data are in the working directory workdir

The pgplot directory is pgplotdir; this contains font data and
the slave plotting program GRWND.EXE etc.


Environment variables (usually set by prop - see below)

These are held in the program directory in the file env.pro
They are reset by prop when the project or program directory is changed.

SAS_DIR 	set to absolute path of sasprogdir 
PGPLOT_DIR 	set to absolute path of pgplotdir
SAS_DATA_PATH	set to absolute path of (say) tests
		NB requires terminal \
SAS_INSTRUMENT	( set to D11 for test data }

Plugin additions for reading data
SAS_XML         allows reading of canSAS XML files by
                sasmpl (general plotting), polymer, rfit...
SAS_ILL         allows reading of standard regrouped ILL
                data by sasmpl
		eg > SET SAS_ILL=illp1.exe for setting a command line
		environment

a typical env.pro:		
		
SAS_DECOMPRESS zcat
SAS_CHECK limited
SAS_EXTRA_G g2x
SAS_XML xml2gin
SAS_ILL illp1


Products

1) PGPLOT  should leave the window running - resize this and
           place in a convenient corner.  I have seen problems 
           when this is deleted.  Once I had to log off and
           relog to clear it. 
           use the print menu for printing!
           now, by default, /GW is for PGPLOT_ILL_DEV_1
           (and /VCPS for PGPLOT_ILL_DEV_2 but probably
            not so useful any more)  If you use ghostscript
           later to view and print the PostScript you
           should read the files as PostScript rather than
           eps, which may lose the new page commands.
           The default size and position of the window may
           be may be changed within
           the window "help/starting options" (click on
           current to copy current values if convenient).
           Clicking on the parameter file name brings up a default
	   name which will be used to save the set parameters on next use.

2) PROP    [ Windows ] a smarter graphical replacement for RSAS using
           expect.  You are advised to install it in the
           default directory c:\prop
 
           On starting this program, given a program directory,
           a raw data directory and a current work directory,
           it offers a simple mechanism for launching
           programs with control "environment variables"
           correctly set, and enables results to be viewed
           (actually using notepad) and easily printed.

           You are advised to keep directory names simple and
           not too long (preferably avoiding embedded spaces
           which can cause problems) e.g. d:\myD22\jun05
           or f:\sasprog for data, program directory etc. 


	   The program can be installed by the Microsoft installer
           by clicking on the prop_2.4.msi file.
 
	   Once PROP runs it will set up environment
           variables and store this as a named project in
           the work directory

           the programs it finds in the program directory
           are placed in a menu and can be launched
           an exclusionfile can be provided in the
           program directory; files named therein are
           not loaded automatically

	   the working directory can be changed (and then
           a copy of the project is also placed therein)

	   once working PROP uses the last project info
	   and resets to the working directory

	   additional evironment variables can be set
           for subtasks in options etc.

	   listing files can be viewed; doubleclicking
           places them in NOTEPAD (for printing) Other
           files can be shown by modifying the options

           the browsers can change volumes if the volume
           (c:\, D:\ etc is given explicitly

	   within the expect environment most filenames etc.
           are accepted with /  or \ characters!

Note on directory names

           You are recommended to use short directory names
           with no spaces embedded for program directories,
           raw data and working directories - e.g.
           C:\sans\work\april10
           D:\sans\sasprogdir


WWW References:

http://www.ill.eu/instruments-support/computing-for-science/cs-software/all-software/sans/analysis-programs/           see http://www.ill./computing/cs-software/all-software/
     
ftp://ftp.ill.fr/pub/cs/sans


Please let reghosh (at) gmail.com know of problems encountered!
