LARI Method On-Line Help

This page contains documentation for IDL software implementing
"The LARI Method for ISO-CAM/PHOT Data Reduction and Analysis"

http://www.mattiavaccari.net/lari

mattia@mattiavaccari.net

Last modified: Thu Jun 5 22:53:48 2003.


List of Routines


Routine Descriptions

ADD_GLITCHES

[Next Routine] [List of Routines]
 NAME:
	ADD_GLITCHES

 PURPOSE:
	Add a glitch (position and height) list to a LISCIO structure

 CATEGORY:
	Deglitching - Utility

 INPUTS:
	LISCIO		Old LISCIO structure
	GLIST_ADD	New glitch position list
	GHLIST_ADD	New glitch height list

 OUTPUTS:
	NEWLISCIO	New LISCIO structure

 KEYED INPUTS:
	EMPTY		Adds "emoty" glitch list, i.e. glitches with
			position = 0 and height = 2*liscio.soglie(2)
			Overwrites input glist_add and ghlist_add, which
			are however needed to determine the number of
			glitches that will be added

 EXAMPLES:
	Can be used after a second, deeper deglitching (carried out e.g.
	with DEEPER_G) or simply to add empty glitches, e.g. giving
	n_add=100 & glist_add=lonarr(2,n_add) & ghlist_add=fltarr(n_add)

 SIDE EFFECTS:
	Defines a new LISCIO structure, therefore needs twice as much RAM!

 MODIFICATION HISTORY:
	24 Sep 2001	Written by Mattia Vaccari

	27 Apr 2003	Debugging (Mattia Vaccari)

(See /home/mattia/idl/lari/add_glitches.pro)


ADD_G_NJ_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ADD_G_NJ_CIA

 PURPOSE:
	Return glitches belonging to a given pixel and nearby pixels,
	higher than given thresholds and from a given input glitch list

 CATEGORY:
	Deglitching

 INPUTS:
	LIST	Input glitch position list
	HLIST	Input glitch height list
	NPIX	pixel
	NPIX1	nearby pixels
	DEV	threshold for glitches in NPIX
	FAC	DEV*FAC = threshold for glitches in NPIX1

 OUTPUTS:
	OLIST	Output glitch position list (1-D)
	OHLIST	Output glitch height list
	ACCI

 DEPENDENCIES:
	Calls	MYQUALI_G_NJ_CIA

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	21 Apr 2001	CPU efficiency improved by calling MYQUALI_G_NJ_CIA
			instead of QUALI_G_NJ_CIA (Mattia Vaccari)

(See /home/mattia/idl/lari/add_g_nj_cia.pro)


BACK_PROJECT_FAST (ADAPTED FROM CIA'S BACK_PROJECT)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BACK_PROJECT_FAST (Adapted from CIA's BACK_PROJECT)

 PURPOSE:
	Interface to the c++ code projection.cc
	Makes the fits file from raster.raster and raster.image, then
	calls projection, then reads the output and puts it in images

 CATEGORY:
      Mapping - Projection

 INPUTS:
   in                 -- IDL structure       : see get_sscdraster
   in.nscd            -- int                 : number of SCDs
   in.image           -- fltarr(32,32,nscd)  : exposures 
   in.npix            -- fltarr(32,32,nscd)  : number of used pixels
   in.rms             -- fltarr(32,32,nscd)  : pixels rms
   in.channel         -- string              : detector : LW or SW
   in.info.ra         -- dblarr(nscd)        : right ascensions
   in.info.dec        -- dblarr(nscd)        : declinations
   in.target          -- string              : target source   
   in.fltrwhl         -- string              : Filter wheel
   in.raster_rotation -- double              : rotation computed from roll angle and orientation
   in.NX_RASTER       -- int                 : mosaic image column
   in.NY_RASTER       -- int                 : mosaic image row
   in.Ra_RASTER       -- double              : mosaic image right ascension
   in.Dec_RASTER      -- double              : mosaic image declination
   in.info            -- IDL sub-structure   : World coordinates system
   in.info.roll       -- dblarr(nscd)        : roll angle
   in.info.pfov       -- fltarr(nscd)        : pixel field of view
   in.info.crpix1     -- fltarr(nscd)        : Reference pixel : x coordinate
   in.info.crpix2     -- fltarr(nscd)        : Reference pixel : y coordinate

 KEYED INPUTS:
   dir -- string : if set looks for the input fits file in this sub-directory
   side -- integer : Lens Position 0=right, 1=left, default 0
   disto -- flag : if set correct the distorsion
   nodel -- flag : FOR DEBUGGINF ONLY if set does not remove fits file
   dist_file -- string : the name of the distortion file
   hr_map -- float(?)
   hr_header -- float(?)
   machine -- string : the name of the machine, to identify the
              !cia_exec and disto_dir directories. Add your machine to
              the list of "known" ones inside the program!

 OUTPUTS:
   images -- fltarr(32,32, nscd) :  images

 KEYED OUTPUTS:
   ack -- logical :  1 ==> OK
   fatti -- bytarr(nscd)
   version -- string : the name and the version of the executable

 DEPENDENCIES:
	The executable projection
	!cia_exec and !cia_vers

 COMMON BLOCKS:
	SESSION_BLOCK, SESSION_MODE, ERROR_CURRENT, STATUS_BOOL

 RESTRICTIONS:
	Creates fits files on the default directory:
	you must have the right to write on the default directory !

 CALLED PROCEDURES AND FUNCTIONS:
	raster2headerfits, roll_to_crota, cia_debug, cia_delete_file
	ia_get_type, make_distortion_name, get_dir, pds2info

 SEE ALSO:
	PROJETTE (CIA)
	PROJETTE_CARLO (LARI)
	PROJETTE_MOS (LARI)

 MODIFICATION HISTORY:
    13 Sep 1999  Written by R. Gastaud (from projette)

    22 Dec 1999  S. Ott header update
    23 Dec 1999  S. Ott SPR-991223-00
                 (back-projection has problems under Unix)

          <2000  Modified to use new distortion maps (Carlo Lari)
           2001  MACHINE keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/back_project_fast.pro)


BK_CHECK_CAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BK_CHECK_CAM

 PURPOSE:
	Compute stabilization background and signal offset and apply
	the latter to LISCIO, BK_CUBE and STRUTTURA (it they do exist)

 CATEGORY:
	Background/Offset Determination

 INPUTS:
	LISCIO
	HOW_LONG	Characteristic scale of glitch length
	HOW_MUCH	Characteristic scale of glitch height
	PARE5		Maximum "depth of dippers/background"
	OFF_LIM		Maximum appliable offset if /HIGH_OFF is not set

 KEYED INPUTS:
	FALLO		to iteratively correct background estimate
	LOG		write log file
	PUT_OFF		apply computed offset
	HIGH_OFF	apply very high offsets (i.e. gt OFF_LIM) as well
	REP		to be set when one runs the program a second time,
			such as after the fit to correct the offset
	USE_QUALI	work only on pixels where liscio.quali=1
	VERBOSE		verbose output

 OUTPUTS:
	AMOUNT	estimate of corrected background
	DEV2	rms deviation of single-pointing background

 SIDE EFFECTS:
	Change LISCIO, BK_CUBE and STRUTTURA (it they do exist)

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	13 Mar 2001	LOG keyword added (Mattia Vaccari)
	10 Apr 2001     Does not consider masked (LISCIO.MASKG=-1) readouts
			in computing MIN_V and USE_QUALI keyword added
			(Mattia Vaccari)
	08 May 2001	BK_CUBE keyword added. Now BK_CHECK_CAM completely
			supersedes BK_OFF_CAM (Mattia Vaccari)
	05 Dec 2001	Debugging and OFF_LIM keyword added
			(Mattia Vaccari)

(See /home/mattia/idl/lari/bk_check_cam.pro)


BK_OFF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BK_OFF

 PURPOSE:
	Compute stabilization background and signal offset and apply
	the latter to LISCIO, BK_CUBE and STRUTTURA (it they do exist)

 CATEGORY:
	Background/Offset Determination

 SIDE EFFECTS:
	Creates BK_CUBE if it doesn't already exist

 SEE ALSO:
	BK_CHECK_CAM
	BK_OFF_CAM

 NOTES:
	Obsolete routine superseded by BK_CHECK_CAM and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/bk_off.pro)


BK_OFF_CAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BK_OFF_CAM

 PURPOSE:
	Compute stabilization background and signal offset and apply
	the latter to LISCIO, BK_CUBE and STRUTTURA (it they do exist)

 CATEGORY:
	Background/Offset Determination

 INPUTS:
	LISCIO
	PARE5

 OPTIONAL INPUTS:
	BK_CUBE
	OFFSET
	DEV2
	HOW_LONG
	HOW_MUCH

 OUTPUTS:
	LISCIO
	QUALI
	BK_CUBE

 RESTRICTIONS:
	Needs STRUTTURA

 SIDE EFFECTS:
	Creates BK_CUBE, DEV2 and OFFSET if they don't exist
	Defines QUALI and AMOUNT
	Writes LISCIO AND STRUTTURA

 SEE ALSO:
	BK_CHECK_CAM

 NOTES:
	Obsolete routine superseded by BK_CHECK_CAM and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	       2001	Adapted from BK_OFF (Mattia Vaccari)

(See /home/mattia/idl/lari/bk_off_cam.pro)


CATALOGUES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CATALOGUES

 PURPOSE:
	Produce ELAIS *.txt source catalogues and S/N map postage-stamps

 CATEGORY:
	Data Products Formatting/Release

 WRITTEN FILES:
	Lots of images in ./images directory

 DEPENDENCIES:
	LARI Directory Structure

 MODIFICATION HISTORY:
	14 Feb 2003	Written by Mattia Vaccari

	25 Apr 2003	(Batch File -> Procedure) conversion and
			various modifications (Mattia Vaccari)

(See /home/mattia/idl/lari/catalogues.pro)


CLEAN_SOURCE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CLEAN_SOURCE

 PURPOSE:
	"Clean" a source from glitches to improve the quality of source fitting

 CATEGORY:
	Deglitching - Utility

 INPUTS:
	M	pixel column index
	N	pixel row index
	KS	pointing index
	LISCIO

 OPTIONAL INPUTS:
	T0	beginning of region to clean (default = liscio.posi(ks))
	TF	end of region to clean (default = liscio.posf(ks))

 OUTPUTS:
	LISCIO
	O	1-D position list of cleaned glitches
	OH	height list of cleaned glitches
	IX	index list of cleaned glitches

 DEPENDENCIES:
	Calls	MYQUALI_G

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	11 May 2001	Now calls MYQUALI_G instead of QUALI_G
			VERBOSE keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/clean_source.pro)


COMPUTE_DEV_PIECE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COMPUTE_DEV_PIECE

 PURPOSE:
	Compute model-to-data standard deviation	

 CATEGORY:
	Fitting - Noise Determination

 INPUTS:
	K	Pixel row index
	H	Pixel column index
	P	Piece index
	LISCIO
	DEV4	Standard deviation
	STRUTTURA

 OUTPUTS:
	DEV4	DEV4(K,H,P) is overwritten

 TODOS:
	Adopt a uniform DEV4 calculation with
	COMPUTE_DEV_PIECE, SEARCHDEV_PIECES and PER_ST2_PIECES_X/ST2_PIECES3_X

 MODIFICATION HISTORY:
               2002	Written by Dario Fadda

(See /home/mattia/idl/lari/compute_dev_piece.pro)


