.ec _
.ll 76
.ad b
.in 4
.\"====================================================================
.ti -4
1 Language
.ti +10
ANALYSE_\ Command Language Summary
.br

.nf
 COMMENT            Manipulate the COMMENT section of spectra
 DIVIDE             Divide R spectrum by T spectrum
 DRAW               Call the cursor or plot comments
 FILL begin end     Fill from begin to end with noise, blank, etc.
 FFT                Compute and edit Fourier Transform of R or P
 GREG [name]        Make a TABLE or formatted file from current scan
 LMV                Convert a data cube into a set of spectra
 MAP [M|W]          Plot a map of spectra (or only their location)
 MEMORIZE Arg	    Memorize the current observation
 MODEL Var          Generate a CLASS spectrum from a 1D variable
 NOISE [S [NEW]]    Generate gaussian noise
 PRINT [Arg]        Print values in a formatted file, or a table
 POPUP              Zoom a spectrum from a STAMP, MAP or PLOT /INDEX
 REDUCE             Reduce a SKYDIP
 RESAMPLE Arg       Resample a spectrum on a specified grid
 RETRIEVE Arg       Retrieve an observation from the memories
 SMOOTH [Arg...]    Smooth the spectrum in R
 STAMP              Display all spectra in index on one plot
 STRIP File         Create an image for Position-Velocity plots
 TABLE              Build a GILDAS table from the current index
.fi
.\"====================================================================
.ti -4
1 COMMENT
.ti +4
 ANALYSE_\COMMENT [READ|WRITE|APPEND|EDIT|DELETE] ["comment"]

This command READs, WRITEs or DELETEs an existing comment
section (max. length: 1020 characters) of the current R buffer.
.in +2
.nf
READ      display the comment section
WRITE     write (or append) the input comment given between
          double quotes.
EDIT      write a comment given interactively
DELETE    delete and reset the comment section
APPEND    Obsolescent
.fi
.in -2
.\"====================================================================
.ti -4
1 DIVIDE
.ti +4
 ANALYSE_\DIVIDE Threshold

This command divides the spectrum in R by the spectrum in T, which is
left unchanged. The two spectra must be on the same velocity scale
(Use command RESAMPLE to do so). Threshold is a value to avoid zero
divide. The output spectrum is blanked for channels where abs(T) <
Threshold.
.\"====================================================================
.ti -4
1 DRAW
.ti +4
 ANALYSE_\DRAW [Action [Parameters]] [/PEN Ipen]

This command executes the specified drawing action, or calls the
graphic cursor and uses the returned character from the cursor to
execute the corresponding action. The mnemonic for the cursor
characters are :
.nf
       F for "FILL" To interpolate a bad channel
       K for "KILL" To flag a bad channel
       L for "LOWER" To flag line identifications, ...
       M for "MASK" To show active masks
       T for "TEXT" To annotate your spectrum
       U for "UPPER" Similar to LOWER
       W for "WINDOW" To show current line windows
.fi
any other to display the channel number, frequency, velocity and
antenna temperature at the cursor position. The explicit form does
not call the cursor and can be used in procedures.

The pen used to draw the elements can be customized with the option
/PEN.
.\"--------------------------------------------------------------------
.ti -4
2 FILL
.ti +4
 ANALYSE_\DRAW FILL Nchan

Interpolates the value of the specified bad channel using the nearest
valid channels. Channel Nchan must be blanked before.  In cursor mode,
the channel number is retrieved from the cursor position.
.\"--------------------------------------------------------------------
.ti -4
2 KILL
.ti +4
 ANALYSE_\DRAW KILL Nchan

Deletes the specified channel, i.e. attributes the blanking value to
it. In cursor mode, the channel number is retrieved from the cursor
position.
.\"--------------------------------------------------------------------
.ti -4
2 LOWER
.ti +4
 ANALYSE_\DRAW LOWER value "text" [angle]

Draws a vertical line with label "text" (written vertically
by default, or with orientation 'angle' in degree) at
abscissa 'value' in lower axis unit. The line length is
adjusted to approach closely the spectrum value at the
corresponding abscissa.
.\"--------------------------------------------------------------------
.ti -4
2 MASK
.ti +4
 ANALYSE_\DRAW MASK [Level]

Plots the active masks, with bars at the mask positions and Y=Level
(Default 0).
.\"--------------------------------------------------------------------
.ti -4
2 MOLECULE
.ti +4
 ANALYSE_\DRAW MOLECULE frequency name [angle]

Display a molecule name at the given frequency (irrespective
of the units from the SET UNIT command), with a given
orientation (angle, default 90). The name lies on the lower
X-axis.

.in +6
.nf
frequency     Frequency in MHz of the line
name          String giving the name to be written
angle         Orientation, in degree, with respect to X-axis
.fi
.in -6
.\"--------------------------------------------------------------------
.ti -4
2 UPPER
.ti +4
 ANALYSE_\DRAW UPPER Value "text" [angle]

Draws a vertical line with label "text" (written vertically
by default, or with orientation 'angle' in degree) at
abscissa Value in upper axis unit. The line length is
adjusted to approach closely the spectrum value at the
corresponding abscissa.
.\"--------------------------------------------------------------------
.ti -4
2 TEXT
.ti +4
 ANALYSE_\DRAW TEXT X Y "text" I

