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
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.
w3=w1+w2
in the formula-entry window. Subtraction,
multiplication etc. are similar. In these operations LAMP will transfer the
parameters, axes values, titles (and monitors) of the first workspace after
the " =" sign into the new workspace (see passing
rule above).
Effectively, w3=w1+w2
also implies:
p3=p1; n3=n1; x3=x1; y3=y1; titles in w3=titles in w1 ...
w4=w1(*,0:39)
In this example the * implies all channels. N.B. 1 has to be subtracted from the spectrum numbers to suit the IDL array numbering.
To extract channels 250 to 500 for all spectra from w1 into w4
w4=w1(249:499,*)
To extract channels 250 to 500 for spectra 30 to 40 from w1 into w4
w4=w1(249:499,29:39)
N.B. LAMP ensures that parameters, axes etc. are transferred correctly but it does not update the values for the number of spectra and number of channels in the new parameters. These can be edited using the Data Params button.
total)w5=total(w4,2)
where 2
represents the second dimension (y) ie. the spectra.
The sum of a range of spectra could be made, say from Spectrum #30 to Spectrum
#40 using
w2=w1(*,29:39) & w2=total(w2,2)
w2=total(w1(*,29:39),2) is correct but Lamp will not update new axis.
To sum across all the channels, eg. for s(Q)
w3=total(w1,1)
If only elastic s(Q) is required and the elastic-peak position is
known to be from say 200 to 220
w3=w1(199:219,*) & w3=total(w3,1)
w3=total(w1(199:219,*),1) is correct but Lamp will not update new axis.
w1=w1/n1
If you need to normalise with the integrated monitor spectrum,
for spectra of say 512 channels you must sum across the channels using
(n1 can be two-dimensions)
w1=w1/total(n1(*,0))
If the position of the peak in the monitor is known to be say 220
to 240 channels then a better result is obtained with
w1=w1/total(n1(219:239,0))
If this command is used frequently it should be put into a
one-line macro, a
command file or a macro.
x*2
x/2
x^2
sqrt(x)
abs(x)
exp(x)
alog(x)
(natural) or alog10(x)
(base 10)sin(x)
or
asin(x)
arc-sine
show)show,x
eg. show,total(w1,1)
show,a*5
If the result is an array only the first 10 elements are displayed.
The IDL print
command can be used to display the entire
array in the shell window, eg.
print,x
Minimum and maximum values of workspaces are available in the
formula-entry area. Otherwise to get min
and max values between say channels 250 to 500 for spectra 30 to 40 of w1
show,max(w1(249:499,29:39))
The channel and spectrum in which the min or max occurs can be put into a
user parameter, say c, as follows
a=max(w1(249:499,29:39),min=b,c)
show,a
;(display maximum)
show,b
;(display minimum)
show,c
;(display index where maximum occurs)
x1=x1+0.15
congrid
)w2=congrid(w1,64,256)
join
)
w4=[ w1 , w2 , w3 ]
w5=[ [w1] , [w2] , [w3] ]
w6=[[[w1]],[[w2]],[[w3]]]
a=0
short integer, limits: -32769 to 32768b=0.0
floating (real), limits: magnitude 10c="hello"
string (text), limit: 32767 charactersChanging between data-types:
d=long(a)
convert 'a' to long-integer (limits: -2 to 2
-1) (a=0L is long integer)
e=fix(b)
truncate 'b' to integer
f=float(b)
convert
'a' to floating
f=double(b)
convert
'a' to double float
g=string(b)
convert 'b' to
string
h=round(b)
convert
'b' to nearest long integer
N.B. By default integers are 2 bytes. If you have numbers greater
than 32768 you will get odd results unless you work with long-integers or floats, eg.
enter w1=float(w1)
in the formula-entry window.
plot,a,b
oplot,a,b
contour,a,b,c
surface,a,b,c
shade_surf,a,b,c
surface
but with shading.
N.B. The plot-range buttons in main Lamp window only apply to workspaces. When you issue
the above commands you must set xrange,yrange
and
zrange
manually, eg. to plot monitor 1 of workspace w3 from 200
to 250 channels:
plot,n3(*,1),xrange=[200,250]