CONGRID_MAPS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONGRID_MAPS

 PURPOSE:
	Increase the size of an image using CONGRID IDL routine

 CATEGORY:
	Mapping

 INPUTS:
	IMAGE		Input image
	IMAGE_BIG	Output image

 KEYED INPUTS:
	MAGNIFICATION	Magnification factor
	MINUS_ONE	Pass keyword to CONGRID
	CUBIC		use cubic spline when interpolating

 DEPENDENCIES:
	CONGRID

 MODIFICATION HISTORY:
	       <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/congrid_maps.pro)


CONVERT_A_2_C100

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONVERT_A_2_C100

 PURPOSE:
	Translate parameters into naive system, checking and forcing them
	to remain in a range of acceptable values

 CATEGORY:
	Fitting - Utility

 INPUTS:
	RAS	Structure that contains also the params in math system

 OUTPUTS:
	A	converted parameters
	RAS	Will be modified if parameters are out of the allowed range
	IZ	n_elements(ras.asave)-1
	JY	BREVE charges
	JZ	LUNGA charges 

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/convert_a_2_c100.pro)


CONVERT_A_2_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONVERT_A_2_CIA

 PURPOSE:
	Translate parameters into naive system, checking and forcing them
	to remain in a range of acceptable values

 CATEGORY:
	Fitting - Utility

 SEE ALSO:
	CONVERT_A_2_C100

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/convert_a_2_cia.pro)


DEEPER_G

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DEEPER_G

 PURPOSE:
	Perform deeper deglitching with respect to an input glitch list
	contained in LISCIO

 CATEGORY:
	Deglitching

 SEE ALSO:
	MYDEEPER_G

 NOTES:
	Obsolete routine superseded by MYDEEPER_G and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/deeper_g.pro)


DEGLITCH_1_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DEGLITCH_1_CIA

 PURPOSE:
	This procedure performs deglitching using a median filter of LENGTH
	points. If one wants to make a deeper search it may be better to use
	DEGLITCH_2_CIA as a second step

 CATEGORY:
	Deglitching

 INPUTS:
	DATI is the input (32,32,net) data cube
	SOGLIA is the level in adu to deglitch
	MBK is the mask cube set to 0 for good data (one can enter
	with all 0 apart coloumn 23) and to 1 for bad data

 OUTPUTS:
	DATI5 is the deglitched cube in which all original data have been
	substituted with the local median over LENGTH points
	NGLITCH is the number of glitches
	GLIST is a (2,nglitch) array in which glist[0,*] are the pixel
	indexes and glist[1,*] are the reading indices

 SEE ALSO:
	MYDEGLITCH_1_CIA

 NOTES:
	Obsolete routine superseded by MYDEGLITCH_1_CIA and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/deglitch_1_cia.pro)


DEGLITCH_2_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DEGLITCH_2_CIA

 PURPOSE:
	Perform deeper deglitching with respect to DEGLITCH_1_CIA
	Mask an input glitch list obtained from DEGLITCH_1_CIA and apply
	a median filter to the masked data

 CATEGORY;
	Deglitching

 SEE ALSO:
	DEGLITCH_1_CIA
	MYDEGLITCH_2_CIA

 NOTES:
	Obsolete routine superseded by MYDEGLITCH_2_CIA and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/deglitch_2_cia.pro)


EFF_AREA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	EFF_AREA

 PURPOSE:
	Compute Effective Area of ELAIS Fields

 CATEGORY:
	Utility

 KEYED INPUTS:
	NX_LIM	NPIX Limit For Effective Pixels (Default is 10)

 MODIFICATION HISTORY:
	23 Apr 2003	Written by Mattia Vaccari

	21 May 2003	Batch -> Procedure conversion (Mattia Vaccari)

(See /home/mattia/idl/lari/eff_area.pro)


E_VALUATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	E_VALUATE

 PURPOSE:
	First guess choice for parameters with the option of external 
	imposition of the background and repeated determination using 
	a first guess of transients

 CATEGORY:
	Fitting - Initialization

 INPUTS:
	DAT	deglitched cube
	E
	TY	readout at which to set initial conditions for liscio.breve
		and liscio.lunga
	VALUES_DEFAULT	default values at a conventional level of 10 ADU/G/S
	POSI, POSF	on_target initial and final readout number 

 OPTIONAL INPUTS:
	MODELBK

 OUTPUTS:
	E	corresponding for the pixel to liscio.pare
	FF	estimate of stabilized flux

 OPTIONAL OUTPUTS:
	None

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/e_valuate.pro)


FADER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FADER

 PURPOSE:
	Compute partial derivatives of model function in the naive system

 CATEGORY:
	Fitting - Glitch Modeling

 INPUTS:
	A	parameters in naive system
	RAS	structure

 OUTPUTS:
	STR	structure with derivatives

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/fader.pro)


FADER_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FADER_X

 PURPOSE:
	Compute partial derivatives of model function in the naive system

 CATEGORY:
	Fitting - Glictch Modeling

 INPUTS:
	A	parameters in naive system
	RAS	structure

 OUTPUTS:
	STR	structure with derivatives

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/fader_x.pro)


FA_LISCIO_CAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FA_LISCIO_CAM

 PURPOSE:
	Perform deglitching on RASTER structure and build LISCIO structure

 CATEGORY:
	Pipeline Reduction 

 INPUTS:
	RASTER	structure
	SOGLIA1	first deglitching threshold
	SOGLIA2	second deglitching threshold

 OPTIONAL INPUTS:
	LENGTH	length of median filter
	STEP_C	sampling interval

 OUTPUTS:
	LISCIO	structure
	DATI5	median-filtered data
	STD	noise

 KEYED INPUTS:
	NO_NOISE
	LOG	write log file 
	VERBOSE verbose output

 DEPENDENCIES:
	Calls	MYDEGLITCH_1_CIA
		MYDEGLITCH_2_CIA
		PUTGLITCH_PIPE
		MYQUALI_G
		RICAMPIONA_C100
		SMOOTH_C100

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	10 Feb 2001	Overall reorganization (Mattia Vaccari)
	23 Feb 2001	OFFSET keyword removed from procedure and OFFSET field
			added by default to LISCIO structure (Mattia Vaccari)

(See /home/mattia/idl/lari/fa_liscio_cam.pro)


FIND_NEW (ADAPTED FROM ASTROLIB'S FIND)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FIND_NEW (Adapted from Astrolib's FIND)

 PURPOSE:
	Find positive brightness perturbations (i.e. stars) in an image

 EXPLANATION:
	Also returns centroids and shape parameters (roundness & sharpness).
	Adapted from 1986 STSDAS version of DAOPHOT.

 INPUTS:
	image - 2 dimensional image array (integer or real) for which one
		wishes to identify the stars present

 OPTIONAL INPUTS:
	FIND_NEW will prompt for these parameters if not supplied

	hmin -	Threshold intensity for a point source - should generally 
		be 3 or 4 sigma above background
	fwhm -  FWHM to be used in the convolve filter
	sharplim - 2 element vector giving low and high cutoff for the
		sharpness statistic (Default: [0.2,1.0] ).   Change this
		default only if the stars have siginificantly larger or 
		or smaller concentration than a Gaussian
	roundlim - 2 element vector giving low and high cutoff for the
		roundness statistic (Default: [-1.0,1.0] ).   Change this 
		default only if the stars are significantly elongated.

 OPTIONAL INPUT KEYWORDS:
	SILENT - Normally, FIND will write out each star that meets all
		selection criteria.   If the SILENT keyword is set and 
		non-zero, then this printout is suppressed.
	PRINT - if set and non-zero then T_FIND will also write its results to
		a file FIND.PRT. Also one can specify a different output file 
		name by setting PRINT = 'filename'.
	STOP -  flag : if set, the program does not prompt for a new HMIN threshold

 OPTIONAL OUTPUTS:
	x - vector containing x position of all stars identified by FIND
	y - vector containing y position of all stars identified by FIND
	flux - vector containing flux of identified stars as determined
		by a gaussian fit.  Fluxes are NOT converted to magnitudes.
	sharp - vector containing sharpness statistic for identified stars
	round - vector containing roundness statistic for identified stars

 NOTES:
	The sharpness statistic compares the central pixel to the mean of the
	surrounding pixels.   If this difference is greater than the originally
	estimated height of the Gaussian or less than 0.2 the height of the
	Gaussian (for the default values of SHARPLIM) then the star will be
	rejected. 

 PROCEDURE CALLS:
	DATATYPE(), GETOPT

 REVISION HISTORY:
	Written W. Landsman, STX  February, 1987
	ROUND now an internal function in V3.1   W. Landsman Jul 1993
	Change variable name DERIV to DERIVAT    W. Landsman Feb 1996
	Use /PRINT keyword instead of TEXTOUT    W. Landsman May 1996
	Changed loop indices to type LONG        W. Landsman Aug 1997
	Converted to IDL V5.0                    W. Landsman Sep 1997

	      <2000	Adapted from astrolib's FIND
			Keyword STOP added (Carlo Lari)

(See /home/mattia/idl/lari/find_new.pro)


FIT_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FIT_X

 PURPOSE:
	Basically a modified version of curvefit.
	The problem with curvefit is that the values returned are not those
	of the best fit, but one iteration later.
	Fit data not blanked in EXCL with a model of 2 transients 
       including also glitches. The parameters are evaluated with the
       gradient expansion method (parts copied from CURVEFIT)
	Subroutine called e.g. by ST2_1_X

 CATEGORY:
	Fitting

	Define partial derivatives array and put in structure
	'str'- call FQ2_00* to get model and derivatives 
	find new parameters and change the model with FQ2_01*
	iterate until convergence or max number of iteration is done


 INPUTS:
	X	READOUTS ARRAY WITH GOOD TO FIT VALUES
	Y	data to be fitted
	W	intarr specifying data type	 1 : THERE IS A SOURCE
						 0 : BACKGROUND
						-1 : EXCLUDED POINTS (NEITHER)

 KEYED INPUTS:
	RAS	input raster from ST2_NJ_1_CIA + OUTPUT
		defined e.g. in ST2_NJ_1_CIA
	ITMAX	maximum number of iterations 
	TOL	tolerance on convergence

 OUTPUTS:
	the value of the fuction + RAS{.OUT,.QY,.QZ,.ASAVE(PARAMETERS)}

 DEPENDENCIES:
	FQ2_00_X
	FQ2_00
	FQ2_01_X
	FQ2_01

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/fit_x.pro)


FLATMAP_OFFSET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FLATMAP_OFFSET

 PURPOSE:
	"Flat-field" offsetted lioscio

 DEPENDENCIES:
	Calls	LISCILISCI

 INPUTS:
	LISCIO

 KEYED INPUTS:
	DRIFT
	T0	Raster Initial Effective Readout
	TF	Raster Final Effective Readout
	LENGTH	Median filtering length

 OUTPUTS:
	CUBE	De-offsetted reconstructed signal
	FLAT_CUBE	De-offsetted median-filtered reconstructed signal
	DM	Pixel-by-pixel offsetted median background
	ZERO	Detector de-offsetted median background

 EXAMPLES:
	See MAPPING_MATTIA.BAT

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/flatmap_offset.pro)