Writes (horizontally) the string "text" at plot position (X,Y)
in paper units, with the centering code I for the string.
.\"--------------------------------------------------------------------
.ti -4
2 WINDOW
.ti +4
ANALYSE_\DRAW WINDOW [Ylow [Yup]]

Plots the current line windows, with bars. Ylow (default at bottom of
the plot) and Yup (default 10% of Y range) refer to the bottom and
upper levels of the windows drawn.
.\"====================================================================
.ti -4
1 FFT
.ti +4
ANALYSE_\FFT [/REMOVE [wmin wmax]]
                [[s1 e1] [s2 e2] ... [s10 e10] /KILL]
                [/INDEX] [/OBS] [/NOCURS]

FFT computes a Fourier transform and plots it. Since Fourier
transforms can not deal with sparse data, blank values in the input
data (spectrum or index) are replaced by interpolated values.

The command acts either on a single spectrum (from the R buffer) or on
the INDEX. The default behavior is defined with SET ACTION, but can
always be ignored with /OBS or /INDEX. Identically, the option /NOCURS
overrides the default cursor.

Three modes are available (see subtopic for details):
.in +4
.ti -2
-_ no option: the FFT is computed and plotted. The RY values are not
modified.
.ti -2
-_ /KILL allows to linearly interpolate pieces of the Fourier
transform, either interactively or by supplying values.
.ti -2
-_ /REMOVE indicates that the Fourier transform is to be computed from
a spectrum linearly interpolated in some intervals (specified or taken
from the last fitted profiles).
.in -4

If the action is applied on the R buffer, the result (including /KILL,
if any) of the FFT is available in the variables R%FFT%X and R%FFT%Y.

There is no option to customize the FFT plot limits. A custom plot can
be done as follows:
.nf
  LAS> FFT  ! Fill the R%FFT%X and R%FFT%Y arrays
  LAS> G\LIMITS /VARIABLES R%FFT%X R%FFT%Y  ! Auto X and Y limits
  LAS> G\LIMITS 0.0 1.0 = =  ! Override X limits with custom values
  LAS> CLEAR
  LAS> G\BOX
  LAS> G\HISTO R%FFT%X R%FFT%Y
  LAS> G\LABEL "Inverse Frequency (MHz\\u-1\d)" /X
.fi
.\"--------------------------------------------------------------------
.ti -4
2 /KILL
.ti +4
FFT [s1 e1] [s2 e2] ... [s10 e10] /KILL

Perform a linear interpolation (on real and imaginary parts) on the
fourier transform. The intervals are defined interactively (if no
value supplied and the cursor is available) or from the command line
(if values in MHz-1 are supplied).
.\"--------------------------------------------------------------------
.ti -4
2 /REMOVE
.ti +4
ANALYSE_\FFT /REMOVE [wmin wmax]
.br
If no value supplied, the sum of existing fits of the
current method is subtracted before computing the Fourier
transform. If an interval is supplied, linearly interpolate
between wmin and wmax.
.\"====================================================================
.ti -4
1 FILL
.ti +4
ANALYSE_\FILL s1 e1 [[s2 e2] ...] [/INTER] [/NOISE [rms]] [/BLANK [bval]]

Performs the specified action in the interval(s) specified
with starting and ending values (in current units).

/INTER
.in +4
Makes a linear interpolation. When combined with /NOISE
[rms], a Gaussian noise is added to the linear interpoltion.
.in -4
/NOISE [rms]
.in +4
Fill in the interval(s) with a Gaussian noise of a given rms. The rms
defaults to the one computed in the BASE section. If this section is
absent, it is computed from Tsys, resolution and integration time in
the GENERAL section. If one of these values is null (e.g. spectrum was
generated by the command MODEL), an error is raised. This option can
be combined with /INTER.
.in -4
/BLANK [bval]
.in +4
Fill in with blank value unless bval is specified.
.in -4
.\"====================================================================
.ti -4
1 GREG
.ti +4
ANALYSE_\GREG Name [/FORMATTED [Format]]
.ti +4
ANALYSE_\GREG Name /READ [X n] [Y m]

Writes in file Name the contents of R buffer as a GILDAS table, or as
a formatted file if the /FORMATTED option is present.

If the /READ option is present, performs the reverse operation: load
the file content in the R buffer. Only available for formatted files;
the equivalent capability for GILDAS tables is available through a
combination of DEFINE IMAGE and MODEL.

For the table, the information stored is :
.nf
    1. Intensity
    2. Channel number
    3. Velocity
    4. Offset frequency
    5. Rest frequency
    6. Image frequency
    7. Fitted profiles if any - fit(i),i=0,nline - in column 7+i
.fi
Line #0 means sum of all lines. Then all lines are written
individually. The output table can be put later in a formatted way
using GILDAS task LIST in you need.

The table may be used as input to GreG to produce fancy
plots, or by the GILDAS software for other applications. In
particular, SIC variables can be used to subtract any of the
fits from the spectrum to produce residuals if needed.  For
plots, note that you can produce essentially the same within
CLASS, except under very special circumstances, and moreover
that only CLASS can handle the different X-unit
simultaneously.

For the formatted list, less information is written (and it takes
longer to write it of course) :
.nf
    1. Current X unit in column 1
    2. Intensity in column 2
    3. Fitted profiles - (fit(i),i=0,nline) - in column 3+i
