presents  

THE   LAMP   BOOK

LAMP by   D. Richard, M. Ferrand, G. J. Kearley.
WWW Manual created by   A. D. Bradley


The LAMP Book is an on-line help and reference manual for the Large Array Manipulation Program, developed initialy for the treatment of data obtained from neutron scattering experiments here at the Institute Laue-Langevin.
LAMP has become more general purpose by adding common features and is seen as a GUI-laboratory for data analyses based on the IDL language.

The main LAMP interface

LAMP provides a predictable and intuitive graphical user interface which integrates scientific visualisation with an enhanced data language. Many high level modules are predefined to enable interactive data analysis and visualisation of 2D , 3D data and atomistic representations.

LAMP also provides for :-


Ftp://Ftp.ILL.FR /pub/cs
Http://Barns.ILL.FR/

[OPEN MANUAL]



OPEN TOF MANUAL (local)    OPEN TOF MANUAL (ILL)


GEORGE on D7

D7 Lamp Book


WARNING: If you just have downloaded the lamp package, click the README below right now.

[README]

WARNING: NEWS over the lamp package and last changes (text file). mail queries to lamp@ill.fr


WARNING:LEGAL NOTICE: The LAMP package is distributed in the public domain. If you find this application useful, you may send an electronic mail message to lamp@ill.fr,. We would gratefully appreciate any feedback on malfunctions.

The reference in your Publications should be:
( ) LAMP, the Large Array Manipulation Program. http://www.ill.fr/data_treat/lamp/front.html



The LAMP Book - Main Contents Page

Using The LAMP Book


This manual can be used in a number of ways:-


Main Contents

1. Introduction - Describes workspaces and contains a clickable image of the basic operations that LAMP performs.

2. Reading in Data - Instructions for starting LAMP, using the Data Collector Area, saving and emptying workspaces.

3. Displaying Data - Using the Display Workspace Area to plot data, perform cursor operations, set preferences, and print.

4. Special Display Interfaces - Basics of the separate LAMP interfaces Scroll Spectra, Radial Integration, Superplot, STR-fit Gk-fit Qens-fit, Atomic structure editor, Miller planes, phonons and vibrations animation, Tomography ...

5. Manipulating Workspaces - Using from Layout features the Formula-Entry Area and the Do/Xbu input text to write and execute fomulae and macros, obtain information about data, save and exit LAMP sessions.

6. Common Workspace Functions - The syntax used to manipulate data, from maths functions and normalising, to plotting data. Help from Idl contains a decription of all available native functions and all about syntax.

7. Other Display interfaces and "TOF legacies" - Filling HKL reciprocal space by series of monicristal diffractions , Magnetic scattering cross-section example , George-Layout , Mask & Group , Tof reduction legacies.

8. LAMP Macros - Making command files and compiled IDL procedures that can be executed in LAMP.

9. Frequently Asked Questions - Plots, printing, instrument-spectrum numbers and what to do if LAMP shows no response.

[FRONT PAGE] [NEXT PAGE]


The LAMP Book - Page 1 - Introduction

    1.   Introduction


Main Concepts | LAMP's Basic Operations (clickable image)


Main Concepts

LAMP allows you to read data into a buffer: one of 40 workspaces (extendable to 80) which can then be handled using the LAMP interface to perform the functions outlined above.

Workspaces are arrays that can contain any type of data. Typically, these are whole experimental runs rather than just single spectra. LAMP also predefines arrays for the instrument parameters, axes information, descriptive text, monitor spectra, errors, ... which are all tied to the individual workspace.
This structure can be visualised as follows:

[Diagram of 
Workspace--Axes Scales,etc] --------

When you read data into a workspace (LAMP predefines 40 workspaces, called w1...w40, for your use) it automatically adapts to the dimensions of the data. Also, when you pass data from one workspace to another LAMP automatically passes the tied arrays (scales, parameters etc.) too.



LAMP's Basic Operations (clickable image)

The basic operations of LAMP are summarised in the following diagram.
This diagram is also an imagemap which means that you can click on any area you are interested in and automatically be taken to the relevant manual entry.


To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]























The LAMP Book - Page 2 - Reading in Data

    2.   Reading in Data


