PIA GUI routines

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Fri Mar 24 12:48:36 2000.


List of Routines


Routine Descriptions

PIA_AALEVEL

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

 PURPOSE:
	Astrophysical Applications Menu for PIA.
	This is a display dependant level menu in the PIA hierarchy.

	This routine should only be called by the PIA display menues
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_AALEVEL, GROUP=group
	
 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
		
 PROCEDURES USED:
	PIA LIB:
		pia_mapw
		pia_multi_aap
		pia_multmeas_choice
		pia_showstr
		pia_xplot
       INTERNAL:
		pia_aalevel_event

 COMMON BLOCKS:
	pia_aalevel_cmn	for internal use
	
 MODIFICATION HISTORY:
	Written by C.Gabriel (ESA/ESTEC-SAI)		April 1995
	Oct 95 Version 3.5
	Spectrophotometry case added	(CG)		October 1995
	Multi-aperture, multi-filter, general listing &
	  correlation structure added (CG)		January 1996
	Returning silently if meas.choice cancelled (CG)January 1996
	Simple polarimetry case added (CG)		February 1996
	Bug fixed (polar ID and polarization degree 
		not present in Show str) (CG)		February 1996
	Call to pia_multmeas for summary (bug fixed)	March 1996
	Colour correction possibility included (CG)	May 1997
	V6.3
	Colour correction extended to medians and 
	 quartiles (CG)					September 1997
	V6.5
	Small graphical change (CG)			October 1997
	V6.6

(See pia_aalevel.pro)


PIA_AAPVIEW

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

 PURPOSE:
	User interface to plot 1-dimensional curves of AAP data.

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
	PIA_AAPVIEW, aap, GROUP=group

 INPUTS:
	AAP:		An AAP structure containing data handles.

 KEYWORD PARAMETERS:
	GROUP:		The widget group leader


 PROCEDURES USED:
	PIA LIB:
		PIA_XPLOT
       INTERNAL:
›		PIA_AAPVIEW_PLOT
		PRO PIA_AAPVIEW_CLEANUP
		PRO PIA_AAPVIEW_EVENT

 MODIFICATION HISTORY:
	Written by: D. Skaley, MPIK/Heidelberg		March 1995
	Oct 95 Version 3.5

(See pia_aapview.pro)


PIA_AAP_BCKSEL

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

 PURPOSE:
	Menu for performing median filtering and smoothing of data 
	for obtaining flat field factors from the filtered data. It 
	includes also the possibility of obtaining directly flat field
	factors from selected data regions. It returns the filtered, smoothed
	and/or flat-fielded data.
	
 CATEGORY:
	PIA - graphics + processing

 CALLING SEQUENCE:
	PIA_AAP_BCKSEL, mnbr, mnbu, ff_mnbr

 INPUT:
	mnbr:		A 2-dim data array 
	mnbu:		Uncertainties of mnbr

 OUTPUT:
	ff_mnbr:	The modified array (same dims as mnbr) 
	
 COMMON BLOCKS:
	colour_indices
	pia_dspchz_cmn
	zoom_discareas

 PROCEDURES USED:
	PIA:
		ff_bck
		ff_med_smooth
		pia_disp_print_file
		pia_xplot
	
 MODIFICATION HISTORY:
	Written by:	Jose Acosta	November 1997
	Version 6.6

(See pia_aap_bcksel.pro)


PIA_ANAL_SIG

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

 PURPOSE:
       Graphical I/F for the analysis of several SRD/SCP measurements

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_ANAL_SIG, GROUP=GROUP

 INPUTS:
	(none)

 KEYWORD PARAMETERS:

	GROUP:		

 OUTPUTS:
	(none)

 COMMON BLOCKS:
	phtsrd
	phtscp
	pickmeas_results

 PROCEDURES CALLED:
	PIA_LIB:
		anal_sig
	Internal:
		pia_anal_sig_event


 MODIFICATION HISTORY:
       Written by:	Carlos GABRIEL (ESA/VILSPA-SAI)		December 1995
	Widget types changed (CG)				February 1996
	Bug for SCP orbit files fixed (CG)			February 1996
	Reading from measurement in buffer included (JAcosta)	February 1997
	Using new pickmeas and pickmeas_results-CB (CG)	May 1997
	V6.3
	Change call to anal_sig, adding admn as argument (JAc)  January 1998
	V7.0

(See pia_anal_sig.pro)


PIA_BASE_DRIFT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_BASE_DRIFT
 PURPOSE:
	Widget routine for graphical establishment of baseline drift factors,
	as observed from long term responsivity changes.
 CATEGORY:
	PIA - graphics
                
 CALLING SEQUENCE: 
	PIA_base_drift, tmpdata, bas_drift, pixel=pixel

 INPUT PARAMETERS:
	TMPDATA	: Structure containing the SCP data to be processed

 OPTIONAL KEYWORD :
	PIXEL	: indicating the detector pixel to start with

 OUTPUT:
	bas_drift: Baseline drift factors, normalized to the last point, with
		   same dimensions as tmpdata.aver

 RESTRICTIONS:
	tmpdata must be a valid phtscp temporary data structure

 PROCEDURES USED:
       Common Block(s) or @ procedure(s):
		colour_indices
		pia_dspchz_cmn
       PIA Procedure(s):
		pia_disp_print_file
		pia_graph_extract
		pia_xplot
		

 MODIFICATION HISTORY:
	Written by: C. Gabriel (ESA/VILSPA-SAI)			July 1997
	V6.4

(See pia_base_drift.pro)


PIA_BCKSUBT

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

 PURPOSE:
	Menu for PIA Background subtraction.
	This is a display dependant level menu in the PIA hierarchy.

	This routine should only be called by the PIA display menues
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_BCKSUBT, tmpdata, SPD=SPD, GROUP=group

 INPUTS:
	tmpdata: structure containing data (SCP or SPD level)
	
 KEYWORD PARAMETERS:
	SPD:	Data identifier (0:SCP, 1:SPD level)
	GROUP:	The group leader of the widget hirarchy

 COMMON BLOCKS:
	colour_indices
	bcksubt_cmn
	bcksubt_cmn0

 PROCEDURES USED:
	PIA LIB:
		chop_levels
		decode_admn
		pia_print_srcbck
		pia_showstr
		pia_xplot
		pia_xsurface
		subtr_bckg
		weight_mean
		bcksub_calc
       INTERNAL:
		pia_bcksubt_event
	
 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/ESTEC-SAI)		February 1995
	Modified (last) by: CG				September 1995
	Oct 95 Version 3.5
	Accomodating subtracted data into dynamical structures 
	  introduced  (CG)				December 1995
	98 & 99 changed -> 'C' and 'I' & chopper position -> chopper
	 step for better comprehension (CG)		April 1996
	Call to SAVE uses temporary header (CG) +
	 bcksub_calc created as external routine	May 1997
	V6.3

(See pia_bcksubt.pro)


PIA_BUFFIL

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

 PURPOSE:
	Menu for PIA Internal Buffers selection and display.
	This is a second level menu in the PIA hierarchy.

	This routine should only be called by the PIA main program
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_BUFFIL, GROUP=group

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	
 COMMON BLOCKS:
	phtaap
	phterd
	phtscp
	phtspd
	phtsrd
	pia_buffil_cmn	for internal use

 PROCEDURES USED:
	PIA LIB:
		decode_admn
		pia_disp_cs
		pia_disp_hdr
		pia_dispdata
		pia_showdata
		pickmeas
       INTERNAL:
		pia_buffil_event
	
 MODIFICATION HISTORY:
	Wrtten by: Carlos GABRIEL (ESA/ESTEC) 		July 1994
	Modified (last) by: CG, PM			September 1995
       SMD out, SMC int (SB)                           August 1996
	Oct 95 Version 3.5
	Common pia_widget_info extension (CG)		November 1997
	V6.6
			

(See pia_buffil.pro)


PIA_CC_DEFIN

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

 PURPOSE:
	Simple Menu for choosing colour correction elements 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_CC_DEFIN, CC_STR [,overpl=overpl]

 INPUT:
	(none)

 OUTPUT:
	CC_STR:	a structure containing parameters for CC

 KEYWORD:
	overpl: if plot to be produced has to be overplotted
		(only meaningful for the calling program)
	
 METHOD:
	Widgets
	
 COMMON BLOCKS:
	none	

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA)		May 1997
	V6.3
	Extension for modified BB models (CG + IH)	July 1997
	V6.4
	Bug for modified BB model nu-2 fixed (CG)	February 1998
	V7.0

(See pia_cc_defin.pro)


PIA_CIMAGE

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

 PURPOSE:
	PIA C-detectors IMAGE lego plotting.
	This is a display dependant level menu in the PIA hierarchy.

	This routine should only be called by the PIA display menues
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA, tmpdata, step

 INPUTS:
	tmpdata: A structure containing data to be displayed
	step:	 The chopper step to be plotted
	rpid_ch: The raster point (BYTARR(2)) to be plotted
	
 RESTRICTIONS:
	Up to 4 chopper steps are lego-plotted
	
 METHOD:
	Use PIA_Xsurface for lego plotting
		
 PROCEDURES USED:
	PIA LIB:
		cp_disc
		decode_admn
		pia_xsurface
	
 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/ESTEC)		October 1994
	Modified by: cg					July 1995
	Extension for raster point choice (CG)		January 1996
	Extension for raster points combination (CG)	December 1997
	V6.6

(See pia_cimage.pro)


PIA_CIMAGE_SPD

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

 PURPOSE:
	PIA C-detectors IMAGE lego plotting for SPD /AAP level.
	This is a display dependant level menu in the PIA hierarchy.

	This routine should only be called by the PIA display menues
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_CIMAGE_SPD, tmpdata, step, mulch, rpid_ch

 INPUTS:
	tmpdata: An SPD (or AAP) structure containing data to be displayed
	step:	 The chopper step to be plotted
	mulch:	 Chopper step number printer flag (0:no, 1:yes)
	rpid_ch: The raster point (BYTARR(2)) to be plotted
		
	
 KEYWORD:
	AAP:	For AAP structure as input

 METHOD:
	Use PIA_Xsurface for lego plotting
	
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_spddisc
		pia_xsurface

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/ESTEC)		November 1994
	Oct 95 Version 3.5
	Extension for raster point choice (CG)		January 1996
	Keyword AAP added (CG)				November 1997
	Extension for raster points combination (CG)	December 1997
	V6.6
			

(See pia_cimage_spd.pro)


PIA_CONVERT_IAAP

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

 PURPOSE:
	Interface to the PHTAAP common block.
	Let the user select an AAP measurement.
	PHTAAP structure of selected measurement is returned.

 CATEGORY:
	PIA - graphics

 MODIFICATION HISTORY:
	Written by:	C. Gabriel, ESA/VILSPA		March 1999

(See pia_convert_iaap.pro)


PIA_CONVOLVE

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

 PURPOSE:
	Convolves a map (using a gaussian) to a different resolution

 CATEGORY:
	PIA - graphics/processing

 CALLING SEQUENCE:
	PIA_CONVOLVE, imap, imappar, imaphdr, scan=scan

 INPUTS:
	IMAP		The two dimensional map of the input image

	IMAPPAR		The map parameter structure  as used in PIA

	IMAPHDR		The header of the measurement

 KEYWORD PARAMETERS:
	GROUP		The widget group leader

 OUTPUTS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		pia_mapdraw
		phtfilter_init
	Astronomical Library:
		psf_gaussian
	Internal:
		pia_convolve_event

 COMMON BLOCKS:
	PIA_convolv_cmn		internal
	phtfilter		filter id's
	phtfilter_prop		filter properties

 MODIFICATION HISTORY:
	Written by:		C. Gabriel, ESA/VILSPA		June 1996
	Convolve (astrolib) replaced by convol (IDL) because of
	 edges problems +
	 taking maximal dimensions for psf up to 15 (CG)	October 1997
	V6.6

(See pia_convolve.pro)


PIA_CONV_DATE

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

 PURPOSE:
	To return the string 'date' after conversion 

 CALLING SEQUENCE:
	PIA_CONV_DATE, UTST, DATE

 INPUT PARAMETERS:
	UTST	: Full seconds after 1989.0

 OUTPUT PARAMETERS:
	DATE	: STRING with format 'dd:mm:yyyy - hh:mm:ss'

 PROCEDURES USED:
       ASTRO LIB:
		date_conv

 MODIFICATION HISTORY:
	Written by: C. Gabriel (ESA/ESTEC)                April 1995
	Oct 95 Version 3.5
	Bug fixed using now julian date conversion (CG)	  January 1997 
			

(See pia_conv_date.pro)


PIA_CORRECTIONS

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

 PURPOSE:
       Widget routine for decision on which correction steps are 
	enabled/disabled, as well as for customizing them by calls 
	to the corresponding routines

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
       PIA_CORRECTIONS

 KEYWORD INPUTS:
	ERD:	Corrections for the ERD level listed for choice & customize
	SRD:	Corrections for the SRD level listed for choice & customize
	SCP:	Corrections for the SCP level listed for choice & customize

 COMMON BLOCKS:
       gen_choices

 PROCEDURES USED:
       PIA LIB:
	  deglitch_change
	  pia_def_darkorb
	  pia_pairdegl
	  pia_rodegl

 MODIFICATION HISTORY:
       Written by: Carlos GABRIEL (ESA-SAI/VILSPA)		March 1998
	V7.0
	/Modal use according to prescribed by IDL >=5.0 (CG)	January 1999
	V7.3
	Signal linearization added (SRD+SCP level)		June 1999
	V7.4
	PHT-S pointing correction added (CG)			December 1999
	V8.2

(See pia_corrections.pro)


PIA_CORR_VIGN

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

 PURPOSE:
	Apply vignetting correction procedure to a phtscp structure 

 CATEGORY:
       PIA - processing

 CALLING SEQUENCE:
	pia_corr_vign, tmpdata, tmphdr, GROUP=group

 INPUTS:
	tmpdata:  A PHTscp temporary structure
	tmphdr:	  The temporary header
	
 OUTPUTS:
	tmpdata:  The updated PHTscp temporary structure
	tmphdr:	  The updated temporary header 
	
 COMMON BLOCKS:
	phtvignet
	
 RESTRICTIONS:
	tmpdata must be a temporary PHT SCP structure
	
 PROCEDURES USED:
	PIA LIB:
		get_wheels
		vignet
		vignet_tables_read
	
 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/ESTEC)		February 1995
	Oct 95 Version 3.5
	Tested and fixed (CG)				May 1997
	V6.3
	Returning asap if only FCS 
	(to avoid HDR line on vignetting) (CG)		October 1997
	V6.5
	Avoiding divisions by 0 and fixing q3me (CG)	July 1998
	V7.2 			
			

(See pia_corr_vign.pro)


PIA_CURFIT

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

 PURPOSE:
	Non-linear least squares fit to a function of an
	arbitrary number of parameters.
	Function may be any non-linear function where
	the partial derivatives are known or can be approximated.

 CATEGORY:
	E2 - Curve and Surface Fitting

 CALLING SEQUENCE:
	yfit = curfit(x,y,w,a,sigmaa)
 INPUTS:
	X = Row vector of independent variables.
	Y = Row vector of dependent variable, same length as x.
	W = Row vector of weights, same length as x and y.
		For no weighting
		w(i) = 1., instrumental weighting w(i) =
		1./y(i), etc.
	
	More correct: If w(i) = 1/sigma^2 then SIGMAA = OK, then
			only in this case Chi^2 has the right meaning  (CG) 

	A = Vector of nterms length containing the initial estimate
		for each parameter.  If A is double precision, calculations
		are performed in double precision, otherwise in single prec.
	R = Two-dimensional array of ranges, for avoiding getaway parameters
		r=[3,N], with [(min,max,no_use), nterms]

 KEYWORD PARAMTERS:
	funct = string containing the name of the fitting function.
	    Default = 'funct'
	flag  = 0 if fit OK, 1 if no convergence found
	quiet = 1 to suppress printing interation information.
	max_its = Maximum number of iterations the function will
		do before giving up. Default=1000.
	accept = Acceptance criterion for acceptable fit. 
		This number is equal to the relative change in the
		ChiSquare statistic from one iteration to the next. 
		Default=.00001
	step = Step array

 OUTPUTS:
	A = Vector of parameters containing fit.
	Function result = YFIT = Vector of calculated
		values.
 OPTIONAL OUTPUT PARAMETERS:
	Sigmaa = Vector of standard deviations for parameters
		A.
	
 COMMON BLOCKS:
	NONE.
 SIDE EFFECTS:
	The function to be fit must be defined and called FUNCT.
	For an example see FUNCT in the IDL User's Libaray.
	Call to FUNCT is:
	FUNCT,X,A,F,PDER
 where:
	X = Vector of NPOINT independent variables, input.
	A = Vector of NTERMS function parameters, input.
	F = Vector of NPOINT values of function, y(i) = funct(x(i)), output.
	PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
		PDER(I,J) = Derivative of function at ith point with
		respect to jth parameter.  Optional output parameter.
		PDER should not be calculated if parameter is not
		supplied in call (unless you want to waste some time).
 RESTRICTIONS:
	NONE.
 PROCEDURE:
	Copied from "CURFIT", least squares fit to a non-linear
	function, pages 237-239, Bevington, Data Reduction and Error
	Analysis for the Physical Sciences.

	"This method is the Gradient-expansion algorithm which
	compines the best features of the gradient search with
	the method of linearizing the fitting function."

	Iterations are perform until the chi square changes by
	only 0.001% or until 1000 iterations have been performed.

	The initial guess of the parameter values should be
	as close to the actual values as possible or the solution
	may not converge.

 MODIFICATION HISTORY:
	PIA adaptation for including parameter ranges
	Written, DMS, RSI, September, 1982.
	Modified by D.L. Windt, AT&T Bell Labs, March, 1989.

(See pia_curfit.pro)


PIA_CURVEFIT

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

 PURPOSE:
       Non-linear least squares fit to a function of an arbitrary 
       number of parameters.  The function may be any non-linear 
       function.  If available, partial derivatives can be calculated by 
       the user function, else this routine will estimate partial derivatives
       with a forward difference approximation.

 CATEGORY:
       E2 - Curve and Surface Fitting.

 CALLING SEQUENCE:
       Result = PIA_CURVEFIT(X, Y, W, A, SIGMAA, FUNCTION_NAME = name, $
                         ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE)

 INPUTS:
       X:  A row vector of independent variables.  This routine does
		not manipulate or use values in X, it simply passes X
		to the user-written function.

       Y:  A row vector containing the dependent variable.

       W:  A row vector of weights, the same length as Y.
               For no weighting,
               w(i) = 1.0.
               For instrumental weighting,
               w(i) = 1.0/y(i), etc.

       A:  A vector, with as many elements as the number of terms, that 
           contains the initial estimate for each parameter.  If A is double-
           precision, calculations are performed in double precision, 
           otherwise they are performed in single precision.

 KEYWORDS:
       FUNCTION_NAME:  The name of the function (actually, a procedure) to 
       fit.  If omitted, "FUNCT" is used. The procedure must be written as
       described under RESTRICTIONS, below.

       ITMAX:  Maximum number of iterations. Default = 20.
       ITER:   The actual number of iterations which were performed
       TOL:    The convergence tolerance. The routine returns when the
               relative decrease in chi-squared is less than TOL in an 
               interation. Default = 1.e-3.
       CHI2:   The value of chi-squared on exit
       NODERIVATIVE:   If this keyword is set then the user procedure will not
               be requested to provide partial derivatives. The partial
               derivatives will be estimated in CURVEFIT using forward
               differences. If analytical derivatives are available they
               should always be used.
	FLAG:	0 if fit OK, 1 if no convergence found
	QUIET:	1 to suppress printing interation information.

 OUTPUTS:
       Returns a vector of calculated values.
       A:  A vector of parameters containing fit.

 OPTIONAL OUTPUT PARAMETERS:
       Sigmaa:  A vector of standard deviations for the parameters in A.

 COMMON BLOCKS:
       NONE.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The function to be fit must be defined and called FUNCT,
       unless the FUNCTION_NAME keyword is supplied.  This function,
       (actually written as a procedure) must accept values of
       X (the independent variable), and A (the fitted function's
       parameter values), and return F (the function's value at
       X), and PDER (a 2D array of partial derivatives).
       For an example, see FUNCT in the IDL User's Libaray.
       A call to FUNCT is entered as:
       FUNCT, X, A, F, PDER
 where:
       X = Variable passed into CURVEFIT.  It is the job of the user-written
		function to interpret this variable.
       A = Vector of NTERMS function parameters, input.
       F = Vector of NPOINT values of function, y(i) = funct(x), output.
       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
               PDER(I,J) = DErivative of function at ith point with
               respect to jth parameter.  Optional output parameter.
               PDER should not be calculated if the parameter is not
               supplied in call. If the /NODERIVATIVE keyword is set in the
               call to CURVEFIT then the user routine will never need to
               calculate PDER.

 PROCEDURE:
       Copied from "CURFIT", least squares fit to a non-linear
       function, pages 237-239, Bevington, Data Reduction and Error
       Analysis for the Physical Sciences.

       "This method is the Gradient-expansion algorithm which
       combines the best features of the gradient search with
       the method of linearizing the fitting function."

       Iterations are performed until the chi square changes by
       only TOL or until ITMAX iterations have been performed.

       The initial guess of the parameter values should be
       as close to the actual values as possible or the solution
       may not converge.

 EXAMPLE:  Fit a function of the form f(x) = a * exp(b*x) + c to
	sample pairs contained in x and y.
	In this example, a=a(0), b=a(1) and c=a(2).
	The partials are easily computed symbolicaly:
		df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0

		Here is the user-written procedure to return F(x) and
		the partials, given x:
       pro gfunct, x, a, f, pder	; Function + partials
	  bx = exp(a(1) * x)
         f= a(0) * bx + a(2)		;Evaluate the function
         if N_PARAMS() ge 4 then $	;Return partials?
		pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(y))]]
       end

         x=findgen(10)			;Define indep & dep variables.
         y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1]
         w=1.0/y			;Weights
         a=[10.0,-0.1,2.0]		;Initial guess
         yfit=curvefit(x,y,w,a,sigmaa,function_name='gfunct')
	  print, 'Function parameters: ', a
         print, yfit
       end

 MODIFICATION HISTORY:
       Written, DMS, RSI, September, 1982.
       Does not iterate if the first guess is good.  DMS, Oct, 1990.
       Added CALL_PROCEDURE to make the function's name a parameter.
              (Nov 1990)
       12/14/92 - modified to reflect the changes in the 1991
            edition of Bevington (eq. II-27) (jiy-suggested by CreaSo)
       Mark Rivers, U of Chicago, Feb. 12, 1995
           - Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE
             These make the routine much more generally useful.
           - Removed Oct. 1990 modification so the routine does one iteration
             even if first guess is good. Required to get meaningful output
             for errors. 
           - Added forward difference derivative calculations required for 
             NODERIVATIVE keyword.
           - Fixed a bug: PDER was passed to user's procedure on first call, 
             but was not defined. Thus, user's procedure might not calculate
             it, but the result was then used.
           

(See pia_curvefit.pro)


PIA_DECONV

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

 PURPOSE:
	Graphical application for map deconvolution 

 CATEGORY:
	PIA - graphics/processing

 CALLING SEQUENCE:
	PIA_DECONV, imap, imappar, imaphdr, dec_imap

 INPUTS:
	IMAP		The two dimensional map of the input image

	IMAPPAR		The map parameter structure  as used in PIA

	IMAPHDR		The header of the measurement


 OUTPUTS:
	DEC_IMAP	The deconvolved map

 PROCEDURES USED:
	PIA Procedure(s):
		pia_mapdraw
		pia_xsurface
		phtfilter_init
	Astronomical Library:
		max_entropy
		max_likelihood
	Internal:
		pia_deconv_event

 COMMON BLOCKS:
	phtfilter		filter id's
	phtfilter_prop		filter properties

 MODIFICATION HISTORY:
	Written by:		C. Gabriel, ESA/VILSPA		May 1998
	V7.2
	No modal mode now (no need) (CG)
	No convolution of footprint before interpolation (CG)	September 1998
	V7.3

(See pia_deconv.pro)


PIA_DECO_DEFIN

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

 PURPOSE:
	Simple Menu for choosing deconvolution parameters 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DECO_DEFIN, DECO_STR 

 INPUT:
	(none)

 OUTPUT:
	DECO_STR: a structure containing parameters for deconvolution

	
 METHOD:
	Widgets
	
 COMMON BLOCKS:
	none	

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA)		September 1998
	V7.3

(See pia_deco_defin.pro)


PIA_DEFAPER

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

 PURPOSE:
	Define aperture constants (ISO,PHT-P) and pixel sizes (PHT-C/PHT-S)
	and store them in a common block.

 CATEGORY:
          PIA - initialization

 CALLING SEQUENCE:
	PIA_DEFAPER

 COMMON BLOCKS:
	piacmn_pow2fb	To hold the aperture values

 MODIFICATION HISTORY:
	Written by: D. Skaley, MPIK/Heidelberg		Feb-95
		     Took values from SPG procedure 'AAP_APER_DIM' (S.Guest)
	Modified by: cg					Jul-95
	Oct 95 Version 3.5
			

(See pia_defaper.pro)


PIA_DEFRATIO

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

 PURPOSE:
	Define ratio of detector response at central wavelength to
	the response integrated over the filter width.
	for PHT-P and PHT-C filters and store the values in a common block.

 CATEGORY:
          PIA - initialization

 CALLING SEQUENCE:
	PIA_DEFRATIO

 COMMON BLOCKS:
	piacmn_pow2fb	To hold the ratio values

 MODIFICATION HISTORY:
	Written by: D. Skaley, MPIK/Heidelberg 		Feb-95 ds
			Took values from SPG procedure 'AAP_RATIO' (S.Guest)
	Oct 95 Version 3.5
			

(See pia_defratio.pro)


PIA_DEFWAVEL

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

 PURPOSE:
	Define central wavelenghts of filters for PHT-P and PHT-C
	and store them in a common block.

 CATEGORY:
          PIA - initialization

 CALLING SEQUENCE:
	PIA_DEFWAVEL

 COMMON BLOCKS:
	piacmn_pow2fb	To hold the weavelength values

 MODIFICATION HISTORY:
	Written by: D. Skaley, MPIK/Heidelberg			Feb-95
			Took values from SPG procedure 'AAP_CENTRAL' (S.Guest)
	Modified (last) by: cg					Sep-95	
	Oct 95 Version 3.5
			

(See pia_defwavel.pro)


PIA_DEF_CORRCOOR

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

 PURPOSE:
	Simple widget I/F for defining !CORRCOOR (using corrected coord or not) 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_corrcoor

	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	September 1997
	Version 6.5