.fi

The /FORMATTED option can be passed a custom Fortran format, e.g. to
extend the number of digits in each column. Default is
"(1PG17.9,12(1PG12.4))". Do not forget to provide the enclosing
parentheses and as many specifications as the number of columns (up to
13 depending on the number of line fits). For example
"(F15.6,1X,F15.4)" is valid if no line fit is available.

For the /READ option, columns are X 1 Y 2 by default but can be
changed. If X 0 is given as zero, then only Y is read and X is filled
with channel numbers. Only very coarse header information is filled
in. A lot of complementary header editing will often be needed.
.\"====================================================================
.ti -4
1 LMV
.ti +4
ANALYSE_\LMV DataCube [/SCAN LAMDBA|BETA] [/STEP DLAMBDA [DBETA]]
[/LINE LineCube] [/FORCE What Value]

Read the spectra cube stored in input DataCube and convert it in a set
of spectra automatically written in the currently opened output
file. The spectra cube can be ordered in LMV, VLM, LVM, etc... FITS
files are automatically converted.

By default, the command sorts the spectra to mimic the scanning path
of a telescope along the lambda direction, shifted on beta for each
scan. Each constant beta row has a unique SCAN number. The sorting can
be rotated by 90 degree by using the /SCAN BETA option.

Fully blanked spectra in the input cube are ignored. If the cube
spatial axes are largely oversampled, the /STEP option allows the user
to select 1 spectrum every DLAMBDA (resp. DBETA) in the LAMBDA
direction (resp. BETA). DLAMBDA and DBETA are expressed in pixel
numbers. If DBETA is omitted, it defaults to DLAMBDA. The default
value of DLAMBDA and DBETA (if the /STEP option is not invoked) is 1,
implying a conversion of the whole cube.

User should take care that many parameters of the CLASS spectrum
headers have no meaning here. They are left to their default values.

If /LINE provides a LineCube which matches exactly the DataCube
(dimensions, coverage, source name, ...), each spectrum extracted from
the DataCube is exported with a LINE Associated Array extracted from
the LineCube. The LineCube should encode with 1 the parts of the cube
where there is signal, and 0 where there is no signal. The LINE
Associated Array can be reused later on with the commands SET WINDOW
/ASSOCIATED and BASE.

If /FORCE is present, elements from the cube header can be overriden
at import time. For now, only the scale unit can be customized with
the keyword UNIT:
.br
_ _ /FORCE UNIT Value
.br
where value is a keyword for supported scale units. This is useful for
cubes imported from outer world where the scale unit syntax may
vary. Type "LMV cubename /FORCE UNIT ?" for possible choices.
.\"--------------------------------------------------------------------
.ti -4
2 FAXIS
.ti +4
ANALYSE_\LMV frequency/velocity axis

If your input file is a Gildas cube (3 dimensions) but it has no or
incomplete frequency/velocity axis description (as found in the
spectroscopic section), it can not be imported as spectra into Class.

However, you can fix this by setting by yourself this description in
the file header. This can be achieved with Sic commands as follows:
.nf
  DEFINE HEADER H mycube.lmv WRITE
  LET H%F__AXIS   ??   ! [    ] Freq/Velo axis (1, 2 or 3)
  LET H%UNIT?    ??   ! [Keyword] Fill e.g. UNIT3 if F__AXIS is 3. Keyword must
                                  be VELOCITY or FREQUENCY according to H%CONVERT
  LET H%LINE     "SOMELINENAME"
  LET H%FREQRES  ??   ! [MHz ] Channel spacing
  LET H%IMAGFRE  ??   ! [MHz ] Image Frequency
  LET H%RESTFRE  ??   ! [MHz ] Rest frequency
  LET H%VELRES   ??   ! [km/s] Most likely -C*H%FREQRES/I%RESTFRE
  LET H%VELOFF   ??   ! [km/s] Velocity at reference channel H%CONVERT[2,H%F__AXIS]
  LET H%DOPPLER  ??   ! [    ] Doppler factor (Class convention)
  LET H%VTYPE    ??   ! [code] Velocity type (see codes in SIC%CODE%VELO%)
  LET H%SPEC     14   ! Section size => non-zero enables the section
  DELETE /VARIABLE H  ! Save the modifications in the file
.fi

If your input cube is a FITS cube, you can either:
.in +4
.ti -2
-_ edit the FITS with you favorite FITS editor, and add the missing
keywords, or
.ti -2
-_ convert the FITS to the Gildas Data Format:
.nf
  V\FITS mycube.fits TO mycube.lmv
.fi
and follow the steps above.
.in -4
.\"====================================================================
.ti -4
1 MAP
.ti +4
ANALYSE_\MAP [Match|Where|Keep] [/CELL Size__X [Size__Y]] [/GRID]
[/NOLABEL] [/NUMBER] [/BASE [Ipen]]

Makes a map of spectra or display the true locations of the
spectra. Offset limits are automatically computed, and it adjusts the
size of a spectrum depending in the current box size. If not in
WHERE-mode, the only constraint of MAP in this mode is that the X and
Y limits must be fixed so that the spectra share a common scale.