FQ2_00

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FQ2_00

 PURPOSE:
	Compute model and partial derivatives using information stored
	in the RAS structure and putting the results in the STR structure

 CATEGORY:
	Fitting

 INPUTS:
	X	readouts indexes at which the fit will be performed
	A0	parameters from the last iteration

 INPUTS/OUTPUTS:
	RAS = structure with main raster parameters, i.e.: 
		ras.posi;ras.posf;ras.nr (no. of raster.pos),
		ras.net (record length), ras.tj (glitch position),
		ras.nj (no. of glitches),ras.asave,ras.ja,
		ras.dat,ras.out,ras.is,ras.nn,ras.upper_flag

 OUTPUTS:
	YFIT	model function
	PDER	partial derivs
	STR	structure whith derivs (.dy,.dz,.di,.der,.nder,.nterms,.w,.e)

 DEPENDENCIES:
	Calls	CONVERT_A_2_CIA to pass from mathematical  variables to
		instrumental ones
		Q2MOD to build the model 
		FADER to compute partial derivatives in instrumental system,
		then compute partial derivatives in mathematical system taking
		into account the freeze condition

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/fq2_00.pro)


FQ2_00_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FQ2_00_X

 PURPOSE:
	Compute model and partial derivatives using information stored
	in the RAS structure and putting the results in the STR structure

 CATEGORY:
	Fitting       

 INPUTS:
	X	readouts indexes at which the fit will be performed
	A0	parameters from the last iteration

 INPUTS/OUTPUTS:
	RAS = structure with main raster parameters, i.e.: 
		ras.posi;ras.posf;ras.nr (no. of raster.pos),
		ras.net (record length), ras.tj (glitch position),
		ras.nj (no. of glitches),ras.asave,ras.ja,
		ras.dat,ras.out,ras.is,ras.nn,ras.upper_flag

 OUTPUTS:
	YFIT	model function
	PDER	partial derivs
	STR	structure whith derivs (.dy,.dz,.di,.der,.nder,.nterms,.w,.e)

 DEPENDENCIES:
	Calls	CONVERT_A_2_CIA	to pass from mathematical variables to
		instrumental ones
		Q2MOD_X	to build the model 
		FADER_X	to compute partial derivatives in instrumental system,
		then compute partial derivatives in mathematical system taking
		into account the freeze condition

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/fq2_00_x.pro)


FQ2_01

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FQ2_01

 PURPOSE:
	Compute model and partial derivatives using information stored
	in the RAS structure and putting the results in the STR structure

 CATEGORY:
	Fitting

 INPUTS:
	X	readouts indexes at which the fit will be performed
	A0	parameters from the last iteration
	RAS = structure with main raster parameters, i.e.: 
		ras.posi;ras.posf;ras.nr (no. of raster.pos),
		ras.net (record length), ras.tj (glitch position),
		ras.nj (no. of glitches),ras.asave,ras.ja,
		ras.dat,ras.out,ras.is,ras.nn,ras.upper_flag
	W - intarr(ras.net) - qualifying data
                             (0 background , 1 glitches -1 excluded from fit

 OUTPUTS:
	YFIT	model function 
	RAS	(updated)

 DEPENDENCIES:
	Calls	Q2MATH_X to build the model

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/fq2_01.pro)


FQ2_01_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FQ2_01_X

 PURPOSE:
	Compute model and partial derivatives using information stored
	in the RAS structure and putting the results in the STR structure

 CATEGORY:
	Fitting

 DEPENDENCIES:
	CONVERT_A_2_C100	to pass to naive variables from math ones
	Q2MATH_X		to build the model

 INPUTS:
	X	readouts indexes at which the fit will be performed
	A0	parameters from the last iteration
	RAS = structure with main raster parameters, i.e.: 
		ras.posi;ras.posf;ras.nr (no. of raster.pos),
		ras.net (record length), ras.tj (glitch position),
		ras.nj (no. of glitches),ras.asave,ras.ja,
		ras.dat,ras.out,ras.is,ras.nn,ras.upper_flag
	W - intarr(ras.net) - qualifying data
                             (0 background , 1 glitches -1 excluded from fit

 OUTPUTS:
	YFIT	model function 
	RAS	(updated)
          
 DEPENDENCIES:
	Calls	CONVERT_A_2_C100 to pass from mathematical variables to
		instrumental ones
		Q2MATH_X to build the model

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari
                       

(See /home/mattia/idl/lari/fq2_01_x.pro)


HEADERFITS_CARLO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HEADERFITS_CARLO

 PURPOSE:
	Create a new fits header for a subsampled image

 CATEGORY:
	Utility - FITS file manipulation

 INPUTS:
	HDR_IN	Input header

 KEYED INPUTS:
	MAGNIFICATION	Magnification factor
	MINUS_ONE	
	IRAF		Deals with CD-like rather than CDELT+CROTA-like astrometry

 OUTPUTS:
	HDR_OUT	Output Header

 DEPENDENCIES:
	Calls	EXTAST (CIA)
		PUTAST (CIA)
		SXADDPAR (ASTROLIB)

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	12 Apr 2002	IRAF keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/headerfits_carlo.pro)


HROT_CARLO (ADAPTED FROM ASTROLIB'S HROT)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HROT_CARLO (Adapted from Astrolib's HROT)

 PURPOSE:
	Rotate an image and create new FITS header with updated astrometry.
	Cubic, bilinear or nearest neighbor interpolation can be used.

 INPUTS:
	OLDIM - the original image array                             
	OLDHD - the original FITS image header, string array

 OPTIONAL INPUTS:
	NEWIM - If NEWIM is set to -1, then the old image and header will
		be updated
	ANGLE - Rotation angle degrees counterclockwise
	XC    - X Center of rotation (-1 for center of image)
	YC    - Y Center of rotation (-1 for center of image)
	INT   - 0 for nearest neighbor, 1 for bilinear interpolation
		2 for cubic interpolation.  

 KEYED INPUTS:
	MISSING - Set this keyword to a scalar value which will be assigned
		to pixels in the output image which do not correspond to 
		existing imput images (e.g if one rotates off-center). 
		If not supplied then linear extrapolation is used.

	INTERP - scalar set to either 0 (nearest neighbor interpolation),
		1 (bilinear interpolation), or 2 (cubic interpolation, V3.5
		or later).    Either the INTERP keyword or the int parameter
		can be specified.
	CUBIC - If set and non-zero then cubic interpolation is used (see ROT),
		which is equivalent to setting INT = 2. In IDL V5.0 and later,
		this keyword can also be set to a value between -1 and 0.

 OPTIONAL OUTPUTS:
	NEWIM - the rotated image, with the same dimensions as Oldim 
	NEWHD - header for newim containing updated astrometry info
		If output parameters are not supplied, the program
		will modify the input parameters OLDIM and OLDHD
		to contain the rotated image and updated header.

 EXAMPLE:
	Rotate an image non-interactively 30 degrees counterclockwise.  Use
	bilinear interpolation, and set missing values to 0.

	IDL>  HROT, im_old, h_old, im_new, h_new, 30, -1, -1, 1, MIS = 0

 RESTRICTIONS:
	Unlike the ROT procedure, HROT cannot be used to magnify or
	or demagnify an image. Use HCONGRID or HREBIN instead.

 PROCEDURE:
	The image array is rotated using the ROT procedure.
	The CD (or CROTA) and CRPIX parameters, if present in the FITS header,
	are updated for the new rotation.
	History records are also added to the header

 PROCEDURES USED:
	CHECK_FITS, EXTAST, GETOPT(), GETROT, ROT(), STRN(), SXADDPAR

 RESTRICTIONS:
	Must be IDL V3.5 or later so that /CUBIC keyword to ROT is recognized

 MODIFICATION HISTORY:
	Written, Aug. 1986 W. Landsman, ST Systems Corp.
	Added MISSING keyword, W. Landsman March, 1991
	Added cubic interpolation, use astrometry structure   Feb 1994
	Removed call to SINCE_VERSION()  W. Landsman  March 1996
	Assume at least V3.5, add CUBIC parameter       W. Landsman  March 1997
	Converted to IDL V5.0   W. Landsman   September 1997
       Fix for CROTA2 defined and CDELT1 NE CDELT2, W. Landsman  November 1998

	      <2000	Modified by Carlo Lari

(See /home/mattia/idl/lari/hrot_carlo.pro)


LARI_PIPE_CAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LARI_PIPE_CAM

 PURPOSE:
	Apply LARI pipeline processing to ISOCAM data, preparing it for
	Interactive Analysis

 CATEGORY:
	Pipeline Reduction

 KEYED INPUTS:
	ONE - logic	RASTER generation
	TWO - logic	LISCIO generation
	THREE - logic	Compute background and offset, read input source list
			(where available) and flag bright sources
	FOUR - logic	Run fit with PER_ST2_PIECES_X
	INT - logic	Set this keyword to stop processing and carry out
			interactive work during step /THREE
	FIELD (string)	ISOCAM LW3 field type (ELAIS or HDF), to identify
			correct parameters to be used in pipeline

 DEPENDENCIES:
	Suitable IDA CISP file or IDL save file e.g. produced by pipeline's
	previous step(s)

	Calls	FA_LISCIO_CAM
		BK_CHECK_CAM
		PER_ST2_PIECES_X
		CIA	- SPDTOSCD
			- SSCD_CLEAN
			- GET_SSCDRASTER
			- CORR_DARK

 EXAMPLES:
	LARI_PIPE_CAM, /one, /two, /three, /four, /int, field='elais'

	runs all pipeline in one go on a field, stopping only
	for interactive analysis between step three and four
	to check BK_CHECK_CAM's output

 TODOS:
	Distinguish ELAIS CAM LW2 and LW3 fields through FIELD keyword,
	and the same for the HDFs
	Pass FIELD keyword to BK_CHECK_CAM, FA_LISCIO_CAM AND PER_ST2_PIECES_X
	(but is this really necessary!?)

 MODIFICATION HISTORY:
	03 Nov 1998	Written by Carlo Lari

	   Nov 1998	adapted to run as a semi-autonomous pipeline
			(Seb Oliver)
	15 Dec 1998	adapted to use existing ICSTM reductions (Seb Oliver)
	17 Dec 1998	save_dir added so totally portable
	18 Jun 1999	adapted to use more memory-efficient version
			of FA_LISCIO (Stephen Serjeant)
	23 Jul 1999	re-adapted (Carlotta Gruppioni)
	   Mar 2001	Variously refined for the reduction of ELAIS
			Northern fields (Mattia Vaccari)
	   Dec 2001	Overall reorganization (Mattia Vaccari)

(See /home/mattia/idl/lari/lari_pipe_cam.pro)


LEGEND_LARI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LEGEND_LARI

 PURPOSE:
	Plot a part of a pixel time history with LARI quantities with a legend

 CATEGORY:
	Plotting

 INPUTS:
	M
	N
	RO	Center of plotted region (in readouts)
	SIZE	Half-width of plotted region (in readouts) 

 KEYED INPUTS:
	YDELTA		Y-axis plotted range size
	YCENTER		Y-axis plotted range center shift

 MODIFICATION HISTORY
	       2002	Written by Mattia Vaccari

(See /home/mattia/idl/lari/legend_lari.pro)


LISCILISCI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LISCILISCI

 PURPOSE:
	Calculates "reconstructed" signal

 INPUTS:
	LISCIO	LISCIO structure
	LENGTH	Median filtering length

 OUTPUTS:
	DG	Reconstructed signal
	DG5	Median-filtered reconstructed signal

 DEPENDENCIES:
	Called by	FLATMAP_OFFSET

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/liscilisci.pro)


LISCIOUPDATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LISCIOUPDATE

 PURPOSE:
	Updates LISCIO ID provided LISCIO and RASTER are defined

 CATEGORY:
	Utility

 INPUTS:
	RASTER
	RASTERV
	OFFNAME		Raster IDA Official Name

 OUTPUTS:
	TARGET
	FILENAME

 MODFICATION HISTORY
	       2002	Mattia Vaccari

(See /home/mattia/idl/lari/liscioupdate.pro)