(See pia_def_corrcoor.pro)


PIA_DEF_DARKORB

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

 PURPOSE:
	Simple widget I/F for defining how the orbital dark current subtraction
	is performed 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_darkorb

	
 COMMON BLOCKS:
	phtdarkorb

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	December 1997
	Version 6.6
	Bug corrected (JAc)				February 1998
	Option for subtraction of dark current dependant on exposure
	 time (only for PHT-S) added (JAc)		January 1999 
	Keyword modal added for inclusion in modal
	widgets (CG)					January 1999
	V7.3

(See pia_def_darkorb.pro)


PIA_DEF_ERRBARS

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

 PURPOSE:
	Simple widget I/F for defining !NO_ERRBARS (showing error bars or not) 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_errbars

	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	September 1997
	Version 6.5

(See pia_def_errbars.pro)


PIA_DEF_FFIELD

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

 PURPOSE:
	Simple widget I/F for defining !PIA_FFUSE (using external flat field) 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_ffield

	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	June 1997
	Version 6.3
	Change nomenclature (external ff to filter2filter) CG - Jul99
	V7.9

(See pia_def_ffield.pro)


PIA_DEF_NOWEIGHT

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

 PURPOSE:
	Simple widget I/F for defining !NO_WEIGHTS (using weighted means or not) 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_noweight

	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	November 1996
	Version 5.x

(See pia_def_noweight.pro)


PIA_DEF_PLOT_LIMITS

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

 PURPOSE:
	Simple widget I/F for defining !PIA_PLOT_LIMIT and !PIA_XPLOT_LIMIT

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_plot_limits

	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	January 1998
	Version 7.0

(See pia_def_plot_limits.pro)


PIA_DEF_RESPORB

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

 PURPOSE:
	Simple widget I/F for defining how the orbital dependant default 
	responsivity has to be taken 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_def_resporb

	
 COMMON BLOCKS:
	phtresporb

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	January 1998
	Version 7.0

(See pia_def_resporb.pro)


PIA_DIS2AAP

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

 PURPOSE:
	Menu for PIA AAP Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DIS2AAP

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       DATA:   An element of the PHTAAP dynamical structure
       NV:     Number of Views (1 <= NV <= 4)
       REDRAW:	To redraw same data

 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phtaap
	pia_ds2aap_cmn (internal)
	pia_dsp2ch6_cmn (internal)
	ds2aap_widg (internal)
	pia_dspchz_cmn (internal)
	aap2_nacc (internal)
	tmp2values6 (internal)
	aap2att (internal)
	dis2cust_cmn (internal)
	pia_widget_info (internal)

 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_convwh
		get_pht_hk
		get_spddisc
		pia_bcksubt
		pia_cimage_spd
		pia_dis2aap
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_get_step
		pia_load_ispd
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_print_spdval
		pia_showstr
		pia_spddisc
		pia_spect
		pia_spect_spd
		pia_write_ispd
		pia_xplot
		pickmeas
		read_irph
		weight_mean
		write_aap
		xdisp_hk
       ASTRO LIB:
		getfiles
       INTERNAL:	
		pixbut2event6
		view2event6
		average2chop6
		average2nonch6
		average2event6
		median2chop6
		median2nonch6
		median2event6
		zoom2event6
		zoom2fourier6
		zoom2sync6
		zoom2nsync6
		zoom2it6
		pia_reset2view6
		pia_daap2_event

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               September 1994
	Modified (last) by: cg				November 1996
	Version 5.x
	Saving internal file upgraded  +
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	V6.3
	Added possibility to save corrections in phtaap 
	buffer  (JAc)   				October 1997
	V6.6
	Chopper frequency correction (OK) added (CG)	March 1998
	V7.1 
	Discarded points taken from tmp.flag (CG)	August 1998
	V7.3
	Main widget is destroyed when new call to 
	 pia_dis2aap (bug in former version) (CG)	February 1999
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Concatenated measurements displayed OK (CG)	February 1999
	Saving AAP FITS files for PHT-S added (CG)	February 1999
	PIA_ff_med_smooth call w. /modal (CG)		March 1999
	Update according to bitflag system (CG)		May 1999
	Display of decoded flags included (JAC)         June 1999
	V7.4
	First quartile FF included (CG)			July 1999
	V7.9
	Avoiding crash by cancel of meas.subtr.(CG)	October 1999
	Including PHT-S off-centre correction (CG)	October 1999
	V8.1
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2
			

(See pia_dis2aap.pro)


PIA_DIS2ERD

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

 PURPOSE:
	Menu for PIA ERD Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DIS2ERD

 KEYWORD PARAMETERS:
	GROUP: 	The group leader of the widget hirarchy
       DATA:	An element of the PHTERD dynamical structure
       NV:	Number of Views (1 <= NV <= 4)
       REDRAW:	To redraw same data
	
 RESTRICTIONS:
       DATA must be a valid element of PHTERD dynamical structure
		
 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phterd
	phtsrd
	splitramp_par
	pia_dsp2erd_cmn (internal)
	pia_dsp2cho_cmn (internal)
	dsp2erd_widg (internal)
	pia_dspchz_cmn (internal)
	pia_plot_over_cmn (internal)
	tmp2values (internal)
	flg2_acc (internal)
	erd2text (internal)
	dispcust_cmn (internal)
	pia_widget_info (internal)

 PROCEDURES USED:
	PIA LIB:
		decode_admn
		decode_pixf
		get_convwh
		get_pht_hk
		get_rodisc
		lin_voltages
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_dispsrd
		pia_load_ierd
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_plot_over
		pia_rodisc
		pia_satlev
		pia_showstr
		pia_write_ierd
		pia_xplot
		pickmeas
		process_erd
		process_pixel
		xdisp_hk
       ASTRO LIB:
		avg
		fxpar
		sigma
       INTERNAL:
		pixbut2event
		view2event
		fit2ram1
		fit2ram2
		fit2ram3
		fit2ramps
		average2event
		median2event
		zoom2event
		zoom2fourier
		zoom2sync
		zoom2nsync
		zoom2it
		pia_derd2_event

 MODIFICATION HISTORY:
       Written by C.Gabriel (ESA/ESTEC)                June 1994
	Modified (last) by: cg				November 1996 
	V5.x
	Bug fixed (wrong plot from testing fit ramps)	January 1997
	V6.x 
	Full TDT Housekeeping data access added	(CG)	April 1997
	V6.2
	Graphical signal discarding added +
	 saving internal file upgraded +
	 ramp subdivision using CB splitramp_par & testing included +
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997	
	V6.3
	Allowing for graph. multi de(re)-selection (CG)	September 1997 
	V6.5
	Using process_tmperd instead of process_erd, 
	 pairdeglitching added (CG)			November 1997
       Change the calling sequence to pia_dispsrd (JA) October 1997
	V6.6
	Pair deglitch testing bug fixed (CG)		June 1998
	V7.2
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Display of decoded pia flags included (JA)	June 1999
	V7.4
	Extension of "pattern proc" to sawtooth (CG) +	July 1999
	Wrong initialisation for 2-Thr. Degl fixed (CG)
	V8.0
	Bug in resetting view fixed (CG)		August 1999
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2

(See pia_dis2erd.pro)


PIA_DIS2SCP

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

 PURPOSE:
	Menu for PIA SCP 2nd Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_dis2scp, DATA=data, NV=nv, REDRAW=redraw, GROUP=group

 KEYWORD PARAMETERS:
	GROUP: 	The group leader of the widget hirarchy
       DATA: 	An element of the PHTSCP dynamical structure
       NV: 	Number of Views (1 <= NV <= 4)
       REDRAW: To redraw same data

 COMMON BLOCKS
	adm
	colour_indices
	phtacc
	phtcs
	phtscp
	phtspd
	phtvignet
	pia_dsp2scp_cmn (internal)
	pia_dsp2ch3_cmn (internal)
	dsp2scp_widg_cmn (internal)
	pia_dspchz_cmn (internal)
	scp2_nacc (internal)
	tmp2values3 (internal)
	scp2attext (internal)
	dispcust_cmn (internal)
	dsp2scp_widg (internal)
	pia_widget_infoo (internal)
       pia_reset2control_cmn
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_convwh
		get_pht_hk
		get_scpdisc
		pia_base_drift
		pia_bcksubt
		pia_cimage
		pia_corr_vign
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_dispspd
		pia_get_step
		pia_load_iscp
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_print_scpval
		pia_respons
		pia_scpdisc
		pia_showstr
		pia_spect
		pia_write_iscp
		pia_xplot
		pickmeas
		process_scp
		weight_mean
		write_scp
		xdisp_hk
       ASTRO LIB:
		avg
		fxpar
       INTERNAL:
		pixbut2event3
		view2event3
		average2chop3
		average2nonch3
		average2event3
		median2chop3
		median2nonch3
		median2event3
		zoom2event3
		zoom2fourier3
		zoom2sync3
		zoom2nsync3
		zoom2it3
		pia_reset2view3
		pia_dscp2_event
		basel2_drift
		pia_reset2corrcontrol3
	
 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               July 1994
	Modified (last) by: cg				December 1996
	Straylight and Dark Current measurement subtraction added (CG)
							December 1996
	Version 5.5
	Bug fixed (index of FCS cal interpolation) (CG)	March 1997
	V6.2
	Saving internal file upgraded (CG) + 
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	V6.3
	Added possibility to save corrections in phtsrd 
	buffer + calling sequence to pia_dispspd (JAc)   October 1997
	and graphical selection capability (CG)		November 1997
	Orbital position dependant dark current 
	 subtraction added (CG)				December 1997
	V6.6
	Chopper frequency correction for subtracted 
	 measurements 	+   default
	 response orbit dep. correction added (CG)	January 1998
	Average actual responsivities included (JAc)    January 1998
	New routine pia_resetcorrcontrol3 used to avoid
	 redrawing the whole screen after loading new
	 measurements	(JAc)				February 1998
	V7.0
	Flux calibration is now possible for FCS (JAc)  June 1998
	Jump directly to pia_dispaap when doing flux 
	calibration (JAc)				August 1998	
	Plotting also flags (CG)			November 1998
	V7.3
	Modified to include direct calib of chopped 
	PHT-S measurements (JAc - IAC) 			February 1999  
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Update according to bitflag system (CG)		May 1999
	Display of decoded flags included (JAC ->CG)	June 1999
	Actual responsivity info added (CG)		July 1999
	V7.4
	Background subtraction disabled for P32 (CG)	July 1999
	V8.0
	Call to calib_choppmeas_sl includes t_on (CG)	September 1999
	V8.1
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2
	

(See pia_dis2scp.pro)


PIA_DIS2SPD

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

 PURPOSE:
	Menu for PIA SPD 2nd Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DIS2SPD

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	
 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phtspd
	raster_info
	pia_ds2spd_cmn (internal)
	pia_dsp2ch4_cmn (internal)
 	ds2spd_widg (internal)
	pia_dspchz_cmn (internal)
	spd2_nacc (internal)
	aar2_struc (internal)
	tmp2values4 (internal)
	spd2attext (internal)
	dispcust_cmn (internal)
	pia_widget_info (internal)

 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_convwh
		get_pht_hk
		get_spddisc
		pia_bcksubt
		pia_cimage_spd
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_get_step
		pia_load_ispd
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_print_spdval
		pia_showstr
		pia_spddisc
		pia_spect
		pia_spect_spd
		pia_write_ispd
		pia_xplot
		pickmeas
		process_spd
		read_irph
		weight_mean
		write_spd
		xdisp_hk
       ASTRO LIB:
		getfiles
       INTERNAL:
		pixbut2event4
 		view2event4
 		average2chop4
 		average2nonch4
 		average2event4
 		median2chop4
 		median2nonch4
 		median2event4
 		zoom2event4
 		zoomfourier4
 		zoom2sync4
 		zoom2nsync4
 		zoom2it4
 		pia_reset2view4
 		pia_dspd2_event
	
 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               September 1994
	Modified (last) by: CG				November 1996
	Version 5.x
	Saving internal file upgraded + 
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	V6.3
	Bug by measurement subtraction fixed (CG)	June 1997
	V6.4
	Added possibility to save corrections in phtspd 
	buffer  (JAc)   				October 1997
	and graphical selection capability (CG)		November 1997
	V6.6
	Chopper frequency correction added (CG)		March 1998
	+ 'corrections' denomination + widgets update   March 1998
	V7.1 
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Update according to bitflag system (CG)		May 1999
	Display of decoded flags included (JAC)         June 1999
	V7.4
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. +
	IMAP processing included (CG)			January 2000
	V8.2
			

(See pia_dis2spd.pro)


PIA_DIS2SRD

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

 PURPOSE:
	Menu for PIA SRD Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
       PIA_DISPSRD, GROUP=group, DATA=data, NV=nv, REDRAW=redraw

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       DATA:   An element of the PHTSRD dynamic structure
       NV:     Number of Views (1 <= NV <= 4)
       REDRAW:	To redraw same data
	
 RESTRICTIONS:
       DATA must be a valid element of PHTSRD dynamic structure
	
 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	pia_drift_inipar_cmn
	pia_dsp2srd_cmn (internal)
	pia_dsp2ch2_cmn (internal)
	dsp2srd_wid (internal)
	pia_dspchz_cmn (internal)
	not2_acc (internal)
	tmp2values2 (internal)
	srd2text (internal)
	dispcust_cmn (internal)
	pia_widget_info (internal)
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		deglitch_change
		do_deglitch
		get_convwh
		get_pht_hk
		get_sigdisc
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_dispscp
		pia_drift_inipar
		pia_load_isrd
		pia_mann
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_showstr
		pia_sigdisc
		pia_sm
		pia_write_isrd
		pia_xplot
		pickmeas
		process_tmpsrd
		write_srd
		xdisp_hk
       ASTRO LIB:
		avg
		fxpar
		sigma
       INTERNAL:
 		pixbut2event2
 		view2event2
 		stabil2_par
 		deglitch2_par
 		average2chop2
 		average2nonch2
 		average2event2
 		median2chop2
 		median2nonch2
 		median2event2
 		zoom2event2
 		zoom2fourier2
 		zoom2sync2
 		zoom2nsync2
 		zoom2it2
 		pia_reset2view2
 		pia_dsrd2_event

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               July 1994
	Modified (last)  CGabriel			February 97
	Call to Deglitching routines modified to include
	discarding flags  (JA)				March 97
	V6.1
	Graphical signal discarding added +
	 reset interval correction added +
	 saving internal file upgraded +
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997	
	Added button to reset RPID	(JAcosta)	June 1997
	V6.3
	Uncertainties from reset int corr added (CG)	September 1997
	Allowing for graph. multi de(re)-selection (CG)	September 1997 
	V6.5
	Added possibility to save corrections in phtsrd 
	buffer + calling sequence to pia_dispscp (JAc)   October 1997
	Orbital position dependant dark current 
	 subtraction added (CG)				December 1997
	V6.6
	Allowing external v. for reset int.corr (CG)	February 1998
	V7.0
	Pixel numbering bug for aver/median fixed (CG)	July 1998
	V7.2
	Bug in the unc. calc. after reset int. corr. fixed (CG)
							September 1998
	Dynamic calibration for PHT-S added 
	 (CG based on JA's work)			November 1998
	V7.3
	Linearization included (only int.version) (CG) 	December 1998
	V7.3
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Pattern processing added (CG)			May 1999
	Adapted for the use of bitflags (JA + CG)	May 1999 
	Use of process_tmpsrd with pattern option (CG)	June 1999
	V7.4
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2
	   

(See pia_dis2srd.pro)


PIA_DISPAAP

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

 PURPOSE:
	Menu for PIA AAP Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DISPAAP

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       DATA:   An element of the PHTAAP dynamical structure
       NV:     Number of Views (1 <= NV <= 4)
       REDRAW:	To redraw same data

 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phtaap
	pia_dispaap_cmn (internal)
	pia_dspch6_cmn (internal)
	dspaap_widg (internal)
	pia_dspchz_cmn (internal)
	aap_nacc (internal)
	tmpvalues6 (internal)
	aapatt (internal)
	dispcust_cmn (internal)
	pia_widget_info (internal)

 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_convwh
		get_pht_hk
		get_spddisc
		pia_bcksubt
		pia_cimage_spd
		pia_dis2aap
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_get_step
		pia_load_iaap
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_print_spdval
		pia_showstr
		pia_spddisc
		pia_spect
		pia_spect_aar
		pia_write_ispd
		pia_xplot
		pickmeas
		read_irph
		weight_mean
		write_spd
		xdisp_hk
       ASTRO LIB:
		getfiles
       INTERNAL:	
		pixbutevent6
		viewevent6
		averagechop6
		averagenonch6
		averageevent6
		medianchop6
		mediannonch6
		medianevent6
		zoomevent6
		zoomfourier6
		zoomsync6
		zoomnsync6
		zoomit6
		pia_resetview6
		pia_daap_event

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               September 1994
	Modified (last) by: cg				November 1996
	Version 5.x
	Saving internal file upgraded  +
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	V6.3
	Added possibility to save corrections in phtaap 
	 buffer  (JAc)   				October 1997
	Measurements concatenation implemented (CG)	December 1997
	V6.6
	Chopper frequency correction (OK) added (CG)	March 1998
	V7.1 
	Discarded points taken from tmp.flag (CG)	August 1998
	V7.3
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Concatenated measurements displayed OK (CG)	February 1999
	Saving AAP FITS files for PHT-S added (CG)	February 1999
	PIA_ff_med_smooth call w. /modal (CG)		March 1999
	Update according to bitflag system (CG)		May 1999
	Display of decoded flags included (JAC)         June 1999
	V7.4
	First quartile FF included (CG)			July 1999
	V7.9
	Avoiding crash by cancel of meas.subtr.(CG)	October 1999
	Including PHT-S off-centre correction (CG)	October 1999
	V8.1
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2
			

(See pia_dispaap.pro)


PIA_DISPCUST

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

 PURPOSE:
	Menu for PIA drawing customization.
	This is a display dependant level menu in the PIA hierarchy.

	This routine should only be called by the PIA display menues
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DISPCUST

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	
 COMMON BLOCKS:
	dispcust_cmn (internal)

 PROCEDURES USED:
       INTERNAL:
		pia_dispcust_event
	
 MODIFICATION HISTORY:
	Written by C.Gabriel (ESA/ESTEC)		August 1994
	Oct 95 Version 3.5
	Extension for new symbols (CG)			November 1995
	Avoiding crashes if no selection (CG)		February 1996
	Choice of lines taken out (CG)			May 1996
	/Modal use according to IDL >=5.0 (CG)		January 1999
	V7.3
			

(See pia_dispcust.pro)


PIA_DISPDATA

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

 PURPOSE:
	PIA Data display menu selector.
	Calls the display menu corresponding to the data level (ftype)
	passing the internal measurement name (filename)

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_dispdata, filename, ftype [,tmppos=tmppos] 

 INPUTS:
	filename: internal name (*.admn) of the chosen measurement
	ftype: 	  data level type  
	
 KEYWORD PARAMETERS:
	tmppos:	Exact position within the array of dynamical structures
	GROUP:	The widget ID of the group leader of the widget.  If this 
		keyword is specified, the death of the group leader results in
		the death of PIA_disp_print_file.

 COMMON BLOCKS:
	adm
	phtcs
	phterd
	phtscp
	phtsmc
	phtspd
	phtsrd
	pia_dspcho_cmn (internal)

 PROCEDURES USED:
	PIA LIB:
		pia_disperd
		pia_dispscp
		pia_dispspd
		pia_dispsrd
		pia_multmeas
		pia_sm
		pia_sm_dispsmc

 MODIFICATION HISTORY:
	Written by: Carlos GABRIEL (ESA/ESTEC)			July 1994
	Modified (last) by SB					October 1996
	V5.x
	tmppos keyword added (CG)				May 1997
	V6.3
	Calling sequence to pia_dispsrd, pia_dispscp, 
	 pia_dispspd  (JAc)					October 1997
	V6.6
	
			

(See pia_dispdata.pro)


PIA_DISPERD

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

 PURPOSE:
	Menu for PIA ERD Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DISPERD

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	DATA:	An element of the PHTERD dynamical structure
	NV:	Number of Views (1 <= NV <= 4)
	REDRAW:	To redraw same data 
	TMPSTR: To use instead of DATA a temporary structure
	NEWH:	To use instead of tmpstr.hdr a different header
	
 RESTRICTIONS:
	DATA must be a valid element of PHTERD dynamical structure
	
 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phterd
	phtsrd
	splitramp_par
	pia_dsperd_cmn (internal)
	pia_dspcho_cmn (internal)
	dsperd_widg (internal)
	pia_dspchz_cmn (internal)
	pia_plot_over_cmn (internal)
	tmpvalues (internal)
	flg_acc (internal)
	erdtext (internal)
	dispcust_cmn (internal)
	dsperd_widg (internal)
	pia_widget_info (internal)
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_convwh
		get_pht_hk
		get_rodisc
		lin_voltages
		pia_dis2erd
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_dispsrd
		pia_load_ierd
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_plot_over
		pia_rodisc
		pia_satlev
		pia_showstr
		pia_write_ierd
		pia_xplot
		pickmeas
		process_tmperd
		process_pixel
		xdisp_hk
       ASTRO LIB:
		avg
		fxpar
		sigma
       INTERNAL:
	 	pixbutevent
		viewevent
		fitram1
	 	fitram2
	 	fitram3
	 	fitramps
		fitrams
	 	process_pixel
	 	averageevent
	 	medianevent
	 	zoomevent
	 	zoomfourier
	 	zoomsync
	 	zoomnsync
	 	zoomit
	 	pia_resetview
	 	pia_derd_event

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/ESTEC)		June 1994
	Modified (last) by: cg				October 1996
	Full TDT Housekeeping data access added	(CG)	April 1997
	V6.2
	Graphical signal discarding added +
	 saving internal file upgraded  + 
	 ramp subdivision using CB splitramp_par & testing included +
	 direct discrimination for measurement selection +
	 keywords TMPSTR and NEWH added +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997	
	V6.3
	Allowing for graph. multi de(re)-selection (CG)	September 1997 
	V6.5
	Using process_tmperd instead of process_erd, 
	 pairdeglitching added (CG)			November 1997
       Change the calling sequence to pia_dispsrd (JA) October 1997
	V6.6
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Display of decoded pia flags included (JA)	June 1999
	V7.4
	Extension of "pattern proc" to sawtooth (CG) +	July 1999
	Wrong initialisation for 2-Thr. Degl fixed (CG)
	V8.0
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2
			

(See pia_disperd.pro)


PIA_DISPSCP

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

 PURPOSE:
	Menu for PIA SCP Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DISPSCP
	
 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       DATA:   An element of the PHTSRD dynamical structure
       NV:	Number of Views (1 <= NV <= 4)
       REDRAW: To redraw same data
	CALA:	To display Cal A data

 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phtscp
	phtspd
	phtvignet
	pia_dspscp_cmn (internal)
	pia_dspch3_cmn (internal)
	dspscp_widg (internal)
	scp_nac (internal)
	tmpvalues3 (internal)
	pia_dspchz_cmn (internal)
	scpattext (internal)
	dispcust_cmn (internal)
	dspscp_widg (internal)
	pia_widget_info 
       pia_resetcontrol_cmn
		
 PROCEDURES USED:
	PIA LIB:
		get_convwh
		get_pht_hk
		get_scpdisc
		pia_base_drift
		pia_bcksubt
		pia_cimage
		pia_corr_vign
		pia_def_resporb
		pia_dis2scp
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_dispspd
		pia_get_step
		pia_load_iscp
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_respons
		pia_scpdisc
		pia_showstr
		pia_spect
		pia_write_iscp
		pia_xplot
		pickmeas
		process_scp
		weight_mean
		write_scp
		xdisp_hk
       ASTRO LIB:
		avg
		fxpar
       INTERNAL:
		 pixbutevent3
		 viewevent3
		 averagechop3
		 averagenonch3
		 averageevent3
		 medianchop3
		 mediannonch3
		 medianevent3
		 zoomevent3
		 zoomfourier3
		 zoomsync3
		 zoomnsync3
		 zoomit3
		 pia_resetview3
		 pia_dscp_event
		 basel_drift
		 pia_resetcorrcontrol3

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               July 1994
	Modified (last) by: cg				December 1996
	Version 5.4
	Straylight and Dark Current measurement subtraction added (CG)
							December 1996
	Version 5.5
	Bug fixed (index of FCS cal interpolation) (CG)	March 1997
	V6.2
	Saving internal file upgraded  +
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	V6.3
	Processing with baseline drift graphical handling
	 added (CG)					July 1997
	V6.4
	Added possibility to save corrections in phtscp 
	 buffer + calling sequence to pia_dispspd (JAc) October 1997
	 and graphical selection capability (CG)	November 1997
	Orbital position dependant dark current 
	 subtraction added (CG)				December 1997
	V6.6
	Chopper frequency correction for subtracted 
	 measurements 	+   default
	 response orbit dep. correction added (CG)	January 1998
	Average actual responsivities included (JAc)    January 1998
	New routine pia_resetcorrcontrol3 used to avoid
	 redrawing the whole screen after loading new
	 measurements	(JAc)				February 1998
	V7.0
	Flux calibration is now possible for FCS (JAc)  June 1998
	Jump directly to pia_dispaap when doing flux 
	calibration (JAc)				August 1998
	Plotting also flags (CG)			November 1998
	V7.3
	Modified to include direct calib of chopped 
	PHT-S measurements (JAc - IAC) 			February 1999  
	Widget problem (INT instead of LON) fixed (CG)  February 1999
	Update according to bitflag system (CG)		May 1999
	Display of decoded flags included (JAC)		June 1999
	Actual responsivity info added (CG)		July 1999
	V7.4
	Background subtraction disabled for P32 (CG)	July 1999
	V8.0
	Call to calib_choppmeas_sl includes t_on (CG)	September 1999
	V8.1
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. (CG)	January 2000
	V8.2
			

(See pia_dispscp.pro)