MATCH
.in +4
To force matching the X to Y ratio, which is otherwise adjusted so as
to make the largest possible drawing.  The options control
presentation details.
.in -4

WHERE
.in +4
Only displays the spectra locations with crosses (the marker can not
be modified). Can be combined with MATCH. Global variables idx%loff
and idx%boff contains offsets positions of all entries of the current
index, and may also be used, with GREG1\ commands (g\limit, g\box,
g\point), to display the spectra locations. In this case, the marker
can be modified (g\set marker).
.in -4

KEEP
.in +4
Will not recompute the grid. Uses the last grid. Can be useful for
online display.
.in -4

The actual graphic output is delayed until the end of the index has
been reached. This process may be slow on some inplementations and
graphic terminals when the number of spectra is large. The MAP command
can be interrupted by typing Control-C.
.\"--------------------------------------------------------------------
.ti -4
2 /GRID
.ti +4
ANALYSE_\MAP /GRID

A grid is plotted to separate the spectra.
.\"--------------------------------------------------------------------
.ti -4
2 /CELL
.ti +4
ANALYSE_\MAP /CELL Size__X [Size__Y]

If the option /CELL is given, the cell size of the grid is
taken to be Size__X by Size__Y (default Size__X) current angular
units. Spectra always fill the cells.
.\"--------------------------------------------------------------------
.ti -4
2 /NOLABEL
.ti +4
ANALYSE_\MAP /NOLABEL

If the option /NOLABEL is present, the coordinates are not written
but ticks are still present. Tick can be suppressed by specifying a tick
size of zero in command SET TICK.
.\"--------------------------------------------------------------------
.ti -4
2 /NUMBER
.ti +4
ANALYSE_\MAP /NUMBER

If the option /NUMBER is present, the observation number is written for
each spectrum in the upper left corner.
.\"--------------------------------------------------------------------
.ti -4
2 /BASE
.ti +4
ANALYSE_\MAP /BASE [Ipen]

If the option /BASE is present, a line at Y=0 will be drawn in
addition to the spectrum, using pen number Ipen (default current pen).
.\"====================================================================
.ti -4
1 MEMORIZE
.ti +4
ANALYSE_\MEMORIZE [Name]
.ti +4
ANALYSE_\MEMORIZE Name|* /DELETE

If a Name is specified, put a copy of the current observation in a
"memory" called Name (limited to 12 characters). The observation can
later be retrieved using command RETRIEVE. If no Name is specified,
list the currently defined memories. Up to 100 memories can be defined
at a time.

MEMORIZE Name /DELETE can be used to delete one "memory" area. Use a
wildcard (*) to delete all memories.
.\"====================================================================
.ti -4
1 MODEL
.ti +4
ANALYSE_\MODEL Y__Variable [X__Variable] [/BLANK Bval] [/REGULAR [Xref
Xval RestFreq]] [/FREQUENCY LineName RestFreq] [/XAXIS Xref Xval Xinc
Unit]

Generates a CLASS spectrum from a 1D SIC variable. Note that the 1D
variable can be (and frequently is) a subset of a higher
dimensionality variable. This command is typically used either to
generate test data, or more frequently to transfer data from outside
world through ASCII files.

A second variable, if present, is interpreted as an associated X axis
scale for a presumably non linear or irregularly sampled frequency
axis, as can occur for non resampled data from AOS backends (or
optical spectra). Please note however that non linear axes are a
largely untested feature in CLASS, you should avoid this solution when
possible.

There are three (exclusive) ways to define the X axis: provide a X
array, /XAXIS option, /REGULAR option (see below). The model header
will have a minimal values set, you should update it with SET VARIABLE
... WRITE afterwards. On the other hand, if none of these three is
used, the command will copy RX and header from the previous R buffer
in memory.

.in +8

.ti -4
MODEL Y                                ! No X array
.br
Velocity and frequency axes description is copied from the previous R
buffer in memory.

.ti -4
MODEL Y X                              ! With an X array
.br
If the X array is regularly sampled, it behaves as MODEL Y X /REGULAR.
Otherwise the spectroscopic axis values are taken "as is" from the X
variable and saved as an irregular axis.

.ti -4
MODEL Y X /REGULAR                     ! With an X array
.br
Velocity axis is read from the X variable, and checked for regular
spacing. The reference channel and velocity at reference channel
(velocity offset) are taken at the middle of the X array.

.ti -4
MODEL Y X /REGULAR Xref Xval RestFreq  ! With an X array
.br
Velocity axis is read from the X variable, and checked for regular
spacing. Velocity spacing is taken from the X array. The reference
channel, the velocity at reference channel (velocity offset), and the
frequency at reference channel (rest frequency) are passed as
arguments to the option.

.ti -4
MODEL Y /XAXIS Xref Xval Xinc Unit     ! No X array
.br
Define the X axis with its reference channel (Xref), its value at
reference channel (Xval), and the increment per channel (Xinc). Units
are km/s or MHz if Unit is VELOCITY or FREQUENCY respectively. If Unit
is FREQUENCY, Xval is expected to be the rest frequency.

.ti -8
Additional options:

.ti -4
/FREQUENCY LineName RestFreq
.br
Indicate line name and the rest frequency. Default rest frequency is
300000 MHz.