LIST_SOURCES_SN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LIST_SOURCES_SN

 PURPOSE:
	Detect sources on a sky map and autosimulate their fluxes

 CATEGORY:
	Source Detection and Flux Autosimulation

 SEE ALSO:
	LIST_SOURCES_COMBINA

 KEYED INPUTS:
	STOP	Passed to FIND_NEW

 MODIFICATION HISTORY:
	       2002	Adapted from LIST_SOURCES_COMBINA by Carlo Lari

(See /home/mattia/idl/lari/list_sources_sn.pro)


MAKE_LARI_HELP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MAKE_LARI_HELP

 PURPOSE:
	Generate LARI software documentation in HTML format

 CATEGORY:
	Help/Documentation

 KEYED INPUTS:
	DIR	directory name (default is ".")
	FILE	help file name (defaults are "./aux/lari_help.html" or
		"./lari_help.html" if "./aux/" directory does not exist)

 WRITTEN FILES:
	FILE

 DEPENDENCIES:
	Calls	MK_LARI_HTML_HELP

 MODIFICATION HISTORY:
	02 Mar 2001 	Written by Mattia Vaccari

	07 May 2001	DIR and FILE keywords added (Mattia Vaccari)
	25 Apr 2003	FILE default value changed and miscellaneous
			improvements: now calls MK_LARI_HTML_HELP, thus
			generating hyperlinks to software source
			(Mattia Vaccari)

(See /home/mattia/idl/lari/make_lari_help.pro)


MAP2X6

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MAP2X6

 PURPOSE:
	Resample map with the "2x6" technique

 CATEGORY:
	Mapping

 INPUTS:
	MAP
	MAPX

 OUTPUTS:
	SDEV	RMS standard deviation
	ZERO	Map "zero" level

 OPTIONAL OUTPUTS
	MAPRMS	If RMS keyword is set, rms sky map is calculated,
		otherwise MAPRMS=MAP

 KEYED INPUTS:
	N_LIN
	RMS	If set, calculate rms map and write it to MAPRMS
	N_REP	Number of repetitions in ZERO/SDEV calculation (default = 1)

 MODIFICATION HISTORY:
	   Jan 2002	Written by Carlo Lari

	08 Apr 2002	N_REP keyword and 0.97 factor in SDEV calculation added
			(Mattia Vaccari)
	04 Dec 2002	N_REP keyword default value changed from 3 to 1
			(Mattia Vaccari)

(See /home/mattia/idl/lari/map2x6.pro)


MK_LARI_HTML_HELP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MK_LARI_HTML_HELP

 PURPOSE:
	Assist generation of LARI help files through MAKE_LARI_HELP
	by defining hyperlinks to IDL source files 

 CATEGORY:
	Help/Documentation

 SEE ALSO:
	MK_HTML_HELP (IDL)

 MODIFICATION HISTORY:
	28 Apr 2003	Adapted from MK_HTML_HELP by Mattia Vaccari
			to generate HTML help file with hyperlinks to
			IDL source files

(See /home/mattia/idl/lari/mk_lari_html_help.pro)


MOSAICING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MOSAICING

 PURPOSE:
	Build a mosaiced sky map of nearby and/or repeated fields and detect
	sources on the resulting sky map

 CATEGORY:
	Mosaicing

 DEPENDENCIES:
	Files - produced by offsetting program
	Calls -	PROJETTE_MOS
		MAP2X6
		RASTER2HEADERFITS_CARLO
		HEADERFITS_CARLO
		LIST_SOURCES_SN
	MACHINE variable - must be defined as listed inside the program so as to define DATA_DIR
	FIELD	variable - must be defined as either 'elais', 'hdf', 'lhs' or 'lhd'
	FIELD2	variable - must be defined as either 'S1', 'N1', 'N2', 'N3', 'HDFS', 'LHS' or 'LHD'

 NOTES:
	Logically follows TAKELISCIO and precedes MOSAICING_AUTOSIM
	See also mosaicing_*.bat

 IDEAS:
	Eliminate dependency on machine/dist_file
	Remove useless fits files (uncommenting spawned rm commands)!

 MODIFICATION HISTORY
	31 Jan 2002	Written by Mattia Vaccari

	28 Mar 2002	RAM-Efficiency improved (Mattia Vaccari)
	15 Apr 2002	Overall Reorganization (Mattia Vaccari)
	07 Oct 2002	Overall Reorganization (Mattia Vaccari)
	04 Dec 2002	Miscellaneous Debugging/Reorganization (Mattia Vaccari)

(See /home/mattia/idl/lari/mosaicing.pro)


MOSAICING_AUTOSIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MOSAICING_AUTOSIM

 PURPOSE:
	Autosimulate sources extracted from mosaic of nearby or repeated fields

 CATEGORY:
	Mosaicing

 DEPENDENCIES:
	Files - produced by offsetting and mosaicing program
		wholly reduced IDL *.save files as set within program file
	Calls -	RASTER2HEADERFITS
		BACK_PROJECT_FAST
		ST2_AUTOSIM_PIECES
		SOURCES_WHERE_SIM
		PROJETTE_CARLO
		PROJETTE_MOS
		MAP2X6
		LIST_SOURCES_SN
	MACHINE variable - must be defined as listed inside the program so as to define DATA_DIR
	FIELD	variable - must be defined as either 'elais', 'hdf', 'lhs' or 'lhd'
	FIELD2	variable - must be defined as either 'S1', 'N1', 'N2', 'N3', 'HDFS', 'LHS' or 'LHD'

 EXAMPLES:
	See MOSAICING_*.BAT

 SEE ALSO:
	MOSAICING_*.BAT

 NOTES:
	Logically follows TAKELISCIO and MOSAICING, as in MOSAICING_*.BAT

 TODOS:
	Eliminate dependency on machine/data_dir/dist_file
	Always "rm" useless fits files (uncommenting spawn commands)!

 MODIFICATION HISTORY
	13 Mar 2002	Written by Mattia Vaccari

	28 Mar 2002	RAM-Efficiency improved (Mattia Vaccari)
	15 Apr 2002	Overall Reorganization (Mattia Vaccari)
	07 Oct 2002	Overall Reorganization (Mattia Vaccari)
	04 Dec 2002	Miscellaneous Debugging/Reorganization (Mattia Vaccari)

(See /home/mattia/idl/lari/mosaicing_autosim.pro)


MOSTRA_CAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MOSTRA_CAM

 PURPOSE:
	Interactive display and modification of ISO-CAM data
	Graphical User Interface for LARI Interactive Analysis

 CATEGORY:
	Interactive Analysis - Graphical User Interface

 KEYED INPUTS:
	YES		If set, actually launches GUI 
	CHECK_SOURCES	If set, enters source-check mode
	QQ		If set, enters quanto-check mode

 COMMON BLOCKS:
	COMMON variabili, liscio,struttura,bk_cube,quanto,qui,qui0,dev4,dev,pix,fac
	COMMON check_com, imtutte, raster, quanto1, flux, ss, ind_sigma, sens

 DEPENDENCIES:
	Calls	ST2_LOCAL
		ST2_PIECES3_X
		ST2_BK_PIECES_X
		BK_OFF

 EXAMPLES:
	See MOSTRA_CAM.BAT

 MODIFICATION HISTORY:
               2002	Written by Dario Fadda

		2003	Miscellaneous modifications easing IA (Mattia Vaccari)

(See /home/mattia/idl/lari/mostra_cam.pro)


MYDATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYDATE

 PURPOSE:
	Return string containing properly formatted date, to be used
	e.g. in generating filenames

 CATEGORY:
	Utility - Saving

 INPUTS:
	prefix	filename prefix (string)
	suffix	filename suffix (string)

 MODIFICATION HISTORY:
	14 Mar 2001	Written by Mattia Vaccari

(See /home/mattia/idl/lari/mydate.pro)


MYDEEPER_G

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYDEEPER_G

 PURPOSE:
	Perform deeper deglitching with respect to an already identified
	glitch list contained in LISCIO

 CATEGORY:
	Deglitching

 INPUTS:
	LISCIO		Structure
	SOGLIA		Deglitching threshold
	T0		Beginning of piece
	TF		End of piece

 OUTPUTS:
	GLIST_ADD	list of new glitch indexes (2-D)
	GHLIST_ADD	list of new glitch heights

 DEPENDENCIES:
	Calls	MYQUALI_G

 MODIFICATION HISTORY:
	10 Feb 2001	Adapted from DEEPER_G (Mattia Vaccari)

	26 Feb 2001	RAM and CPU efficiency improved (Mattia Vaccari)

(See /home/mattia/idl/lari/mydeeper_g.pro)


MYDEGLITCH_1_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYDEGLITCH_1_CIA

 PURPOSE:
	Perform deglitching using a median filter of LENGTH points
	If one wants to make a deeper search it may be better to use
	MYDEGLITCH_2_CIA as a second step

 CATEGORY:
	Deglitching

 INPUTS:
	DATI		input (32,32,net) data cube
	SOGLIA		deglitching threshold in ADU/G/S
	MBK		mask set to 0 for good data and to 1 for bad data

 OUTPUTS:
	DATI5		deglitched cube in which all original data have been
			substituted with the local median over LENGTH points
	NGLITCH		number of glitches
	GLIST		(2,nglitch) array in which glist[0,*] are the pixel
			indexes and glist[1,*] are the reading indexes

 KEYED INPUTS:
	LOG		Log file generation
	VERBOSE		Verbose output setting

 MODIFICATION HISTORY:
	10 Feb 2001	Adapted from DEGLITCH_1_CIA (Mattia Vaccari)

	15 Feb 2001	RAM and CPU efficiency improved (Mattia Vaccari)
	14 Mar 2001	LOG keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/mydeglitch_1_cia.pro)


MYDEGLITCH_2_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYDEGLITCH_2_CIA

 PURPOSE:
	Perform deeper deglitching with respect to MYDEGLITCH_1_CIA
	Mask an input glitch list obtained from MYDEGLITCH_1_CIA and apply
	a median filter to the masked data

 CATEGORY:
	Deglitching

 SEE ALSO:
	MYDEGLITCH_1_CIA

 MODIFICATION HISTORY:
	10 Feb 2001	Adapted from DEGLITCH_2_CIA (Mattia Vaccari)

	12 Feb 2001	RAM and CPU efficiency improved (Mattia Vaccari)
	14 Mar 2001	LOG keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/mydeglitch_2_cia.pro)


MYJOURNAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYJOURNAL

 PURPOSE:
	Opens a journal file named according to date

 CATEGORY:
	Journaling

 TODOS:
	Check whether a journal file  is already open before issuing
	the JOURNAL command

 MODIFICATION HISTORY:
	14 Mar 2001	Written by Mattia Vaccari

(See /home/mattia/idl/lari/myjournal.pro)


MYQUALI_G

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYQUALI_G

 PURPOSE:
	Search a glitch list for glitches relative to a pixel

 CATEGORY:
	Deglitching

 INPUTS:
	LIST	input glitch position list (2-D)
	HLIST	input glitch height list
	NPIX	pixel 2-D index

 OPTIONAL INPUTS:
	DEV	consider glitches higher than DEV only

 KEYED INPUTS:
	VERBOSE	for verbose output

 OUTPUTS:
	NG	number of glitches relative to NPIXth pizel
	OLIST	output glitch position list (1-D)
	OHLIST	output glitch height list

 OPTIONAL OUTPUTS:
	INDEX	list of glitch indices

 MODIFICATION HISTORY:
	10 Feb 2001	Adapted from QUALI_G (Mattia Vaccari)

	26 Feb 2001	CPU efficiency improved (Mattia Vaccari)
	24 May 2001	DEV keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/myquali_g.pro)