PIA_DISPSPD

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

 PURPOSE:
	Menu for PIA SPD Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DISPSPD

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       DATA:   An element of the PHTSRD dynamical structure
       NV:     Number of Views (1 <= NV <= 4)
       REDRAW:	To redraw same data

 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phtspd
	pia_dspspd_cmn (internal)
	pia_dspch4_cmn (internal)
	dspspd_widg (internal)
	pia_dspchz_cmn (internal)
	spd_nacc (internal)
	aar_struc (internal)
	tmpvalues4 (internal)
	spdattext (internal)
	dispcust_cmn (internal)
	dspspd_widg (internal)
	pia_widget_info (internal)

 PROCEDURES USED:
	PIA LIB:
		decode_admn
		get_convwh
		get_pht_hk
		get_spddisc
		pia_bcksubt
		pia_cimage_spd
		pia_dis2spd
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_get_step
		pia_load_ispd
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_print_spdval
		pia_showstr
		pia_spddisc
		pia_spect
		pia_spect_spd
		pia_write_ispd
		pia_xplot
		pickmeas
		process_spd
		read_irph
		weight_mean
		write_spd
		xdisp_hk
       ASTRO LIB:
		getfiles
       INTERNAL:	
		pixbutevent4
		viewevent4
		averagechop4
		averagenonch4
		averageevent4
		medianchop4
		mediannonch4
		medianevent4
		zoomevent4
		zoomfourier4
		zoomsync4
		zoomnsync4
		zoomit4
		pia_resetview4
		pia_dspd_event

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               September 1994
	Modified (last) by: cg				November 1996
	Version 5.x
	Saving internal file upgraded  +
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	V6.3
	Added possibility to save corrections in phtspd 
	buffer  (JAc)   				October 1997
	and graphical selection capability (CG)		November 1997
	V6.6
	Chopper frequency correction added (CG)		March 1998
	+ 'corrections' denomination + widgets update	March 1998
	V7.1 
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Update according to bitflag system (CG)		May 1999
	Display of decoded flags included (JAC)         June 1999
	V7.4
	Exit including possibility of saving meas. +
	replacing numbers by letters in pixel ind. +
	IMAP processing included (CG)			January 2000
	V8.2
			

(See pia_dispspd.pro)


PIA_DISPSRD

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

 PURPOSE:
	Menu for PIA SRD Data display.
	This is a fourth level menu in the PIA hierarchy.

	This routine should only be called by the PIA Display Data routine
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DISPSRD
	
 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       DATA:   An element of the PHTSRD dynamic structure
       NV:     Number of Views (1 <= NV <= 4)
       REDRAW: To redraw same data
	
 COMMON BLOCKS:
	adm
	colour_indices
	phtacc
	phtcs
	phtdarkcur
	phtsmc
	phtsrd
	pia_drift_inipar_cmn
	pia_dspsrd_cmn (internal)
	pia_dspch2_cmn (internal)
	dspsrd_widg (internal)
	pia_dspchz_cmn (internal)
	not_acc (internal)
	tmpvalues2 (internal)
	dispcust_cmn (internal)
	srdtext (internal)
	pia_widget_info (internal)

 RESTRICTIONS:
       DATA must be a valid element of PHTSRD dynamic structure
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		deglitch_change
		do_deglitch
		get_convwh
		get_pht_hk
		pia_dis2srd
		pia_disp_cs
		pia_disp_hdr
		pia_dispcust
		pia_dispscp
		pia_drift_inipar
		pia_load_isrd
		pia_mann
		pia_multchoice
		pia_multmeas
		pia_oplot
		pia_pixchoice
		pia_plot
		pia_showstr
		pia_sigdisc
		pia_sm
		pia_write_isrd
		pia_xplot
		pickmeas
		process_tmpsrd
		write_srd
		xdisp_hk
       ASTRO LIB:
		avg
		avg
		fxpar
		sigma
       INTERNAL:
		pixbutevent2
		viewevent2
		stabil_par
		deglitch_par
		averagechop2
		averagenonch2
		averageevent2
		medianchop2
		mediannonch2
		medianevent2
		zoomevent2
		zoomfourier2
		zoomsync2
		zoomnsync2
		zoomit2
		pia_resetview2
		pia_dsrd_event

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/ESTEC)               July 1994
	Modified (last) by JAcosta - CGabriel		February 97
	Call to Deglitching routines modified to include
	discarding flags  (JA)				March 97
	V6.1
	Graphical signal discarding added  +
	 reset interval correction added +
	 saving internal file upgraded + 
	 direct discrimination for measurement selection +
	 auxiliary files display added (EOH*, OLR) (CG) May 1997
	Added button to reset RPID	(JAcosta)	June 1997
	V6.3
	Uncertainties from reset int corr added (CG)	September 1997
	Allowing for graph. multi de(re)-selection (CG)	September 1997 
	V6.5
	Added possibility to save corrections in phtsrd 
	 buffer + calling sequence to pia_dispscp (JAc)	October 1997
	Orbital position dependant dark current 
	 subtraction added (CG)				December 1997
	V6.6
	Allowing external v. for reset int.corr (CG)	February 1998
	V7.0
	Pixel numbering bug for aver/median fixed (CG)	July 1998
	V7.2
	Bug in the unc. calc. after reset int. corr. fixed (CG)
							September 1998
	Dynamic calibration for PHT-S added 
	 (CG based on JA's work)			November 1998
	V7.3
	Linearization included (only int.version) (CG) 	December 1998
	V7.3
	Widget problem (INT instead of LON) fixed (CG)	February 1999
	Pattern processing added (CG)			May 1999
	Adapted for the use of bitflags (JA + CG)	May 1999 
	Use of process_tmpsrd with pattern option (CG)	June 1999
	Display of decoded flags included (JAC)         June 1999
	V7.4
       Exit including possibility of saving meas. +
       replacing numbers by letters in pixel ind.      (CG) January 2000
	Include dynamical response calibration for PHT-S
	in OLP style				   (JAcosta) February 2000
       V8.2

(See pia_dispsrd.pro)


PIA_DISP_CS

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

 PURPOSE:
       Displays the converted Compact Status contents
       
 CALLING SEQUENCE:
       PIA_disp_cs, measname

 INPUT PARAMETERS:
       measname: e.g. 'C102003102'

 OUTPUT PARAMETERS:
       widget

 COMMON BLOCKS:
		phtcs
		pia_disp_cs_cmn (internal)

 PROCEDURE:
	reads CS buffer, converts data in readable
	information and xdisplays detector data onto screen

 PROCEDURES USED:
	PIA LIB:
		conv_cs
		decode_admn
		read_cs
		pia_disp_print_file

 MODIFICATION HISTORY:
       Written by: Thorsten Reimann 		10/94
	Modified by: (CG)			November 1996
	V5.x
	Simplified through use of PIA_DISP_PRINT_FILE (CG)	Feb.97
	V6.1			

(See pia_disp_cs.pro)


PIA_DISP_EOHA

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

 PURPOSE:
	Read the Edited Observation History (EOHA) from FITSDIR and 
	display/print contents for a given TDT

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_DISP_EOHA, tdtnr

 INPUTS:
	tdtnr:		TDT number for which OLP report shall be displayed

 KEYWORD PARAMETERS:
	ERROR : 	returns an error condition:
			0 = no error
			1 = could not successfully read the EOHA file

 PROCEDURES USED:
	PIA Procedure(s):
		pia_disp_print_file

 MODIFICATION HISTORY:
	Written by: 	I. Heinrichsen, MPIK/Heidelberg, Mai 1997

(See pia_disp_eoha.pro)


PIA_DISP_EOHI

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

 PURPOSE:
	Read the Edited Observation History (EOHI) from FITSDIR and 
	display/print contents for a given TDT

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_DISP_EOHI, tdtnr

 INPUTS:
	tdtnr:		TDT number for which OLP report shall be displayed

 KEYWORD PARAMETERS:
	ERROR : 	returns an error condition:
			0 = no error
			1 = could not successfully read the EOHA file

 PROCEDURES USED:
	PIA Procedure(s):
		pia_disp_print_file

 MODIFICATION HISTORY:
	Written by: 	I. Heinrichsen, MPIK/Heidelberg, Mai 1997

(See pia_disp_eohi.pro)


PIA_DISP_HDR

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

 PURPOSE:
       Displays header contents
       
 CATEGORY:
          PIA - graphics

 CALLING SEQUENCE:
       PIA_disp_hdr, header, admn, level

 INPUT PARAMETERS:
	header: The header to be displayed
       admn:	A measurement name (PIA admn convention) 
	level:	Level of processing, e.g. SRD

 KEYWORD PARAMETERS:
	GROUP=group: Group leader

 COMMON BLOCKS:
	pia_disp_hdr_cmn (internal)
	
 PROCEDURES USED:
       INTERNAL:
		pia_disp_hdr_event

 MODIFICATION HISTORY:
       Written by: Carlos GABRIEL (ESA/ESTEC)		Dec. 94
	Oct 95 Version 3.5
	Free_lun instead of close - get_lun used (CG)	May 1996
	Print_dir bug fixed (CG)			July 1996
	Simplified through use of PIA_DISP_PRINT_FILE (CG)	Feb.97
	V6.1			
			

(See pia_disp_hdr.pro)


PIA_DISP_ISR

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

 PURPOSE:
	Read the Instrument station report from FITSDIR and 
	display/print contents

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_DISP_ISR, tdtnr

 INPUTS:
	tdtnr:		TDT number for which IS report shall be displayed

 KEYWORD PARAMETERS:
	ERROR : 	returns an error condition:
			0 = no error
			1 = could not successfully read the PISR file

 PROCEDURES USED:
	PIA Procedure(s):
		pia_disp_print_file

 MODIFICATION HISTORY:
	Written by: 	I. Heinrichsen, MPIK/Heidelberg	December 1995
                       I. H.: Header corrected          March   1997

(See pia_disp_isr.pro)


PIA_DISP_OLR

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

 PURPOSE:
	Read the OLP report from FITSDIR and 
	display/print contents

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_DISP_OLR, tdtnr

 INPUTS:
	tdtnr:		TDT number for which OLP report shall be displayed

 KEYWORD PARAMETERS:
	ERROR : 	returns an error condition:
			0 = no error
			1 = could not successfully read the POLR file

 PROCEDURES USED:
	PIA Procedure(s):
		pia_disp_print_file

 MODIFICATION HISTORY:
	Written by: 	I. Heinrichsen, MPIK/Heidelberg, March 1997

(See pia_disp_olr.pro)


PIA_DISP_PHOTOM

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

  PURPOSE:
	Displays the photometric table

  CATEGORY:
	PIA - I/O

  CALLING SEQUENCE:
	PIA_Disp_AAP, Text, Observation

  INPUTS:
	Text: Array of text lines 
	Observation: An observation string derived from the TDT and OBS

  OUTPUTS:
	None

  RESTRICTIONS:
 	None

  PROCEDURES USED:
	None

  MODIFICATION HISTORY
	Written by:	Huw Morris
	Oct 95 Version ?.?
	Modified by:	Huw Morris
	Unit number 1 replaced by /get_lun  (CG)		Jan 96 
	Free_lun instead of close (CG)				May 1996

(See pia_disp_photom.pro)


PIA_DISP_PRINT_FILE

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

 PURPOSE:
	Display an ASCII text file using widgets and the widget manager, giving
	the possibility of printing it or saving it as a file

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_disp_print_file, Filename

 INPUTS:
     Filename:	A scalar string that contains the filename of the file
		to display.  The filename can include a path to that file.
		It is also used as the first choice for the output filename.

 KEYWORD PARAMETERS:
	FONT:   The name of the font to use.  If omitted use the default
		font.

	GROUP:	The widget ID of the group leader of the widget.  If this 
		keyword is specified, the death of the group leader results in
		the death of PIA_disp_print_file.

	HEIGHT:	The number of text lines that the widget should display at one
		time.  If this keyword is not specified, 24 lines is the 
		default.

	TEXT:	A string or string array to be displayed in the widget
		instead of the contents of a file.  This keyword supercedes
		the FILENAME input parameter.

	TITLE:	A string to use as the widget title rather than the file name 
		or "PIA_disp_print_file".

	WIDTH:	The number of characters wide the widget should be.  If this
		keyword is not specified, 80 characters is the default.

	UNIQUE:	If set, a special name for Xregistering is used, which can be
		used for avoiding multiple warnings 
		"PIA_DISP_PRINT_FILE_UNIQUE"

 OUTPUTS:
	No explicit outputs.  A file viewing widget is created.

 COMMON BLOCKS:
	pia_disp_print_file_cmn

 SIDE EFFECTS:
	Triggers the xMANAGER,No_BLOCK=1 if it is not already in use.

 PROCEDURE:
	Open a file and create a widget to display its contents.

 PROCEDURES USED:
       INTERNAL:
		PIA_Disp_Print_File_evt

 MODIFICATION HISTORY:
	Written by: Carlos GABRIEL (ESA/VILSPA-SAI)  		July 1995
	Oct 95 Version 3.5
	Savename in common replaced by widget_id (CG)		Christmas 1995
	Free_lun instead of close - get_lun used (CG)		May 1996
	Savefiles now by default to PIA_SAVEDIR (CG)		March 1997
	V6.2
	Using the system variable !PIA_PRINTDIR instead of
	 the environment variable for SPAWN (CG)		June 1997
	V6.3 
	Editing text accepted (CG)				June 1997
	V6.4
	optional keyword SAVENAME added (IH)			August 1997
	Optional keyword "unique" added (CG)			January 1998
	Bug for text > 1000 lines fixed (CG)			February 1998
	V7.0
	Adding Adobe prefix to a2ps output (CG)			March 1998
	V7.1
			

(See pia_disp_print_file.pro)


PIA_DISP_STAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_DISP_STAT
 PURPOSE:
	Display information comprised in the phtdrift structure
 
 CATEGORY:
	PIA - graphics
                
 CALLING SEQUENCE:
	PIA_DISP_STAT, admname

 INPUT PARAMETERS:
	admname: 	the internal measurement name
	
 KEYWORDS:
	DRIFT: 		If set, drift analysis statistics showed
	STAB:  		If set, stability analysis ("mann") statistics showed
	SLOPV:  	If set, slope variation analysis statistics showed
	NO_SHOWSTR:	If set, NO simultaneous structure display activated


 RESTRICTIONS:

 METHOD:

 PROCEDURES USED:
       Common Block(s) or @ procedure(s):
               phtdrift
       PIA Procedure(s):
               pia_disp_print_file
		pia_showstr

 MODIFICATION HISTORY:
	Written by: C. Gabriel - ESA/SAI		December 1996
	V5.5
	Parameter bug fixed (CG)			January 1997
	Widget access to structure added (CG)		February 1997
	V6.1 

(See pia_disp_stat.pro)


PIA_DX2Y

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

 PURPOSE:
	Calculate map Y-coordinates for given declination and given map
	X-coordinate values. Arrays can be used in two forms:
	(1) a set of X pixel values, and a scalar declination, or
	(2) a set of declination values, and a scalar X value.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	y = PIA_DX2Y( dec, x, trans, ra )

 INPUTS:
	DEC:	Declination value(s) in degrees.
		If X is an array, then DEC must be a scalar.

	X:	Map X-coordinate value(s).
		If DEC is an array, then X must be a scalar.

	TRANS:	Transformation parameters as provided by PIA_MKTRANS.

 OUTPUTS:
	Y:	Map Y-coordinate value(s).

 OPTIONAL OUTPUTS:
	RA:	Corresponding right ascension value(s) in degrees.

 CALLED ROUTINES:
	PIA_RD2XY

 RESTRICTIONS:
	Program will have difficulty converging for declination values near 90.

	The transformation structure TRANS is not compatible with the
	ASTR structure of ASTROLIB routines!

 MODIFICATION HISTORY:
	Written by: D.Skaley, MPIK			Mar-95 
	Oct 95 Version 3.5
			

(See pia_dx2y.pro)


PIA_DY2X

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

 PURPOSE:
	Calculate map X-coordinates for given declination and given map
	Y-coordinate values. Arrays can be used in two forms:
	(1) a set of Y pixel values, and a scalar declination, or
	(2) a set of declination values, and a scalar Y value.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	x = PIA_DY2X( dec, y, trans, ra )

 INPUTS:
	DEC:	Declination value(s) in degrees.
		If Y is an array, then DEC must be a scalar.

	Y:	Map Y-coordinate value(s).
		If DEC is an array, then Y must be a scalar.

	TRANS:	Transformation parameters as provided by PIA_MKTRANS.

 OUTPUTS:
	X:	Map X-coordinate value(s).

 OPTIONAL OUTPUTS:
	RA:	Corresponding right ascension value(s) in degrees.

 CALLED ROUTINES:
	PIA_RD2XY

 RESTRICTIONS:
	Program will have difficulty converging for declination values near 90.

	The transformation structure TRANS is not compatible with the
	ASTR structure of ASTROLIB routines!

 PROCEDURES USED:
	PIA LIB:
		pia_rd2xy

 MODIFICATION HISTORY:
	Written by: D.Skaley, MPIK Mar-95 
	Oct 95 Version 3.5
			

(See pia_dy2x.pro)


PIA_FACTOR

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

 PURPOSE:
	Ask the interactive user for a factor, and pass it back to the PIA 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_factor, anythin, anythout

 INPUTS:
	anythin:
		A string indicating what is the calling routine looking for
 	
 KEYWORD PARAMETERS:
	proposal:
		Output proposed
	
 OUTPUT:
	anythout:
		The factor chosen by the user
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	September 1995
	Oct 95 Version 3.5

(See pia_factor.pro)


PIA_FCSPRE_STRUCT_VAL_CHOICE

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

 PURPOSE:
	Menu for extracting values from the PHT FCS Preselected power Files 

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
       PIA_FCSPRE_STRUCT_VAL_CHOICE

 INPUTS:
	STRFCSPRE
		The structure to be chosen from

 KEYWORD PARAMETERS:
	GROUP=group: Group leader

 OUTPUTS:
	ACC_INDICES
		The structure indices corresponding to the selection
 COMMON BLOCKS:
	pia_varselected_cmn	I/F to pia_select_var
	
 PROCEDURES USED:
	PIA Lib: 
		pia_select_var
	Astro Lib:
		match

 MODIFICATION HISTORY:
       Written by: C. Gabriel (ESA/VILSPA) 		November 1995
	STRTRIM used for strings (CG)			February 1996

(See pia_fcspre_struct_val_choice.pro)


PIA_FF_BACKGR

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

 PURPOSE:
	Menu for obtaining directly flat field
	factors from selected data regions. It returns the flat-fielded data.
	
 CATEGORY:
	PIA - graphics + processing

 CALLING SEQUENCE:
	PIA_ff_backgr, mnbr, mnbu, ff_mnbr

 INPUT:
	mnbr:		A 2-dim data array 
	mnbu:		Uncertainties of mnbr

 OUTPUT:
	ff_mnbr:	The modified array (same dims as mnbr) 
	
 INPUT KEYWORDS:
	flag:		Flag array (same dimension as mnbr)
	modal:		For running widget in /modal 
	group:		Group leader of the widget (mandatory if /modal)
  
 COMMON BLOCKS:
	colour_indices
	pia_dspchz_cmn
	zoom_discareas

 PROCEDURES USED:
	PIA:
		ff_bck
		pia_disp_print_file
		pia_xplot
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	August 1999
	

(See pia_ff_backgr.pro)


PIA_FF_MED_SMOOTH

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

 PURPOSE:
	Menu for performing median filtering and smoothing of data 
	for obtaining flat field factors from the filtered data. It 
	returns the filtered, smoothed and flat-fielded data.
	
 CATEGORY:
	PIA - graphics + processing

 CALLING SEQUENCE:
	PIA_ff_med_smooth, mnbr, mnbu, ff_mnbr

 INPUT:
	mnbr:		A 2-dim data array 
	mnbu:		Uncertainties of mnbr

 OUTPUT:
	ff_mnbr:	The modified array (same dims as mnbr) 
	
 INPUT KEYWORDS:
	flag:		Flag array (same dimension as mnbr)
	modal:		For running widget in /modal 
	group:		Group leader of the widget (mandatory if /modal)
  
 COMMON BLOCKS:
	colour_indices
	pia_dspchz_cmn
	zoom_discareas

 PROCEDURES USED:
	PIA:
		ff_bck
		ff_med_smooth
		pia_disp_print_file
		pia_ff_med_smooth_param
		pia_xplot
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	September 1997
	Version 6.5
	Keywords modal and group added for running it 
	in modal mode only if required and according to 
	IDL >= 5.0 prescription (CG)			January 1999
	V7.3
	Separation of median flat-fielding and 
	 background flat-fielding (CG)			August 1999
	V8.0

(See pia_ff_med_smooth.pro)


PIA_FF_MED_SMOOTH_PARAM

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

 PURPOSE:
	Simple widget I/F for defining the parameters for median filtering and
	smoothing by mapping

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_ff_med_smooth_param, med_smooth_par

 INPUT:
	None

 OUTPUT:
	med_smooth_par:	Structure {fw:fw,sw:sw} containing the chosen parameters
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	September 1997
	Version 6.5

(See pia_ff_med_smooth_param.pro)


PIA_FILEFILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_FILEFILTER
	
 PURPOSE:
	Return a proper file filter corresponding to PIA product type
	
 CATEGORY:
	PIA - support
	
 CALLING SEQUENCE:
	filter = PIA_FILEFILTER( producttype, detectortype )
	
 INPUTS:
	producttype :	Type of PIA product. Valid types are:
			'CS'	= compact status file
			'ERD'	= Edited Raw Data file
			'SPD'	= Standard Processed Data file
			'CALA'	= cal-A file
			'AAR'	= Auto Analysis Results file
			'*'	= any file

	detectortype :	Subtype of file corrsponding to PHT detector.
			(are not for all producttypes meaningful)
			'P'	= P1, P2, or P3
			'P1'	= P1
			'P2'	= P2
			'P3'	= P3
			'C'	= C100 or C200
			'C1'	= C100
			'C2'	= C200
			'S'	= SS or SL
			'SS'	= SS
			'SL'	= SL
			'*'	= all types

 OPTIONAL INPUTS:
	(none)
	
 KEYWORD PARAMETERS:
	(none)
	
 OUTPUTS:
	(none)

 RETURN VALUE:
	filter :	The file filter string corresponding to product type
			and eventually detectortype.
	
 CALLED ROUTINES:
	(none)
	
 COMMON BLOCKS:
	(none)
	
 SIDE EFFECTS:
	(none)
	
 RESTRICTIONS:
	Not all non-product files can be excluded with the returned filter.
	
 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg
	Oct 95 Version 3.5

(See pia_filefilter.pro)


PIA_FILETYPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_FILETYPE
	
 PURPOSE:
	Determine the product type and the detector type of a product file
	from the file name.
	
 CATEGORY:
	PIA - support
	
 CALLING SEQUENCE:
	PIA_FILETYPE( filename, producttype, detectortype )
	
 INPUTS:
	filename :	The name of the product file.
			May contain the directory path.


 OPTIONAL INPUTS:
	(none)
	
 KEYWORD PARAMETERS:
	(none)
	
 OUTPUTS:
	producttype :	Type of PIA product:
			'CS'	= compact status file
			'ERD'	= Edited Raw Data file
			'SPD'	= Standard Processed Data file
			'CALA'	= cal-A file
			'AAR'	= Auto Analysis Results file
			'*'	= unknown file type

	detectortype :	Detector type of file:
			'P'	= P1, P2, or P3
			'P1'	= P1
			'P2'	= P2
			'P3'	= P3
			'C'	= C100 or C200
			'C1'	= C100
			'C2'	= C200
			'S'	= SS or SL
			'SS'	= SS
			'SL'	= SL
			'G'	= general (for AAR)
			'*'	= any detector or unknown

 CALLED ROUTINES:
	(none)
	
 COMMON BLOCKS:
	(none)
	
 SIDE EFFECTS:
	(none)
	
 RESTRICTIONS:
	(none)
	
 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg
	Oct 95 Version 3.5

(See pia_filetype.pro)


PIA_FXTFIL

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

 PURPOSE:
	Menu for PIA External IA Produced Data (FITS) selection and read-in.
	This is a second level menu in the PIA hirarchy.

	This routine should only be called by the PIA main program
	and should not be called directly from the command line.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_FXTFIL, GROUP=group

 INPUTS:
	none
	
 OPTIONAL INPUTS:
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	
 OUTPUTS:
	none
	
 METHOD:
	Widgets
	
 PROCEDURES USED:
	PIA Procedure(s):
		pia_open_fxb
		pia_read_fits
		pia_view_txt
	Astronomical Library:
		fxbclose

 COMMON BLOCKS:
	pia_fxtfil_cmn	for internal use
	
 MODIFICATION HISTORY:
	Written by Carlos GABRIEL (ESA/ESTEC)		February 1995
	Oct 95 Version 3.5

(See pia_fxtfil.pro)


PIA_GBLDEF_INIT

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

 PURPOSE:
	Initialize the common block PIACMN_GBLDEF variable 'gbldef'.
	Definition of directories from environment variables:
	PIA_CALG	cal-G files
	PIA_DATA	ISO data files
	PIA_WORK	working directory

 CATEGORY:
	PIA - initialization

 CALLING SEQUENCE:
	PIA_GBLDEF_INIT

 INPUTS:
	(none)

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	(none)

 COMMON BLOCKS:
	PIACMN_GBLDEF	The global default definitions

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg
	Modified by:	C. Gabriel, ESA/VILSPA
	Oct 95 Version 3.5

(See pia_gbldef_init.pro)


PIA_GENCHO

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

 PURPOSE:
	Menu for general choices within an automatic PIA procedure.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_gencho

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	
 OUTPUTS:
	none
	
 SIDE EFFECTS:
	several variables are defined in two common blocks, which drive
	the automatic measurements processing	
	
 PROCEDURES USED:
	INTERNAL: 
		pia_gencho_event

 COMMON BLOCKS:
	pia_gencho_cmn	for internal use
	gencho_cmn	for returning several variables
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		January 1995
	Modified(last):	CG				September 1995
	Oct 95 Version 3.5
	Including ramps deglitching (CG)		December 1995
	Including drifts recognition (CG)		December 1995
	Initializing erdsel ... correctly (CG)		May 1996
	Initializing all corrections to 1 (CG)		July 1996
	Update including vignetting + reset interval corrections, 
	 ramps subdivision, background subtraction (CG)	May 1997
	V6.3
	Modal defined as prescribed by IDL >= 5.0 (CG)	January 1999
	V7.3
	Pattern analysis included for internal version (CG)  March 1999
	 + also for external version (CG)		     June 1999
	V7.4
	Dynamic calibration included for PHT-S chopped meas.(CG) September 1999
	V8.0.1

(See pia_gencho.pro)


PIA_GENPRO_TOP

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

 PURPOSE:
	Ask the interactive user for general decisions for sequence processing 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_genpro_top, genpro_top
	
 OUTPUT:
	genpro_top:
		The structure chosen by the user: {gbegin: ,gend: ,auto_reco: }
	
 COMMON BLOCKS:
	(none)

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	June 1997
	V6.4

(See pia_genpro_top.pro)


PIA_GET_INBPOWER

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

 PURPOSE:
	Graphical I/F to read records from the source calibration files
	accomodating values into a structure returned in a common block

 CATEGORY:
       PIA - graphics-I/O

 CALLING SEQUENCE:
       PIA_GET_INBPOWER, source_id, filter_id

 INPUT:
	source_id: 	Name of Calibration Source to start with. 
	filter_id:	Filter name to start with. 

 COMMON BLOCKS:
	pia_get_inbp_res (returning results)
	pia_get_inbp_cmn (internally used)

 PROCEDURES USED:
	PIA LIB:
       ASTRO LIB:
		FXBOPEN
		FXBREAD
		FXBCLOSE
	INTERNAL:
		pia_get_inbpower_event

 MODIFICATION HISTORY:
       Written by: C. Gabriel (ESA/VILSPA-SAI)			December 1995
	sed_id shown together with source_id (CG)		January 1996
	Bug fixed (IBP uncert. was initialized as INT !) (CG)	February 1996
	Filter names changed in Source files (CG)		February 1996
	Modal defined as prescribed for IDL>=5.0 (CG)		January 1999
	V7.3
			

(See pia_get_inbpower.pro)


PIA_GET_RPID

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

 PURPOSE:
	Simple Menu for choosing a RPID from a list

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_get_rpid, rpids, rpid_chosen

 INPUT:
	RPIDS
		[points per raster line, raster lines]  (INTARR(2))

 OUTPUT:
	RPID_CHOSEN
		The chosen RPID (BYTARR(2))

	
 METHOD:
	Widgets
	
 COMMON BLOCKS:
	none	

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		January 1996

(See pia_get_rpid.pro)


PIA_GET_SREGION

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

 PURPOSE:
	Menu for choosing either a PHT-S pixel or a wavelength region

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_GET_SREGION, phts, sr_STR 

 INPUT:
	phts:	'SS' or 'SL' for PHT-SS or PHT-SL respectively

 OUTPUT:
	SR_STR:	a structure containing chosen parameters 

	
 METHOD:
	Widgets
	
 COMMON BLOCKS:
	none	

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA)		November 1997
	V6.6