.ti -4
/BLANK Bval
.br
Allow the user to provide the blanking value. Default is -1000.
.in -8
.\"====================================================================
.ti -4
1 NOISE
.ti +4
ANALYSE_\NOISE [S [NEW]]

Generates and draws a spectrum with only gaussian noise of rms S, to
be compared with actual receiver noise.

S defaults to the rms computed in the BASE section of the current
spectrum. If this section is absent, it is computed from Tsys,
resolution and integration time in the GENERAL section. If one of
these values is null (e.g. spectrum was generated by the command
MODEL), an error is raised.

If the argument NEW is present, the spectrum is not plotted but the R
buffer is copied in T, and the generated noise put into the R buffer.
The baseline section is updated accordingly (in particuler the noise
value in R%HEAD%BAS%SIGFI).
.\"====================================================================
.ti -4
1 POPUP
.ti +4
ANALYSE_\POPUP [ObsNum | OffX OffY]

Plot an observation in a popup window.

-_ POPUP without argument will invoke the cursor to select
interactively the observation to be plotted. Point the cursor to one
spectrum in the MAP, STAMP or PLOT /INDEX plots, and follow the usage
explained in the terminal window.

-_ POPUP Number will display a separate window containing a plot (same
as PLOT) of an observation specified by its number (last version
only).

-_ POPUP OffX OffY will display a separate window containing a
complete plot (same as PLOT) of an observation with offsets matching
OffX and OffY, which has been previously displayed by a command
MAP. If more than one observation have the same offsets, only the
first one will be displayed.

In the first and last cases, POPUP assumes that the index has not been
modified since the last STAMP, MAP, or PLOT /INDEX commands.
.\"====================================================================
.ti -4
1 PRINT
.ti +4
ANALYSE_\PRINT [Arg] [/OUTPUT File] [/TABLE File]

PRINT lists some observation parameters in a Greg compatible
format. It loops on all the observations in the current index (one
line printed per observation). The kind of parameters to be printed is
ruled by the optional argument Arg. Default is FIT.

.in +4
.ti -2
FIT_ _ _ _ _ _ _ Results of profile fits in current method

The information written is (1) the number of lines fitted, (2) the
observation number, (3,4) the offsets in current angle units,
(5,6,...) fit results of the current method in the same order as in
DISPLAY command. For the Gauss Method, this order is: (5) Line Area,
(6) its incertainty (7) Position (8) incert. (9) Width (10) incert.
(11) Intensity (12) Base RMS (13) Line RMS.

.ti -2
AREA_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Integrated area computed by BASE

The information written is (1) the observation number, (2,3) the
offsets in current angle units, (4,5) Area and rms noise.

.ti -2
AREA_ List_ _ _ _ _ _ _ Area in velocity ranges

The list in the same format as the FOR-NEXT loop, for example v1 v2
v3, or v1 to v2 by 1. Area in velocity ranges v1 to v2 and v2 to v3,
etc. Up to 19 ranges (20 values in list) may be listed at a time. The
information written is (1) the observation number, (2,3) the offsets
in current angle units, (4,5,...) the areas. If a velocity boundary do
not fall exactly on a channel boundary, the proper channel fraction is
added to the sum.

.ti -2
CHANNEL_ List_ _ _ _ _ _ _ _ _ _ _ _ _ _ List of channels

The list in the same format as the FOR-NEXT loop. Up to 20 channels at
a time may be listed. The information written is (1) the observation
number, (2,3) the offsets in current angle units, (4,5,...) the
channels value.

.ti -2
MOMENT_ List_ _ _ _ _ _ _ Moments of the observations

The list in the same format as the FOR-NEXT loop, for example v1 v2 v3
v4, or v1 to v4 by 1. The moments (area, mean velocity, width) are
computed in the ranges [v1,v2] [v3,v4] etc... Up to 10 ranges (20
values in list) may be listed at a time. Current unit is used.  The
information written is (1) the observation number, (2,3) the offsets
in current angle units, (4,5,6) area, position, width, (7,8,9) etc...
If a velocity boundary do not fall exactly on a channel boundary, it
is rounded to the nearest integer channel, so that no channel fraction
is involved in the computations.

.ti -2
POINTING_ _ _ _ _ _ _ _ _ _ _ Pointing fit results

Results of CONTINUUM method fit are printed in a format adapted to
pointing constants measurements. See subtopic for details.

.ti -2
FLUX_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Flux measurements results

Results of CONTINUUM method fits printed in a format adapted to flux
measurements. The information written is (1,2) The observation and
scan number, (3) a code for scan direction, (4,5) Azimuth and
Elevation in degrees, (6) Time in hours, (7,8) Position and error
along drift direction, (9) the antenna number, (10,11) Width and
error, (12,13) Intensity and rms noise, (14) Image gain ratio, (15,16)
Signal and Image frequencies, (17) Source name, (18) Observing date.
.in -4

.in +2
.ti -2
/OUTPUT File
.br
Write the results in a formatted file named File instead of on the
screen. The file is suited for later processing by GreG, in particular
for contour maps.

.ti -2
/TABLE File
.br
Write the results in a table named File. This table can also be
accessed by GreG, in a much faster (50 times) way than a formatted
file. Tables can also handle many more columns than formatted files,
and they are not limited in precision by the formatting. Mathematical
operations can be done directly on the table columns. However the FIT
results cannot be written to a table.
.in -2
.\"--------------------------------------------------------------------
.ti -4
2 FIT
.ti +4
ANALYSE_\PRINT FIT