MYQUALI_G_NJ_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYQUALI_G_NJ_CIA

 PURPOSE:
	Find glitches relative to NPIXth pixel above DEV in LIST/HLIST,
	flagging major and minor contiguous ones

 CATEGORY:
	Deglitching

 INPUTS:
	LIST	glitch position list
	HLIST	glitch height list
	DEV	minimum glitch height
	NPIX	pixel index

 OUTPUTS
	OLIST	Glitch position list of single glitches and major ones
		in contiguous cases (1-D)
	OHLIST	Glitch height list of glitches in OLIST

 OPTIONAL OUTPUTS:
	KKP	list of major glitches in contiguous cases ("p" for piu')
	KKM	list of minor glitches in contiguous cases ("m" for meno)
	INDEXM  position list of minor glitches in contiguous cases

 DEPENDENCIES:
	Calls	MYQUALI_G

 MODIFICATION HISTORY:
	10 Feb 2001	Adapted from QUALI_G_NJ_CIA (Mattia Vaccari)

	20 Apr 2001	CPU efficiency improved by calling MYQUALI_G_DEV
			(Mattia Vaccari)
	25 Apr 2003	Now calls MYQUALI_G with DEV keyword rather than
			MYQUALI_G_DEV (Mattia Vaccari)

(See /home/mattia/idl/lari/myquali_g_nj_cia.pro)


MYSAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYSAVE

 PURPOSE:
	Save LARI session in a straightforward and safe way

 CATEGORY:
	Utility - Saving

 WRITTEN FILES:
	SAVENAME	defined as in program listing

 SEE ALSO:
	MYSAVECOM

 MODIFICATION HISTORY:
	       2001	Written by Mattia Vaccari

(See /home/mattia/idl/lari/mysave.pro)


MYSAVECOM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MYSAVECOM

 PURPOSE:
	Save LARI session in a straightforward, safe and compact way

 CATEGORY:
	Utility - Saving

 WRITTEN FILES:
	SAVENAME	defined as in program listing

 SEE ALSO:
	MYSAVE

 MODIFICATION HISTORY:
	       2001	Written by Mattia Vaccari

(See /home/mattia/idl/lari/mysavecom.pro)


OFFSETS_AUTO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	OFFSETS_AUTO

 PURPOSE:
	Interface to OFFSETS_MATTIA allowing its application to all
	rasters belonging to a given field

 CATEGORY:
	Astrometry

 KEYED INPUTS:
	FIELD	sub-field name

 RESTRICTIONS:
	To be launched from N1, N2, N3 ... directories!

 MODIFICATION HISTORY:
	   June 2002	Written by Mattia Vaccari

(See /home/mattia/idl/lari/offsets_auto.pro)


OFFSETS_MATTIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	OFFSETS_MATTIA

 PURPOSE:
	Compute the astrometric offset of ISO sky maps with respect
	to observational nominal astrometry through "cross-correlation"
	between ISO source lists and USNO catalogue sources, and carry
	out "identifications" based on USNO, GSC, Tycho2, 2MASS and APM
	catalogue sources.

 CATEGORY:
	Astrometry - Optical Identifications

 INPUTS:
	FILENAME	Common prefix of files read or created

 KEYED INPUTS:
	MODE	Can be 'raster' or 'mosaic'/'catalogue' for use on ISO
		raster or mosaic (FIND-ordered/RA-ordered) sky maps
		and source lists

 WRITTEN FILES:
	FILENAME+'_offset.save'
	FILENAME+'_elais_usno.asc'
	FILENAME+'_elais_usno_ids.txt'
	FILENAME+'_elais_apm_ids.txt'
	FILENAME+'_elais_tycho2_ids.txt'
	FILENAME+'_elais_2mass_ids.txt'

 DEPENDENCIES:
	ISO source *.save file
	USNO, GSC, APM, Tycho2 and 2MASS source *.txt files obtained from:
	USNO - USNO A2.0 - ESO - http://archive.eso.org/skycat/servers/usnoa
	GSC - GSC 2.2.1 - STScI - http://www-gsss.stsci.edu/gsc/gsc2/GSC2home.htm  
	Tycho2 - ESO - http://archive.eso.org/skycat/servers/ASTROM
	2MASS - All Sky Release - IPAC - http://irsa.ipac.caltech.edu/applications/Gator/
	APM - IoA - http://www.ast.cam.ac.uk/~apmcat/

 COMMON BLOCKS:
	OFFSET_COMMON, apmra, apmdec, rmag, bmag, rclass, bclass, apmnum

 EXAMPLES:
	See OFFSETS_ALL.BAT

 RESTRICTIONS:
	To be launched from N1, N2, N3 ... directories!

 MODIFICATION HISTORY:
	10 Jun 2002	Written by Mattia Vaccari

	06 Jan 2003	MODE Keyword Added (Mattia Vaccari)
	24 Feb 2003	Modified to provide ELAIS-Tycho2 IDs (Mattia Vaccari)
	26 Feb 2003	Modified to provide ELAIS-2MASS IDs (Mattia Vaccari)
	29 Apr 2003	Modified to work on ELAIS FA catalogues Mattia Vaccari)
	13 May 2003	Modified to work on 2MASS All-Sky PSC (Mattia Vaccari)
	14 May 2003	Modified to provide ELAIS-GSC IDs (Mattia Vaccari)
	19 May 2003	Debugging (Mattia Vaccari)

(See /home/mattia/idl/lari/offsets_mattia.pro)


PER_ST2_PIECES_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PER_ST2_PIECES_X

 PURPOSE:
	Fit two-component LARI model to data contained within LISCIO structure

	Version of PER_ST2* with piece-wise fitting, non-uniform sampling
	and scaling, or version of ST2* not taking into account glitches 
	from nearby pixels

 CATEGORY:
	Fitting
	"Funny IDL" - spares memory "come un genovese"

 DEPENDENCIES:
	Main	Q2MATH_START
		ST2_GEN_X
		Q2MATH_START

	Aux	PUTGLITCH_PIPE
		RECOVER_C100
		RICAMPIONA_1_C100
		VICINI_CIA
		ADD_G_NJ_CIA

 SEE ALSO:
	ST2_PIECES3_X

 TODOS:
	Remove soglie keyword! Use liscio.soglie instead! 

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	10 Apr 2001	SCALE and NO_NOISE keywords added (Mattia Vaccari)

(See /home/mattia/idl/lari/per_st2_pieces_x.pro)


PHOT_CAL_TYCHO2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PHOT_CAL_TYCHO2

 PURPOSE:
	Compute photometric calibration factor from the comparison
	between measured MIR fluxes and predictions following
	Aussel 2003 based on (B,V) Tycho2 magnitudes

 CATEGORY:
	Photometric Calibration

 INPUTS:
	FILENAME	ELAIS-Tycho2 IDs file produced by OFFSETS_MATTIA

 KEYED INPUTS:
	APPLY_QMED	If set, apply QMED correction factor (as defined
			within source) to input fluxes

 EXAMPLES:
	See PHOT_CAL.BAT

 MODIFICATION HISTORY:
	07 Apr 2003	Written by Mattia Vaccari

	30 Apr 2003	QMED keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/phot_cal_tycho2.pro)


PIXNOISE_OFFSET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIXNOISE_OFFSET

 PURPOSE:
	Compute pixel-wise noise of an offsetted map

 CATEGORY:
	Mapping - Noise Determination

 INPUTS:
	FLAT_CUBE	(Output by FLATMAP_OFFSET)
	LISCIO
	DM	(Output by FLATMAP_OFFSET)
	ZERO	(Output by FLATMAP_OFFSET)

 KEYED INPUTS:
	TI	Raster Initial Effective Readout
	TF	Raster Final Effective Readout

 OUTPUTS:
	DEV_CUBE	Pixel-wise noise
	DEV_MOD		Pixel-wise background-weighed noise

 EXAMPLES:
	See MAPPING_MATTIA.BAT

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/pixnoise_offset.pro)


PROJETTE_CARLO (ADAPTED FROM CIA'S PROJETTE)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PROJETTE_CARLO (Adapted from CIA's PROJETTE)

 PURPOSE:
       Interface to the c++ code projection.cc
       Makes the fits file from raster.image and raster.npix,
       then calls projection, then reads the output and puts it
       in raster.raster, raster.npixraster raster.rmsraster

 CATEGORY:
      Mapping - Projection

 INPUTS:
   in                 -- IDL structure       : see get_sscdraster
   in.nscd            -- int                 : number of SCDs
   in.image           -- fltarr(32,32,nscd)  : exposures
   in.npix            -- fltarr(32,32,nscd)  : number of used pixels
   in.rms             -- fltarr(32,32,nscd)  : pixels rms
   in.channel         -- string              : detector : LW or SW
   in.info.ra         -- dblarr(nscd)        : right ascensions
   in.info.dec        -- dblarr(nscd)        : declinations
   in.target          -- string              : target source
   in.fltrwhl         -- string              : Filter wheel
   in.raster_rotation -- double              : rotation computed from roll angle and orientation
   in.nx_raster       -- int                 : mosaic image column
   in.ny_raster       -- int                 : mosaic image row
   in.ra_raster       -- double              : mosaic image right ascension
   in.dec_raster      -- double              : mosaic image declination
   in.info            -- IDL sub-structure   : World coordinates system
   in.info.roll       -- dblarr(nscd)        : roll angle
   in.info.pfov       -- fltarr(nscd)        : pixel field of view
   in.info.crpix1     -- fltarr(nscd)        : Reference pixel : x coordinate
   in.info.crpix2     -- fltarr(nscd)        : Reference pixel : y coordinate

 KEYED INPUTS:
   raster -- string : if set the output image will have the size and
              coordinates of in.raster
   dir -- string : if set looks for the input fits file in this sub-directory
   side -- integer : Lens Position 0=right, 1=left, default 0
   disto -- flag : if set correct the distorsion
   ra_offset -- float : add an offset to ra of the imagettes (unit:arcsecondes)
   dec_offset -- float : add an offset to dec of the imagettes(unit:arcsecondes)
   nodel -- flag : FOR DEBUGGINF ONLY if set does not remove fits file
   dist_file -- string : the name of the distortion file
   machine -- string : the name of the machine, to identify the
              !cia_exec and disto_dir directories. Add your machine to
              the list of "known" ones inside the program!

 OUTPUTS:
   in                  -- IDL structure       : see get_sscdraster
   Most important tags are the following :
   in.raster           -- fltarr(nx,ny)       : mosaic image
   in.npixraster       -- fltarr(nx,ny)       : mosaic image number of counts
   in.rmsraster        -- fltarr(nx,ny)       : mosaic image root mean squared

 KEYED OUTPUTS:
   ack -- logical :  1 ==> OK
   version -- string : the name and the version of the executable

 DEPENDENCIES:
   The executable projection
   !cia_exec and !cia_vers

 COMMON BLOCKS:
    SESSION_BLOCK, SESSION_MODE, ERROR_CURRENT, STATUS_BOOL

 RESTRICTIONS:
   Creates fits files on the default directory:
   you must have the right to write on the default directory !

 CALLED PROCEDURES AND FUNCTIONS:
   raster2headerfits, roll_to_crota, fits_header, cia_delete_file
   ia_get_type, make_distortion_name, get_dir

 SEE ALSO:
	BACK_PROJECT_FAST (LARI)
	PROJETTE (CIA)
	PROJETTE_MOS (LARI)

 MODIFICATION HISTORY:
    29 Jul 1997  H Aussel 
    01 Oct 1997  R. Gastaud, D. Landriu : Calls now raster2headerfits, 
                 instead roll_to_crota , fits_header when not imagette
    03 Oct 1997  R. Gastaud add ack and -H option for unix
    06 Oct 1997  R. Gastaud check for the existence of the disto file
    10 Oct 1997  R. Gastaud add nodel
    20 Oct 1997  R. Gastaud add dir
    16 Mar 1997  O. Laurent add cds distorsion name in version
    31 Aug 1997  R. Gastaud add dist_file
    14 Apr 1999  R. Gastaud change c++ version 
    24 Jun 1999  R. Gastaud noshell   
    22 Dec 1999  S. Ott header update

          <2000  Modified to use new distortion maps (Carlo Lari)
           2001  MACHINE keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/projette_carlo.pro)