(See pia_get_sregion.pro)


PIA_GET_STEP

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

 PURPOSE:
	Simple Menu for choosing a chopper step from a list

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_get_step, steps

 INPUTS:
	STEPS
		Number of chopper steps
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy;	

 OUTPUTS:
	STEPS
		The step chosen
	
 METHOD:
	Widgets
	
 COMMON BLOCKS:
	none	

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		October 1994
	Oct 95 Version 3.5

(See pia_get_step.pro)


PIA_GET_STRAYL

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

 PURPOSE:
	Graphical I/F to calculate straylight on the FCS expected from a certain
	source measurement (including the possibility of changing the sl level)

 CATEGORY:
       PIA - graphics-processing

 CALLING SEQUENCE:
       PIA_GET_STRAYL, ident

 INPUT:
	ident: 	Name (PIA nomenclature) to start with. 

 COMMON BLOCKS:
	pia_get_strayl_res (returning results)
	pia_get_strayl_cmn (internally used)

 PROCEDURES USED:

 MODIFICATION HISTORY:
       Written by: C. Gabriel (ESA/VILSPA-SAI)			April 1996
			

(See pia_get_strayl.pro)


PIA_GRAPH_EXTRACT

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

 PURPOSE:
	Widget routine for extraction of points graphically determined on
	a plot.

 CATEGORY:
	PIA - graphics
                
 CALLING SEQUENCE: 
	PRO PIA_GRAPH_EXTRACT, x, y, interp, xch, ych, error=error

 INPUT PARAMETERS:
	x:	The abscissae values
	y:	The ordinate values

 OPTIONAL KEYWORD :
	ERROR	: 1 for error

 OUTPUT:
	interp:	The interpolated values at the x positions 
	xch:	The x values for the graphically chosen points
	ych:	The y values for the graphically chosen points

 RESTRICTIONS:
	At least 4 points must be chosen

 PROCEDURES USED:
       Common Block(s) or @ procedure(s):
		colour_indices
       PIA Procedure(s):
		pia_write_anything
		

 MODIFICATION HISTORY:
	Written by: C. Gabriel (ESA/VILSPA-SAI)			July 1997
	V6.4

(See pia_graph_extract.pro)


PIA_IN_BUFFER

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

 PURPOSE:
	Controls the filling of a temporary structure into one of the 
	PIA dynamical structures   

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_IN_BUFFER, tmp, REPLACE=replace

 INPUT:
       tmp 	: A temporary structure  (phterd, phtsrd, ... type)

 OPTIONAL INPUT:
	REPLACE : IF set (> 0) put the structure into this position
		  within the buffer, if set and negative starts a widget
		  for getting the desired position


 RESTRICTIONS:
       tmp must be a valid (phterd, phtsrd, ...)  temporary structure

 PROCEDURES USED: 
	PIA procedures:
		FILL_ERD
		FILL_SRD
		FILL_SCP
		FILL_SPD
		FILL_AAP
		PICKMEAS_POS

 MODIFICATION HISTORY:
       Written by: C. Gabriel  (ESA-SAI)			July 1996
	Bug for AAP fixed (CG)					December 1996
	Bug for AAP fixed (after adding CWVL to AAP) (CG)	February 1997
	V6.1
	Bug for SPD fixed (CG)					March 1998
	V7.1

(See pia_in_buffer.pro)


PIA_LOAD_CALA

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

 PURPOSE:
	Write a PHT-CALA (Signal measurement from the 
	dynamical structure CLADAT (PHTCLA type) onto a temporary structure 

 CALLING SEQUENCE:
       PIA_load_CALA, CLADAT, tmpcla

 CATEGORY:
	PIA - processing

 INPUT:
       CLADAT 	: PHTCLA like dynamical structure

 KEYWORD PARAMETERS:
	none

 OUTPUT:
	none

 RESTRICTIONS:
       CLADAT must exist

 PROCEDURES USED: 
	none

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)		October 1994
       Modified by:	Wai-Ming Tai (DIAS)		December 1994
	Modified(last): CG				September 1995
	Oct 95 Version 3.5

(See pia_load_cala.pro)


PIA_LOAD_DRIFTPAR

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

 PURPOSE:
	Load drift modelling parameters into structure PIA_DRIFTPAR

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_LOAD_DRIFTPAR, tmpdata, pixel, FUNCT = funct, NON_INT = non_int 

 INPUT:
	tmpdata:	A phtsrd like temporary structure
	pixel:		The pixel number of the data to be used

 KEYWORD PARAMETERS:
	FUNCT:		The name of the function to be used
	NON_INT:	When using it non-interactively less parameters are
			set variable
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTSRD temporary structure
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:
	PIA LIB:
		fouks_start_par
		gauss_start_par
		gaussinv_start_par

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)		August 1996
	Version 5.0 - Aug.96
			

(See pia_load_driftpar.pro)


PIA_LOAD_IAAP

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

 PURPOSE:
	Write a PHT-AAP (Astrophysical Applications) measurement from the 
	dynamical structure AAPDAT (PHTAAP type) onto a temporary structure 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_LOAD_IAAP, aapdat, tmpaap

 INPUT:
       aapDAT 	: PHTaap like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	TMPaap	: A temporary structure of aap type

 RESTRICTIONS:
       aapDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)          December 1995
	Central wavelength added, WMT (DIAS)            Nov 1996

(See pia_load_iaap.pro)


PIA_LOAD_ICS

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

 PURPOSE:
	Write a PHT-CS (Compact Status Data) record from the dynamical 
	structure CSDAT (PHTCS type) onto a temporary structure 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_load_ICS, CSDAT, tmpcs

 INPUT:
       CSDAT 	: PHTCS like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	tmpcs - A temporary structure of CS type

 RESTRICTIONS:
       CSDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/VILSPA-SAI)	December 1995

(See pia_load_ics.pro)


PIA_LOAD_IERD

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

 PURPOSE:
	Write a PHT-ERD (Edited Raw Data) measurement from the dynamical 
	structure ERDDAT (PHTERD type) onto a temporary structure 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_load_IERD, ERDDAT, tmperd

 INPUT:
       ERDDAT 	: PHTERD like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	tmperd - A temporary structure of ERD type

 RESTRICTIONS:
       ERDDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)          August 1994
	Modified:	CG				September 1994
	Oct 95 Version 3.5
	Array FLAG added to temp structure (CG)		November 1997
	V6.6
	Position of PIXF changed to be = phterd (CG)	September 1999
	V8.0

(See pia_load_ierd.pro)


PIA_LOAD_ISCP

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

 PURPOSE:
	Write a PHT-SCP (Signal per chopper plateau) measurement from the 
	dynamical structure SCPDAT (PHTSCP type) onto a temporary structure 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_LOAD_ISCP, scpdat, tmpscp

 INPUT:
       SCPDAT 	: PHTSCP like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	TMPSCP	: A temporary structure of SCP type

 RESTRICTIONS:
       SCPDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)          October 1994
	Oct 95 Version 3.5
	Extension for ANDR,AVSD and ARSI (CG)		  January 1996

(See pia_load_iscp.pro)


PIA_LOAD_ISPD

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

 PURPOSE:
	Write a PHT-SPD (Standard Processed Data) measurement from the 
	dynamical structure SPDDAT (PHTSPD type) onto a temporary structure 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_LOAD_ISPD, spddat, tmpspd

 INPUT:
       SPDDAT 	: PHTSPD like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	TMPSPD	: A temporary structure of SPD type

 RESTRICTIONS:
       SPDDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)          November 1994
	Modified:	CG				March 1995
	Oct 95 Version 3.5
	Coordinates keywords in double precision - CG	October 1995
	Order changed (CG)				September 1997
	V6.5

(See pia_load_ispd.pro)


PIA_LOAD_ISRD

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

 PURPOSE:
	Write a PHT-SRD (Signal Raw Data) measurement from the dynamical 
	structure SRDDAT (PHTSRD type) onto a temporary structure 

 CALLING SEQUENCE:
       PIA_load_ISRD, SRDDAT, tmpsrd

 CATEGORY:
	PIA - processing

 INPUT:
       SRDDAT 	: PHTSRD like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	TMPSRD	: A temporary structure of SRD type

 RESTRICTIONS:
       SRDDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)          	September 1994
	Modified(last):	CG					April 1995
	Oct 95 Version 3.5
	Effective reset time and nr of read-outs added (CG)	January 1996
	Forgotten DIMS keyword added (CG)			June 1996

(See pia_load_isrd.pro)


PIA_MANN

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

 PURPOSE:
	Menu for mann stability parameters handling.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MANN, tmpdata, pixel, GROUP=group 

 INPUT:
	tmpdata: SRD level temporary structure
	pixel:	 chosen pixel for testing

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTSRD temporary structure
	
 COMMON BLOCKS:
	colour_indices
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		mann
       INTERNAL:
		pia_mann_event

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)		January 1996
	Interval division logic changed  (CG)		February 1996
	Interval division (special case) bug fixed (CG)	February 1996
	Confidence level renamed to (1-confidence) (CG) May 1996
			

(See pia_mann.pro)


PIA_MAN_MEA

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

 PURPOSE:
       This is the "ISOPHOT Interactive Analysis" Control Panel
       program. It is used for the management of
       measurement.

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
       PIA

 COMMON BLOCKS:
       phtcs
       phterd
       phtsrd
       phtspd
       phtscp
       phtsmc
       phtcla

 PROCEDURES USED:
       PIA LIB:
         pia_disp_hdr
         pia_load_ierd
         pia_pickfile1
         pia_load_isrd
         pia_sm_load_ismc
         pia_load_iscp
         pia_load_ispd
         pia_read_ifile
         pia_dispdata
         pia_disp_cs
         pia_showdata
         pcont_valid_dir
         pcont_getfiles
         pcont_getdirs
         decode_cs2mea
         decode_filetype
         decode_hdr2mea
         decode_tdt2mea
       Astronomical Library:
         sxpar
 MODIFICATION HISTORY:
       Written by: Wai-Ming Tai (DIAS)                    Apr 1996
	Modified (last) by CG-SB - Oct 96
	V5.x
	Leaving last chosen combination as default +
	 print contents added + display also measurement
	 name given by the user (if any) + 
	 use explicitly chosen measurement		   May 1997
	V6.3
	Change the renaming of measurements + saving (JA)  December 1997
	Change call to pcont_vmeahdr (JA)		   January 1998
	V7.0
	phtaar added (CG)				   April 1998
	V7.1
	Save FITS allowed for AAP from here (CG)	   February 1999
	V7.4

(See pia_man_mea.pro)


PIA_MAPAAP

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

 PURPOSE:
	Produce a map of AAP data.
	This routine operates on a PHTAAP structure containing one measurement.
	Unpacks the arrays from handles and passes them to the mapping routines.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MAPAAP, aap, hbright, pixselect, pixsize, rota, $
			map_bright, map_uncert, map_expose, trans

 INPUTS:
	AAP		The PHT structure (arrays are stored with handles)

	HBRIGHT		Handle containing the brightness array

       PIXSELECT       A 4 or 9 element array of logical values (0 or 1)
                       indicating whether an array pixel should be selected
                       for processing (not used for PHT-P).

	PIXSIZE		The requested map pixel size [x,y]

	ROTA		The requested rotation angle of the map

 KEYWORD PARAMETERS:

	FFIELD		Flat field method (0:no, 1:central FF, 2:med.filter)
	
	MMETHOD		Map method (0:full cov.,1:dist.wgt,2:trigrid,3:tr.quint)

	FRACTION	Fraction of pixel size to be used for methods 1-3	

	FILTER		Filter name

	EVENT		Event ID calling this routine

	ERROR		Returns an error status:
			0 = no error
			1 = error: output is not valid

 OUTPUTS:
	MAP_BRIGHT	The brightness map

	MAP_UNCERT	The uncertainty map

	MAP_EXPOSE	The exposure map

	TRANS		Transformation structure from PIA_MKTRANS

 PROCEDURES USED:
	PIA Procedure(s):
		pia_mapbin
		pia_mapset

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 			D. Skaley, MPIK/Heidelberg
	Oct 95 Version 3.5
	Flat fielding option added	(CG)	                 February 1996
	Pivoting added and different interpolation  (JA & CG)	 April 1997
	Putting roll as rota only for chopped meas. (CG)	 December 1997
	V6.6
	Passing parameter FRACTION in call to map binning (CG)	 January 1999
	V7.3
	Shift_x & Shift_y keywords added 			February 1999
	Use of coded bitflag system (CG)			May 1999
	V7.4 

(See pia_mapaap.pro)


PIA_MAPBIN

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

 PURPOSE:
	Bin detector brightness density values into map grid.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPBIN, detector, aperture, pixsize, gridsize, x_coord, y_coord, $
			dwel, flag, bright, uncert, $
			map_bright, map_uncert, map_expose

 INPUTS:
	DETECTOR	'C1', 'C2', 'P1', 'P2', 'P3'

	APERTURE	PHT-P aperture ID.
			For PHT-C the value of this argument is ignored.

	PIXSIZE		Grid pixel size of map [x,y] in arcsec

	GRIDSIZE	Total size of grid points [nx,ny]
			as calculated by PIA_MAPSET

	X_COORD		Map x-coordinates of input data
			as calculated by PIA_MAPSET

	Y_COORD		Map y-coordinates of input data
			as calculated by PIA_MAPSET

	DWEL		Dwell time of input data

	FLAG		Flags array

	BRIGHT		Brightness density values [MJy/sr]

	UNCERT		Uncertainty of brightness density [MJy/sr]

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no error
			1 = error: output arguments are not correct

 OUTPUTS:
	MAP_BRIGHT	Brightness density map [MJy/sr]

	MAP_UNCERT	Uncertainty map of brightness density [MJy/sr]

	MAP_EXPOSE	Exposure map [sec]


 PROCEDURES USED:
	PIA Procedure(s):
		pia_defaper

 COMMON BLOCKS:
	piacmn_pow2fb
	

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg	March 1995
	Modified by:	C. Gabriel, ESA/VILSPA		July 1995
	Oct 95 Version 3.5
	Flat fielding call added (CG)			February 1996
	Bug with dwell time units & map exposure times
		fixed (CG)				March 1996
	Forgotten gap_factor included  (CG)		March 1996
	Single uncertainties used as weight for the 
	 flux computation (IH + CG)			June 1997
	V6.3
	Call to median filtering, smoothing and 
	 background flat-fielding added (CG)		October 1997
	V6.5
	Changes for treating correctly P map data,
	shifts in semi-pixels corrected	(CG)		May 1998
	Bug with overlap fixed following (CG)		June 1998
	V7.2
	Different mapping methods implemented (CG)	September 1998
	Trigrid map converted to floating point (CG)	January 1999
	FF_med_smooth call using modal keyword (CG)	January 1999
	V7.3
	Limit for triangulation to grid > [4,4] +
	calculation of map uncertainty using weighted
	mean derivation (CG)				June 1999
	V7.4
	1st Quartile Normalization FField included (CG)	August 1999
	Separation of median filtering and bcgr. (CG)	August 1999
	V8.0
	COMMON PIA_FF_INFO  added (CG)			December 1999
	V8.2

(See pia_mapbin.pro)


PIA_MAPDEF

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

 PURPOSE:
	Define a default grid size of a map

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPDEF, detector, pixsize

 INPUTS:
	PAR		The map obs. structure containing at least:
	 par.DETECTOR	  'P1', 'P2', 'P3', 'C1', 'C2', 'SS', 'SL'
	 par.APER	  Aperture position (meaningful only for PHT-P)
	 par.DPTS	  The raster step size in Y raster direction
	 par.DLNS	  The raster step size in Z raster direction
	 par.AOTN	  AOT name


 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	PIXSIZE		The pixel size of the resulting map grid in arcsec
			(0) = in spacecraft y-direction
			(1) = in spacecraft z-direction

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	March 1995
	Modified by:	C. Gabriel (ESA/VILSPA)		October 1995
	Oct 95 Version 3.5
	Maps default pixsizes changed (CG)		April 1996
	V6.2 
	Change in input (using structure par) + 
	 full refinement of default map size (CG)	September 1998
	V7.3
	Preventing from pixsize=0. for scan case (CG)	February 1999
	V7.4

(See pia_mapdef.pro)


PIA_MAPDRAW

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

 PURPOSE:
	Draw a 2-dimensional map of the sky in gnomonic coordinates

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MAPDRAW, map, trans, pixsize

 INPUTS:
	MAP		The two dimensional map of the image to be drawn

	TRANS		The transformation structure as provided by PIA_MKTRANS

	PIXSIZE		Pixel size [x,y] of a map pixels in arcsec

 KEYWORD PARAMETERS:
	TITLE		The widget title

	GROUP		The widget group leader

	HEADLINE	The headline (plot title)

	NO_ROT		Rotation menu disabled

	NO_DECONV	Deconvolution menu disabled

 OUTPUTS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		pia_mapgrid
		pia_prtdef
		pia_source_search
		pia_xy2rd
		write_map
	Astronomical Library:
		avg
		radec
		sigma
	Internal:
		pia_mapdraw_cust_event
		pia_mapdraw_cust
		pia_mapdraw_draw
		pia_mapdraw_cleanup
		pia_mapdraw_drev
		pia_mapdraw_event

 COMMON BLOCKS:
	PIA_PRINT

 MODIFICATION HISTORY:
	Written by:		D. Skaley, MPIK/Heidelberg	March 1995
	Modified (last) by:	C. Gabriel, ESA/VILSPA		November 1996
	V5.x
	Plot profiles better handled - CG			March 1997
	V6.1
	Continuous zooming disabled by default (CG)		October 1997
	V6.5
	Reserving last color for white (CG)			April 1998
	V7.1
	Message for "one-dimensional" map added (CG)		May 1998
	V7.1.1
	Map deconvolution menu added (CG)			May 1998
	Profiles extracted linearly (CG)			May 1998
	V7.2
	Headline configurable now - zooming fixed (CG)		August 1998
	V7.3
	pia_pickfile1 replaced (CG)				February 1999
	V7.4
	Map noise calculated "intrinsically" if not derived
	+ aspect ratio added to customize (CG)			August 1999
	V8.0
	

(See pia_mapdraw.pro)


PIA_MAPDRIFT_P32

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

 PURPOSE:
	Perform a drift correction for P32 raster data.
	The 'simple map' method is used for the map definition.
	(See procedure PIA_P32SMAP.PRO for 'simple' assumptions.)

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPDRIFT_P32, detector, n_raster, dist_raster, $
			time, rpid, cpos, dwel, flag, bright, $
			corr, n_fit, dirft_rate

 INPUTS:
	DETECTOR	'C1' or 'C2'

	N_RASTER	Number of spacecraft raster points
			(0) = Y-direction, (1) = Z-direction

	DIST_RASTER	The distance of the raster points/lines [arcsec]
			(0) = Y-direction, (1) = Z-direction

	TIME		Time values for all measurements (any units)

	RPID		Raster point IDs
			rpid(0,*) = sequence number in +Y direction
			rpid(1,*) = sequence number in -Z direction

	CPOS		Chopper positions [arcsec]

	DWEL		Chopper dwell times [2^-7 seconds]

	FLAG		Flags array

	BRIGHT		Brightness density array [MJy/sr]

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no errors
			1 = error: maps were not produced

 OUTPUTS:
	CORR		Brightness density array [MJy/sr] containing
			drift corrected values.

 OPTIONAL OUTPUTS:
	N_FIT		Number of fits used for calculating the drift
			correction. A value of 0 means that the corresponding
			value DRIFT_RATE is not valid.
			The array size is the number of detector pixels.

	DRIFT_RATE	Drift rates [MJy/sr/sec].
			The array size is the number of detector pixels.

 PROCEDURES USED:
	PIA Procedure(s):
		ggt

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg	March 1995
	Oct 95 Version 3.5

(See pia_mapdrift_p32.pro)


PIA_MAPGRID

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

 PURPOSE:
	Draw a grid over a map in gnomonic coordinates.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MAPGRID, trans, area, ngrid

 INPUTS:
	TRANS		Structure of transformation values

	AREA		Image area in device coordinates: [X0,Y0,X1,Y1]
			TRANS.CRPIX should refer to [X0,Y0]

	NGRID		Approximate maximum number of required grid lines

 OUTPUTS:
	none

 PROCEDURES USED:
	PIA Procedure(s):
		pia_dx2y
		pia_dy2x
		pia_rd2xy
		pia_rx2y
		pia_ry2x
		pia_xy2rd
		pia_xy2rd
	Astronomical Library:
		sixty
	Internal:
		pia_mapgrid_tics (function)

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	March 1995

(See pia_mapgrid.pro)


PIA_MAPSET

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

 PURPOSE:
	Define parameters for mapping of raster data
	for given grid pixel size.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPSET, detector, pixsize, rota, rpid, cpos, ra, dec, roll, $
			gridsize, x_coord, y_coord, trans

 INPUTS:
	DETECTOR	'C1', 'C2', 'P1', 'P2', 'P3'

	PIXSIZE		Pixel size [x,y] of the resulting grid in arcsec

	ROTA		Rotation of the map axes [x,y] relative to sky
			coordinates [-RA,DEC]. Rota increases counterclockwise.
			Supply the overall roll angle of the raster to achieve
			a map which is parallel to detector [y,z] axes.

	RPID		The raster IDs of all chopper plateaux

	CPOS		The chopper positions of all chopper plateaux

	RA		The right ascension values of all chopper plateaux

	DEC		The declination values of all chopper plateaux

	ROLL		The roll angles of all chopper plateaux

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no error
			1 = error: output arguments are not correct

 OUTPUTS:
	GRIDSIZE	The total size [nx,ny] of the resulting grid points

	X_COORD		The map x-coordinates of the detector pixels
			The array dimension is [ n_pixel, n_plat ]
			where n_pixel is the number of detector pixels in the
			array and n_plat is the number of chopper plateax
			in the data arrays.

	Y_COORD		The map y-coordinates of the detector pixels
			The array dimension is [ n_pixel, n_plat ]

 OPTIONAL OUTPUTS:
	TRANS		The transformation parameters RA, DEC -> X, Y

 PROCEDURES USED: 
	PIA Procedure(s):
		pia_mktrans
		pia_rd2xy

 COMMON BLOCKS:
	(none)

 ASSUMPTIONS:
	The exact definition of the roll angle and the orientation of
	detector pixels is still uncertain to me!
	Here I make the following assumptions:
	(1) The detector coordinates [y,z] map directly onto the sky without
	    having to be reflected to achieve a true image of the source.
	    Ref.: TN 2069-81000DS/01
	(2) The roll angle is the rotation angle of the detector axes [y,z]
	    relative to the sky coordinates [-RA,DEC] and increases
           counterclockwise.

 MODIFICATION HISTORY:
	Written by: 		D. Skaley, MPIK/Heidelberg	  March 1995
	Oct 95 Version 3.5
	Provisory change. Only valid for P32 and rota=360.-avg(roll) 
		until derivatives problem fixed (CG)		  March 1996
	ROTA=avg(roll) ! probably after NEW definition change	  May 1996
	No border size & gridsize adjusted for small jitter(CG)   June 1996		
	CRVAL is the centre of the map, as given by (RA,Dec) + 
	border size are computed from pixel size/aperture (JA)    April 1997
	phtapert used now (CG)					  February 1998
	V7.0
	Changes for treating correctly P map data,
	semi-pixels correctly treated (CG)			  May 1998
	V7.2	
	Shift_x & Shift_y keywords added 			February 1999
	V7.4 

(See pia_mapset.pro)


PIA_MAPSIMPLE_AAP

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

 PURPOSE:
	Produce a simple map of AAP data for PHT-C or for PHT-P
	raster data ignoring true pointing.

	Be sure to call this procedure not for any other data types.
	No checks are performed on this.

	This routine operates on a PHTAAP structure containing one measurement.
	Unpacks the arrays from handles and passes them to the mapping routine.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPSIMPLE_AAP, aap, hbright, pixselect, $
			map_bright, map_uncert, map_expose, pixsize, trans

 INPUTS:
	AAP		The PHT structure (arrays are stored with handles)

       HBRIGHT         Handle containing the brightness array

	PIXSELECT	A 4 or 9 element array of logical values (0 or 1)
			indicating whether an array pixel should be selected
			for processing (not used for PHT-P).

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no error
			1 = error: output is not valid

	PCHOP		For chopped P crude mapping 

 OUTPUTS:
	MAP_BRIGHT	The brightness map

	MAP_UNCERT	The uncertainty map

	MAP_EXPOSE	The exposure map

	PIXSIZE		The map pixel size [x,y]

	TRANS		Transformation structure from PIA_MKTRANS

 PROCEDURES USED:
	PIA Procedure(s):
		pia_mapsimple_p32
		pia_mapsimple_phtp
		pia_mktrans
	Astronomical Library:
		fxpar

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 		D. Skaley, MPIK/Heidelberg	March 1995
	Oct 95 Version 3.5
	Extension for P chopped maps (CG)			January 1995
	Flat fielding added (CG)				March 1996
	Allowing for ffield=2 (CG)				October 1997
	V6.5