The information written is the following ("current angle unit" is the
current SET ANGLE setting):
.in +2
- 1 Number of lines fitted,
.br
- 2 Observation number,
.br
- 3 Lambda offset [current angle unit],
.br
- 4 Beta offset [current angle unit],
.in -2

Then follows the fit results for the current selected method (METHOD
command), in the same order as in DISPLAY command. "X" means SET UNIT
unit at time of the fit.

METHOD GAUSS:
.in +2
-  5 Fitted line area [K.X],
.br
-  6 Error on fitted line area [K.X],
.br
-  7 Fitted position [X],
.br
-  8 Error on fitted position [X],
.br
-  9 Fitted width [X],
.br
- 10 Error on fitted width [X],
.br
- 11 Intensity (Area/Width/1.064467) [K],
.br
- 12 Base RMS [K],
.br
- 13 Line RMS [K]
.in -2

METHOD CONTINUUM:
.in +2
-  1 Observation number,
.br
-  2 Azimuth [degrees],
.br
-  3 Elevation [degrees],
.br
-  4 Fitted line area [counts.current angle unit],
.br
-  5 Error on fitted line area [counts.current angle unit],
.br
-  6 Fitted position [current angle unit],
.br
-  7 Error on fitted position [current angle unit],
.br
-  8 Fitted width [current angle unit],
.br
-  9 Error on fitted width [current angle unit],
.br
- 10 Fitted intensity (Area/Width/1.064467) [counts],
.br
- 11 Base RMS [counts],
.br
- 12 Line RMS [counts],
.br
- 13 Source name
.in -2
.\"--------------------------------------------------------------------
.ti -4
2 POINTING
.ti +4
ANALYSE_\PRINT POINTING

The information written is:
.in +2
-  1 Observation number
.br
-  2 Scan number,
.in +5
.ti -5
-_ _ 3_ Code for scan direction according to R%HEAD%DRI%APOS [0 drift
along elevation, +1 drift along azimuth, -1 other],
.in -5
-  4 Azimuth [degrees],
.br
-  5 Elevation [degrees],
.br
-  6 Sidereal time [hours],
.br
-  7 Fitted collimation along drift direction [arcsec]
.nf
     R%HEAD%DRI%COLLE + fitted position + R%HEAD%POS%BETOF (code 0), or
     R%HEAD%DRI%COLLA + fitted position + R%HEAD%POS%LAMOF (code 1), or
     fitted position (code -1)
.fi
-  8 Fitted collimation error (= error on fitted position) [arcsec],
.br
-  9 Antenna number,
.br
- 10 Station code,
.br
- 11 Fitted width [arcsec],
.br
- 12 Error on fitted width [arcsec],
.br
- 13 Fitted intensity (Area/Width/1.064467) [counts],
.br
- 14 RMS noise on line [counts],
.br
- 15 Source name
.in -2
.\"====================================================================
.ti -4
1 REDUCE
.ti +4
ANALYSE_\REDUCE

This command reduces a SKYDIP observation, by fitting the sky emission
using atmospheric parameters written in the observation, and displays
the results : Water vapor content and Telescope Forward Efficiency
.\"====================================================================
.ti -4
1 RESAMPLE
.ti +4
ANALYSE_\RESAMPLE Nx Xref Xval Xinc Unit [Shape] [Width] [/[NO]FFT]
.ti +4
ANALYSE_\RESAMPLE /LIKE GDFFile [/FFT]

This command resamples a given spectrum on a specified X axis in given
unit. The arguments are:
.in +8
.ti -6
Nx    the number of channels desired,
.ti -6
Xref  the new reference channel,
.ti -6
Xval_ _ the value at the reference channel. Changing the reference
frequency or velocity has non trivial effects on the axis. Use '='
when possible (see below), else change the value with caution,
.ti -6
Xinc_ _ the new channel separation. In case of FREQUENCY resampling,
the resolution is expected to be given in the restf frame. However,
RESAMPLE does not modify the current frame of the spectrum (i.e. the
Doppler factor is left unchanged), so the input frequency resolution
will be corrected to the current frame.
.ti -6
Unit_ _ VELOCITY or FREQUENCY for spectroscopic data, or ANGLE for
continuum drifts, to indicate the units used for Xval and Xinc.
.ti -6
Shape_ (optional) a keyword for the frequency response of the
synthesized channels (see subtopic for details). By default the shape
of the output channels is the same as the shape of the input channels.
.ti -6
Width_ (optional) the width of the output channels in units of the
channel separation. The default (and minimum value) is 1.
.in -8

Using an equal sign '=' for any of these arguments indicates to use
the same value as before. Using a wildcard '*' will choose an
automatic default:
.in +8
.ti -6
Nx    is set such as the last input and output channels are aligned,
.ti -6
Xref  is set such as the first input and output channels are aligned,
.ti -6
Xval  the reference frequency and velocity are left unchanged (same as =)
.ti -6
Xinc  same as =
.ti -6
Shape same as =
.ti -6
Width same as =
.in -8