PROJETTE_MOS (ADAPTED FROM CIA'S PROJETTE ROUTINE)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PROJETTE_MOS (Adapted from CIA's PROJETTE routine)

 PURPOSE:
	Project a raster structure on a map with different astrometry
	(PROJETTE_CARLO modified so as to mosaic repeated/adjacent fields)

       Interface to the c++ code projection.cc
       Makes the fits file from raster.image and raster.npix
       then calls projection, then read the ouput and put it
       in raster.raster, raster.npixraster raster.rmsraster

 CATEGORY:
      Mapping - Projection

 INPUTS:
    in       -- IDL structure : see get_sscdraster
   in.nscd            -- int                 : number of SCDs
   in.image           -- fltarr(32,32,nscd)  : exposures 
   in.npix            -- fltarr(32,32,nscd)  : number of used pixels
   in.rms             -- fltarr(32,32,nscd)  : pixels rms
   in.channel         -- string              : detector : LW or SW
   in.info.ra         -- dblarr(nscd)        : right ascensions
   in.info.dec        -- dblarr(nscd)        : declinations
   in.target          -- string              : target source   
   in.fltrwhl         -- string              : Filter wheel
   in.raster_rotation -- double              : rotation computed from roll angle and orientation
   in.NX_RASTER       -- int                 : mosaic image column                             
   in.NY_RASTER       -- int                 : mosaic image row                                
   in.Ra_RASTER       -- double              : mosaic image right ascension                    
   in.Dec_RASTER       -- double             : mosaic image declination                        
   in.info             -- IDL sub-structure  : World coordinates system
   in.info.roll        -- dblarr(nscd)       : roll angle
   in.info.pfov        -- fltarr(nscd)       : pixel field of view
   in.info.crpix1      -- fltarr(nscd)       : Reference pixel : x coordinate
   in.info.crpix2      -- fltarr(nscd)       : Reference pixel : y coordinate

 KEYED INPUTS:
   raster -- string : if set the output image will have the
            size and coordinates of in.raster
   dir -- string : if set looks for the input fits file in this sub-directory
   side -- integer : Lens Position 0=right, 1=left, default 0
   disto  -- flag : if set correct the distorsion
   ra_offset -- float : add an offset to ra of the imagettes (unit:arcsecondes)

   dec_offset -- float : add an offset to dec of the imagettes(unit:arcsecondes)

   nodel    -- flag : FOR DEBUGGINF ONLY if set does not remove fits file
   dist_file -- string : the name of the distortion file
   ref_hd --
   map --
   image_rms --
   image_npix --
   machine -- string : the name of the machine, to identify the !cia_exec
              directory. Add your machine to the list inside the program!

 OUTPUTS:
   in -- IDL structure : see get_sscdraster
     Most important tags are the following : 
   in.raster           -- fltarr(nx,ny)         : mosaic image
   in.npixraster       -- fltarr(nx,ny)         : mosaic image number of counts
   in.rmsraster        -- fltarr(nx,ny)         : mosaic image root mean squared

 KEYED OUTPUTS:
   ack -- logical :  1 ==> OK
   version -- string : the name and the version of the executable

 DEPENDENCIES:
   the executable projection
   !cia_exec and !cia_vers

 COMMON BLOCKS:
    SESSION_BLOCK, SESSION_MODE, ERROR_CURRENT, STATUS_BOOL

 RESTRICTIONS:
  Creates fits files on the default directory:
 you must have the right to write on the default directory !

 CALLED PROCEDURES AND FUNCTIONS:
   raster2headerfits, roll_to_crota, fits_header, cia_delete_file
   ia_get_type, make_distortion_name, get_dir

 SEE ALSO:
	BACK_PROJECT_FAST (LARI)
	PROJETTE (CIA)
	PROJETTE_CARLO (LARI)

 MODIFICATION HISTORY:
    29 Jul 1997  H Aussel 
    01 Oct 1997  R. Gastaud, D. Landriu : Calls now raster2headerfits, 
                 instead roll_to_crota , fits_header when not imagette
    03 Oct 1997  R. Gastaud add ack and -H option for unix
    06 Oct 1997  R. Gastaud check for the existence of the disto file
    10 Oct 1997  R. Gastaud add nodel
    20 Oct 1997  R. Gastaud add dir
    16 Mar 1997  O. Laurent add cds distorsion name in version
    31 Aug 1997  R. Gastaud add dist_file
    14 Apr 1999  R. Gastaud change c++ version 
    24 Jun 1999  R. Gastaud noshell   
    22 Dec 1999  S. Ott header update

          <2000  Modified to use new distortion maps and for mosaicing
                 of repeated fields (Carlo Lari)
           2001  MACHINE keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/projette_mos.pro)


PUTGLITCH_PIPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PUTGLITCH_PIPE

 PURPOSE:
	Build one-pixel glitch list/mask from overall equivalent arrays:
	- List and "if put ne 0" flag with MASKG=1 the glitches relative to a
	pixel (M,N) that are above DEV threshold
	- List contiguous glitches and "if put ne 0" mask minor ones putting
	MASKG=-1

 CATEGORY:
	Deglitching

 INPUTS:
	M,N		pixel column and line indices
	GLIST		glitch position list (pixel and readout indexes)
	GHLIST		glitch height list
	DEV		minimum glitch height
	MASKG		one-pixel glitch mask

 KEYED INPUTS:
	PUT	"if PUT ne 0" masks OL with a glitch putting MASKG=1
	VERBOSE

 OUTPUTS:
	OL	list of returned glitches
	KKM	list of minor glitches in contiguous cases ("m" for meno)
	KKP	list of major glitches in contiguous cases ("p" for piu')
	NKK	number of groups of contiguous glitches
	MASKG	one-pixel glitch mask

 OPTIONAL OUTPUTS:
	INDEXM	list of indices of minor glitches

 DEPENDENCIES:
	Calls	MYQUALI_G_NJ_CIA

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	21 Apr 2001	CPU efficiency improved by calling MYQUALI_G_NJ_CIA
			instead of QUALI_G_NJ_CIA (Mattia Vaccari)

(See /home/mattia/idl/lari/putglitch_pipe.pro)


PUTMASK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PUTMASK

 PURPOSE:
	Write RASTER.MASK partly copying it from LISCIO.MASKG

 CATEGORY:
	Deglitching

 INPUTS:
	RASTER
	LISCIO
	EXCL1

 KEYED INPUTS:
	SENS	Sensitivity (default is 1.96)
	SOGLIA  Glich mask threshold (default is LISCIO.SOGLIE(2)/SENS)

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/putmask.pro)


Q2MATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Q2MATH

 PURPOSE:
	Compute the two memory functions QY and QZ using
	mathematical parameters

 CATEGORY:
	Fitting

 INPUTS:
	FF	fltarr(ras.net) - the last determined stabilized flux
	GG	fltarr(ras.net) - model of stabilized flux
	W	intarr(net) - 0:background 1:glitches -1:excluded from fit
	A	parameters in math system
	RAS	structure with remaining information

 KEYED INPUTS:
	START	if true A is only a fltarr(7)
	FX	= fltarr(2,nglitch) - factors across glitches for breve and
		lunga (used in start)

 OUTPUTS:
	QY	breve
	QZ	lunga
	RAS.ASAVE([0,3,7:6+ras.nj,7+ras.nj:*])

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/q2math.pro)


Q2MATH_START

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Q2MATH_START

 PURPOSE:
	Initialize memory functions to call Q2MATH

 CATEGORY:
	Fitting

 DEPENDENCIES:
	Calls	Q2MATH

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/q2math_start.pro)


Q2MATH_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Q2MATH_X

 PURPOSE:
	Compute the two memory functions RAS.QY and RAS.QZ using
	mathematical parameters

 CATEGORY:
	Fitting

 INPUTS:
	FF	= fltarr(ras.net) - the last determined stabilized flux
	GG	= fltarr(ras.net) - model of stabilized flux
	W	= intarr(net) - 0:background 1:glitches -1:excluded from fit
	A	parameters in mathematical system
	RAS	structure with other information (see ST2_1_X)

 KEYED INPUTS:
	FX	= fltarr(2,nglitch) - factors across glitches for breve and
		lunga (used in start)
	START	if set A is only a fltarr(7)

 OUTPUTS:
	RAS.QY (breve)
	RAS.QZ (lunga)
	RAS.ASAVE([0,3,7:6+ras.nj,7+ras.nj:*])

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/q2math_x.pro)


Q2MOD[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Q2MOD

 PURPOSE:
	Compute the two memory functions RAS.QY and RAS.QZ using naive
	parameters

 CATEGORY:
	Subroutine to be used after a call of CONVERT_A_2_CIA that
	translates mathematical parameters into naive ones

 INPUTS:
	FF - fltarr(ras.net)- with the last determined stabilized flux
	GG - fltarr(ras.net)- model of stabilized flux 
	W  - intarr(net) - 0:background 1:glitches -1:excluded from fit
	A  - parameters in naive system
	RAS - structure with the remaining informations

 OUTPUTS:
	RAS.QY (BREVE)
	RAS.QZ (LUNGA)
	RAS.ASAVE([0,3,7:6+ras.nj,7+ras.nj:*])

 MODIFICATION HISTORY:
	       <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/q2mod.pro)


Q2MOD[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Q2MOD

 PURPOSE:
	Compute the two memory functions RAS.QY and RAS.QZ using naive
	parameters

 CATEGORY:
	Subroutine to be used after a call of CONVERT_A_2_CIA that
	translates mathematical parameters into naive ones

 INPUTS:
	FF - fltarr(ras.net)- with the last determined stabilized flux
	GG - fltarr(ras.net)- model of stabilized flux 
	W  - intarr(net) - 0:background 1:glitches -1:excluded from fit
	A  - parameters in naive system
	RAS - structure with the remaining informations

 OUTPUTS:
	RAS.QY (BREVE)
	RAS.QZ (LUNGA)
	RAS.ASAVE([0,3,7:6+ras.nj,7+ras.nj:*])

 MODIFICATION HISTORY:
	       <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/q2mod_x.pro)


QUALI_G

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	QUALI_G

 INPUTS:
	list	input glitch position list (2-D)
	hlist	input glitch height list
	npix	pixel index

 OUTPUTS:
	ng	number of glitches after deeper search
	olist	output glitch position list (1-D)
	ohlist	output glitch height list

 OPTIONAL OUTPUTS:
	index	list of glitch indices

 NOTES:
	Obsolete routine superseded by MYQUALI_G and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	       <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/quali_g.pro)