(See pia_mapsimple_aap.pro)


PIA_MAPSIMPLE_CHOP

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

 PURPOSE:
	Produce a simple map from P32 SPD data (PHT-C).
	The simplifications are:

	(1) True spacecraft pointing is ignored: It is assumed that the
	    spacecraft raster is a perfect regular grid.

	(2) The spacecraft raster is assumed to coincide with multiples of
	    1 or 1/2 or 1/3 of the detector pixel size. In y-direction it is
	    also assumed to coincide with the chopper amplitude.

	The resulting maps are produced in the frame of reference [x,y] which
	coincides with the spacecraft axes [Y,Z].

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPSIMPLE_CHOP, detector, n_raster, dist_raster, $
			rpid, cpos, dwel, flag, bright, uncert, $
			map_bright, map_uncert, map_expose, pixsize, $
			aperture=aperture

 INPUTS:
	DETECTOR	'C1' or 'C2'

	N_RASTER	Number of spacecraft raster points
			(0) = Y-direction, (1) = Z-direction

	DIST_RASTER	The distance of the raster points/lines [arcsec]
			(0) = Y-direction, (1) = Z-direction

	RPID		Raster point IDs
			rpid(0,*) = sequence number in +Y direction
			rpid(1,*) = sequence number in -Z direction

	CPOS		Chopper positions [arcsec]

	DWEL		Chopper dwell times [2^-7 seconds]

	FLAG		Flags array

	BRIGHT		Brightness density array [MJy/sr]

	UNCERT		Uncertainties array of brightness density [MJy/sr]

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no errors
			1 = error: maps were not produced
	APERTURE	The aperture (wheel II) position

 OUTPUTS:
	MAP_BRIGHT	Brightness map

	MAP_UNCERT	Uncertainty map

	MAP_EXPOSE	Exposure map

	PIXSIZE		The pixel size of the maps in [x,y] directions

 PROCEDURES USED:
	PIA Procedure(s):
		ggt

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 	C. Gabriel, ESA/VILSPA-SAI		December 1995
	Adapted from PIA_MAPSIMPLE_P32 by D.Skaley
	Points weighted with uncertainties (CG)			October 1997
	V6.5

(See pia_mapsimple_chop.pro)


PIA_MAPSIMPLE_P32

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

 PURPOSE:
	Produce a simple map from P32 SPD data (PHT-C).
	The simplifications are:

	(1) True spacecraft pointing is ignored: It is assumed that the
	    spacecraft raster is a perfect regular grid.

	(2) The spacecraft raster is assumed to coincide with multiples of
	    1 or 1/2 or 1/3 of the detector pixel size. In y-direction it is
	    also assumed to coincide with the chopper amplitude.

	The resulting maps are produced in the frame of reference [x,y] which
	coincides with the spacecraft axes [Y,Z].

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPSIMPLE_P32, detector, n_raster, dist_raster, $
			rpid, cpos, dwel, flag, bright, uncert, $
			map_bright, map_uncert, map_expose, pixsize

 INPUTS:
	DETECTOR	'C1' or 'C2'

	N_RASTER	Number of spacecraft raster points
			(0) = Y-direction, (1) = Z-direction

	DIST_RASTER	The distance of the raster points/lines [arcsec]
			(0) = Y-direction, (1) = Z-direction

	RPID		Raster point IDs
			rpid(0,*) = sequence number in +Y direction
			rpid(1,*) = sequence number in -Z direction

	CPOS		Chopper positions [arcsec]

	DWEL		Chopper dwell times

	FLAG		Flags array

	BRIGHT		Brightness density array [MJy/sr]

	UNCERT		Uncertainties array of brightness density [MJy/sr]

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no errors
			1 = error: maps were not produced

 OUTPUTS:
	MAP_BRIGHT	Brightness map

	MAP_UNCERT	Uncertainty map

	MAP_EXPOSE	Exposure map

	PIXSIZE		The pixel size of the maps in [x,y] directions

 PROCEDURES USED:
	PIA Procedure(s):
		ggt

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg		March 1995
	Modified by:	C. Gabriel, ESA/ESTEC			April 1995
	Oct 95 Version 3.5
	Raster distance = 0 allowed (case Nx1 raster) (CG)	December 1995
	y-direction changed to have righthand coordinates (CG)	January 1996 
	Flat fielding option added (CG)				February 1996
	Dwell time units bug fixed (CG)				March 1996
	Back to 45 and 90 arcsec  (CG)				May 1996
	Call to median filtering, smoothing and 
	 background flat-fielding added (CG)			October 1997
	Points weighted with uncertainties (CG)			October 1997
	V6.5

(See pia_mapsimple_p32.pro)


PIA_MAPSIMPLE_PHTP

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

 PURPOSE:
	Produce a simple map from PHT-P SPD raster data (PHT-P).
	Chopper positions (other than 0) are not considered, since raster
	data are always taken in staring mode. For AOT P32 an individual
	routine exists for making a 'simple' map.

	The simplification is:

	(1) True spacecraft pointing is ignored: It is assumed that the
	    spacecraft raster is a perfect regular grid.

	The resulting maps are produced in the frame of reference [x,y] which
	coincides with the spacecraft axes [Y,Z].

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_MAPSIMPLE_PHTP, detector, n_raster, dist_raster, aperture, $
			rpid, dwel, flag, bright, uncert, $
			map_bright, map_uncert, map_expose, pixsize

 INPUTS:
	DETECTOR	'P1', 'P2' or 'P3'

	N_RASTER	Number of spacecraft raster points
			(0) = Y-direction, (1) = Z-direction

	DIST_RASTER	The distance of the raster points/lines [arcsec]
			(0) = Y-direction, (1) = Z-direction

	APERTURE	Aperture ID for the PHT-P measurement

	RPID		Raster point IDs
			rpid(0,*) = sequence number in +Y direction
			rpid(1,*) = sequence number in -Z direction

	DWEL		Chopper dwell times [2^-7 seconds]

	FLAG		Flags array

	BRIGHT		Brightness density array [MJy/sr]

	UNCERT		Uncertainties array of brightness density [MJy/sr]

 KEYWORD PARAMETERS:
	ERROR		Returns an error status:
			0 = no errors
			1 = error: maps were not produced

 OUTPUTS:
	MAP_BRIGHT	Brightness map

	MAP_UNCERT	Uncertainty map

	MAP_EXPOSE	Exposure map

	PIXSIZE		The pixel size of the maps in [x,y] directions

 PROCEDURES USED:
	PIA Procedure(s):
		pia_defaper

 COMMON BLOCKS:
		piacmn_pow2fb

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	March 1995
	Modified by:	C. Gabriel, ESA/VILSPA		July 1995
	Oct 95 Version 3.5
	Y-Raster direction turned around to get right hand coordinates
							February 1996
	Points weighted with uncertainties (CG)			October 1997
	V6.5

(See pia_mapsimple_phtp.pro)


PIA_MAPW

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

 PURPOSE:
	Widget user interface to process maps for rastered images.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MAPW

 INPUTS:
	(none)

 KEYWORD PARAMETERS:
	GROUP		The group leader of this widget hirarchy.

 OUTPUTS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn
		pia_aapview
		pia_disp_hdr
		pia_mapaap
		pia_mapdef
		pia_mapdraw
		pia_mapdrift_p32
		pia_mapsimple_aap
		pia_mktrans
		pia_open_iaap
	Astronomical Library:
		fxpar
	Internal:
		pia_mapw_drift_event
		pia_mapw_drift
		pia_mapw_defmap_event
		pia_mapw_defmap
		pia_mapw_cleanup
		pia_mapw_event

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg	March 1995
	Modified by:	C. Gabriel, ESA/SAI		April 1995
	Oct 95 Version 3.5
	
	setting colour table automatically (CG)		December 1996
	V5.5
	Using chosen directory as default for further 
	 searches (both by FITS & internal) (CG)	June 1997
	V6.4
	Call to median filtering, smoothing and 
	 background flat field added (CG)		September 1997
	V6.5
	Map division and map subtraction added (CG)	
	(also ROTA from header)				November 1997
	V6.6
	Array rotation for explicit given raster rotation
	(ATTRORIE=0) computed correctly	
	Tag APER added to structure PAR (CG)		June 1998
	V7.2  
	V7.3
	Possibility for Shift in x and y added (CG)	February 1999
	Replacing pia_pickfile1 (CG)			February 1999
	Use of coded bitflag system (CG)		May 1999
	V7.4 
	Intrinsic noise calculation added for undefined
	 map noise (CG)					August 1999
	V8.0
		

(See pia_mapw.pro)


PIA_MAP_OPERATIONS

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

 PURPOSE:
	Perform math. operations with maps and extract correlations

 CATEGORY:
	PIA - graphics/processing

 CALLING SEQUENCE:
       PIA_MAP_OPERATIONS, map, mappar, maphdr, par=par, dmap_type=dmap_type, $
	div=div, subtr=subtr, norm_peak=norm_peak, $
	subt_1quartil=subt_1quartil, corr_hist=corr_hist 

 INPUT:
       (none)

 INPUT KEYWORDS:
	div:		If set, maps chosen by the GUI will be divided (1/2)
	subtr:		If set, maps chosen by the GUI will be subtracted (1-2)
	norm_peak:	If set, normalization to the peak value prior operation
	subt_1quartil:	If set, "background" subtraction performed "    "
	corr_hist:	A diplot correlating the positions will be produced 
	
 OUTPUT:
	map:		A resulting map from the applied operation
	mappar:		The PIA map parameter structure corresponding to "map"
	maphdr:		Its header
	dmap_type:	Its type
	 

 OUTPUT KEYWORDS:
	par:	

 MODIFICATION HISTORY:
       Written by:	Carlos GABRIEL (ESA/VILSPA)		March 1999
	V7.4

(See pia_map_operations.pro)


PIA_MAP_ROTATE

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

 PURPOSE:
	Rotates a PHT PIA map by a given angle

 CATEGORY:
	PIA - graphics/processing

 CALLING SEQUENCE:
	PIA_MAP_ROTATE, imap, imappar, imaphdr

 INPUTS:
	IMAP		The two dimensional map of the input image

	IMAPPAR		The map parameter structure  as used in PIA

	IMAPHDR		The header of the measurement

 KEYWORD PARAMETERS:
	GROUP		The widget group leader

 OUTPUTS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		pia_mapdraw
		pia_mktrans
	Internal:
		pia_map_rotate_event

 COMMON BLOCKS:
	PIA_map_rotate_cmn		internal

 MODIFICATION HISTORY:
	Written by:		C. Gabriel, ESA/VILSPA		July 1996
	Modified by CG						November 1996
	V5.x
	Different interpolation alternatives built in,
	no pivot.   (CG)					April 1997
	V6.2 
	Bug for rotated saved maps fixed (CG)			February 1999
	V7.4

(See pia_map_rotate.pro)


PIA_MKTRANS

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

 PURPOSE:
	Make a transformation structure appropriate for usage with
	routines PIA_XY2RD and PIA_RD2XY.

	No checks of input parameters are made.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	trans = PIA_MKTRANS( crval, crpix, pixsize, theta )

 INPUTS:
	CRVAL		Reference sky position [ RA, DEC ] in degrees

	CRPIX		Reference map point [ X0, Y0 ]

	PIXSIZE		Pixel size of map [ Xsize, Ysize ] in arcsec

	THETA		Rotation of map [x,y] axes relative to sky [-RA,DEC]
			coordinates at the reference point in degrees.
			Theta increases counterclockwise.

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	TRANS		Transformation structure:
	.CRVAL		The reference sky position in degrees
	.CRPIX		The reference map position
	.CD		The forward transformation matrix X,Y -> RA,DEC in rad
	.DC		The back transformation matrix RA,DEC -> X,Y in rad

 PROCEDURES USED:
	none

 NOTES:
	Note that this definition of the CD matrix is different
	from the ASTROLIB structure ASTR. Here the usage is:

	[ delta_xi  ]   [ CD(0,0) CD(0,1) ]   [ delta_x   ]
	|           | = |                 | * |           |
	[ delta_eta ]   [ CD(1,0) CD(1,1) ]   [ delta_y   ]

	[ delta_x   ]   [ DC(0,0) DC(0,1) ]   [ delta_xi  ]
	|           | = |                 | * |           |
	[ delta_y   ]   [ DC(1,0) DC(1,1) ]   [ delta_eta ]

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg	March 1995
	CRVAL and CRPIX -> double precision (CG)	March 1998
	Forcing cd and dc to single precision to
	avoid problems with maps with different 
	formats in a declared structure (CG)		May 1999
	V7.4

(See pia_mktrans.pro)


PIA_MULTCHOICE

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

 PURPOSE:
	Simple Menu for getting one element from a list

 CATEGORY:

 CALLING SEQUENCE:
	PIA_multchoice, list, ELEMNAMES = elemnames 

 INPUTS:
	LIST:
		An array of elements to choose from	
	
 KEYWORD PARAMETERS:
	ELEMNAMES
		A string array containing the elements names
	
 OUTPUT:
	LIST:
		The index of the chosen element within the input LIST
	
 MODIFICATION HISTORY:
	Written by C.Gabriel (ESA/ESTEC-SAI)		March 1995
	Oct 95 Version 3.5
       Include xsize as optional keyword (Jacosta)     April 1996
	Modal and group keywords added (CG)		January 1998
	V7.3	

(See pia_multchoice.pro)


PIA_MULTI_AAP

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

 PURPOSE:
	Extract several measurements variables from phtaap accomodating them 
	in a new structure for further processing

 CATEGORY:
	PIA I/O + processing

 CALLING SEQUENCE:
	PIA_MULTI_AAP

 INPUTS:
	index:	the indices within phtaap from which the variables have to 
		be extracted

 OUTPUTS:
	mult_aap_str: structure containing (reduced) variables

 COMMON BLOCKS:
	phtaap
	phtfilter
	phtapertures

 SIDE EFFECTS:
	The variables in the phtapertures & phtfilter common blocks are 
	initialised

 PROCEDURES USED:
	PIA LIB:
		phtfilter_init
		aperture_size_init
		pia_load_iaap
		weight_mean

 MODIFICATION HISTORY:
	Written by:	Carlos GABRIEL (ESA/VILSPA-SAI)		January 1996
	Modified (last) by CG 					December 1996
	V5.4
	Full PSF used for C100/C200 arrays			January 1997
	V6.0	
	Using phtapert now (CG)					February 1998
	V7.0
	Hardcoding of nominal apertures (CG)			February 1998
	Bug in calculation for not chosen pixels fixed (CG)	February 1998
	V7.1
	Use of coded bitflag system (CG)			May 1999
	V7.4 
	Bugs fixed for brightness calculations - using
	individual brightnesses instead of fluxes !! (CG)	November 1999
	V8.2		

(See pia_multi_aap.pro)


PIA_MULTI_FIT

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

 PURPOSE:
	        Perform different fits in a widget environment 

 CATEGORY:
	PIA - graphics (+ processing)

 CALLING SEQUENCE:
       pia_multi_fit, xin, yin ,xout=xout, yout=yout, weight=weight, a=a, $
			sigmaa=sigmaa, xrange=xrange, yrange=yrange, psym=psym
                                    
 INPUTS:        Name      I/O   Type       Description
                ---------------------------------------------------------
                xin        I    fltarr     x data
                yin        I    fltarr     y data

 KEYWORD PARAMETERS:
                xout       O    fltarr     x data    
                yout       O    fltarr     y data    
                weight     I    fltarr     weighting 
                a          O    fltarr     parameter data
                sigmaa     O    flt/fltarr stand.dev.    
                xrange     I    fltarr     xrange        
                yrange     I    fltarr     yrange        
                psym       I    integer    plot-symbol   

 OUTPUTS:
	none

 COMMON BLOCKS:
	pia_multi_fit_cmn
	colour_indices
	multi_fit_help
	dfermi

 PROCEDURES USED:
	Astronomical Library:
		match
	Internal:
		fit_event
		fct_sum
		proposal
		plus_event
		par_in_ev
		par_cur_val_ev
		cursor_ev
		par_fix
		peak_del
		sel_desen
		sel_box
		selection_ev
		degree_event
		desi
		resi
		mess
		mess_ev
		text_event
		cancel_event
		next_event
		new_range
		file_event
		print_view
		help_event
		exit_event

 MODIFICATION HISTORY:
	Written by:	 Carlos GABRIEL (ESA/VILSPA) 	July 1995
		[Adapted from a ISO-SWS (K. Seidenschwang)
		 routine (multi_fit.pro) for its use within the PHT-IA]
	Oct 95 Version 3.5
	Curfit used as "quiet"	CG			October 1995
	Common pia_multi_fit_res added  CG		October 1995
	Changed /modal type according to IDL>=5.0 (CG)	January 1999
	V7.3

(See pia_multi_fit.pro)


PIA_MULTI_FIT_NOMODAL

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

 PURPOSE:
	        Perform different fits in a widget environment 
		(Same as pia_multi_fit, but in widget /nomodal mode)

 CATEGORY:
	PIA - graphics (+ processing)

 CALLING SEQUENCE:
       pia_multi_fit_nomodal, xin, yin ,xout=xout, yout=yout, weight=weight, $
		a=a, sigmaa=sigmaa, xrange=xrange, yrange=yrange, psym=psym
                                    
 INPUTS:        Name      I/O   Type       Description
                ---------------------------------------------------------
                xin        I    fltarr     x data
                yin        I    fltarr     y data

 KEYWORD PARAMETERS:
                xout       O    fltarr     x data    
                yout       O    fltarr     y data    
                weight     I    fltarr     weighting 
                a          O    fltarr     parameter data
                sigmaa     O    flt/fltarr stand.dev.    
                xrange     I    fltarr     xrange        
                yrange     I    fltarr     yrange        
                psym       I    integer    plot-symbol   

 OUTPUTS:
	none

 COMMON BLOCKS:
	pia_multi_fit_nm_cmn
	colour_indices
	multi_fit_help
	dfermi

 PROCEDURES USED:
	Astronomical Library:
		match
	Internal:
		nfit_event
		nfct_sum
		nproposal
		nplus_event
		npar_in_ev
		npar_cur_val_ev
		ncursor_ev
		npar_fix
		npeak_del
		nsel_desen
		nsel_box
		nselection_ev
		ndegree_event
		ndesi
		nresi
		nmess
		nmess_ev
		ntext_event
		ncancel_event
		nnext_event
		nnew_range
		nfile_event
		nprint_view
		nhelp_event
		nexit_event

 MODIFICATION HISTORY:
	Written by:	 Carlos GABRIEL (ESA/VILSPA) 	July 1995
		[Adapted from a ISO-SWS (K. Seidenschwang)
		 routine (multi_fit.pro) for its use within the PHT-IA]
	Oct 95 Version 3.5
	Common pia_multi_fit_res added  CG		October 1995

(See pia_multi_fit_nomodal.pro)


PIA_MULTMEAS

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

 PURPOSE:
	Simple Menu for getting one measurement from a list of measurements

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_multmeas, measlist

 INPUTS:
	measlist:
		The list of measurements to choose from	

 KEYWORD PARAMETERS:
	none
	
 OUTPUT:
	measlist:
		The index of the chosen measurement
	
 METHOD:
	Widgets

 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn

 COMMON BLOCKS:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		October 1994
	Modified by:	CG				December 1994
	Oct 95 Version 3.5

(See pia_multmeas.pro)


PIA_MULTMEAS_CHOICE

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

 PURPOSE:
	Menu for choosing several measurements from the dynamical structures
	phterd, phtsrd, phtscp, phtspd and phtaap

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MULTMEAS_CHOICE, level, indices

 INPUTS:
	LEVEL:	the pht type level, from which to choose

 OUTPUTS:
	INDICES: The indices of the chosen measurements within the level
 OPT. OUTPUT:
	status: character flag, '0' for fail and '1' for sucess
	
 KEYWORD PARAMETERS:
	(none)
		
 PROCEDURES USED:
	PIA LIB:
		pickmeas
		pia_multmeas

 COMMON BLOCKS:
	phterd
	phtsrd
	phtscp
	phtspd
	phtaap
	
 MODIFICATION HISTORY:
	Written by C.Gabriel (ESA/VILSPA-SAI)		January 1996
	Returning indices=0 & message if cancelled (CG)	January 1996
	status flag added (WMT)			        March 1996
	Using new pickmeas and pickmeas_results-CB (CG)	May 1997
	V6.3
			

(See pia_multmeas_choice.pro)


PIA_MULT_RP_CHOICE

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

 PURPOSE:
       Graphical I/F for choosing raster point, chopper position
		and mode for using the combination

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_MULT_RP_CHOP, RP_MAX, STEP_MAX, CHOP_MAX, rpc_CHOICE

 INPUTS:
	RP_MAX:	   A maximal value ISO raster point [byte or intarr(2)] 
			(informative)
	STEP_MAX:  Maximal value for chopperstep (informative)
	CHOP_MAX:  Maximal value for chopper plateau (informative)


 OUTPUTS:
	rpc_CHOICE:	The choice in a structure, see EXAMPLE

 EXAMPLE:
	Measurement with a 3x4 raster, chopped rectangular with 
	a total of 32 chopper plateaux
 
	The corresponding call should be:
		PIA_MULT_RP_CHOP, [3,4], 2, 32, rp
	The widget ask for raster position and chopper step or absolute 
	chopper plateau. If raster [2,3] and absolute ch-plateau 20 chosen:
	    
			   rp.rpid_chosen: [2B,3B]
			   rp.chop_chosen: [0,20]

	In case of chopper step 2 the last would be
			   rp.chop_chosen: [1,2]
			



 MODIFICATION HISTORY:
       Written by:	Carlos GABRIEL (ESA/VILSPA-SAI)		February 1997
	V6.1

(See pia_mult_rp_chop.pro)


PIA_ON_LINE

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

 PURPOSE:
	Insert all the dynamical commons into some environment (e.g. within 
	the general IDL environment)

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       @pia_on_line

 INPUT:

 RESTRICTIONS:
	(none)       

 PROCEDURES USED: 
       Common Block(s) or @ procedure(s):
               phterd
               phtsrd
               phtscp
               phtspd
               phtaap

 MODIFICATION HISTORY:
       Written by: C. Gabriel  (ESA-SAI)			Jul 1996
     phtaar + phtcs added (CG)                   		Mar 1998
     phtdrift + phtdyncal added (JAc)		  		Dec 1998
     V7.3

(See pia_on_line.pro)


PIA_OPEN_FXB

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

 PURPOSE:
	Opens a binary FITS file,
	returns the FITS header and the dimensions of the binary table.

 CATEGORY:
	PIA - I/O
	
 CALLING SEQUENCE:
	PIA_OPEN_FXB, filename, unit, header, dims
	
 INPUTS:
	filename :	The file name of the FITS file to be openend.
	
 KEYWORD PARAMETERS:
	none

 OUTPUTS:
	unit :		The unit number under which the file is opened.

	header :	The FITS header as a string array.

	dims :		The dimensions of the binary table in the FITS file
			read from the common block FXBINTABLE.
			It is an array of three elements with the meaning:
			Element# 0: NAXIS1 = Number of bytes per table row
			Element# 1: TFIELDS = Number of table columns
			Element# 2: NAXIS2 = Number of table rows
	
	FXBOPEN		from ASTRON library, used to open the FITS binary file.
	
 COMMON BLOCKS:
	FXBINTABLE	defined in ASTRON library, file FXBINTABLE.PRO
	
 SIDE EFFECTS:
	The FITS file must be closed by the routine FXBCLOSE, since
	the FXB package defines its own administration to trace FITS files
	which have been opened by the routine FXBOPEN.

 PROCEDURES USED:
	Astronomical Library:
		fxbintable
		fxbopen
	
 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	July 1994
	Oct 95 Version 3.5	

(See pia_open_fxb.pro)


PIA_OPEN_IAAP

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

 PURPOSE:
	Interface to the PHTAAP common block.
	Let the user select an AAP measurement.
	PHTAAP structure of selected measurement is returned.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_OPEN_IAAP, aap

 INPUTS:
	(none)

 KEYWORD PARAMETERS:
	GROUP		The widgets group leader

	DTYPE		The detector type

	ERROR		Returns an error status:
			0 = no error
			1 = error: AAP does not contain valid AAP data

 OUTPUTS:
	AAP		A copy of the selected PHTAAP structure
			(structure of handles).

 PROCEDURES USED:
	PIA Procedure(s):
		pickmeas

 COMMON BLOCKS:
	PHTAAP
	pickmeas_results

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	March 1995
	Modified by:	C. Gabriel, ESA/VILSPA		July 1995
	Oct 95 Version 3.5
	Several same AAP measurements case handled (CG)	October 1995
	Detector keyword added (CG)			April 1996
	Using new pickmeas and pickmeas_results-CB (CG)	May 1997
	V6.3
	Creating a new pseudo measurement for making 
	 possible PHT-S mapping (CG)			November 1997
	V6.6

(See pia_open_iaap.pro)


PIA_OPLOT

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

 PURPOSE:
	PIA OPLOT routine. It allows overplotting one point, not possible with
	the normal OPLOT routine

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_OPLOT, X, Y

 INPUTS:
	X: Abscisse data to be plotted. It can be a scalar
	Y: Ordinate data to be plotted. It can be a scalar
	
 KEYWORD PARAMETERS:
	XERR: X uncertainties
	YERR: Y uncertainties
	+ some original plot keywords: 
		psym, title, xtitle, ytitle, subtitle, charsize, 
		color, symsize, xrange, yrange, xmargin, thick
	
 OUTPUTS:
	none
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
 	Astronomical Library:
		oploterr
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		October 1994
	thick keyword added (CG)			August 1997
	Doing nothing if !NO_ERRBARS set (CG)		September 1997
	V6.5

(See pia_oplot.pro)


PIA_PAIRDEGL

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

 PURPOSE:
	Menu for RO-deglitching parameters handling (Readout pair method).

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_PAIRDEGL, tmpdata, pixel, GROUP=group 

 INPUT:
	tmpdata: ERD level temporary structure
	pixel:	 chosen pixel for testing

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	NO_DATA: 
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTERD temporary structure
	
 COMMON BLOCKS:
	colour_indices
		
 PROCEDURES USED:
	PIA LIB:
		pairr_deglitch
		pia_xplot
       INTERNAL:
		pia_pairdegl_event

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)		November 1997
	V6.6
	Extension for setting params without data testing (CG) 	January 1998
	V7.0
	-> In this case modal keyword can be active (CG) 	January 1999
	V7.3 
	Default initialisation through pdegl_str_init (CG)	July 1999
	and ramps reconstruction included			August 1999
	V8.0
			

(See pia_pairdegl.pro)