/NOFFT is the default behavior. In this case, the output spectrum is a
subset of the original one if their axes are aligned to a given
precision. If not, the spectrum is resampled by direct
interpolation. In this mode the exact channel separation requested
will be used. The counterpart to this technique is that correlation is
introduced between adjacent channels and thus affects the noise
intensity (e.g. it is divided by sqrt(2) if the axis is shifted by
half a channel).

The Width parameter is used to provide an oversampled output spectrum
if needed.
.\"--------------------------------------------------------------------
.ti -4
2 /FFT
.ti +4
RESAMPLE /FFT

The resampling is done in the delay domain and the data are Fourier
transformed.  The Fourier transform is divided by the transform of the
input channel shape, then extrapolated by zeroes (if interpolation in
the frequency domain is required), multiplied by the transform of the
desired channel shape, and finally transformed back to frequency
domain. The output channel separation usually needs to be slightly
rounded (to enable use of the FFT, the input spectrum must contain a
round number of output channels).
.\"--------------------------------------------------------------------
.ti -4
2 /LIKE
.ti +4
ANALYSE_\RESAMPLE /LIKE GDFFile

/LIKE option can be used to resample automatically the spectrum on the
spectral axis used by the named GDF file (can be a cube or UV
table).
.\"--------------------------------------------------------------------
.ti -4
2 SHAPE

Four keywords are used to describe the frequency response of the
synthesized channels:
.in +8
.ti -8
-_ TBOX means a rectangular function in the delay domain, as for
unsmoothed correlator channels (sin(pi.x)/(pi.x) in the frequency
domain)
.ti -8
-_ TPAR means a parabolic function in the delay domain, as for
smoothed correlator channels (smoothing function used at Plateau de
Bure)
.ti -8
-_ FBOX means a rectangular function in the frequency domain (as for
filterbank channels)
.ti -8
-_ FTRIANGLE means a triangular function in the frequency domain (as
for filterbank channels, Hanning smoothed)
.in -8

The shape of the input channels is derived from the backend number
read in the telescope name for IRAM-30m spectra: TBOX for
autocorrelator, FBOX for other (filter) backends. Otherwise,
rectangular filter channels are assumed.
.\"====================================================================
.ti -4
1 RETRIEVE
.ti +4
ANALYSE_\RETRIEVE Name

Retrieve the observation in memory "Name" and copy it in the
R observation.
.\"====================================================================
.ti -4
1 SMOOTH
.ti +4
ANALYSE_\SMOOTH [Arg...]

SMOOTH copies R into T, then degrades the frequency/velocity
resolution of R according to the selected method. If the R buffer also
provides Associated Arrays, the smoothing method is also applied to
them, except for the method NOISE where this is not relevant. It is
not yet possible to provide a custom smoothing method for the
Associated Arrays.

The arguments are used to specify the method:

.in +4
.ti -2
- HANNING (no argument, default)
.br
The new spectrum has twice less channels and twice less
resolution. Each output channel RY[J] is evaluated from the inputs
channels as TY[I-1]/2 + TY[I] + TY[I+1]/2.

.ti -2
- HANNING_ Width_ Spacing_ [Shift]
.br
The Hann window width is ruled by the "Width" variable, and the output
channel spacing by the "Spacing" variable. By default, the left
boundaries of the first input and output channels are aligned, but
user can shift the output grid by any fraction of channel using a
custom shift ("Shift" variable). All values are expected in lower axis
unit. Invoking SMOOTH HANNING 4*res 2*res 0.5*res (where "res" is the
lower axis resolution) is equivalent to the default SMOOTH HANNING (no
argument, as described above), except it uses the generic (less
efficient) engine.

.ti -2
- GAUSS_ Width
.br
Convolves (by multiplication in the Fourier plane) by a gaussian of
specified width in current X units. Because this method does not
support bad values in the Fourier plane, bad channels are interpolated
before use.

.ti -2
- BOX_ Nchan
.br
Averages Nchan adjacent channels to produce a spectrum with Nchan less
resolution and channels.

.ti -2
- NOISE_ Flux_ Nc
.br
For each channel, sums at most Nc neighbouring channels
until a total flux Flux is reached in the sum. Then
attributes the average value (sum divided by number of
channels added) to the channel. This smoothing is
non-uniform, strictly positive, and has an obvious tendency
to produce wings...
.in -4
.\"====================================================================
.ti -4
1 STAMP
.ti +4
ANALYSE_\STAMP NX [NY] [/LABEL SCAN|NUMBER|SOURCE|LINE [...] ]

This command is intended to have a quick look at all the
observations in the index.  It makes a plot of all the
observations in the index, arranged in a "map" of NX by NY
observations. (If the index contains many observations, they
will be very small, hence the name of the command). 
The command does not require that X and Y scales be fixed.

Command POPUP allows a selective zooming of any observation displayed
by command STAMP.

.ti -4
2 /LABEL
.ti +4
ANALYSE_\STAMP NX [NY] /LABEL SCAN|NUMBER|SOURCE|LINE [...] 

The option /LABEL  writes the required additional information
(scan number, observation number, source or line name) in 
some part of the box to help identification. Several additional
informations can be displayed.
number of each observation in the
upper left part of its box.

.\"====================================================================
.ti -4
1 STRIP
.ti +4
ANALYSE_\STRIP File