QUALI_G_NJ_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	QUALI_G_NJ_CIA

 PURPOSE:
	Find glitches relative to NPIXth pixel above DEV in LIST/HLIST

 CATEGORY:
	Deglitching

 INPUTS:
	LIST	input glitch position list (2-D)
	HLIST	input glitch height list
	DEV	minimum glitch height
	NPIX	pixel index

 OUTPUTS
	OLIST	output position list of single glitches and major ones in
		contiguous cases (1-D)
	OHLIST	output height list of glitches in OLIST

 OPTIONAL OUTPUTS:
	KKP	position (i.e. readout) list of major glitches in contiguous
		cases ("p" for piu')
	KKM	position (i.e. readout) list of minor glitches in contiguous
		cases ("m" for meno)
	INDEXM	list of indices of minor glitches

 NOTES:
	Obsolete routine superseded by MYQUALI_G_NJ_CIA and retained
	for compatibility reasons

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/quali_g_nj_cia.pro)


RANDOM_RADEC_MOSQ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RANDOM_RADEC_MOSQ

 PURPOSE:
	Generates random source positions on mosaic

 CATEGORY:
	Simulations - Utility

 MODIFICATION HISTORY:
	       <2000	Written by Carlo Lari

	12 July 2002	Modified to exclude simulated sources too near
			to each other (Mattia Vaccari)

(See /home/mattia/idl/lari/random_radec_mosq.pro)


RASTER2HEADERFITS_CARLO (ADAPTED FROM CIA'S RASTER2HEADERFITS)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RASTER2HEADERFITS_CARLO (Adapted from CIA's RASTER2HEADERFITS)

 PURPOSE:
	To keep the compatibility with old structures.
	It makes a fits header from an IDL raster structure.

 CATEGORY:
	FITS file manipulation

 INPUTS:
	Raster	IDL structure : a raster structure, 
		as defined by raster_struc_init

 KEYED INPUTS:
	d_crpix1 -- float   : delta crpix1
	d_crpix2 -- float   : delta crpix2
	naxis1   -- integer : image dimension
	naxis2   -- integer : image dimension
	iraf     -- flag    : if set, use CDx_y instead of CD00x00y
	invert   -- flag    : if set, invert the ISO axes so that cdelt is
	                    : (-ve,+ve) for LW and (+ve,+ve) for SW
	magnification -- int : image magnification factor

 OUTPUTS:
	Hdr -- string array : a fits header containing astrometry

 COMMON BLOCKS: 
	SESSION_BLOCK, SESSION_MODE, ERROR_CURRENT, STATUS_BOOL, ASTROM 

 MODIFICATION HISTORY: 
    12 Sep 1997 D.Landriu Creation.
    22 Sep 1997 R Gastaud added d_crpix1 and d_crpix2
    24 Sep 1997 D.Landriu Added keyword iraf
    24 Sep 1997 D.Landriu Added Calling sequence
    29 Sep 1997 R.Gastaud D.Landriu  Added naxis2 naxis1
    02 Oct 1997 R Gastaud the previous was a bugged one , use now my_ast 
               nd crpix(1) !!v1.1
    08 Oct 1997 RG and DL back to the previous one + reset the header
    26 Nov 1997 RG manage /iraf add cd_type
    03 Dec 1997 RG add aips option
    11 Jun 1998 S Guest     v2.0 add /invert
    27 Jan 1998 RG aips option was not done ? 2.1

          <2000 MAGNIFICATION keyword added (Carlo Lari)

(See /home/mattia/idl/lari/raster2headerfits_carlo.pro)


RASTERUPDATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RASTERUPDATE

 PURPOSE:
	Updates Raster ID provided RASTER and RASTERV are defined

 CATEGORY:
	Utility

 INPUTS:
	RASTER
	RASTERV
	OFFNAME		Raster IDA Official Name

 OUTPUTS:
	TARGET
	FILENAME
	FILENAME_RASTER

 MODIFICATION HISTORY:
	       2002	Written by Mattia Vaccari

(See /home/mattia/idl/lari/rasterupdate.pro)


RASTER_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RASTER_INFO

 PURPOSE:
	Print on screen and save to journal raster information

 CATEGORY:
	Utility

 MODIFICATION HISTORY:
	12 Mar 2001	Written by Mattia Vaccari

(See /home/mattia/idl/lari/rasterinfo.pro)


RECOVER_C100

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RECOVER_C100

 PURPOSE:


 CATEGORY:
	Resampling

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/recover_c100.pro)


RICAMPIONA_1_C100

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RICAMPIONA_1_C100

 PURPOSE:
	Return the list of indexes in common between XX and ARRAY,
	expressed in terms of XX index number

 CATEGORY:
	Utility - Resampling

 INPUTS:
	XX	index list
	B	array
	ARRAY	index list

 OUTPUTS:
	R_ARRAY	index list

 SIDE EFFECTS:
	R_ARRAY = -1 if XX and ARRAY are disjoint

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/ricampiona_1_c100.pro)


RICAMPIONA_C100

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RICAMPIONA_C100

 PURPOSE:
	Resample array with a different step

 CATEGORY:
	Utility - Resampling

 INPUTS:
	XX
	TY
	NET
	STEP_C
	P1
	P2
	LL0

 OUTPUTS:
	M
	B
	LLX

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/ricampiona_c100.pro)


SCREEN_GRAB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SCREEN_GRAB

 PURPOSE:
	Write current window contents to file

 CATEGORY:
	Procedure - Utility - Send output to file

 INPUTS:
	None

 OPTIONAL INPUTS:	
	file	file name (defaults to pickfile)
	
 KEYED INPUTS:
	format	format for image file

	jpeg	specfies jpeg format (default)
	gif	specfies gif format (no longer supported from IDL 5.4)
	png	specifies png format
	tiff	specfies tiff format
	bmp	specfies bmp format
	ps	specifies ps format (not recommended)

	back	change default black background pixels to white

 COMMON BLOCKS:
	COLORS	colour look-up table

 EXAMPLES:
	screen_grab,
		[file, format=format, gif=gif, bmp=bmp, jpeg=jpeg, 
		tiff=tiff, png=png, ps=ps, back=back]

 SIDE EFFECTS:
	Writes file to disk

 MODIFICATION HISTORY:
	01 May 1997	Written by Seb Oliver

	12 Apr 2001	PS and PNG support added (Mattia Vaccari)
	11 Jun 2001	JPEG support added and BACK keyword removed
			(Mattia Vaccari)

(See /home/mattia/idl/lari/screen_grab.pro)


SEARCHDEV_PIECES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SEARCHDEV_PIECES

 PURPOSE:
	Find and flag pieces where NaN/Infinity occurred in the fitting
	process and where DEV4 is higher than given threshold

 CATEGORY:
	Fitting - Noise determination

 INPUTS:
	LISCIO
	DEV4	RMS deviation of model wrt data on (m,n,p) piece
	PIECES  number of pieces
	LENGTH  length of median filter
	FAC	if dev4(m,n,p) gt fac*liscio.soglie(1) then quali(m,n,p)

 OUTPUTS:
	DEV4	(also as input)
	QUALI	= bytarr(32,32,pieces) flags where DEV4 is higher than
		fac*liscio.soglie(1)

 SIDE EFFECTS:
	Rewrites DEV4
	Rewrites QUALI

 TODOS:
	Change FAC with SOGLIA independent of LISCIO.SOGLIE(1)

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/searchdev_pieces.pro)


SMOOTH_C100

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SMOOTH_C100

 PURPOSE:
	Smooth data

 CATEGORY:
	Utility - Smoothing

 INPUTS:
	XX
	B
	ARRAY	input array
	LL0
	EXCL	index array flagging points to be excluded

 OUTPUTS:
	S_ARRAY	smoothed array

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/smooth_c100.pro)


SORT_CAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SORT_CAM

 PURPOSE:
	Sort and print to screen a
	(pixel-row,pixel-column[,piece][,pointing])
	index list

 CATEGORY:
	Utility

 INPUTS:
	IND	Index array

 KEYED INPUTS:
	PIXEL		Pixel-wise indexing
	PIECE		Piece-wise indexing
	POINTING	Pointing-wise indexing

 EXAMPLES:
	ind=where(dev4 gt 0.2) & sort_cam,ind,/pie
	or more simply
	sort_cam,where(dev4 gt 0.2),/pie
	prints to screen the sorted list of (pixel-row,pixel-column,piece)
	indices of pieces whose DEV4 is greater than 0.2

 MODIFICATION HISTORY:
	       2002	Written by Mattia Vaccari

	27 Apr 2003	Debugging (Mattia Vaccari)

(See /home/mattia/idl/lari/sort_cam.pro)


SOURCES_WHERE_1

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SOURCES_WHERE_1

 PURPOSE
	Detect and flag sources in real time history

	On pixels where liscio.quali(m,m)=1, compute QUANTO signal excess
	as the average of median(liscio.ddata-bk_cube) over whole pointings
	and flag with QUI=1 pointings for which QUANTO is higher than
	liscio.soglie(2)

 CATEGORY:
	Source Detection

 INPUTS:
	LISCIO
	STRUTTURA
	BK_CUBE

 KEYED INPUTS:
	LENGTH

 KEYED OUTPUTS:
	QUI	Flag array flagging "where(quanto(m,n,p) gt liscio.soglie(2))"
	QUANTO	Poiting-wise excess flux wrt local background

 SIDE EFFECTS:
	Rewrites QUI (everywhere) and QUANTO (where(liscio.quali))

 MODIFICATION HISTORY
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/sources_where_1.pro)


SOURCES_WHERE_SIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SOURCES_WHERE_SIM

 PURPOSE:
	Detect and flag sources in autosimulated time history

 CATEGORY:
	Source Detection

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/sources_where_sim.pro)


SOURCE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SOURCE_IMAGES

 PURPOSE:
	Produce PS postage stamps of S/N maps around detected sources

 CATEGORY:
	Data Products Formatting/Release

 MODIFICATION HISTORY:
	       2002	Written by Mattia Vaccari

(See /home/mattia/idl/lari/source_images.pro)


SPAZZA_VIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SPAZZA_VIA

 PURPOSE:
	Reinitialize LISCIO and STRUTTURA " where(quali_p) ", for use
	on pieces flagged e.g. by SEARCHDEV_PIECES

 INPUTS:
	LISCIO
	STRUTTURA
	QUALI_P		= intarr(32,32,pieces) - flag array
	CHECK_FILE	file containing confirmed sources

 OUTPUTS
	LISCIO
	STRUTTURA

 SIDE EFFECTS:
	Erase fit results: USE IT VERY CAREFULLY!!!

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/spazza_via.pro)


SRC_EXT_2MASS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SRC_EXT_2MASS

 PURPOSE:
	Extract 2MASS sources in a given sky region from 2MASS
	2nd Incremental Data Release catalogues downloaded from the www

 CATEGORY:
	Identifications - Flux Calibration - Utility

 INPUTS:
	RA_LIM		RA range (fltarr(2))
	DEC_LIM		Dec range (fltarr(2))
	FILE_IN		Input filename
	FILE_OUT	Output filename

 MODIFICATION HISTORY:
	28 Feb 2003	Written by Mattia Vaccari

(See /home/mattia/idl/lari/src_ext_2mass.pro)