PIA_PICKFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
       PIA_PICKFILE 
 
 PURPOSE: 
	This function is an extension of the pickfile.pro for its use within
	the PHT-Interactive Analysis and
       allows the user to interactively pick files.  A file 
       selection tool with a graphical user interface is created.  Files 
       can be selected from the current directory or other directories. 
 
 CATEGORY: 
       PIA - graphics 
 
 CALLING SEQUENCE: 
       Result = PIA_PICKFILE() 
 
 KEYWORD PARAMETERS: 
 
       FILE:   A string value for setting the initial value of the 
               selection. Useful if there is a default file 
 
       GET_PATH: Set to a named variable. Returns the path at the 
               time of selection. 
 
       GROUP:  The widget ID of the widget that calls PIA_PICKFILE.  When this 
               ID is specified, a death of the caller results in the death of 
               the PIA_PICKFILE widget application. 
 
       READ:   Set this keyword to make the title of the PIA_PICKFILE window  
               "Select File to Read". 
 
       WRITE:  Set this keyword to make the title of the PIA_PICKFILE window  
               "Select File to Write". 
 
       PATH:   The initial path to select files from.  If this keyword is  
               not set, the current directory is used. 
 
       FILTER: A string value for filtering the files in the file list.  This 
               keyword is used to reduce the number of files to choose from. 
               The user can modify the filter unless the FIX_FILTER keyword 
               is set.  Example filter values might be "*.pro" or "*.dat". 
 
       FIX_FILTER: When this keyword is set, only files that satisfy the 
               filter can be selected.  The user has no ability to modify 
               the filter and the filter is not shown. 
 
       TITLE:  A scalar string to be used for the window title.  If it is 
               not specified, the default title is "Select File" 
 
       NOCONFIRM: Return immediately upon selection of a file.  The default 
               behavior is to display the selection and then return the 
               file when the user uses the "ok" button. 
 
       MUST_EXIST: When set, only files that actually exist can be selected. 
 
       MULTI: When set, several files can be selected at one time, returning
		a string array    (Extension of pickfile.pro) 
 
 OUTPUTS: 
       PIA_PICKFILE returns a string array containing the names of the files 
	selected. 
       If no file is selected, PIA_PICKFILE returns a null string. 
 
 COMMON BLOCKS: 
       PICKER: COMMON block that maintains state for the widget. 
 
 SIDE EFFECTS: 
       This function initiates the xMANAGER,No_BLOCK=1 if it is not already running. 
 
 RESTRICTIONS: 
       This routine is known to work on Suns (OPEN LOOK), MIPS, RS/6000,  
       DEC Ultrix, HP/700, VAX/VMS and SGI machines. 
 
       Only one instance of the PIA_PICKFILE widget can be running at one time. 
 
       PIA_PICKFILE does not recognize symbolic links to other files in UNIX. 
 
 PROCEDURE: 
       Create and register the widget and then exit, returning the filename 
       that was picked. 
 
 PROCEDURES USED:
	none

 EXAMPLE: 
       Create a PIA_PICKFILE widget that lets users select only files with  
       the extensions 'pro' and 'dat'.  Use the 'Select File to Read' title  
       and store the name of the selected file in the variable F.  Enter: 
 
               F = PIA_PICKFILE(/READ, FILTER = '*.pro *.dat') 
 
 MODIFICATION HISTORY: 
	Written by:	Carlos Gabriel (ESA/ESTEC)		March 1995
			(Adapted from the original pickfile for its use within
			 the PIA, with some capabilities extension)
	Modified(last):	CG					June 1995
	Oct 95 Version 3.5
	Cancel working for multiple files (CG)			May 1996
	'Select all' button added for multiple files (CG)	July 1996
	/modal use according to IDL>=5.0 (CG)			January 1999
	V7.3
	KEYWORD OVERW added, merging with pia_pickfile1 (CG)	February 1999
	V7.4	

(See pia_pickfile.pro)


PIA_PICKFILE1

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
       PIA_PICKFILE1 
 
 PURPOSE: 
       This function allows the user to interactively pick a file.  A file 
       selection tool with a graphical user interface is created.  Files 
       can be selected from the current directory or other directories. 
 
 CATEGORY: 
       Widgets. 
 
 CALLING SEQUENCE: 
       Result = PIA_PICKFILE1() 
 
 KEYWORD PARAMETERS: 
 
       FILE:   A string value for setting the initial value of the 
               selection. Useful if there is a default file 
 
       GET_PATH: Set to a named variable. Returns the path at the 
               time of selection. 
 
       GROUP:  The widget ID of the widget that calls PICKFILE.  When this 
               ID is specified, a death of the caller results in the death of 
               the PICKFILE widget application. 
 
       READ:   Set this keyword to make the title of the PICKFILE window  
               "Select File to Read". 
 
       WRITE:  Set this keyword to make the title of the PICKFILE window  
               "Select File to Write". 
 
       PATH:   The initial path to select files from.  If this keyword is  
               not set, the current directory is used. 
 
       FILTER: A string value for filtering the files in the file list.  This 
               keyword is used to reduce the number of files to choose from. 
               The user can modify the filter unless the FIX_FILTER keyword 
               is set.  Example filter values might be "*.pro" or "*.dat". 
 
       FIX_FILTER: When this keyword is set, only files that satisfy the 
               filter can be selected.  The user has no ability to modify 
               the filter and the filter is not shown. 
 
       TITLE:  A scalar string to be used for the window title.  If it is 
               not specified, the default title is "Select File" 
 
       NOCONFIRM: Return immediately upon selection of a file.  The default 
               behavior is to display the selection and then return the 
               file when the user uses the "ok" button. 
 
       MUST_EXIST: When set, only files that actually exist can be selected. 
 
 OUTPUTS: 
       PICKFILE returns a string that contains the name of the file selected. 
       If no file is selected, PICKFILE returns a null string. 
 
 COMMON BLOCKS: 
       PICKER: COMMON block that maintains state for the widget. 
 
 SIDE EFFECTS: 
       This function initiates the xMANAGER,No_BLOCK=1 if it is not already running. 
 
 RESTRICTIONS: 
       This routine is known to work on Suns (OPEN LOOK), MIPS, RS/6000,  
       DEC Ultrix, HP/700, VAX/VMS and SGI machines. 
 
       Only one instance of the PICKFILE widget can be running at one time. 
 
       PICKFILE does not recognize symbolic links to other files in UNIX. 
 
 PROCEDURE: 
       Create and register the widget and then exit, returning the filename 
       that was picked. 
 
 EXAMPLE: 
       Create a PICKFILE widget that lets users select only files with  
       the extensions 'pro' and 'dat'.  Use the 'Select File to Read' title  
       and store the name of the selected file in the variable F.  Enter: 
 
               F = PICKFILE(/READ, FILTER = '*.pro *.dat') 
 
 MODIFICATION HISTORY: 
       Adapted by: Carlos GABRIEL, ESA/VILSPA-SAI		     July 1995 
	 from IDL's pickfile.pro to PIA needs  --> PIA_pickfile 
	Changed by Wai-Ming Tai for getting path back and renamed
	 into pia_pickfile1 for coexistence within package of both   March 1996
	/modal use according to IDL>=5.0 (CG)			January 1998
	V7.3	

(See pia_pickfile1.pro)


PIA_PIXCHOICE

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

 PURPOSE:
	Menu for PIA drawing pixels choice.
	This is a display dependant level menu in the PIA hierarchy.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_pixchoice

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy

 OUTPUTS:
	none
	
 SIDE EFFECTS:
	Modifies the variables in common block pia_pixch_cmn, used for
	defining the pixels to be used (e.g. for display)
 	
 PROCEDURES USED:
	Internal:
		pia_pixchoice_event

 COMMON BLOCKS:
	pia_pixch_cmn
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		August 1994
	Oct 95 Version 3.5
	/modal acc IDL>=5.0 (CG)			January 1999
	V7.3
	Fixing widget numbers as LONG (CG)		February 1999
	V7.4

(See pia_pixchoice.pro)


PIA_PLOT

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

 PURPOSE:
	PIA PLOT routine. It allows plotting one point, not possible with
	the normal PLOT routine

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_PLOT, X, Y

 INPUTS:
	X: Abscisse data to be plotted. It can be a scalar
	Y: Ordinate data to be plotted. It can be a scalar
	
 KEYWORD PARAMETERS:
	XERR: X uncertainties
	YERR: Y uncertainties
	+ some original plot keywords: 
		psym, title, xtitle, ytitle, subtitle, charsize, 
		color, symsize, xrange, yrange, xmargin
	thick keyword added
 OUTPUTS:
	none
	
 PROCEDURES USED:
	Astronomical Library:
		oploterr
	
 COMMON BLOCKS:
	none
	
 MODIFICATION HISTORY:
	Written by C. Gabriel (ESA/ESTEC)		October 1994
	Oct 95 Version 3.5
	thick keyword added (CG)			August 1997
	NODATA keyword added (JAcosta)			August 1997
	V6.5
	Limiting output possible through 
		!PIA_PLOT_LIMIT (CG)			January 1998
	V7.0
	Correct color handling for reverse table (CG)	November 1998
	V7.3
	

(See pia_plot.pro)


PIA_PLOT_OVER

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

 PURPOSE:
	Menu for getting decision to overplot or not.
	This is a display dependant level menu in the PIA hierarchy.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_plot_over

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	none
	
 OUTPUTS:
	none
	
 COMMON BLOCKS:
	pia_plot_over_cmn

 PROCEDURES USED:
	Internal:
		pia_plot_over_event	
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)			December 1994
	Oct 95 Version 3.5
	Modified to include status as output, COMMON
	block is meant to be of internal use (Jacosta)		August 1998
	Modal keyword according to IDL5.0 prescription (CG)	January 1999
	V7.3

(See pia_plot_over.pro)


PIA_POW2FB

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

 !!!WARNING!!! This routine is obsolete and uses as input an AAP
		structure which is DIFFERENT to the phtaap structure.

 PURPOSE:
	Convert in-band power values of AAP data
	into flux density and brightness.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_POW2FB, aap, ERROR=error

 INPUTS:
	AAP : 		An AAP data structure (one measurement).
			Handles contain in-band power arrays.

 KEYWORD PARAMETERS:
	ERROR :		Returns an error condition:
			0 = no error
			1 = data could not be converted

 OUTPUTS:
	none

 PROCEDURES USED:
	PIA Procedure(s):
		pia_defaper
		pia_defratio
		pia_defwavel
		pia_read_ppsf
		read_ppsf

 COMMON BLOCKS:
	PIACMN_POW2FB	Transformation parameters power -> flux/brightness

 SIDE EFFECTS
	The AAP structure in common block is filled with flux density
	and brightness values.

 MODIFICATION HISTORY:
	Written by: 	D. Skaley (MPIK/Heidelberg)		March 1995
	Modified(last): Carlos Gabriel (ESA/ESTEC)		July 1995
	Oct 95 Version 3.5

(See pia_pow2fb.pro)


PIA_PRINT_AAPVAL

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

 PURPOSE:
	Print out the values corresponding to the AAP arrays

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
       PIA_Print_aapval, tmpdata

 INPUT PARAMETERS:
       tmpdata:
		A PHT-AAP temporary structure

 OUTPUT PARAMETERS:
	none


 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn

 MODIFICATION HISTORY:
       Written by Carlos GABRIEL (ESA/VILSPA)              September 1995
	Oct 95 Version 3.5
	Free_lun instead of close (CG)			    May 1996
	Simplified through use of PIA_DISP_PRINT_FILE (CG)	Feb.1997
	V6.1

(See pia_print_aapval.pro)


PIA_PRINT_SCPVAL

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

 PURPOSE:
	Print out the values corresponding to the SCP arrays

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
       PIA_Print_scpval, tmpdata

 INPUT PARAMETERS:
       tmpdata:
		A PHT-SCP temporary structure

 OUTPUT PARAMETERS:
	none

 COMMON BLOCKS:
	pia_printscp_cmn

 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn
		pia_disp_print_file

 MODIFICATION HISTORY:
       Written by:	Carlos GABRIEL (ESA/VILSPA)	October 1994
	Modified (last) by:	CG			November 1996
	V5.x
	Simplified through use of PIA_DISP_PRINT_FILE (CG)	Feb.1997
	V6.1

(See pia_print_scpval.pro)


PIA_PRINT_SPDVAL

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

 PURPOSE:
	Print out the values corresponding to the SPD arrays

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
       PIA_Print_spdval, tmpdata

 INPUT PARAMETERS:
       tmpdata:
		A PHT-SPD temporary structure

 OUTPUT PARAMETERS:
	none


 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn

 MODIFICATION HISTORY:
       Written by:	Carlos GABRIEL (ESA/VILSPA)	November 1994
	Modified by:	CG				September 1995
	Oct 95 Version 3.5
	Free_lun instead of close (CG)			May 1996
	Simplified through use of PIA_DISP_PRINT_FILE (CG)	Feb.1997
	V6.1

(See pia_print_spdval.pro)


PIA_PRINT_SRCBCK

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

 PURPOSE:
	Print out the values corresponding to a SRC - BCK subtraction structure

 CALLING SEQUENCE:
       PIA_Print_srcbck, value, unc

 INPUT PARAMETERS:
       value: 	Array (Pixel#) of SRC-BCK values
	unc:	Uncertainties array

 KEYWORD PARAMETERS:
	GROUP:	The group leader of this widget hierarchy

 OUTPUT PARAMETERS:
	none

 COMMON BLOCKS:
	pia_print_srcbck_cmn

 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn
	Internal:
		pia_print_srcbck_event

 MODIFICATION HISTORY:
       Written by Carlos GABRIEL (ESA/ESTEC-SAI)	February 1995
	Oct 95 Version 3.5
	Free_lun instead of close (CG)			May 1996

(See pia_print_srcbck.pro)


PIA_PRINT_UM

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

 PURPOSE:
	Send the full User Manual to the printer

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_PRINT_UM

 INPUTS:

 KEYWORD PARAMETERS:

 OUTPUTS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		print_um (unix script)
		print_um.com (VMS command)

 COMMON BLOCKS:
 MODIFICATION HISTORY:
	Written by:		C. Gabriel, ESA/VILSPA		July 1996
	Printing now TeX - PS files (CG)			June 1998
	V7.2

(See pia_print_um.pro)


PIA_PROC_GEN

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

 PURPOSE:
       Menu and procedure within the PIA to get automatically
       a sequence of steps to be performed, without major interaction.
       Data reduction from ERD up to AAP level, including calibration.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_PROC_GEN

 INPUTS:
	none

 KEYWORD PARAMETERS:
	SRD:		If present, processing stopped at SRD level
	SCP:		If present, processing stopped at SCP level
	FROM_SRD:	If present, processing started at SRD level
	FROM_SCP:	If present, processing started at SCP level
	ABS_PHT:	Absolute photometry ('dark'+'straylight' recognition)
	SPARSE_MAP:	Sparse map case
	PER_RPID:	Reduce long measurement dividing per RPID
	AUTO_REC:	Recognize for AOT type and reduce accordingly
	GROUP:	The group leader of this widget hierarchy

 OUTPUTS:
	none

 SIDE EFFECTS:
	If the FITS files are chosen as input, the ERD dynamic structure
	is expanded with all the measurements contained in those files.
	The dynamic structures containing the SRD, SCP, SPD and AAP levels
	are expanded with all the measurements to be processed.

 COMMON BLOCKS:
	phterd:		ERD dynamic structure
	phtsrd:		SRD dynamic structure
	phtscp:		SCP dynamic structure
	phtspd:		SPD dynamic structure
	phtaap:		AAP dynamic structure
	phtresact:	actual responsivities 
	deglitch_param: parameters for deglitching procedure
	ibcksub_param:	background subtraction parameters
	gen_choices:	parameters for AOT/Batch procedures driving
	splitramp_par:	ramp subdivision parameters
	widget_log_cmn:	info window common
	phtpatt:	pattern analysis parameters

 PROCEDURES USED:
	PIA Procedure(s):
		deglitch_param_init
		lin_voltages
		pia_gencho
		pia_load_ierd
		pia_load_iscp
		pia_load_isrd
		pia_pickfile
		pia_respons
		pia_rodisc
		pia_sigdisc
		pickmeas
		process_erd
		process_scp
		process_srd
		read_erd
		respons_interpol
	Internal:
		pia_proc_gen_event

 MODIFICATION HISTORY:
       Written by: 	Carlos Gabriel (ESA/ESTEC)		January 1995
	Last Modification:	
		P05/P25 case extended & saves also,	
		new use of gen_choices (CG) 			April 1997
	V6.2
	Batch and per RPID modes integrated, 
	 correction for reset interval and vignetting and
	 ramps sub-division capability added  (CG)		May 1997
	Still some improvements to provide more info in the 
	log screen			(JAcosta)		June 1997
	V6.3 
	Using subtr_darstr_meas extension +
	 correct treatment of RPID division +
	 extension in responsivity choices (CG)			June 1997
	V6.4
	Using decoded administration names & 
	 Stop at SCP if per raster point (CG)			September 1997
	V6.5
	call to add_coordinates changed (JAc)			 February 1998
	FCS limits check -> def.Resp. if OoL (CG)		 February 1998
	V7.0
	Problem with FCSN=-1 fixed (CG)				 February 1998
	Def. Resp. also for interpolation if OoL (CG)		 March 1998
	2 Threshold deglitching added (CG)			 March 1998
	Default responsivity choice corrected for sequences
	 with more than 2 calibration measurements (CG)		March 1998
	V7.1 
	Respons choices extended,
	 bug for SPD FITS file header fixed (JA+CG)		July 1998
	V7.2
	Signal linearization included (CG)
	Pattern processing included (CG)			March 1999
	V7.4
	Bug fixed: header by deglitching overwritten (CG)	July 1999
	V7.9
	Vignetting correction not performed if pattern (CG)	July 1999
	+ logic changed for including corrections on SRD
	  level if pattern and corrections on SCP required
	Extension of "pattern proc" to sawtooth (CG)		July 1999
	Setting RPID>[1,1] for tracking at ERD instof SRD (CG)	September 1999
	V8.0
	Adding PHT-S pointing correction (CG)			December 1999
	V8.2
	

(See pia_proc_gen.pro)


PIA_PRTDEF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_PRTDEF
	
 PURPOSE:
	Define parameters for sending an IDL plot to the printer
	(printer device, print command, device keywords, etc.).
	The parameters are stored in a common block to make them
	available to each routine that needs to print out something.
	Although the routine is part of the 'Interactive Analysis
	software for ISOPHOT' (PIA) it makes no use of special
	definitions of that software and thus can be used generally.
	
 CATEGORY:
	PIA - initialization
	
 CALLING SEQUENCE:
	PIA_PRTDEF 
	
 INPUTS:
	None.
	
 KEYWORD PARAMETERS:
	GROUP:
		The widget group leader. Destroying the group leader
		will also destroy the PIA_PRTDEF widget.
	
 OUTPUTS:
	None.
	
 SIDE EFFECTS:
	None.
	
 RESTRICTIONS:
	None.
	
 COMMON BLOCKS:
	PIA_PRINT
	
 PROCEDURES USED:
	Internal:
		pia_prtinit
		pia_devkey_event
		pia_devkey
		pia_prtdef_event

 MODIFICATION HISTORY:
	Written by:	Detlef Skaley, MPIK Heidelberg	October 1994
	Modified (last) by CG				November 1996
	Initialized as no color (CG)			March 1998
	V7.1
	Initialized as 8 bits per pixel (CG)		June 1998
	V7.2
	Modal keyword according to IDL>=5.0 (CG)	January 1999
	V7.3

(See pia_prtdef.pro)


PIA_PSEUDO_RD

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

 PURPOSE:
	Ask the interactive user for a value, and pass it back to the PIA 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_pseudo_rd, anythin, anythout

 INPUTS:
	anythin:
		A value indicating a maximum value to be chosen
	
 OUTPUT:
	anythout:
		The structure chosen by the user: {model:0 or 1,value:value}
	
 COMMON BLOCKS:
	@splitramp_par

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	November 1996
	Version 5.x
	Returning a structure for defining model 	May 1997
	V6.3
	Checking that number of read-outs per ramp or
	number of sub-ramps is not outside (CG)	        November 1999
	V8.2

(See pia_pseudo_rd.pro)


PIA_RD2XY

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

 PURPOSE:
	Transform right_ascension/declination to map x/y coordinates
	and optionally the derivatives.
	No input parameter checks are performed.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_RD2XY, r, d, trans, x, y, xr, xd, yr, yd

 INPUTS:
	R		The right_ascension value(s) in degrees.
			May be an array.

	D		The declination value(s) in degrees.
			May be an array.

	TRANS		The transformation parameters structure:
	.CD		forward transformation matrix
	.DC		back transformation matrix
	.CRVAL		reference position (ra,dec)
	.CRPIX		reference pixel (x,y)

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	X		The x coordinate values in the map

	Y		The y coordinate values in the map

 OPTIONAL OUTPUTS:
	XR		The partial derivative dX/dR (R in degrees)

	XD		The partial derivative dX/dD (D in degrees)

	YR		The partial derivative dY/dR (R in degrees)

	YD		The partial derivative dY/dD (D in degrees)

 NOTES:
	This routine differs from the similar ASTROLIB routine AD2XY
	in several ways, mainly:
	(1) The input parameter TRANS is expected to contain the
	    inverse transformation matrix DC.
	(2) The definitions of the matrixes CD and DC are not consistent
	    with the definition of the ASTROLIB matrix CD or its inverse.
	(3) CRPIX values correspond to IDL indexing scheme (starting at 0).
	(4) Derivatives are computed.

 PROCEDURES USED:
	none
 MODIFICATION HISTORY:
	Written by:	Detlef Skaley, MPIK, Heidelberg		March 1995
			[Adapted from ASTROLIB routine AD2XY]
	Oct 95 Version 3.5
	Derivative parameter changed after testing (CG)		March 1996

(See pia_rd2xy.pro)


PIA_READ_CS

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

 PURPOSE:
	Read in the binary table of a PHT CS (Compact Status) file
	whis has been opened already with PIA_OPEN_FXB.
	The CS file is in FITS binary table format.

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_READ_CS, unit, table, rows

 INPUTS:
       unit :	The unit number of the opened FXB file.

 OPTIONAL INPUTS:
	rows :	If 'rows' is a single value, only this row is read.
		If 'rows' ia a 2-dimensional array, it gives the range
		of rows to be read. Row numbers start with 1.

 KEYWORDS:
	(none)

 OUTPUTS:
	table :	Structure of binary values read from the CS file table.

	rows :	A 2-dimensional array giving the range of rows which have
		been read.

 RESTRICTIONS:
	unit must have been opened with FXBOPEN

 COMMON BLOCKS:
	fxbintable	from ASTRON library

 PROCEDURES USED:
	Astronomical Library:
		fxbread

 MODIFICATION HISTORY:
       Written by:	C. Gabriel, ESA/ESTEC		February 1994
	Modified by:	D. Skaley, MPIK			August 1994
	Oct 95 Version 3.5

(See pia_read_cs.pro)


PIA_READ_ERD

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

 PURPOSE:
	Read in the binary table of a PHT ERD (Edited Raw Data) file
	whis has been opened already with PIA_OPEN_FXB.
	The ERD file is in FITS binary table format.

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_READ_ERD, unit, erdtype, table, rows

 INPUTS:
       unit :	The unit number of the opened FXB file.

	erdtype :
		The ERD type: 'C1' = C100, 'C2' = C200, 'P' = Px, 'S' = Sx

 OPTIONAL INPUTS:
	rows :	If 'rows' is a single value, only this row is read.
		If 'rows' ia a 2-dimensional array, it gives the range
		of rows to be read. Row numbers start with 1.

 KEYWORDS:
	(none)

 OUTPUTS:
	table :	Structure of binary values read from the ERD file table.

	rows :	A 2-dimensional array giving the range of rows which have
		been read.

 RESTRICTIONS:
	unit must have been opened with FXBOPEN

 COMMON BLOCKS:
	fxbintable	from ASTRON library

 PROCEDURES USED:
	Astronomical Library:
		fxbread

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK		August 1994	
	Oct 95 Version 3.5

(See pia_read_erd.pro)


PIA_READ_EXT

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

 PURPOSE:
       This is the "ISOPHOT Interactive Analysis" Control Panel
	program. It is used for reading input files. 

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
       PIA

 COMMON BLOCKS:
       phtcs
       phterd
	phtsrd
	phtspd
	phtscp
	phtsmc
	phtcla

 PROCEDURES USED:
       PIA LIB:
	  pia_read_fits
	  pia_view_txt
	  pia_load_ierd
	  pia_pickfile1
	  pia_load_isrd
	  pia_sm_load_ismc
	  pia_load_iscp
	  pia_load_ispd
	  pia_read_ifile
	  pia_prtdef
	  pia_dispdata
	  pia_disp_cs
	  pia_showdata
	  pcont_valid_dir
	  pcont_getfiles
	  pcont_getdirs
	  decode_cs2mea
	  decode_filetype
	  decode_hdr2mea
	  decode_tdt2mea
	Astronomical Library:
	  sxpar
 MODIFICATION HISTORY:
	Written by: Wai-Ming Tai (DIAS)			Apr 1996
	Changed (last) by SB+CG				Oct 1996
	V5.x
	Preventing a crash by choosing 1 measurement 
	  in multi-mode (CG)				Jun 1997
	V6.4
	Passing real string to filelist to avoid Linux
	 strange appearance (CG)			Aug 1999
	V8.0
	Taking out question on adding several meas.(CG) Dec 1999
	V8.2

(See pia_read_ext.pro)


PIA_READ_FITS

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

 PURPOSE:
	Recognize several ISOPHOT FITS files and pass it over to 
	the corresponding I/O routine

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_READ_FITS, filename [, header], [path = path]

 INPUTS:
	filename	The name of the file (PATH not necessary)
	
 OPTIONAL INPUT:
       path:  path for the filename
 OUTPUTS:
	Header
	
 SIDE EFFECTS:
	None
	
 RESTRICTIONS:
	filename must correspond to a real PHT-FITS file
	
 METHOD:
	Use the name to distinguish among the different PHT FITS files
 	
 COMMON BLOCKS:
	None
	
 PROCEDURES USED:
	PIA Procedure(s):
		read_cala
		read_cs
		read_erd
		read_scp
		read_spd
		read_spd_sl
		read_srd

 MODIFICATION HISTORY:
	Written by:	Carlos GABRIEL (ESA/ESTEC)		July 1994
	Modified(last):	SB 					October 1996
	V5.x
	Upgraded avoiding the search for suffix 'FITS' (CG)	May 1997
	V6.3
	Bug for IA produced FITS files corrected (CG)		October 1997
	V6.5

(See pia_read_fits.pro)


PIA_READ_IFILE

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

 PURPOSE:
	Recognize one of the PIA internal files (IDL save format) and call
	the corresponding read procedure 

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	pia_read_ifile, filename, path = path

 INPUTS:
	Filename
 OPTIONAL INPUT:
	PATH : path for the filename
	
 KEYWORD PARAMETERS:
	none
	
 OUTPUTS:
	none
	
 RESTRICTIONS:
	suffix of filename must correspond to the PIA internal files
	nomenclature 	
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	PIA Procedure(s):
		read_icla
		read_ierd
		read_iscp
		read_ispd
		read_isrd

 MODIFICATION HISTORY:
	Written by:	C. Gabriel, ESA/ESTEC		August 1994
	Oct 95 Version 3.5
	Modified (last) by CG - October 1996
	V5.x
	Accepting any filename (CG)			May 1997
	V6.3

(See pia_read_ifile.pro)


PIA_READ_PPSF

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

 PURPOSE:
	Read the cal-G file PPSF and store the values in a common block.
	PPSF contains the 'Point Spread Function' correction values.

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_READ_PPSF, filename

 INPUTS:
	(none)

 OPTIONAL INPUTS:
	filename :	An alternative PSF cal-G file.
			The default file is read if this argument is not given.

 KEYWORD PARAMETERS:
	ERROR : 	returns an error condition:
			0 = no error
			1 = could not successfully read the cal-G file

 OUTPUTS:
	(none)

 SIDE EFFECTS:
	The PSF values are stored in the common block

 COMMON BLOCKS:
	PIACMN_GBLDEF	global defaults
	PIACMN_POW2FB	to hold the PPSF values

 PROCEDURES USED:
	PIA Procedure(s):
		pia_gbldef_init
		read_ppsf
		readhdr
	Astronomical Library:
		fxpar

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg	February 1995
	Modified by:	C. Gabriel, ESA/VILSPA		July 1995	
	Oct 95 Version 3.5

(See pia_read_ppsf.pro)


PIA_READ_SPD

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

 PURPOSE:
	Read in a ISOPHOT SPD FITS file.
	The data are stored in arrays which can be accessed by handles.

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	PIA_READ_SPD, filename, data, ERROR=error

 INPUTS:
	filename :	The full name of the SPD file to be read
			(may include a directory specification).

 KEYWORD PARAMETERS:
	ERROR :		Returns an error status:
			0 = no error: file has been read
			1 = error: file could not be read

 OUTPUTS:
	data :		A handle with child handles containing the data.
			The first child handle containes the FITS header
			(primary+extension header combined).
			The sibling childs contain the data columns from the
			FITS binary table.
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	PIA Procedure(s):
		mergehdr
		readhdr
	Astronomical Library:
		fxpar

 MODIFICATION HISTORY:
	Written by: 	D. Skaley, MPIK/Heidelberg	February 1995
	Oct 95 Version 3.5

(See pia_read_spd.pro)


PIA_READ_UNKN

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

 PURPOSE:
	Read in the table of a general FITS binary table file
	which has already been opened with FXBOPEN.

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_READ_UNKN, unit, table, rows, columns

 INPUTS:
       unit :	The unit number of the opened FXB file.

 OPTIONAL INPUTS:
	rows :	If single value, the row to be read,
		if 2-dimensional array, the range of rows to be read.
		Row numbers start with 1.

	columns : If single value, the column to be read,
		If 2-dimensional array, the range of columns to be read.
		Column numbers start with 1.

 OUTPUTS:
	table :	Handle pointing to FITS table data.
		First child points to array of keywords (table column names),
		the remaining childs point to arrays of table column values.

	rows :	The actual range of rows which has been read in.

	columns : The actual range of columns which has been read in.

 RESTRICTIONS:
	(none)

 COMMON BLOCKS:
	fxbintable  (from ASTRO lib)

 PROCEDURES USED:
	Astronomical Library:
		fxbfind
		fxbread

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	August 1994
	Oct 95 Version 3.5

(See pia_read_unkn.pro)


PIA_RESPONS

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

 PURPOSE:
	Menu for PIA Response calculation.

 CATEGORY:
	PIA - graphics / processing

 CALLING SEQUENCE:
	PIA_respons, tmpdata, header

 INPUTS:
	tmpdata
		A temporary SCP structure
	header
		The corresponding header
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	NO_WIDGET
		To work without widget use - [=1: avg FCS1, =2: medians FCS1]
	
 OUTPUTS:
	header
		Modified header
	
 KEYWORD OUTPUT:
	out_of_limits	If out_of_limits check positive, is set to 1	
	
 SIDE EFFECTS:
	Variables in the common block for actual responsivities are changed
	
 RESTRICTIONS:
	tmpdata must be a temporary PIA SCP structure, corresponding to an
	FCS measurement

 METHOD:
	Use of an FCS measurement and the corresponding calibration tables
	for the responsivity determination	

 COMMON BLOCKS:
	respon_cmn	local common
	phtcs		compact status dynamical structure
	phtresdef	default responsivities common
	phtresact	actual responsivities common
	phtfcs		FCS calibration tables
	phtillum	FCS illumination matrices common
	phtcap		capacitances common
	phtoptpow	FCS optical power range
	phtacc		actual selection criteria
	
 PROCEDURES USED:
	PIA Procedure(s):
		conv_subs
		cp_disc
		phtcap_init
		read_cs
		read_fcsill
		read_fcspow
		read_resp
	Internal:
		pia_respons_event
	Astrolib:
		fxaddpar

 MODIFICATION HISTORY:
	Written by:	Carlos GABRIEL (ESA/ESTEC)	October 1994
	Modified(last):	CG					November 1996
	V5.x
	Adapted to new cal file FCSILL - CG		January 1997
	V6.0
	Adapted to use external flatfield factors - CG	May 1997
	V6.3
	Fills into phtresact name and filter used (CG)	July 1997
	Widget appearance modified (Jacosta)		July 1997
	V6.4
	Using FCSPOW validity limits  
	 and taking apertures from phtapert (CG + IH)	January 1998
	Old default responsivity deleted (CG)		
	KEYWORD out_of_limits added			February 1998
	V7.0
	Out_of_limits only set if "hard" limits 
	 violation (0. or 99. mW)			March 1998
	V7.1
	Default choice is now FCS1 instead of 
	 "default response" (CG)			June 1998
	V7.2
	Checking error from get_respons (CG)		November 1998
	Modal use according to IDL >= 5.0 (CG)		January 1999
	V7.3

(See pia_respons.pro)


PIA_RESPONS_ABS

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

 PURPOSE:
	Menu for PIA Response calculation for absolute Photometry.

 CATEGORY:
	PIA - graphics / processing

 CALLING SEQUENCE:
	PIA_respons_abs, tmpdata, header

 INPUTS:
	tmpdata
		A temporary SCP structure
	header
		The corresponding header
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	
 OUTPUTS:
	header
		Modified header

 KEYWORD OUTPUT:
	out_of_limits	If out_of_limits check positive, is set to 1	
	
 SIDE EFFECTS:
	Variables in the common block for actual responsivities (absolute 
	photometry case) are changed
	
 RESTRICTIONS:
	tmpdata must be a temporary PIA SCP structure, corresponding to an
	absolute photometry measurement
	
 METHOD:
	Use of the FCS chopper plateaux within the absolute photometry 
	measurement and the corresponding calibration tables
	for responsivity determination per chopper plateau	

 COMMON BLOCKS:
	resp_abs_cmn	local common
	respabso	common with actual responsivities for abs. phot.
	colour_indices	PIA color definitions common
	phtcs		compact status dynamical structure
	phtresdef	default responsivities common
	phtresact	actual responsivities common
	phtfcs		FCS calibration tables
	phtillum	FCS illumination matrices common
	phtcap		capacitances common
	phtoptpow	FCS optical power range
	phtacc		actual selection criteria
	
 PROCEDURES USED:
	PIA Procedure(s):
		conv_subs
		cp_disc
		phtcap_init
		pia_oplot
		pia_plot
		read_cs
		read_fcsill
		read_fcspow
		read_resp
	Internal:
		viewabsres
		resetview_abs
		pia_respons_abs_event
	Astrolib:
		fxaddpar

 MODIFICATION HISTORY:
	Written by:	Carlos GABRIEL (ESA/ESTEC)		November 1994
	Modified(last):	CG					November 1996
	V5.x
	Adapted to new cal file FCSILL - CG		January 1997
	V6.0
	Adapted to use external flatfield factors - CG	May 1997
	V6.3
	Using FCSPOW validity limits  (CG)              January 1998
	Old default responsivity deleted (CG)		February 1998
	V7.0
	Out_of_limits only set if "hard" limits 
	 violation (0. or 99. mW)			March 1998
	V7.1
	Modal use according to IDL >= 5.0 (CG)		January 1999
	V7.3

(See pia_respons_abs.pro)


PIA_RESPS_STRUCT_VAL_CHOICE

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

 PURPOSE:
	Menu for extracting values from the PHT Responses Structures 

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
       PIA_RESPS_STRUCT_VAL_CHOICE

 INPUTS:
	STRRESPONS
		The structure to be chosen from

 KEYWORD PARAMETERS:
	GROUP=group: Group leader

 OUTPUTS:
	ACC_INDICES
		The structure indices corresponding to the selection
 COMMON BLOCKS:
	pia_varselected_cmn	I/F to pia_select_var
	
 PROCEDURES USED:
	PIA Lib: 
		pia_select_var
	Astro Lib:
		match

 MODIFICATION HISTORY:
       Written by: C. Gabriel (ESA/VILSPA) 		November 1995
	Bug with String lengths fixed (CG)		January 1996
	Bug for several absolute choices fixed (CG)	February 1996

(See pia_resps_struct_val_choice.pro)


PIA_RODEGL

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

 PURPOSE:
	Menu for RO-deglitching parameters handling.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_RODEGL, tmpdata, pixel, GROUP=group 

 INPUT:
	tmpdata: ERD level temporary structure 
	pixel:	 chosen pixel for testing

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hierarchy
	NO_data: For no data testing
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTERD temporary structure in case the
	NO_DATA Keyword is not set
	
 COMMON BLOCKS:
	colour_indices
		
 PROCEDURES USED:
	PIA LIB:
		decode_pixf
		acc_flag
		acc_volt
		degl_ramps
		pia_xplot
       INTERNAL:
		pia_rodegl_event

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)			December 1995
	Modified by CG
	Version 5.0 						August 1996
	Statistical info extended (CG)				January 1998
	V6.6
	Extension for setting params without data testing (CG) 	January 1998
	V7.0
	-> In this case modal keyword can be active (CG) 	January 1999
	V7.3 
	Ramps reconstruction added as option (CG)		August 1999
	V8.0
			