Running LAMP | Imagemap | Selecting Instrument | Selecting Data-Base | Selecting a Workspace | Selecting a Run-Number | Reading the Run | Other Methods of Reading Data | Reading Treated Data | Saving Workspaces


The Lamp Book describes the classical lamp interface selected from "Lamp/Layout" item in the menu-bar.

To start Lamp see "Installation README" in the front page of this manual.


The correct instrument and data-base may already be set, if not you must select DATA Instrument and the Data Collector Area will then appear as :

Imagemap - click on any point to go to the relevant paragraph.

Some on-line help can be obtained by pressing the ' ? ' button.


To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]







The LAMP Book - Page 3 - Displaying Data

    3.   Displaying Data


Imagemap | Plotting a Workspace | Below and Beside | Colours | "Be Good" Button (Set Preferences) | Image, Contour and Surface | Ranges | Zoom | Cursor | Printing


The 'Display Workspace Area' showing a combined surface and contour plot

Imagemap - Click on any point to go to the relevant paragraph.

See Graphics on Common Workspace Fuctions page for direct methods of plotting data and setting plot ranges using the formula-entry window.


To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]


 






The LAMP Book - Page 4 - Special Display Interfaces

    4.   Special Display Interfaces


SuperPlot - Overplotting | Scaling and Zooming | Cut applied to ... | Plot Style and Printing | Tips
Radial integrations
Unroll images
Curve fit - Str-Fit(complete and generous) | GK-Fit(limited but easy to use | Qens-Fit(for quasi-elastic spectra)
Tomography
Magnetic structure - Editor | incommensurate example | commensurate example
Atomistic representation - Miller planes/isodensities | Molecules/displacements
Scroll Spectra - Scrolling | Scaling and Zooming | Plot Style and Printing | Tips


The DISPLAY FUNCTIONS list on the right of the classical LAMP interface and the TOOLS list in the Menu-bar contain buttons to select the following interfaces :-

SuperPlot

This interface provides a window for plotting several individual spectra. The current workspace number used in Lamp is automatically used as the default workspace. You can change it with the workspace slider. The cut axis and the cutting value can also be easily choosen using X or Y button and cutting value slider.

The SuperPlot window diplaying five spectra from 1 workspace
[Snapshot]


Also in the DISPLAY FUNCTIONS area on the right of the main LAMP interface are buttons to select a Radial Integration programs, a curve function fitting program (GK_Fit), SCAN for more elaborate image manipulation, and Load new Colours.



RADIAL INTEGRATIONS

This interface provides a window for radial and azimutal integrations using user defined sectors.



UNROLLING RINGS

This interface provides a window for unrolling large images.The analyse becomes easier since integrations are simple projections.




CURVE FITTING with Str_Fit

Originally developed for analysing strain scanning aquisitions in which a Bragg peak is measured as a function of the position in the sample. The diffraction peak in each pattern is fitted with a given theorical lineshape (e.g. pseudo-Voigt), including convolution with a resolution function.
The fitted data, residuals and parameters can be viewed in different ways.
Today the program aims to give users a general fitting interface in which we can:

  • Construct a model by entering own formulae and using predefined functions.
  • Constraint and tie parameters for independent spectra or 2D spectra (simultaneous fitting).
  • Fit parameters in one go using previous spectra results.
  • Choose a resolution as a function or numerical input spectra.
  • Save models and results. Call "Str_fit" from a macro without using the interface.


  • CURVE FITTING with GK_Fit

    From one to six Gaussian & Lorenzian functions can be fitted from this interface.


    CURVE FITTING with Qens_Fit

    Used to analyse quasi-elastic spectra. Inelastic excitations can also be treated. The input for "Qens_fit" consists of two workspaces, one containing the data as a function of Q(or temperature,pressure etc), the other containing the corresponding set of resolution functions, and a fitting model(typically a delta function for the elastic peak and lorentzians and gaussians for the quasi/inelastic features).
    Once one spectrum has been fitted the remaining spectra can be fitted in one go and parameters can be fixed for all spectra. Instead of fitting independently each spectrum, a physical model can be imposed, for example for diffusion on a sphere. Models are added when needed.


    TOMOGRAPHY

    A straightforward interface for reconstruction.


    MAGNETIC STRUCTURE

    An editor for magnetic strutures representations with the possibility to add planes and do animations. MAGDRAW reads the nuclear and magnetic structures following Rietvelt refinement in standard programs like "FULLPROF". The structure is displayed as a 3D object that can be easily rotated.


    DyMn6Ge6 incommensurate magnetic structure in MAGDRAW. The magnetic structure is characterized by two propagation vectors K1=(0,0,0) and K2=(0,0,.16). the first one provides a ferro-magetic component to the helical part described in K2.


    Cu4O3 commensurate magnetic structure in MAGDRAW

    MILLER PLANES, ISOSURFACE OF ELECTRON OR SPIN DENSITY

    Miller planes can be shown in the crystallographic cell to help visualise local structure. Standard representations of atoms and structural units(balls,sticks,polyhedra etc) are available. High quality images and animations can be saved for publications or presentations.
    Atomistic representations are also being explored for visualising the results of solid state, first principles calculations on materials. Computational codes like VASP based on density functional theory (DFT), allow electron and spin density to be calculated and these can be displayed with the crystal structure.

    3D isosurface and 2D contour plot representations of electron density, calculated by VASP for LiFePO4.

    MOLECULES/DISPLACEMENTS

    The animation capabilities in LAMP can be used to visualise molecular dynamics simulations and calculated phonons and molecular vibrations.


    Scroll Spectra

    This provides a window for scrolling through the individual spectra within a workspace. At start-up only triangles are displayed until an input workspace is selected using Load W#.

    The Scroll Spectra window diplaying just two spectra from a workspace
    [Snapshot]



    To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]







    The LAMP Book - Page 5 - Manipulating Workspaces

        5.   Manipulating Workspaces


    Imagemap | Formula-Entry Window | One-line Macros (Do buttons) | Errors | Workspace Array and Data Dimensions | Workspace History | User-Macro Files | Internals accessible functions | IDL Help | Instrument or Data Parameters | Session Journal | Saving the Session | Exiting LAMP


    The 'Formula-Entry Area' showing entered formulae and workspace history

    Imagemap - Click on any point to go to the relevant paragraph.


    To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]


     






    The LAMP Book - Page 6 - Common Workspace Functions

        6.   Common Workspace Functions


    Formula-entry syntax (IDL) | Simple Algebra ( +, -, /, * ) | Extracting sub-arrays | Integrating (total) | Normalising on Monitors | Maths-functions | Showing Values (show) | Shifting axes | Resizing an array (congrid) | Putting Workspaces together | | Changing Data-type | Graphics


    Formula-entry and Do text area syntax is IDL

    All text entered in the formula-entry area is parsed and then sent by LAMP to the Interactive Data Language (IDL). The main reason for parsing is to enable blocks of related arrays in a source workspace (see Main Concepts) to be passed together to a target workspace.
    The passing rule is :-
    The workspace, eg. w2, on the left of the '=' is the target workspace, whilst the first workspace, eg. w1 , on the right of the '=' is the source workspace.

    Extensive on-line help is available on this language by pressing the IDL? button. You can make any IDL command through the formula-entry area, and these will normally be operations on workspaces. LAMP provides maximum flexibility by giving you access to the majority of its working variables, either for one line commands or for command files. You can put data into any variable that you have declared and operate on it with IDL, but these variables will not be managed by LAMP, the variables a,b,c,...z are available for your use. 3.14159... can be obtained by typing in " !PI"


    Note: In the following we refer to data in the x-dimension as "channels" and in the y-direction as " spectra". Appologies to crystalography.


    See IDL help for more functions.

    To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]







        7.   Other Display interfaces and "TOF legacies

        7.   Other Display interfaces and "TOF legacies


    Filling reciprocal space | Magnetic scattering cross-section | George Layout | Mask & Group masking grouping spectra | TOF reduction legacies

    Filling reciprocal space

    Represention of a serie of scans during acquisition to survey different regions of the reciprocal space and identify complex features due to incommensurability or diffuse.



    Using the function MAKE_VOLUME we obtain a real 3D object which may assist during the mesurement to identify the observed intensities appearing outside Bragg positions. Syntax is: w2=make_volume(w1,/hkl)
    Now the figure below shows nuclear and diffuse, magnetic scattering from many data sets taken on D9 on TbMnO3. By interactively rotating and zooming the data in (hkl) space, the data can be inspected in detail and indexing the reflections becomes easier. The 2D projections can be moved dynamicaly through the volume to help locate more precisely diffracted intensity of interest.


    Magnetic scattering cross-section example

    Using the program suite described in the TOF-Manual (linked in the FRONT page) here is an example of diffuse scattering in manganese oxide (MnO) from D7.
    Magnetting scattering cross-section of a 5g MnO single cristal at -122°C, 30°C above the temperature at which the sample orders magnetically. The nuclear contribution to the scattering has been removed using neutron polarisation analysis. Magnetic manganese atoms tend to align themselves at temp greater that the Néel temperature.



    George Layout

    GEORGE (General Experiment Organisation, Response and Guidance Executive) allows on-line data analysis to be combined with any instrument control and data acquisition sequences. The macros written by the instrument scientist has a frequency property which determines how often information is sent to, or received from the instrument control system. Other properties when updated in the macro, allow George to display "live" texts, images, fit results etc...
    The Control Pad with there pull-down buttons is dynamicaly constructed at launch from a text file edited by the scientist!!!


    Mask & Group

    This interface allows the noisy or unwanted spectra in a workspace to be masked and the remaining spectra to be regrouped into a new workspace. At start-up a colour chart is displayed until a workspace is loaded using the Load W# button.

    The Mask & Group window with some spectra already masked
    [Snapshot]


    The TOF Manual which will help you to reduce Time-of-Flight data is linked to the FRONT page


    DidLine | Convert to Energy (t2e) | Rebinning Irregular Data (rbin) | Convert to s(Q,w) | Normalise to Vanadium (vnorm) | Normalise Backscattering Spectra (bsnorm) | Line-up Elastic Peaks (lineup)

    DidLine

    A friendly way to inspect rapidly the Tof raw data.
    The call is :Wi = didline(Wj) Where Wj = Workspace containing the raw sample.

    This command invokes an intermediate interface to specify essentials inputs.
    Before calling didline check the following parameters:
    Pj( 2)= Doppler frequency (Hz)
    Pj(11)= Temperature (K)
    Pj(18)= Channel width (microsec.)
    Pj(21)= Wavelength (angstroms)
    Pj(27)= Distance Det - Sample (meter)


    Convert to Energy (t2e)

    LAMP uses the function t2e (tee) to convert the x axis from time-of-flight (channels) to energy. Usually it is best to normalise, remove noisy spectra, subtract background etc. before using this transformation.
    The function is written in IDL and can be examined by pressing the User Macros? button and selecting t2e.pro from the list which appears.

    LAMP makes two simple checks on the input workspace before converting to energy.
    1. Does the workspace contain more than 1 point?
    2. Does the text t2e exist in the history of the workspace?
    If the input workspace is suitable, t2e will convert the energy scale and make the appropriate corrections to the intensity for changing from time-bins to energy-bins. The title of the x-axis is changed. A "shot" sound indicates success and a "crunch" sound signifies an error. Please report unexplained errors.


    Rebinning Irregular Data (rbin)

    Data on an irregular energy-scale can be rebinned to a regular grid by typing rbin in the formula-entry window. A window opens in which the energy range and energy increment can be chosen for a given input and output workspace.
    The rbin window makes and executes the command: w_out=ebin(w_in, E min, E max, increment)

    If required this command can be entered directly in the formula-entry window as, eg.

    w2=ebin(w1,-0.7,7.0,0.05)


    Convert to s(Q,w)

    When time-of-flight versus angle data are transformed to energy versus momentum transfer (Q,w), the data points fall on a rather irregular grid. A Delaunay triangulation of the planar set of Q, w points is constructed and used to interpolate the data onto a regular grid which can simplify preliminary analysis.
    The function sqw performs this task but the syntax is complicated so you are strongly recommended to use the sqwwin command, but if you wish to make conversion within a macro or command file you need to use the sqw function.

    Function sqw

    example syntax: w2=sqw(w1,0.02,0.1,-1.0,1.0,0.1,2.0)
    Order of arguments: (input workspace, energy increment, Q increment, energy min, energy max, Q min,Q max)
    You should use a course grid whenever possible otherwise the processing time will be very long. Choose Q max, Q min within the limits of the data.
    An aditional argument ,/fast can be added if the Q, w grid of the input workspace is the same as that used for a previous call of sqw, the same triangles will then be used, making the calculation faster.

    Command sqwwin

    Typing sqwwin in the formula-entry area will bring up a special interface to set the arguments for the sqw function and then perform the calculation.

    Adjust the sliders to select the workspaces (in and out), the energy (E) and Q ranges of interest. The default maximum Q corresponds to the maximum energy transfer in the highest-angle spectrum - that is 1 point! Usually you should reduce the maximum Q value. You should avoid generating more than about 30 points in energy and 50 values in Q.

    Press the Do Interpolation button to start the calculation. If sqwwin has been used previously you will get extra options related to the triangles calculated before. If in doubt, select the Delete Triangles option. The interface closes when the calculation is complete.


    Normalise to Vanadium (vnorm)

    The function vnorm will take the integral of a given spectral region in one workspace and then divide the corresponding spectra in a second workspace by this integral.

    The limits are those of the elastic peak in the vanadium spectra and must be given in channels not energy.
    You can use this to get s(Q) for either an elastic or inelastic peak by extracting the spectra of interest eg.:
    w2=w1(150:200,*) and then normalising: w4=vnorm(w2,w3,230,250)


    Normalise Backscattering Spectra (bsnorm)

    The function bsnorm is used to normalise backscattering spectra to the monitor spectrum eg. to normalise workspace,w1, and put the normalised workspace into w2, type

    w2=bsnorm(w1)


    Line-up Elastic Peaks (lineup)

    Because there are frequently small differences between the distance from the sample to individual detector-groups there can be slight differences in the time-of-flight channel in which the elastic peak arises. When keyword NOFIT is set, the function lineup first smoothes each spectrum and then estimates the position of the maximum. if NOFIT is not present then a gaussian fit is made for all spectra. An average of these positions is taken and then all spectra are shifted so that their elastic peaks are at the average position. Any peak which is more than 10 channels away from the elastic-peak channel given in the parameters is not shifted. The new average peak position is returned in elas but not entered in the parameters automatically.

    The counting statistics in an individual spectrum need to be adequate to enable the elastic-peak to be found. Otherwise the routine does nothing.


    To Top     [PREVIOUS PAGE] [MAIN CONTENTS] [NEXT PAGE]







    The LAMP Book - Page 8 - LAMP Macros

        8.   LAMP Macros


    Command Files | Command Files with loops | Compileable Macros (*.pro files) | IDL Basics | Passing of Common Variables | An Example Macro: demo.pro | How LAMP deals with macros | Statistics errors handling | Simple IDL programming


    Command Files

    Command files are simply a list of functions or commands written into a file as they would be typed in the formula-entry area. The file can then be called up in the formula-entry and Do input text area and the functions it contains will be executed, line by line.

    Files can be written in a window which is opened by pressing User Macros? button and selecting the Create a new: Batch option, the filename should be given a *.prox form, select Write new file to save it in your directory.

    This would be executed by entering @demo in the formula-entry or Do input text area.


    Command Files with Loops using the XBU interpreter

    You have access to the XBU interpreter from item "Lamp/Layout" in the menu-bar of Lamp.
    You will be able to execute a command file in which you can insert statements like While , for , if. This tool is very usefull for writing simple codes without programming and compiling. You also write some conditionnal codes in the runtime version of Lamp (see the Help in the XBU interface).


    Compileable Macros (*.pro files)

    More elaborate IDL functions and commands (such as t2e used to convert time-of-flight channels into energy units) can be written, compiled and saved as macros using LAMP. They can then be executed in the formula-entry area.

    A macro procedure can be written by pressing the User Macros? button and selecting the Create a new: Macro option, the filename should be given a *.pro form. After writing the file pressing Write new file will compile and save it, any compile errors will appear in the shell window from which LAMP was started.