ST2_1_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ST2_1_X

 PURPOSE:
	Build inputs to FIT_X and send outputs to ST2_GEN_X:
	- prepare RAS structure
	- prepare the function to be fitted excluding excluded values
	- compute from fitted parameterss q1, q2, dat(fit) and
	  outf(stabilized flux)

 CATEGORY:
	Fitting

 INPUTS:
	INPUTF	median-filtered data apart near features
	OUTF	stabilized flux : initial guess (also output)
	A	parameters = fltarr(7+2*ng)
	NN	structure.tq-structure.ti
	POSI,POSF as .posi .posf moved by .ti (arrays of on_target boundaries
	GLIST	(2,nglitch) positions (0,*) and order numbers (1,*)
	NPIX	pixel identifier m+n*32 (only for messages)
	IS	where are sources
	Q1,Q2	from .breve and .lunga - also in output
	TOL	minimum chi^2 difference between two iterations
	EXCL	readouts excluded from the fitting
	FREEZE	variables kept constant

 KEYED INPUTS:
	UPPER_FLAG (no faders if true)

 OUTPUTS:
	DAT	model
	OUTF	stabilized flux
	AE	parameters from fit
	Q1,Q2	see input

 OPTIONAL OUTPUTS:
	FCONV	if true fit has not achieved convergence
	ITER	number of performed iterations performed

 DEPENDENCIES
	Calls	FIT_X
		Q2MATH_X
		RICAMPIONA_1_C100

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/st2_1_x.pro)


ST2_AUTOSIM_PIECES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ST2_AUTOSIM_PIECES

 PURPOSE:
	Simulate data cube on the basis of input pointing fluxes ("images")

 CATEGORY:
	Simulation

 INPUTS:
	LISCIO
	STRUTTURA
	SIM_FILL	Input "images"
	QUALI_PSIM	Flag array flagging pieces to simulate

 KEYED INPUTS:
	VERBOSE		For verbose output

 OUTPUTS:
	CUBE	Simulated Cube

 DEPENDENCIES:
	Calls	Q2MATH
		Q2MATH_X

 MODIFICATION HISTORY
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/st2_autosim_pieces.pro)


ST2_BK_PIECES_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ST2_BK_PIECES_X

 PURPOSE:
	Update BK_CUBE where LISCIO.QUALI

 CATEGORY:
	Fitting

 INPUTS:
	LISCIO
	STRUTTURA

 KEYED INPUTS:
	VERBOSE		For verbose output

 OUTPUTS:
	BK_CUBE

 MODIFICATION HISTORY
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/st2_bk_pieces_x.pro)


ST2_GEN_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ST2_GEN_X

 PURPOSE:
	Modelling of one ISOCAM/ISOPHOT pixel using LARI method

	Takes all spikes found by deglitching software (in GLIST and GHLIST),
	and any further cosmic rays given as initial conditions (in JLIST1),
	and compares them all with the thresholds given in the SOGLIE array.
	This thresholded, combined glitch list is used to mark potential
	discontinuities in the fit.
	The fit is iterated, adding to the discontinuity list at each
	iteration: the first iteration uses JLIST1, the next iteration uses 
	JLIST1 plus the brightest accepted glitch from GLIST, the next uses
	JLIST1 plus the brightest two, and so on until convergence is achieved
	or we run out of acceptable glitches.
	NB: for dippers, the depth of the dipper is used rather than
	the brightness of the initial spike when ordering the glitches
	by their strengths.

	Find glitches and dippers (fka jumps) to consider in the fit and
	prepare arrays and parameters - repeat fitting to the end of
	model correction programs --- for one pixel --- outputs the results to
	ST2_PIPE_X, ST2_PIECES_X, PER_ST2_PIECES_X, ST2_PIECES3_X, ...

 CATEGORY:
	Fitting

 INPUTS:
	INPUT = LISCIO.DATAI(M,N,*)
	INPUT5	deglitched and median-filtered input
	NPIX	1-D pixel index
	POS1,POS2	starting and ending on-target readouts
	GLIST,GHLIST = INTARR(2,NGLITCH),FLTARR(NGLITCH)
			lists of all glitch positions and heights
	SOGLIE = FLTARR(3)	lower limits for glitch height, rms dev of fit
				and source internal identification 
	AEE = LISCIO.PARE(M,N,[0:6]+where(struttura.quali))
	JLIST1 = INTARR(2,N)	inherited glitches
		These are the glitches being used as discontinuities
		This routine uses MYQUALI_G_NJ_CIA to find a revised list of
		glitches, and makes a new glitch list called JLIST
		These get added to JLIST1 (which are fixed glitches)
       Q1,Q2	breve and lunga arrays from T0 to Tf
       TOL	tolerance in the fitting (from the structure but it may change)
       FREEZE	parameters to freeze
       T0,TY,TF = STRUTTURA.TI,TQ,TF
       EX	excluded readouts from fitting, e.g. where(liscio.maskg eq -1)
		it may change

 KEYED INPUTS:
	BETWEEN		see ST2_COME_CIA
	UPPER_FLAG		"
	FEND		if true only one iteration is requested
	VERBOSE		verbose output

 OUTPUTS:
	FIT	model DATA
	OUT	restored data = LISCIO.LISCI
		(Also an input: starts on value of the background plus sources)
	AEE = PARAMETERS AND MEDIANS OVER RASTER POSITION FOR .PARE
	JLIST1	considered glitches for .MASKG (also as input)
	IJUMP	where there is a dipper (also as input)
	Q1,Q2 = .BREVE AND .LUNGA (.TI:.TF+1)
	EX	readouts excluded from fitting (also as input)

 OPTIONAL OUTPUTS:
	ITER	number of performed iterations
	FCONV	if returned true fit has not achieved convergence after the
		maximum number of allowed iterations

 DEPENDENCIES:
	Main	ST2_1_X - (ITERATED)

	Aux	MYQUALI_G_NJ_CIA
		RICAMPIONA_1_C100
		RICAMPIONA_C100
		SMOOTH_C100

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	21 Apr 2001	CPU efficiency improved by calling MYQUALI_G_NJ_CIA
			instead of QUALI_G_NJ_CIA, refined dropout search
			(Mattia Vaccari)

(See /home/mattia/idl/lari/st2_gen_x.pro)


ST2_LOCAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ST2_LOCAL

 PURPOSE:
	Version of ST2_PIECES3_X to work on an arbitrary part of
	pixel time history, possibly extending over different pieces

 CATEGORY:
	Fitting

 SEE ALSO:
	ST2_PIECES3_X
	Differences with respect to ST2_PIECES3_X include:
	 - no SOGLIE, QUALIP, and NO_NOISE in the calling
	 - compute STD over region of interest only, thus giving a
	   misleading estimate of the goodness of the fit. DEV4 therefore
	   needs to be recomputed after local fit!

 MODIFICATION HISTORY:
	       2001	Written by Carlo Lari

(See /home/mattia/idl/lari/st2_local.pro)


ST2_PIECES3_X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ST2_PIECES3_X

 PURPOSE:
	Fit two-component LARI model to data contained within LISCIO structure

       Version of ST2* with piece-wise fitting, non-uniform sampling
	and scaling, or version of PER_ST2* taking into account glitches 
	from nearby pixels

 CATEGORY:
	Fitting
	"Funny IDL" - spares memory "come un genovese"

 INPUTS:
	LISCIO	structure, generated by e.g. FA_LISCIO_CAM, with the first
		guess for pare, lisci, breve and lunga and with main glitches
		and dippers set in LISCIO.MASKG, masked with 1 at glitches,
		2 at dippers and -1 for contiguous minor glitches
		(or in faders)
		liscio.quali(m,n)=1 on pixels one wants to fit

 OPTIONAL INPUTS:
	PUT = 0	(default) gives only the rough estimate of parameters,
		no glitches are considered and does not evaluate memories
           = 1 picks up the glitches stronger then soglie(0)
           = 2 picks up glitches as with = 1 + faders
	PUT > 0 evaluates liscio.breve liscio.lunga and liscio.model
	DEV	(default = soglie(0)) the minimum height of glitches
		considered
	SOGLIE	defines the minimum values for glitches, dippers and sources
	STEP_C	sampling factor with which data are rebinned before actually
		performing the fit
	BK_FLAG = 0	no external evaluation of background
               = 1	keeps liscio.pare(*,*,6) for the background
               = 2	(default) keeps liscio.pare(*,*,0:6)
	TWICE	if true the fitting for the glitch values is repeated
		computing also liscio.pare(*,*,4:5)

 KEYED INPUTS:
	BETWEEN		keyword passed to ST2_GEN_X excluding readouts
			between strong sources
	EVERBOSE	extremely verbose output
	LENGTH		obsolete (now = 7), kept for compatibility
	NO_NOISE	do not consider pixel noise as given by std(m,n,0)
	SCALE		data scaling inside ST2_GEN_X
	VERBOSE		verbose output

 OUTPUTS:
	See INPUTS

 OPTIONAL OUTPUTS:
	STD	rms difference between model and data

 DEPENDENCIES:
	Main	Q2MATH_START
		ST2_GEN_X
		Q2MATH
		Q2MATH_X

	Aux	ADD_G_NJ_CIA
		PUTGLITCH_PIPE
		RECOVER_C100
		RICAMPIONA_1_C100
		VICINI_CIA

 EXAMPLE:
	You can start with strongest glitches and dippers set in the mask
	with put = 1 or put = 2 (in the latter case faders are also taken
	into account)

 TODOS:
	Remove soglie keyword! Use liscio.soglie instead!
	Remove length keyword!
 
 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

	10 Apr 2001	NO_NOISE keyword added (Mattia Vaccari)
	03 May 2001	SCALE keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/st2_pieces3_x.pro)


TAKELISCIO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	TAKELISCIO

 PURPOSE:
	Restore LISCIO, STRUTTURA, BK_CUBE and some ancillary arrays
	from *.save.com files and save them separately!

 CATEGORY:
	Mosaicing

 RESTRICTIONS:
	To be run from '~/iso/data/'+field2+'/mosaic' directory!

 MODIFICATION HISTORY:
	28 Mar 2002	Written by Mattia Vaccari

(See /home/mattia/idl/lari/takeliscio.pro)


VICINI_CIA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	VICINI_CIA

 PURPOSE:
	Flag nearby pixels

 CATEGORY:
	Utility

 INPUTS:
	NPIX	pixel of interest

 OUTPUTS:
	NPIX1	pixels "near" to NPIX

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/vicini_cia.pro)


VICINI_CIA_SORGENTI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	VICINI_CIA_SORGENTI

 PURPOSE:
	Flag nearby pixels

 CATEGORY:
	Utility

 INPUTS:
	NPIX

 OUTPUTS:
	MM	Column indices of "valid" nearby pixels
	NN	Row indices of "valid" nearby pixels
	CONT	Number of "valid" nearby pixels

 MODIFICATION HISTORY:
	      <2000	Written by Carlo Lari

(See /home/mattia/idl/lari/vicini_cia_sorgenti.pro)


WWWLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	WWWLIST

 PURPOSE:
	Produce source lists for the www from IDL *.save file

 CATEGORY:
	Data Products Formatting/Release

 KEYED INPUTS:
	OFFNAME		raster official name according to IDA naming
	SNR		threshold snr
	ANGUNITS	angular units (dec/sex)
	OFFSET		fltarr(2) - ADDS specified offset to source positions,
			i.e. add offset(0) to ra and offset(1) do dec
			(without any */cos(dec) correction to offset(0)!!!)

 MODIFICATION HISTORY:
	       2002	Written by Mattia Vaccari

(See /home/mattia/idl/lari/wwwlist.pro)


WWWRASTER

[Previous Routine] [List of Routines]
 NAME:
	WWWRASTER

 PURPOSE:
	Produce IDL *.save files containing reduced rasters for the www

 CATEGORY:
	Data Products Formatting/Release

 KEYED INPUTS:
	COM	If set, IDL built-in compression is used in saving files

 MODIFICATION HISTORY:
	       2002	Written by Mattia Vaccari

	02 Oct 2002	COM keyword added (Mattia Vaccari)

(See /home/mattia/idl/lari/wwwraster.pro)