(See pia_rodegl.pro)


PIA_RODISC

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

 PURPOSE:
	Menu for PIA Read-out selection.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_RODISC

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	NNDR
		Number of non destructive read-outs per ramp
	
 OUTPUTS:
	none
	
 SIDE EFFECTS:
	values of some variables in common phtacc are changed, which drive
	the different data selections
 	
 COMMON BLOCKS:
	pia_rodisc_cmn		for internal use
	phtacc			selection variables
	phtselndr		default selection criteria 
	pia_rodis_out		for passing back error status
	
 PROCEDURES USED:
	Internal:
		pia_rodisc_event

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		August 1994
	V3.5
	Modification history:
	  pia_rodis_out added  (CG)			December 1996
	  V5.5
	Modal use according to IDL >= 5.0 (CG)		January 1999
	V7.3

(See pia_rodisc.pro)


PIA_RX2Y

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

 PURPOSE:
	Calculate map Y-coordinates for given right ascension and given map
	X-coordinate values. Arrays can be used in two forms:
	(1) a set of X pixel values, and a scalar right ascension, or
	(2) a set of right ascension values, and a scalar X value.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	y = PIA_RX2Y( ra, x, trans, dec)

 INPUTS:
	RA		Right ascension value(s) in degrees.
			If X is an array, then RA must be a scalar.

	X		Map X-coordinate value(s).
			If RA is an array, then X must be a scalar.

	TRANS		Transformation parameters as provided by PIA_MKTRANS.

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	Y		Map Y-coordinate value(s).

 OPTIONAL OUTPUTS:
	DEC		Corresponding declination value(s) in degrees.

 COMMON BLOCKS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		pia_rd2xy

 RESTRICTIONS:
	Program will have difficulty converging for declination values near 90.

 NOTES:
	The transformation structure TRANS is not compatible with the
	ASTR structure of ASTROLIB routines!

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK, Heidelberg	March 1995
			(Adapted from ASTROLIB routine CONS_RA)
	Oct 95 Version 3.5

(See pia_rx2y.pro)


PIA_RY2X

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

 PURPOSE:
	Calculate map X-coordinates for given right ascension and given map
	Y-coordinate values. Arrays can be used in two forms:
	(1) a set of Y pixel values, and a scalar right ascension, or
	(2) a set of right ascension values, and a scalar Y value.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	x = PIA_RY2X( ra, y, trans, dec)

 INPUTS:
	RA		Right ascension value(s) in degrees.
			If Y is an array, then RA must be a scalar.

	Y		Map Y-coordinate value(s).
			If RA is an array, then Y must be a scalar.

	TRANS		Transformation parameters as provided by PIA_MKTRANS.

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	X		Map X-coordinate value(s).

 OPTIONAL OUTPUTS:
	DEC		Corresponding declination value(s) in degrees.

 COMMON BLOCKS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		pia_rd2xy

 RESTRICTIONS:
	Program will have difficulty converging for declination values near 90.

 NOTES:
	The transformation structure TRANS is not compatible with the
	ASTR structure of ASTROLIB routines!

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK, Heidelberg	March 1995
			(Adapted from ASTROLIB routine CONS_RA)
	Oct 95 Version 3.5

(See pia_ry2x.pro)


PIA_SATLEV

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

 PURPOSE:
	Menu for PIA valid voltage levels setting.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SATLEV

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	
 OUTPUTS:
	none
	
 SIDE EFFECTS:
	changes the contents of the common block phtacc for data selection
	
 COMMON BLOCKS:
	phtacc		data selection parameters
	pia_satlev_cmn	for internal use

 PROCEDURES USED:
	Internal:
		pia_satlev_event
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		August 1994
	Oct 95 Version 3.5
	Made much more simple (CG)			April 1996
	Widget bug fixed (CG)				May 1996

(See pia_satlev.pro)


PIA_SCPDISC

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

 PURPOSE:
	Menu for PIA Chopper Plateau selection.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SCPDISC

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	NCHP
		Ramps per chopper plateau
	
 OUTPUTS:
	none
	
 SIDE EFFECTS:
	Affects variables in common phtacc for selection criteria
	
 COMMON BLOCKS:
	phtacc			data selection parameters 
	pia_scpdsc_cmn		for internal use
	
 PROCEDURES USED:
	Internal:
		pia_scpdisc_event

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		October 1994
	Modified by:	CG				February 1995
	Oct 95 Version 3.5
	XSIZE deleted from button (IDL V4 problem) (CG)	January 1996 
	Modal use according to IDL >= 5.0 (CG)		January 1999
	V7.3

(See pia_scpdisc.pro)


PIA_SELECT_VAR

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

 PURPOSE:
	Menu for PIA general selection of variables.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SELECT_VAR, var, VARNAMES=varnames, GROUP=group

 INPUTS:
	VAR
		 variable example (one for each variable)
		
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hierarchy
	VARNAMES
		String for variable identification
	VARTYP
		Type of selection: 0 for range, 1 for exact matching

 OUTPUTS:
	none
	
 SIDE EFFECTS:
	
 COMMON BLOCKS:
	pia_select_var_cmn	for internal use
	pia_varselected_cmn	variable ranges per index
	
 PROCEDURES USED:
	Internal:
		pia_select_var_event

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		April 1995
	Modified by:	CG				May 1995
	Oct 95 Version 3.5
	'xxxxx' indicating non selectable fields (CG)	November 1995
	Modal keyword according to IDL>=5.0 (CG)	January 1999
	V7.3

(See pia_select_var.pro)


PIA_SEP_AAP

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

 PURPOSE:
	Separate a raster leg from an AAP structure writing this part
	as a new measurement in the dynamical structure

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_SEP_AAP, aapdat, nleg

 INPUT:
       aapDAT 	: PHTaap like dynamical structure
	nleg:	  Raster leg to be taken

 KEYWORDS:
	(none)

 OUTPUTS:
	(none)

 RESTRICTIONS:
       aapDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC)          January 1996
	Raster lines number modified in header (CG)	January 1996
	central wavelength added (WMT)                  Nov 1996

(See pia_sep_aap.pro)


PIA_SEP_AAP_CHOP

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

 PURPOSE:
	Separate a chopper step from an AAP structure writing this part
	as a new measurement in the dynamical structure

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_SEP_AAP_chop, aapdat, nchop

 INPUT:
       aapDAT 	: PHTaap like dynamical structure
	nchop:	  Chopper step to be taken

 KEYWORDS:
	(none)

 OUTPUTS:
	(none)

 RESTRICTIONS:
       aapDAT must exist

 MODIFICATION HISTORY:
       Written by:	C. Gabriel (ESA/ESTEC-SAI)          January 1996
	central wavelength added (WMT)                      Nov 1996

(See pia_sep_aap_chop.pro)


PIA_SET_PATHS

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

 PURPOSE:
	Menu for setting different path variables.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SET_PATHS

 INPUT KEYWORD:
	MODAL		set widget in modal 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)		July 1996
	Keyword MODAL added (CG)			June 1999
	V7.4				
	IRAF_LOGIN and IRAF_DATA system keywords added	August 1999
	V8.0

(See pia_set_paths.pro)


PIA_SET_SYSVAR

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

 PURPOSE:
	Menu for changing PIA system variables.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_set_sysvar, sysvar

 INPUTS:
	sysvar: a string identifier for the system variable to be 
		displayed and changed. 
		Valid identifiers are:
			'FITDIR': for the external FITS directory 
			'XDRDIR': for the general internal save directory 
                  	'CALG': for the Cal G files directory
                   	'CALU': for the Cal U files directory 	
                   	'CALSAVE': for the directory to accomodate SAVE files 
				from cal menues (requires write permission)
                   	'INTDIR': for the directory to accomodate general 
				save files (requires write permission)       	
	
 KEYWORD PARAMETERS:
	GROUP : The group leader of the widget hierarchy
	
 OUTPUTS:
	(none)
	
 SIDE EFFECTS:
	System variables used in PIA are changed
	
 COMMON BLOCKS:
	(none)

 PROCEDURES USED:
	Internal:
		pia_set_sysvar_event

 MODIFICATION HISTORY:
	Written by:	Jose ACOSTA (IAC)		August 1995
	Modified by:	Carlos GABRIEL (ESA/VILSPA)	August 1995
	Oct 95 Version 3.5
	XDRDIR added (CG)				December 1995
	Appearance changed (CG)				October 1997
	V6.5
	Modal keyword according to IDL>=5.0 (CG)	January 1999
	V7.3

(See pia_set_sysvar.pro)


PIA_SHOWDATA

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

 PURPOSE:
	PIA Data Structure Show menu selector.
	Calls the show structure menu. 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_showdata, filename, ftype

 INPUTS:
	filename: internal name (*.admn) of the chosen measurement
	ftype: data level type  
	
 KEYWORDS USED:
	TMPPOS	Position within the corresponding buffer
	GROUP	The group leader of the widget hierarchy

 OUTPUTS:
	none
	
 COMMON BLOCKS:
	phtaap	AAP (Astrophysical Applications level) dynamical structure
	phtcla	CLA (Cal A) dynamical structure
	phterd	ERD (Edited Raw Data) dynamical structure
	phtscp	SCP (Signal per Chopper Plateau data) dynamical structure
	phtsmc	SMC (Serendipity Mode data) dynamical structure
	phtspd	SPD (Standard Processed Data) dynamical structure
	phtsrd	SRD (Signal per Ramp data) dynamical structure
	
 MODIFICATION HISTORY:
	Written by:	Carlos GABRIEL (ESA/ESTEC-SAI)	February 1995
	Modified(last): SB, WMT             	        October 1996
	change aar/aap for including central wavelength Nov 1996
	V5.x
	Wavelengths now from buffers (CG)		January 1997
	V6.0
	Keyword tmppos added (CG)			June 1997
	V6.3

(See pia_showdata.pro)


PIA_SHOWSTR

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

 PURPOSE:
	Menu for display of structures variables

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SHOWSTR, tmpstr, GROUP=group, VALNAMES=valnames, TITLE=title

 INPUTS:
	(none)
	
 KEYWORD PARAMETERS:
	GROUP : 	The group leader of the widget hirarchy
	VALNAMES:	String for variables identification
	
 OUTPUTS:
	(none)
	
 COMMON BLOCKS:
	pia_dspchz_cmn	keywords for plotting/overplotting 
	colour_indices	PIA plot color definitions

 PROCEDURES USED:
	PIA Procedure(s):
		pia_xplot
	Internal:
		pia_showstr_cleanup
		pia_showstr_event

 MODIFICATION HISTORY:
	Written by:	C. Gabriel, ESTEC/ESA		February 1995  
	Modified(last):	CG				July 1995
	Oct 95 Version 3.5
	PIA_XPLOT call without GROUP (CG)		November 1995
	lindgen for indgen to allow for large str. (CG) March 1998
	V7.1
	Saving the structure capability added (CG)	May 1999
	V7.4

(See pia_showstr.pro)


PIA_SIGDISC

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

 PURPOSE:
	Menu for PIA Signal selection.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SIGDISC

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	NSIG
		Number of ramps per chopper plateau
	
 OUTPUTS:
	none
	
 SIDE EFFECTS:
	Modifies the variables in phtacc for selection criteria
	
 COMMON BLOCKS:
	pia_sigdsc_cmn	for internal use
	phtacc		selection parameters
	
 PROCEDURES USED:
	Internal:
		pia_sigdisc_event

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		September 1994
	Modified by:	CG				February 1995
	Oct 95 Version 3.5
	Not reseting anysig when starting (CG)		December 1995
	XSIZE deleted from button (IDL V4 problem) (CG)	January 1996 
	Modal keyword according to IDL>=5.0 (CG)	January 1999
	V7.3

(See pia_sigdisc.pro)


PIA_SOURCE_SEARCH

[Previous Routine] [Next Routine] [List of Routines]

  NAME:
	PIA_source_search

  PURPOSE:
	Allows the user to interactively find positions and fluxes of stars
 	in a field and to alter the parameters for searching

  CATEGORY:
	PIA - processing

  INPUTS:
	image  : m x n image data
	trans  : coordinates transformation parameters

  OPTIONAL INPUTS:
	measname: map measurement name 

  OUTPUTS:
	x: vector with x-positions of stars
	y: vector with y-positions of stars
	flux: vector with estimated fluxes of stars

  COMMON BLOCKS:
	find_param

  PROCEDURES USED:
	PIA Procedure(s):
		acknowledge
		find_param_init
		pia_disp_print_file
		pia_xy2rd
	Astronomical Library:
		radec
	Internal:
		PIA_source_search_Event

  RESTRICTIONS:
	none

  Modification History:
	Written by:	I. Heinrichsen, MPIK, Heidelberg	July 1995	
	Modified by:	Carlos GABRIEL, ESA/VILSPA		July 1995
	Oct 95 Version 3.5
	Pixel index bug fixed	(IH)				October 1995

(See pia_source_search.pro)


PIA_SPDDISC

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

 PURPOSE:
	Menu for PIA Chopper Plateau selection.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SPDDISC

 INPUTS:
	none
	
 OPTIONAL INPUTS:
	
 KEYWORD PARAMETERS:
	GROUP
		The group leader of the widget hirarchy
	NCHP
		Number of chopper plateaux			
 OUTPUTS:
	none
	
 SIDE EFFECTS:
	Selection parameters in phtacc are altered
  	
 COMMON BLOCKS:
	pia_spddsc_cmn	for internal use
	phtacc

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by C.Gabriel (ESA/ESTEC)		February 1995
	Oct 95 Version 3.5
	XSIZE deleted from button (IDL V4 problem) (CG)	January 1996 
	Modal keyword according to IDL>=5.0 (CG)	January 1999
	V7.3

(See pia_spddisc.pro)


PIA_SPECPHOT

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

 PURPOSE:
	Widget user interface to process PHT-S on AA level.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_SPECPHOT

 INPUTS:
	(none)

 KEYWORD PARAMETERS:
	GROUP		The group leader of this widget hirarchy.

 OUTPUTS:
	(none)

 PROCEDURES USED:
	PIA Procedure(s):
		decode_admn
		pia_aapview
		pia_disp_hdr
		pia_get_rpid
		pia_get_step
		pia_open_iaap
		sep_rp_chop
	Astronomical Library:
		fxpar
	Internal:
		pia_specphot_cleanup
		pia_specphot_event
		pia_specphot_rpchop

 COMMON BLOCKS:
	phtslwavelen

 MODIFICATION HISTORY:
	Written by: 	C. Gabriel, ESA/VILSPA		October 1995
	Oct 95 Version 3.5
	Plot + overplot of all spectra included		April 1996
	F_lambda plotting added (CG)			April 1996
	F_lambda plot in W/m^2/um now (CG)		June 1996
	mnbr variable bug fixed (CG)			June 1996
	help added (CG)					July 1996
	Separation into RPID and CH.POS added (CG)	July 1996
	PIA_SPECPHOT_RPCHOP routine added for simplification
	 using pia_get_rpid and pia_get_step and 	
	 adding possibility of adding several RPIDs(CG) December 1997
	V6.6
	Use of coded bitflag system (CG)			May 1999
	V7.4 

(See pia_specphot.pro)


PIA_SPECT

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

 PURPOSE:
	Plot PHT-S-Spectra of signals (V/s) per chopper level.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_spect, tmpdata, step, mulch, rpid_ch

 INPUTS:
	tmpdata: A structure (SCP type) containing data to be displayed
	step: Chopper step to be plotted
	mulch: Print chopper step flag (0: no print, 1: print)
	rpid_ch: The raster position
	
 KEYWORD PARAMETERS:
	overplot	

 OUTPUTS:
	none
	
 RESTRICTIONS:
	using keyword overplot requires existing plot
	
 METHOD:
	average all signals of a chopper step per pixel and plot (PIA_XPLOT) 
	the results versus the pixel central wavelength

 COMMON BLOCKS:
	phtslwavlen
	colour_indices
	pia_dspchz_cmn
	
 PROCEDURES USED:
	PIA Procedure(s):
		cp_disc
		decode_admn
		pia_xplot
		set_slwavelen
		weight_mean

 MODIFICATION HISTORY:
	Written by:	C. Gabriel (ESA/ESTEC)		October 1994
	Modified(last):	CG				February 1995
	Oct 95 Version 3.5
	Bug for overplotting (2-dim -> 1) fixed (CG)	December 1995
	Raster points choice added (CG)			January 1996
	Message in case of one ch plat taken out (CG)	August 1996
	Extension for combining RPIDs (CG)		December 1997
	V6.6