STRIP creates a GILDAS 2-D image which can be used later by GILDAS to
produce Velocity-Position plots using command RGMAP. STRIP works on
the current index, and checks that it defines a true strip along one
of the main directions (according to the SET MATCH tolerance). That
means you should have build the current index with FIND /OFFSET Value
* or FIND /OFFSET * Value.  The current X unit is used. The name of
the output file must be given.

To produce a strip along another direction than X or Y, change the
offsets of your spectra using command MODIFY OFFSETS, and write the
modified spectra in a new output file.

STRIP can also produce a GILDAS 2-D image from a set of parallel
continuum drifts. The drifts must have the same steps, and be
regularly spaced.  The index must define a coherent map.

PV cuts might also be done easily in GREG from a GILDAS table or cube
with more versatility.
.\"====================================================================
.ti -4
1 TABLE
.ti +4
ANALYSE_\TABLE Filename [OLD|NEW] [/MATH Expression1 ... ExpressionN]
[/RANGE rmin rmax unit] [/RESAMPLE Nc Ref Val Inc Unit [Shape]
[Width]] [/FFT] [/LIKE GDFFile] [/FREQUENCY name rest-freq] [/WEIGHT
TIME|SIGMA|EQUAL] [/NASMYTH] [/NOCHECK
[SOURCE|POSITION|LINE|SPECTROSCOPY]]

Build a GILDAS table from current index entries. No gridding is
done. This table may be then regridded on a Regular Grid to build a
datacube for further use in GREG.

.in +2
.nf
OLD     Append to table 'filename'
NEW     Create a new table
.fi
.in -2

.in +2
/MATH
.in +2
Compute one or more mathematical expressions instead of storing a
spectrum. See subtopic /MATH for details.
.in -2
.in -2

.in +2
/RANGE
.in +2
By default, the whole X axis is stored in the GILDAS
table. A range can be imposed, in which case the unit must
be specified.
.in -2
.in -2

.in +2
/RESAMPLE
.in +2
By default, the spectra are resampled, on-the-fly while building the
TABLE, on the first spectrum X axis. This option allows to enforce
that resampling is done on the given X axis. See HELP RESAMPLE for
possible uses and caveats.
.in -2
.in -2

.in +2
/LIKE
.in +2
Same as /RESAMPLE, except that the X axis is guessed from a reference
GDF file (can be a cube or a UV table).
.in -2
.in -2

.in +2
/FFT
.in +2
To specify that resampling is done in time domain.
.in -2
.in -2

.in +2
/FREQUENCY
.in +2
To change the line name and/or the rest frequency.
.in -2
.in -2

.in +2
/WEIGHT
.in +2
Specify which weight is to be saved in the dedicated column in the
output table. Default is ruled by SET WEIGHT.
.in -4

.in +2
/NASMYTH
.in +2
Specify that the spectra offsets (X and Y leading columns) written to
the table should be rotated to offsets expressed in the Nasmyth
plane. Beware it is the responsibility of the user to remember if this
conversion was applied or not, as the data format does not keep track
of it.
.in -4

.in +2
/NOCHECK
.in +2
By default, the consistency of the index is checked against
SOURCE, POSITION, LINE and SPECTROSCOPY parameters (see
LAS_\CONSISTENCY) before building the table. If the
SPECTROSCOPY section appears inconsistent, the spectra are
resampled on-the-fly on the first spectrum X axis. Other
sources of inconsistency are not recoverable and the table
is not built. This option without keyword allows to disable
all consistency checks. With keyword(s), disable the
corresponding checks.
.in -2
.in -2

Warnings:
.nf
   1.  /MATH, /RANGE, /RESAMPLE and /LIKE are exclusive
   2.  Continuum data not supported
.fi
.\"--------------------------------------------------------------------
.ti -4
2 /MATH
.ti +4
TABLE /MATH Expression1 [... ExpressionN]

Instead of storing the spectrum (channels) for each entry in the
current index, you can use any Sic mathematical formula
(e.g. involving some R buffer variables).

The following functions are also predefined (see e.g. HELP FUNCTION
SDTV for details):
.in +4
.br
STDV(dummy)_ _ _ integrated area (K.Km/s)
.br
TPEAK(dummy)_ _ peak temperature (K)
.br
VPEAK(dummy)_ _ velocity at peak (Km/s)
.br
TDV(v1,v2)_ _ _ _ integrated area (K.Km/s) between velocities V1 and V2
.br
TPEAKV(v1,v2)_ peak temperature (K) between velocities V1 and V2
.br
VPEAKV(v1,v2)_ velocity at peak (Km/s) between velocities V1 and V2
.in -4

For example, to create a table containing the integrated area of each
spectra, you can use:
.ti +4
TABLE Filename /MATH STDV(0)

To create a table of the RMS of each spectrum measured during
BASElining, use:
.ti +4
TABLE Filename /MATH R%HEAD%BAS%SIGFI

And to create a table of the area, position, and width of the line
fitted with the command MINIMIZE for all the spectra, use:
.nf
    TABLE Filename /MATH R%HEAD%GAU%RESULT[1] R%HEAD%GAU%RESULT[2] -
      R%HEAD%GAU%RESULT[3]
.fi

Once used in XY__MAP, these tables will result in maps of integrated
area, RMS, line width, etc.
.\"====================================================================
.ti -4
1 ENDOFHELP