(See pia_spect.pro)


PIA_SPECT_AAR

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

 PURPOSE:
	Plot PHT-S-Spectra of flux density/surface brightness per chopper level.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_spect_aar, tmpdata, step, mulch, rpid_ch

 INPUTS:
	tmpdata: A structure (AAP type) containing data to be displayed
	step: Chopper step to be plotted
	mulch: Print chopper step flag (0: no print, 1: print)
	rpid_ch: The raster position
	
 KEYWORD PARAMETERS:
	overplot
		to overplot on active PIA_xplot window
	mjy	
		to plot brightness surfaces instead of fluxes present in tmpdata

 OUTPUTS:
	none
	
 RESTRICTIONS:
	using keyword overplot requires existing plot
	
 METHOD:
	average all flux densities/surface brightness of a chopper step per 
	pixel and plot (PIA_XPLOT) the results versus the pixel central 
	wavelengths

 COMMON BLOCKS:
	phtslwavlen
	colour_indices
	pia_dspchz_cmn
	
 PROCEDURES USED:
	PIA Procedure(s):
		spd_disc
		decode_admn
		pia_xplot
		set_slwavelen
		weight_mean

 MODIFICATION HISTORY:
	Written by:	C. Gabriel (ESA/VILSPA-SAI)		April 1996
	Overplot symbol set back if = 8 (CG)			May 1996
	Extension for combining RPIDs (CG)			December 1997
	V6.6
	Use of coded bitflag system (CG)			May 1999
	V7.4 

(See pia_spect_aar.pro)


PIA_SPECT_SPD

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

 PURPOSE:
	Plot PHT-S-Spectra of in-band-powers [W] (or flux density [Jy]) 
	per chopper level.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_spect_spd, tmpdata, step, mulch, rpid_ch

 INPUTS:
	tmpdata: A structure (SPD or AAP type) containing data to be displayed
	step: Chopper step to be plotted
	mulch: Print chopper step flag (0: no print, 1: print)
	rpid_ch: The raster position
	
 KEYWORD PARAMETERS:
	overplot
	aap:	IF AAP data as input, instead of SPD	

 OUTPUTS:
	none
	
 RESTRICTIONS:
	using keyword overplot requires existing plot
	
 METHOD:
	average all in-band-power/fluxes of a chopper step per pixel and plot 
	(PIA_XPLOT) the results versus the pixel central wavelengths

 COMMON BLOCKS:
	phtslwavlen
	colour_indices
	pia_dspchz_cmn
	
 PROCEDURES USED:
	PIA Procedure(s):
		spd_disc
		decode_admn
		pia_xplot
		set_slwavelen
		weight_mean

 MODIFICATION HISTORY:
	Written by:	C. Gabriel (ESA/ESTEC)		November 1994
	Modified(last):	CG				February 1995
	Oct 95 Version 3.5
	Raster points choice added (CG)			January 1996
	Overplot symbol set back if = 8 (CG)			May 1996
	Keyword AAP added (CG)				November 1997
	Extension for combining RPIDs (CG)		December 1997
	V6.6
	Bug from typo 'uudata' fixed (CG)		May 1998
	V7.2

(See pia_spect_spd.pro)


PIA_STRUCTURES_HELP

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

 PURPOSE:
	Print information on the dynamical PIA buffers 

 CATEGORY:
	PIA - help

 CALLING SEQUENCE:
       pia_structures_help, [/phterd], [/phtsrd], ...

 INPUT KEYWORDS:
	phterd: To obtain info on phterd
	phtsrd: To obtain info on phtsrd
	phtscp: To obtain info on phtscp
	phtspd: To obtain info on phtspd
	phtaap: To obtain info on phtaap
       phtaar: To obtain info on phtaar
       PPAP:   PHT-P point source photometry sub-structure
       PPAE:   PHT-P extended source photometry sub-structure
       PPAS:   PHT-P scan & slew photometry sub-structure
       PLAP:   PHT-SL point source spectroscopy sub-structure
       PLAE:   PHT-SL extended source spectroscopy sub-structure
       PLAS:   PHT-SL Raster mode spectroscopy sub-structure
       PSAP:   PHT-SS point source spectroscopy sub-structure
       PSAE:   PHT-SS extended source spectroscopy sub-structure
       PSAS:   PHT-SS Raster mode spectroscopy sub-structure
       PCAP:   PHT-C point source photometry sub-structure
       PCAE:   PHT-C extended source photometry sub-structure
       PCAS:   PHT-C scan & slew photometry sub-structure

 PROCEDURES USED: 
       Common Block(s) or @ procedure(s):
               phterd
               phtsrd
               phtscp
               phtspd
               phtaap
               phtaar

 MODIFICATION HISTORY:
       Written by: C. Gabriel  (ESA-SAI)		July 1996
       AAR structures added:    IH (MPIK)              Mai  1997
	V6.3

(See pia_structures_help.pro)


PIA_VIEW

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

 PURPOSE:
	Menu for PIA FileViewer. Access different types of PHT-FITS files
	per filetype and detector, and display their contents.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_VIEW

 INPUTS:
	(none)
	
 KEYWORD PARAMETERS:
	GROUP : The group leader of the widget hirarchy
	
 OUTPUTS:
	(none)
	
 SIDE EFFECTS:
	(none)
	
 RESTRICTIONS:
	(none)
	
 COMMON BLOCKS:
	PIA_VIEW	for internal use
	
 PROCEDURES USED:
	PIA Procedure(s):
		pia_filefilter
		pia_filetype
		pia_open_fxb
		pia_read_cs
		pia_read_erd
		pia_read_unkn
		pia_view_erd
		pia_view_txt
		pia_view_unkn
		pia_xplot
		read_cs
		read_erd
	Astronomical Library:
		fxbclose
		fxbfind
		fxbread
	Internal:
		pia_view_plot_cleanup
		pia_view_plot_event
		pia_view_plot
		pia_view_cleanup
		pia_view_event

 MODIFICATION HISTORY:
	Written by: D. Skaley, MPIK/Heidelberg		August 1994
	Oct 95 Version 3.5

(See pia_view.pro)


PIA_VIEW_CS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_VIEW_CS
	
 PURPOSE:
	Write values from the binary table CS (Compact Status) FITS file
	to a text widget. The table values must have been read already.
	
 CATEGORY:
	PIA - graphics
	
 CALLING SEQUENCE:
	PIA_VIEW_CS, table, rows
	
 INPUTS:
	table :	The table values of the CS file.

	rows :	2-dimensional array denoting the range of rows
		which are contained in 'table'.
	
 KEYWORD PARAMETERS:
	NAME :	The name of the CS file which will be written out as an
		informational string.

	GROUP :	The group leader of the widget.
	
 OUTPUTS:
	(none)
	
 SIDE EFFECTS:
	(none)

 RESTRICTIONS:
	(none)
	
 COMMON BLOCKS:
	(none)
	
 PROCEDURES USED:
	PIA Procedure(s):
		pia_view_txt
	
 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	August 1994
	Oct 95 Version 3.5

(See pia_view_cs.pro)


PIA_VIEW_ERD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_VIEW_ERD
	
 PURPOSE:
	Write values from the binary table ERD (Edited Raw Data) FITS file
	to a text widget. The table values must have been read already.
	
 CATEGORY:
	PIA - graphics
	
 CALLING SEQUENCE:
	PIA_VIEW_ERD, erdtype, table, rows, NAME=name, GROUP=group
	
 INPUTS:
	erdtype : The ERD type: 'C1'=C100, 'C2'=C200, 'P'=P1,P2,P3, 'S'=S1,S2

	table :	The table values of the ERD file.

	rows :	2-dimensional array denoting the range of rows
		which are contained in 'table'.
	
 KEYWORD PARAMETERS:
	NAME :	The name of the ERD file which will be written out as an
		informational string.

	GROUP :	The group leader of the widget.
	
 OUTPUTS:
	(none)
	
 SIDE EFFECTS:
	(none)

 RESTRICTIONS:
	(none)
	
 COMMON BLOCKS:
	(none)
	
 PROCEDURES USED:
	PIA Procedure(s):
		pia_view_txt
 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	August 1994
	Oct 95 Version 3.5
	

(See pia_view_erd.pro)


PIA_VIEW_TXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_VIEW_TXT
	
 PURPOSE:
	Create a text widget and write a string array to it.
	To write out a table of binary values, the values must be formatted
	first into a string array.
	
 CATEGORY:
	PIA - graphics
	
 CALLING SEQUENCE:
	PIA_VIEW_TXT, text
	
 INPUTS:
	text :	An array of strings which will be written to the text widget.

 KEYWORD PARAMETERS:
	TITLE :	The title of the widget.

	NAME :	The name of the file from which the text/values come.

	GROUP :	The group leader of the widget.
	
 OUTPUTS:
	(none)
	
 SIDE EFFECTS:
	(none)

 RESTRICTIONS:
	(none)
	
 COMMON BLOCKS:
	(none)
	
 PROCEDURES USED:
	PIA Procedure(s):
		pia_prtdef
	Internal:
		pia_view_txt_event

 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	August 1994
	Oct 95 Version 3.5

(See pia_view_txt.pro)


PIA_VIEW_UNKN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_VIEW_UNKN
	
 PURPOSE:
	Write values from the binary table genaral binary FITS file
	to a text widget. The table values must have been read already.
	
 CATEGORY:
	PIA - graphics
	
 CALLING SEQUENCE:
	PIA_VIEW_UNKN, table, rows, columns
	
 INPUTS:
	table :	The table values of the FITS binary table.

	rows :	2-dimensional array denoting the range of rows
		which are contained in 'table'.
	
	columns : 2-dimensional array denoting the range of columns
		which are contained in 'table'.
	
 KEYWORD PARAMETERS:
	NAME :	The name of the FITS file which will be written out as an
		informational string.

	GROUP :	The group leader of the widget.
	
 OUTPUTS:
	(none)
	
 SIDE EFFECTS:
	(none)

 RESTRICTIONS:
	(none)
	
 COMMON BLOCKS:
	(none)
	
 PROCEDURES USED:
	PIA Procedure(s):
		pia_view_txt
	
 MODIFICATION HISTORY:
	Written by:	D. Skaley, MPIK/Heidelberg	August 1994
	Oct 95 Version 3.5

(See pia_view_unkn.pro)


PIA_WELCOME

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

 PURPOSE:
	Display a welcome text file using widgets without widget manager, 
	giving the possibility of printing it. The purpose is to get an 
	acknowledgement from the user under which conditions he might use
	the PIA package. 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_welcome

 INPUTS:
     (none)

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	No explicit outputs.  A file viewing widget is created.

 COMMON BLOCKS:
	(none)

 SIDE EFFECTS:
	(none)

 PROCEDURE:
	Creates a widget to display a text, giving the chance of printing it.


 MODIFICATION HISTORY:
	Re-Written by: Carlos GABRIEL (ESA/VILSPA-SAI)  	January 1999
	V7.3
	Changed acknowledgement (IPAC included)			December 1999
	V8.2

(See pia_welcome.pro)


PIA_WELLCOME

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

 PURPOSE:
	Display a wellcome text file using widgets and the widget manager, 
	giving the possibility of printing it. The purpose is to get an 
	acknowledgement from the user under which conditions he might use
	the PIA package. 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_wellcome

 INPUTS:
     (none)

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	No explicit outputs.  A file viewing widget is created.

 COMMON BLOCKS:
	pia_wellcome_cmn (internal)

 SIDE EFFECTS:
	Triggers the xMANAGER,No_BLOCK=1 if it is not already in use.

 PROCEDURE:
	Creates a widget to display a text, giving the chance of printing it.

 PROCEDURES USED:
       INTERNAL:
		PIA_wellcome_evt

 MODIFICATION HISTORY:
	Written by: Carlos GABRIEL (ESA/VILSPA-SAI)  		November 1995
	Free_lun instead of close - get_lun used (CG)		May 1996
	No /modal now (CG)					January 1999
	V7.3

(See pia_wellcome.pro)


PIA_WRITE_ANYTHING

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

 PURPOSE:
	Ask the interactive user for a string, and pass it back to the PIA 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_write_anything, anythin, anythout

 INPUTS:
	anythin:
		A string indicating what is the calling routine looking for
 	
 KEYWORD PARAMETERS:
	proposal:
		Output proposed
	
 OUTPUT:
	anythout:
		The string given by the user
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/VILSPA-SAI)	September 1995
	Oct 95 Version 3.5

(See pia_write_anything.pro)


PIA_WRITE_AUTHOR

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

 PURPOSE:
	Ask for a string to be quoted as "author" (needed by some output files)

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_write_author, author

 INPUTS:
	none
	
 KEYWORD PARAMETERS:
	none

 OUTPUT:
	author:
		The string "author"
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/ESTEC-SAI)		April 1995
	Oct 95 Version 3.5

(See pia_write_author.pro)


PIA_WRITE_COMMENT

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

 PURPOSE:
	Ask for a string array to be quoted as "comment" (needed by some output
	files)
	
 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_write_comment, comment

 INPUTS:
	none

 KEYWORD PARAMETERS:
	instcom:
		A string indicating what is the comment good for
	
 OUTPUT:
	comment:
		A string (array) "comment"
	
 COMMON BLOCKS:
	none

 PROCEDURES USED:
	none
	
 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC-SAI)	March 1995
	Modified by:	CG				May 1995
	Oct 95 Version 3.5 

(See pia_write_comment.pro)


PIA_WRITE_ICS

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

 PURPOSE:
	Write a PHT-CS (Compact Status Data) structure from a temporary 
	structure CSDAT (PHTCS type) onto an IDL savefile. Ask first
	the interactive user if he/she wants to save the file under the 
	"normal" name, or for a different one.  

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_WRITE_ICS, CSDAT

 INPUT:
       CSDAT : PHTCS temporary structure

 KEYWORD PARAMETERS:
	none

 OUTPUTS:
	none

 METHOD: 
	WIDGETS + IDL save

 COMMON BLOCKS:
	pht_wrtics_cmn		for internal use

 PROCEDURES USED:
	Internal:
		pia_write_ics_event
		
 MODIFICATION HISTORY:
       Written by C. Gabriel                      	December 1995
	Path keyword added (Jacosta)			May 1997

(See pia_write_ics.pro)


PIA_WRITE_IERD

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

 PURPOSE:
	Write a PHT-ERD (Edited Raw Data) measurement from a temporary 
	structure ERDDAT (PHTERD type) onto an IDL savefile. Ask first
	the interactive user if he/she wants to save the file under the 
	"normal" name, or for a different one.  

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_WRITE_IERD, ERDDAT

 INPUT:
       ERDDAT : PHTERD temporary structure

 KEYWORD PARAMETERS:
	none

 OUTPUTS:
	none

 METHOD: 
	WIDGETS + IDL save

 COMMON BLOCKS:
	pht_wrtierd_cmn		for internal use

 PROCEDURES USED:
	Internal:
		pia_write_ierd_event
		
 MODIFICATION HISTORY:
       Written by C. Gabriel                      	August 1994
	Oct 95 Version 3.5

(See pia_write_ierd.pro)


PIA_WRITE_IMAP

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

 PURPOSE:
	Write out the map parameter and the map to a save file from
	within the pia_mapdraw routine

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
	WRITE_INTMAP, MAP, MAPPAR

 INPUTS:
	MAP : the map array
	MAPPAR: the parameter par in the PIA_MAPDRAW.PRO

 KEYWORD PARAMETERS:

 OUTPUTS:
	IDL save file

 PROCEDURES USED:
	PIA Procedure(s):
	Astronomical Library:
	Internal:

 COMMON BLOCKS:
	(none)

 MODIFICATION HISTORY:
	Written by: 	Wai Ming Tai, DIAS	Feb 1996

(See pia_write_imap.pro)


PIA_WRITE_ISCP

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

 PURPOSE:
	Write a PHT-SCP (Signal per Chopper Plateau) measurement from a 
	temporary structure SCPDAT (PHTSCP type) onto an IDL savefile.
	Ask first the interactive user if he/she wants to save the file 
	under the "normal" name, or for a different one. 
 
 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       PIA_WRITE_ISCP, SCPDAT [, tmphdr]

 INPUT:
       SCPDAT : PHTSCP temporary structure

 OPTIONAL INPUT:
       tmphdr 	: temporary header

; KEYWORD PARAMETERS:
	none

 OUTPUTS:
	none

 METHOD: 
	WIDGETS + IDL save

 COMMON BLOCKS:
	pht_wrtierd_cmn		for internal use

 PROCEDURES USED:
	Internal:
		pia_write_iscp_event
		
 MODIFICATION HISTORY:
       Written by:	C. Gabriel, ESA/ESTEC		October 1994
	Modified by:	CG				February 1995
	Oct 95 Version 3.5
	Extension for ANDR,AVSD and ARSI (CG)		January 1996
	Save directory system variable used (CG)	February 1996

(See pia_write_iscp.pro)


PIA_WRITE_ISPD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PIA_WRITE_ISPD
 PURPOSE:
	Write a PHT-SPD (Standard Processed Data) measurement from a 
	temporary structure SPDDAT (PHTSPD type) onto an IDL savefile  
 CATEGORY:
	PIA - graphics
	PIA - I/O
 CALLING SEQUENCE:
       PIA_WRITE_ISPD, SPDDAT

 INPUT:
       PHTISPD : PHTSPD like temporary structure

 OUTPUT:
       IDL save file

 RESTRICTIONS:

 PROCEDURES USED: 

 MODIFICATION HISTORY:
       Written by: C. Gabriel
	Oct 95 Version 3.5
	!INTDIR used as directory to look for

(See pia_write_ispd.pro)


PIA_WRITE_ISRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PIA_WRITE_ISRD
 PURPOSE:
	Write a PHT-SRD (Signal Data) measurement from a temporary 
	structure SRDDAT (PHTSRD type) onto an IDL savefile  
 CATEGORY:
	PIA - graphics
	PIA - I/O
 CALLING SEQUENCE:
       PIA_WRITE_ISRD, SRDDAT, TMPHDR

 INPUT:
       PHTISRD : PHTSRD like temporary structure

 OPTIONAL INPUT:
       TMPHDR 	: Temporary header

 OUTPUT:
       IDL save file

 RESTRICTIONS:

 PROCEDURES USED:

 MODIFICATION HISTORY:
       Written by: C. Gabriel
	Oct 95 Version 3.5
	Extension for effective reset time & nr of used readouts (CG)	Jan.96
	Saving in other places than !INTDIR possible (CG)		May 97
	V6.3

(See pia_write_isrd.pro)


PIA_WRITE_VERSION

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

 PURPOSE:
	Simple Menu for getting a string as the version to be added 
	to FITS files

 CATEGORY:
	PIA - graphics
	PIA - I/O

 CALLING SEQUENCE:
	PIA_write_version, version

 INPUTS:

 OPTIONAL INPUTS:
	
 KEYWORD PARAMETERS:
	
 OUTPUT:
	version:
		The string "version"
	
 OPTIONAL OUTPUTS:
	
 SIDE EFFECTS:
	
 RESTRICTIONS:
	
 METHOD:
	
 EXAMPLE:
	
 CALLED ROUTINES:
	
 COMMON BLOCKS:

 PROCEDURES USED:
	
 MODIFICATION HISTORY:
	Written by: C.Gabriel
	Oct 95 Version 3.5

(See pia_write_version.pro)


PIA_XPLOT

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

 PURPOSE:
       This routine provides a graphical user interface to PLOT
       and OPLOT routines. Overplotting is possible, also the
       plotting range can be changed interactively.

 CATEGORY:
       PIA - graphics

 CALLING SEQUENCE:
       PIA_XPLOT, [X,] Y [, YERR]

 INPUTS:
       Y:        The ordinate data to be plotted.

 OPTIONAL INPUTS:
       X:        A vector argument. If X is not specified, Y is
                 plotted as a function of point number (starting at
                 zero). If both arguments are provided, Y is plotted
                 as a function of X.

       YERR:     The uncertainties of Y.

 OUTPUTS:
       None.

 KEYWORDS:
       OVERPLOT: Set this keyword to plot over a previously performed
                 plot. If this keyword is not set or a value of 0 is
                 supplied a new plot window is opened. A value of -1
                 draws an additional Y-axis for the new ordinate data.
                 A value of n greater than 0 uses the n-th previously
                 drawn Y-axis for scaling the data. If n is larger
                 than the number of existing Y-axes the last drawn
                 Y-axis is used.

       FOURIER:  Set this keyword to Fourier-transform the data
                 before plotting

	DISC_AREA: If this keyword is set, then a selection of an area
		  can be graphically done. The widget is in this case
		  of type modal (to avoid problems with overplotting).
		  The selected region is handled back via the common block
		  DISC_AREA
  
       GROUP:    The group leader of the widget.

       ANNOTATION:
                The value of type string or string array is printed
                to the output page. Annotation strings of succeeding
                calls of PIA_XPLOT will be concatenated.

       LEGEND:  A string describing the data in a legend.

	YERRSTYLE: Linestyle for error bars (default=0)

 Graphics Keywords Accepted:

       CHARSIZE COLOR LINESTYLE
       PSYM SUBTITLE SYMSIZE THICK TITLE
       XCHARSIZE XSTYLE XTHICK XTITLE XTYPE
       YCHARSIZE YSTYLE YTHICK YTITLE YTYPE

       See Chapter 2, Graphics Keywords and System Variables,
       for the description of graphics and plotting keywords.

 CALLED ROUTINES:
       PIA_PRTDEF

 COMMON BLOCKS:
       PIA_XPLOT
       PIA_PRINT
	DISC_AREA

 SIDE EFFECTS:
       None.

 RESTRICTIONS:

 PROCEDURE:
       Common Block(s) or @ procedure(s):
               colour_indices
               pia_xplot_bmd
       PIA Procedure(s):
               pia_prtdef

 MODIFICATION HISTORY:
	Written by: C Gabriel (adapted from Stefan Bogun)
	Modified by: Detlef Skaley
	Oct 95 Version 3.5
	Hypertext Help added, CG		October 1995
	Zooming now exact working; FFT only on first 30000 points allowed (CG)
						December 1995
	Problem with legend (when psym=10) fixed (CG)
						December 1995
	Loop variable now of type LONG (CG)	Christmas 1995	
	zoomfl now passed over vpar (CG)	February 1996
	Area selection capability added + 
	 better zooming +
	 print values capability  (CG) 		May 1997
	V6.3
	Yranges can be individually set + bug in print
	 values (wrong order) fixed (CG)	July 1997
	V6.4
	Allowing for selection of several areas (CG)	September 1997
	V6.5
	Number of elements for plotting can be
	 defined (!PIA_XPLOT_LIMIT system var.) (CG)	January 1998
	V7.0
	Xranges can be individually set  (CG)		March 1998
	Bug when zooming data with one point by x=0 
	 fixed (CG)					May 1998
	V7.1
	Problem with extension of empty space by update
	(IDL bug!) fixed by taking frames out (CG)	July 1998
	V7.2
	Changing according to IDL5.0 modal keyword use
	(forced by IDL5.1)				January 1999
	V7.3
	Better handling of x-y axis keywords (CG)	March 1999
	V7.4
	Force exact range and extended range NOT exclusive
	 by x-y axis keywords (CG)			January 2000
	Yerrstyle keyword added (CG)			February 2000
	V8.2

(See pia_xplot.pro)


PIA_XPLOT.BMD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PIA_XPLOT.BMD

 PURPOSE:
	Definition of the bitmap PIA_XPLOT.BMD for inclusion
	into other routines.

 CATEGORY:
       PIA - common block

 CALLING SEQUENCE:
	@pia_xplot.bmd


 MODIFICATION HISTORY:
 	Written by:	Stefan BOGUN (MPIA-Heidelberg)
	Oct 95 Version 3.5

(See pia_xplot_bmd.pro)


PIA_XSURFACE

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

 PURPOSE:
	This routine provides a graphical interface to the SURFACE and
	SHADE_SURFACE commands.  Different controls are provided to change 
	the viewing angle and other plot parameters.  It is an extension
	of the Xsurface routine provided by IDL

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_XSURFACE, Data

 INPUT PARAMETERS:
	Data:	The two-dimensional array to display as a wire-mesh or
		shaded surface.

 KEYWORD PARAMETERS:
	GROUP:	The widget ID of the widget that calls XSURFACE.  When this
		keyword is specified, the death of the caller results in the
		death of XSURFACE.

 SIDE EFFECTS:
	The xMANAGER,No_BLOCK=1 is initiated if it is not already running.

 RESTRICTIONS:
	PIA_XSURFACE does not accept any of the keywords that the IDL command 
	SURFACE does except the LEGO keyword.

 PROCEDURE:
	Create and register the widget with the xMANAGER,No_BLOCK=1 and then exit.

 PROCEDURES USED:
       PIA Procedure(s):
               pia_xsur2face

 MODIFICATION HISTORY:
	Written by: Carlos GABRIEL (adapted from Steve Richards)
	Oct 95 Version 3.5
	Hypertext Help added, CG		October 1995
	Draw widget enlarged (CG)		January 1996
	Contours option added (CG)		January 1996
	Printer definition added (WMT)          March   1996
	No use of common blocks, thus allowing for 
	any number of parallel pia_xsurface (CG) January 1998
	V7.0

(See pia_xsurface.pro)


PIA_XY2RD

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

 PURPOSE:
	Transform map x/y coordinates to right_ascension/declination.
	No checks are performed.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_XY2RD, x, y, trans, r, d

 INPUTS:
	X		The x coordinate values in the map

	Y		The y coordinate values in the map

	TRANS		The transformation parameters structure:
	.CD		forward transformation matrix
	.DC		back transformation matrix
	.CRVAL		reference position (ra,dec)
	.CRPIX		reference pixel (x,y)

 KEYWORD PARAMETERS:
	(none)

 OUTPUTS:
	R		The right_ascension value(s) in degrees.
			May be an array.

	D		The declination value(s) in degrees.
			May be an array.

 NOTES:
	This routine differs from the similar ASTROLIB routine XY2AD
	in several ways, mainly:
	(1) The input parameter TRANS is expected to contain the
	    inverse transformation matrix DC.
	(2) The definitions of the matrixes CD and DC are not consistent
	    with the definition of the ASTROLIB matrix CD or its inverse.
	(3) CRPIX values are consistent with IDL indexing (starting at 0).

 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: D Skaley
	Oct 95 Version 3.5

(See pia_xy2rd.pro)