ISOPHOT Interactive Analysis (PIA)

PIA drifts

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:51 2000.


List of Routines


Routine Descriptions

CHECK_LIMITS_DFPAR

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

 PURPOSE:
	Check the limits of fitting parameters for drift model functions

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	CHECK_LIMITS_DFPAR, par0, drift_par, flag

 INPUT:
	par0:		Array containing the initial values of parameters
	drift_par:	Structure containing the fitted parameters and their 
			limits

 KEYWORD PARAMETERS:
	MULTI_PIX:	For non-interactive use. Performing loop over different
			pixels.
	
 OUTPUT:
	flag:		Array wit flags for each parameter:
				 (0=within limits,1=outside)
			
	
 COMMON BLOCKS:
	pia_drift_par 
		
 RESTRICTIONS:
	The structure fit_par_str has to be defined prior to access this routine

 PROCEDURES USED:
	PIA LIB:

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)		   November 1996 
	Version 5.x - Aug.96
			

(See check_limits_dfpar.pro)


DFFUNCT_INFO[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dffunct_info
 PURPOSE:
       Initializes the common blcck DFFUNCT_INFO which contains the information
	for the differente fitting functions. In principle this should be the
	only place where specific information for each function is contained.
	The rest of routines used in the drifting modelling will work
	independently of any function. 

 CATEGORY:
	PIA - initialization

 CALLING SEQUENCE:
       DFFUNCT_INFO

 INPUT PARAMETERS:
	None       

 OUTPUT PARAMETERS: 
	None

 PROCEDURES USED:
       Common Block(s) or @ procedure(s):
               dffunct_info

 MODIFICATION HISTORY:
       Written by: J.Acosta
	Oct 96 Version 5.x
	Include Fouks for Triangular and sawtooth chopp. (Jacosta)  May 97

(See dffunct_info.pro)


DFFUNCT_INFO[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dffunct_info
 PURPOSE:
       Initializes the common blcck DFFUNCT_INFO which contains the information
	for the differente fitting functions. In principle this should be the
	only place where specific information for each function is contained.
	The rest of routines used in the drifting modelling will work
	independently of any function. 

 CATEGORY:
	PIA - initialization

 CALLING SEQUENCE:
       DFFUNCT_INFO

 INPUT PARAMETERS:
	None       

 OUTPUT PARAMETERS: 
	None

 PROCEDURES USED:
       Common Block(s) or @ procedure(s):
               dffunct_info

 MODIFICATION HISTORY:
       Written by: J.Acosta
	Oct 96 Version 5.x

(See dffunct_info_forexp.pro)


DRFT1.PRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DRFT1.PRO

 PURPOSE:
	Function corresponding to the numerical differential drift model

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	fct = DRFT1(x,a)

 INPUT:
	x:	independent variable 
	a:	parameter set:
		a(0)	F  ideal signal during measurement
		a(1)	p0 ideal signal before measurement
		a(2)	a  coupling parameter

	
 OUTPUT:
	fct:	function by time x	
			
 METHOD:

 Numerical solution of differential equation

    d(fct)
   ------- = F * a - fct * a = v
      dt

 MODIFICATION HISTORY:
	Written by: B. Schulz (ESA/VILSPA-SAI)		August 1996 
	Modified by: CG					August 1996
	Version 5.0 - Aug.96
			

(See drft1.pro)


DRIFT_INIT

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

 PURPOSE:
       Re-Initializes the structure PHTDRIFT defining the contents as
	a template structure PHTDRIFT_TYPE. It can be used for clearing
	the whole DRIFT structure, in case this should show as necessary. 

 CATEGORY:
	PIA - initialisation

 CALLING SEQUENCE:
       DRIFT_INIT

 INPUTS:
	None       

 OUTPUTS: 
	None

 KEYWORDS:
	Index:	If set, only those will be deleted from buffer

 COMMON BLOCKS:
	phtdrift
	
 PROCEDURES USED:

 MODIFICATION HISTORY:
       Written by:	Carlos Gabriel (ESA/SAI-VILSPA)		Dec 1999
	V8.2

(See drift_init.pro)


DRIFT_MOD_PROC

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

 PURPOSE:
	Call a drift modelling routine returning the modelled signal

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	DRIFT_MOD_PROC, det, time, slop, slop_unc, slop_flag, rpid, step,$
	 tempera, fit_par_str, newhdr, CHOPPED=chopped, MULTI_PIX= multi_pix, $
 	 PIXCH= pixch

 INPUT:
	det:		Detector name
	time:		Array containing the signals' times
	slop:		Slopes array
	slop_unc:	Slopes' uncertainties array
	slop_flag:	Slopes' flags array
	rpid:		Raster points array
	step:		Chopper step positions array
	tempera;	Detector temperature array

 KEYWORD PARAMETERS:
	MULTI_PIX:	For non-interactive use. Performing loop over different
			pixels.
	
 OUTPUT:
	fit_par_str:	Structure containing the fitting information:
			 mod_func:	function used
			 nparams:  	number of parameters used 
			 flag:		output flag
                	 param:         parameters array 
                	 		(3-dim: pixel, step, parameter)
                	 sg_param:	uncertainties of param
                	 slop: 		fitted slopes
                	 slop_flag:	flag of the fitted slopes
                 	 signal:	final signals
			 time_sg:	time for final signals
                	 err:		uncertainties of 'signal'
                	 chisq:		chi-squares of the fit
			
	
 COMMON BLOCKS:
	TEMPERATURE
		
 RESTRICTIONS:
	The structure fit_par_str has to be defined prior to access this routine

 PROCEDURES USED:
	PIA LIB:
		check_unc
		fit_function
		fouks_start_par
		get_rastersteps
		get_nchoppsweep
		gauss_start_par
		gaussinv_start_par
		pixel_det

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)		   		June 1996 
	Modified by: C.Gabriel (ESA/VILSPA-SAI)	   		August 1996
	Temperature is included as input to be
	used in thermal Fouks, by JAcosta(ESA/IAC) 		September 1996
	Version 5.0 - Aug.96
	Chi-square calculations improved (JA+CG)   		February 1997
	Bug corrected when not enough points (JA)  		February 1997
	V6.1
	Possibility to use Fouks rectangular chopping mode	
	  for meas. performde in triangular mode (JA)		December 1998	 
			

(See drift_mod_proc.pro)


DRIFT_STD_SCP

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

 PURPOSE:
	Derive a SCP level structure using the drift analysis cumulated 
	information and the standard acceptance criteria

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	drift_std_scp, driftps, scppos, ACC_ALL=acc_all

 INPUT:
	driftps:	Position of the drift info within the phtdrift array
	scppos:		Position of the scp meas. within the phtscp array

 KEYWORD PARAMETERS:
	ACC_ALL:	Ignore drift analysis acceptance criteria
	
 OUTPUT:
	(none)			
	
 COMMON BLOCKS:
	phtdrift
	phtscp
		
 RESTRICTIONS:

 PROCEDURES USED:
	PIA LIB:
		decode_flag

 MODIFICATION HISTORY:
	Written by: C. Gabriel (ESA/VILSPA-SAI) 		February 1997
	V6.1
	Bug for all accepted by array detectors fixed (CG)	April 1997
	V6.2		

(See drift_std_scp.pro)


FILL_DRIFT

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

 PURPOSE:
	FILLS a temporary structure into the dynamical structure PHTDRIFT  

 CATEGORY:
	PIA - I/O

 CALLING SEQUENCE:
       FILL_DRIFT, tmp, REPLACE=replace

 INPUT:
       tmp 	: PHTDRIFT like temporary structure

 OPTIONAL INPUT:
	REPLACE : IF set (different to 0) put structure into this PHTDRIFT position

 RESTRICTIONS:
       tmp must be a valid phtdrift like temporary structure

 PROCEDURES USED: 
       Common Block(s) or @ procedure(s):
               phtdrift

 MODIFICATION HISTORY:
       Written by: J.Acosta  (MPIA/ESA/IAC)		October 1996
	Updated by CG, including SLOP variation tag	February 1997
	V6.1

(See fill_drift.pro)


FITPAR_STR_INIT

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

 PURPOSE:
	Initializes the drift fitting parameters for a given function

 CATEGORY:
	PIA - algorithms

 CALLING SEQUENCE:
	FITPAR_STR_INIT, tmpsrd, fitpar_str, init_error, ffunct, 
	 	[,/ONLY_MEASPAR] [,/DEFAULT] [,PIXEL=pixel]  

 INPUT:
	tmpsrd:		A phtsrd like temporary structure
	ffunct:		Optional parameter to specify a particular function. 
			If not specified a default function is used depending
			on the detector: 
			     Fouks function for P1, P2 & SL
			     Exponential function for P3, C100 & C200

 OUTPUT:
	fit_par_str:	Structure containing the initial parameters for fitting
	init_error:	Initialization error (1-D array  of NPIX elements)

 KEYWORD PARAMETERS:
	ONLY_MEASPAR:	Change only parameters related to the measurement
	DEFAULT:	Assing values stored in common block DFFUNCT_INFO to
			parameters independent of measurements
	PIXEL:		Use only the specified pixel 
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTSRD temporary structure
	
 COMMON BLOCKS:
	dffunct_info
	pia_drift_par 
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		drift_mod_proc
		pia_disp_print_file
		pia_load_driftpar
		pia_xplot
       INTERNAL:
		pia_drift_mod_event

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC-La Laguna)		September 1996
	Added flag as input parameter to parfunc call
					    (J.Acosta)  October 1996
	include all treatment with flag at beggining of 
	each chopper/raster plateau. Consistency with
	fraction of the given measurement (J.Acosta)	November 1996
	Adapted to use mininmum time to discard values
	(JAcosta)					June 1997
	Version 6.1 - Oct.96
			

(See fitpar_str_init.pro)


FIT_FUNCTION

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

 PURPOSE:
	Interface routine between measurement, signal drift parameters and 
	fitting routine

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FIT_Function, xx, yy, yyerr, yyflag, drift_par, step=STEP, $ 
		RASTERSTEP = rasterstep

 INPUT:
	xx:	The independent variable
	yy:	The dependant variable
	yyerr:	Uncertainty array of yy
	yyflag:	Flag array corresponding to yy
	

 KEYWORD PARAMETERS:
	Step:	Chopper step (not set for non chopped measurements)
	WEIGHT: indicate which weighting system is used among the
		following possibilities:
			sigma 	=  1/sigma^2   (DEFAULT)
			none	= 1
			time    = exp((t-t_zero)/512.)
			signal	= 1/abs(signal)	
	          
	
 OUTPUT:
	drift_par:	A PIA_drift_par likely structure, containing e.g. the 
			fitted parameters, sigmas, etc
	
 COMMON BLOCKS:
	(none) 
		
 PROCEDURES USED:
	PIA lib:
		pia_curfit

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	New way to estimate the weights of points
	for the fit. A normalization based on stdev
	of the difference between consecutive signals
	J. Acosta				  January 1997
	Version 5.0 - Aug.96
	Bug in the flag treatment for chopped meas., 
	+ change call of get_nchoppsweep - JAcosta,  Aug 1997  
			

(See fit_function.pro)


FOUKSC_CHOP_DRIFT

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

 PURPOSE:
	Calculate the temperature independent Fouks function for rectangular
		chopped case and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_CHOP_DRIFT, t, a, step, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)
	step:	Chopper step number 

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Perform operation in double precision to
	avoid underflows  (J.Acosta)		  October 1996
	Version 5.0 - Aug.96
			

(See fouksc_chop_drift.pro)


FOUKSC_CHOP_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks model for chopped measurements

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_CHOP_start_par, det, time, slop, flag, pixel, start_par, $
		error=error, step=step

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	STEP:	Chopper step array
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Added flag as input parameter (J.Acosta)  October 1996
	Added time as input parameter J.Acosta	  October 1996
	Added t_zero as input keyword (J.Acosta)  October 1996
	Set a dummy value for S_C(pixel) when 
	argument of sqrt is negative  (J.Acosta)  January 1997	 
	Version 5.0 - Aug.96
			

(See fouks_chop_start_par.pro)


FOUKSC_DRIFT

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

 PURPOSE:
	Calculate the temperature independent Fouks function and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	ERROR:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: J.Acosta (IAC) + C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	E_j is taken normalized to Temp = 3.K
	Version 5.0 - Aug.96
			

(See fouksc_drift.pro)


FOUKSC_RTCHO_DRIFT

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

 PURPOSE:
	Calculate the temperature independent Fouks function for rectangular
		chopped case and derivatives. It includes all chopper 
		steps and compute the signal jump based on final values.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_RTCHO_DRIFT, t, a, step, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)
	step:	Chopper step number 

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Perform operation in double precision to
	avoid underflows  (J.Acosta)		  October 1996
	Version 5.0 - Aug.96
			

(See fouksc_rtcho_drift.pro)


FOUKSC_RTCHO_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks model for rectangular 
	chopped measurements. It includes all chopper steps and 
	compute the signal jump based on final values.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_RTCHO_start_par, det, time, slop, flag, pixel, start_par, $
		ERROR=error, STEP=step, SG_JUMP = sg_jump

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	STEP:	Chopper step array
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: J.Acosta (VILSPA)	  	  January 1997
	Set a dummy value for S_C(pixel) when 
	argument of sqrt is negative  (J.Acosta)  January 1997	 
	Version 5.6 - Jan.97
	Small changes in start parameters (JA+CG) February 1997
	V6.1
	Starting values for final fluxes come from
	all chopper plateaux corresponding to a given 
	step. Jumps are determined in a rough way (JACOSTA)  August 1997
	V6.4			

(See fouksc_rtcho_start_par.pro)


FOUKSC_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks model 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Added flag as input parameter (J.Acosta)  October 1996
	Added time as input parameter (J.Acosta)  October 1996
	Added t_zero as input keyword (J.Acosta)  November 1996
	Set a dummy value for S_C(pixel) when 
	argument of sqrt is negative  (J.Acosta)  January 1997	 
	Version 5.0 - Aug.96
			

(See fouks_start_par.pro)


FOUKSC_STCHO_DRIFT

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

 PURPOSE:
	Calculate the temperature independent Fouks function for rectangular
		chopped case and derivatives. It includes all chopper 
		steps and compute the signal jump based on final values.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_STCHO_DRIFT, t, a, step, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)
	step:	Chopper step number 

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Perform operation in double precision to
	avoid underflows  (J.Acosta)		  October 1996
	Version 5.0 - Aug.96
			

(See fouksc_stcho_drift.pro)


FOUKSC_STCHO_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks model for sawtooth 
	chopped measurements. It includes all chopper steps and 
	compute the signal jump based on final values.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_STCHO_start_par, det, time, slop, flag, pixel, start_par, $
		ERROR=error, STEP=step, SG_JUMP = sg_jump

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	STEP:	Chopper step array
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: J.Acosta (VILSPA)	  	  May 1997
	V6.2
	Starting values for final fluxes come from
	all chopper plateaux corresponding to a given 
	step. Jumps are determined in a rough way (JACOSTA)  August 1997
	v6.4
			

(See fouksc_stcho_start_par.pro)


FOUKSC_TTCHO_DRIFT

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

 PURPOSE:
	Calculate the temperature independent Fouks function for rectangular
		chopped case and derivatives. It includes all chopper 
		steps and compute the signal jump based on final values.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_TTCHO_DRIFT, t, a, step, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)
	step:	Chopper step number 

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Perform operation in double precision to
	avoid underflows  (J.Acosta)		  October 1996
	Version 5.0 - Aug.96
			

(See fouksc_ttcho_drift.pro)


FOUKSC_TTCHO_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks model for triangular 
	chopped measurements. It includes all chopper steps and 
	compute the signal jump based on final values.

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_TTCHO_start_par, det, time, slop, flag, pixel, start_par, $
		ERROR=error, STEP=step, SG_JUMP = sg_jump

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	STEP:	Chopper step array
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: J.Acosta (VILSPA)	  	  May 1997
	V6.2
	Starting values for final fluxes come from
	all chopper plateaux corresponding to a given 
	step. Jumps are determined in a rough way (JACOSTA)  August 1997
	v6.4
			

(See fouksc_ttcho_start_par.pro)


FOUKST_CHOP_DRIFT

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

 PURPOSE:
	Calculate the temperature dependent Fouks function and its derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKST_CHOP_DRIFT, t, a, fct, pder, error, FINAL=final, STEP=step

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:
	therm_int

 MODIFICATION HISTORY:
	Written by: J.Acosta (IAC) + C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Correction of bugs and include a new way to compute 
	integrals  (J.Acosta)					  October 1996
	Version 5.0 - Aug.96
			

(See foukst_chop_drift.pro)


FOUKST_CHOP_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks model for chopped measurements,
	 with temperature influence

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKST_CHOP_start_par, det, time, slop, flag, pixel, start_par, $
		error=error, step=step

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	STEP:	Chopper step array
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Added flag as input parameter (J.Acosta)  October 1996
	Added time as input parameter J.Acosta	  October 1996
	Added t_zero as input keyword (J.Acosta)  November 1996
	Small change in initial pars (jacg)	  Dec 1996
	Set a dummy value for S_C(pixel) when 
	argument of sqrt is negative  (J.Acosta)  January 1997	 
	Version 5.0 - Aug.96
			

(See foukst_chop_start_par.pro)


FOUKST_DRIFT

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

 PURPOSE:
	Calculate the temperature dependent Fouks function and its derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:
	therm_int

 MODIFICATION HISTORY:
	Written by: J.Acosta (IAC) + C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Correction of bugs and include a new way to compute 
	integrals  (J.Acosta)					  October 1996
	Version 5.0 - Aug.96
			

(See foukst_drift.pro)


FOUKST_START_PAR

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

 PURPOSE:
	Calculate start parameters for the fouks thermal model 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	FOUKSC_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	time:   Time array
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	fouks_start_par 
		
 PROCEDURES USED:
	Astrolib:
		readcol

 MODIFICATION HISTORY:
	Written by: J.Acosta (ESA/VILSPA-SAI)	  October 1996
	Added flag as input parameter (J.Acosta)  October 1996
	Added t_zero as input keyword (J.Acosta)  November 1996
	Set a dummy value for S_C(pixel) when 
	argument of sqrt is negative  (J.Acosta)  January 1997	 
	Version 5.1 - Oct.96
			

(See foukst_start_par.pro)


FUNCTION_2B_FITTED

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

 PURPOSE:
	Interface function for drift modelling functions written
	as procedures

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	Result = FUNCTION_2B_FITTED(var)

 INPUT:
	var:	The dependant parameters
	

 KEYWORD PARAMETERS:
	(none)	          
	
 OUTPUT:
	Result: Chi-square corresponding to the distribution passed
		by common F_2B_FIT, function passed by common PIA_DRIFT_PAR
		 and the variables var.
	
 COMMON BLOCKS:
	F_2B_FIT  Containing x, y(x), w(x)=weight, r(x)=raster/chopper step 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)	  February 1997
	Version 6.1
			

(See function_2b_fitted.pro)


INVEXP_DRIFT

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

 PURPOSE:
	Calculate an offset inverse exponential function and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	INVEXP_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

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

(See invexp_drift.pro)


INVEXP_START_PAR

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

 PURPOSE:
	Calculate start parameters for the 'offset inverse exponential' drift 
	function 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	GAUSSINV_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	time:   Time array
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	(none) 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)	  August 1996
	Added flag as input parameter (J.Acosta)  October 1996
       Added time as input parameter J.Acosta    October 1996
	Added t_zero as input keyword (J.Acosta)  November 1996
	Version 5.0 - Aug.96
			

(See invexp_start_par.pro)


NUMDIF_DRIFT

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

 PURPOSE:
	Calculate an offset exponential function and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	NUMDIF_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: B. Schulz (ESA/VILSPA-SAI) + CG	  August 1996
	Version 5.0 - Aug.96
			

(See numdif_drift.pro)


NUMDIF_START_PAR

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

 PURPOSE:
	Calculate start parameters for the 'Numerical differ' drift function 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	NUMDIF_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	(none) 
				
 PROCEDURES USED:
       PIA LIB:
               s_ini_final

 MODIFICATION HISTORY:
	Written by: C. Gabriel (ESA/VILSPA-SAI)	  August 1996
	Added flag as input parameter (J.Acosta)  October 1996
	Added t_zero as input keyword (J.Acosta)  November 1996
       Added time as input parameter J.Acosta    October 1996
	Version 5.0 - Aug.96
			

(See numdif_start_par.pro)


OFFEX2_START_PAR

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

 PURPOSE:
	Calculate start parameters for the 'two offset exponential' drift 
	function 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	OFFEXP_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	time:	Time array
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	(none) 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)	  November 1996
	added prescription to estimate lambda (J.Acosta)  November 1996
	Version 5.3 - Nov.96
			

(See offexp2_start_par.pro)


OFFEXP2_DRIFT

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

 PURPOSE:
	Calculate an offset exponential function and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	OFFEXP2_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: J.Acosta (IAC) + C.Gabriel (ESA/VILSPA-SAI)	  November 1996
	Version 5.3 - Nov.96
			

(See offexp2_drift.pro)


OFFEXP3_DRIFT

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

 PURPOSE:
	Calculate an offset exponential function and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	OFFEXP3_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: J.Acosta (IAC) + C.Gabriel (ESA/VILSPA-SAI)	  November 1996
	Version 5.3 - Nov.96
			

(See offexp3_drift.pro)


OFFEXP3_START_PAR

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

 PURPOSE:
	Calculate start parameters for the 'two offset exponential' drift 
	function 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	OFFEXP_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	time:	Time array
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	(none) 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)	  November 1996
	added prescription to estimate lambda (J.Acosta)  November 1996
	Version 5.3 - Nov.96
			

(See offexp3_start_par.pro)


OFFEXP_DRIFT

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

 PURPOSE:
	Calculate an offset exponential function and derivatives

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	OFFEXP_DRIFT, t, a, fct, pder, error, FINAL=final

 INPUT:
	t:	The independent variable
	a:	The parameter set (variable and fixed parameters)

 KEYWORD PARAMETERS:
	FINAL:	For a final calculation, without looking which parameters
		are variable. No calculation of derivatives.
	
 OUTPUT:
	fct: 	The function values for t
	pder:	The derivatives
	error:	Error flag checking for the consistency of the function params.
	
 COMMON BLOCKS:
	pia_drift_par 
		
 PROCEDURES USED:

 MODIFICATION HISTORY:
	Written by: J.Acosta (IAC) + C.Gabriel (ESA/VILSPA-SAI)	  August 1996
	Change the functional form to have tau=E/S_final^p        Feb    1997
	Using drift_par.t_ini instead of drift_par.t_zero, as
	definition has changed	(JAcosta)			  June   1997
	Version 5.0 - Aug.96
			

(See offexp_drift.pro)


OFFEXP_START_PAR

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

 PURPOSE:
	Calculate start parameters for the 'offset exponential' drift function 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	OFFEXP_start_par, det, time, slop, flag, pixel, start_par, $
		error=error

 INPUT:
	det:	PHT detector ('P1', 'C2', ...)
	time:	Time array
	slop:	Signal slopes array
	pixel:	Pixel to be used

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	
 OUTPUT:
	start_par: The start parameters
	
 COMMON BLOCKS:
	(none) 
		
 PROCEDURES USED:
       PIA LIB:
               s_ini_final

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)	  August 1996
	Added flag as input parameter (J.Acosta)  October 1996
       Added time as input parameter J.Acosta    October 1996
	Added t_zero as input keyword (J.Acosta)  November 1996
	handling error when initialization was not
	succesful		      (J.Acosta)  June 1997
	Version 5.0 - Aug.96
	Change parameters for C100   (JAcosta)    January 1998
	Version 6.6   
			

(See offexp_start_par.pro)


PHTDRIFT

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

 PURPOSE:
	Definition of the common block PHTDRIFT  for inclusion
	into other routines.

 CATEGORY:
       PIA - common block

 CALLING SEQUENCE:
	@phtdrift


 MODIFICATION HISTORY:
 	Written by:	Carlos Gabriel (ESA/ESTEC) + J Acosta (La Laguna) Oct96
	V5.x

(See phtdrift.pro)


PHTDRIFT_INIT

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

 PURPOSE:
       Initializes the structure PHTDRIFT defining the contents as
	a template structure PHTDRIFT_TYPE. It can be used for clearing
	the whole DRIFT structure, in case this should show as necessary. 

 CALLING SEQUENCE:
       @phtdrift_init


 COMMON BLOCKS:
	phtdrift

 MODIFICATION HISTORY:
       Written by: C. Gabriel + J. Acosta                     October 1996
	V5.x	

(See phtdrift_init.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_DISPDRIFT

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

 PURPOSE:
	Menu for PIA Drift Analysis intermediate level.

	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_DISPDRIFT, driftps, data_srd, scpps

 INPUT PARAMETERS:
	driftps:	Position within the phtdrift dynamycal structure
	data_srd:	Temporary SRD level structure
	scpps:		Position within the phtscp dynamycal structure

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
       NV:	Number of Views (1 <= NV <= 4)

 COMMON BLOCKS:
	adm
	colour_indices
	drift_not_acc
	phtdrift
	phtscp
	pia_driftmod_out
	pia_dispdrift_cmn (internal)
	pia_dspchdr_cmn (internal)
	pia_dspchz_cmn 
	pia_widget_info 

 PROCEDURES USED:
	PIA LIB:
		drift_std_scp
		pia_get_step
		pia_get_rpid
		pia_drift_mod
		pia_xplot
		pia_showstr
		pia_disp_hdr 
		pia_disp_cs
		pia_disp_isr
		pia_disp_stat
		pia_dispscp
       ASTRO LIB:
       INTERNAL:
		 drft_showpar
		 pixbuteventd
		 viewevent_drft
		 zoomevent_drft
		 zoomsync_drft
		 zoomnsync_drft
		 pia_resetview_drft
		 pia_dispdrift_event
		 reprocess_drft

 MODIFICATION HISTORY:
       Written by: C.Gabriel (ESA/VILSPA-SAI)          February 1997
	V6.1
	Refreshing drift info before new actions 
	 + bug with pixel change fixed +
	 + saving capability 		(CG)		May 1997
	V6.3
	Calling sequence to pia_dispscp (JAc)   	October 1997
	V6.6
       Inconsistency in common block removed (CG)      April 1998
       V7.1
	Bug by pixel serial decrement fixed (CG)	August 1999
	V8.0
			

(See pia_dispdrift.pro)


PIA_DRIFT_DEFIN

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

 PURPOSE:
	Simple Menu for choosing different drift handling methods 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DRIFT_DEFIN, DRIFT_DEFIN_STR

 INPUT:
	(none)

 OUTPUT:
	DRIFT_DEFIN_STR:	a structure containing handling to be used

	
 METHOD:
	Widgets
	
 COMMON BLOCKS:
	none	

 MODIFICATION HISTORY:
	Written by:	C.Gabriel (ESA/ESTEC)		December 1996
	Interactive+cancel choices included (JACOSTA)   January  1997

(See pia_drift_defin.pro)


PIA_DRIFT_INIPAR

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

 PURPOSE:
	Menu for project signals algorithm parameters handling.

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DRIFT_INIPAR, det, GROUP=group 

 INPUT:
	det: The detector to be drift modelled

 KEYWORD PARAMETERS:
	GROUP:	The group leader of the widget hirarchy
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTSRD temporary structure
	
 COMMON BLOCKS:
	colour_indices
	not_acc
	pia_driftmod_cmn
	pia_drift_par 
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		drift_mod_proc
		pia_disp_print_file
		pia_load_driftpar
		pia_xplot
       INTERNAL:
		pia_drift_mod_event

 MODIFICATION HISTORY:
	Written by: JAcosta (IAC/VILSPA-SAI)		October 1996
	Version 5.1 - Oct.96
	/Modal use according to IDL >= 5.0 (CG)
	V7.3
			

(See pia_drift_inipar.pro)


PIA_DRIFT_MOD

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

 PURPOSE:
	Menu for modelling PHT signals' drifts. 

 CATEGORY:
	PIA - graphics

 CALLING SEQUENCE:
	PIA_DRIFT_MOD, tmpdata, pixel, sig_disc, degl_acc, degl_set

 INPUT:
	tmpdata:	A phtsrd like temporary structure
	pixel:		The pixel number of the data to be used
	sig_disc:	Flag array corresponding to tmpdata.slop (0:OK,1:BAD)
	degl_acc:	Flag array corresponding to deglitched points (same)
	degl_set:	Flag indicating validity of degl_acc

 KEYWORD PARAMETERS:
	GROUP:		The group leader of the widget hirarchy
	FITRESULTS:	If set, widget prepared for reprocess results
			(comm. through CB  pia_driftmod_out)
	
 RESTRICTIONS:
	TMPDATA must be a valid PHTSRD temporary structure
	
 COMMON BLOCKS:
	colour_indices
	not_acc
	pia_driftmod_cmn
	pia_drift_par 
	pia_driftmod_out
		
 PROCEDURES USED:
	PIA LIB:
		decode_admn
		drift_mod_proc
		pia_disp_print_file
		pia_load_driftpar
		pia_xplot
       INTERNAL:
		pia_drift_mod_event

 MODIFICATION HISTORY:
	Written by: C.Gabriel (ESA/VILSPA-SAI)		August 1996
	Change call of drift_mod_proc, suppressing
	 chopped keyword  (J.Acosta)			October 1996
	Version 5.0 - Aug.96
	Extended for reprocessing results (Keyword FITRESULTS)
	 CG -						February 1997
	Version 6.1
			

(See pia_drift_mod.pro)


PIA_LOAD_DRIFTPAR1

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

 PURPOSE:
	Load drift modelling parameters into structure PIA_DRIFTPAR

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	PIA_LOAD_DRIFTPAR1, drift_par, 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:
	dffunct_info	
		
 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_driftpar1.pro)


PIA_LOAD_IDRIFT

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

 PURPOSE:
	Write a PHT-DRIFT (Signal per chopper plateau) measurement from the 
	dynamical structure DRIFTDAT (PHTDRIFT type) onto a temporary structure 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
       PIA_LOAD_IDRIFT, driftdat, tmpdrift

 INPUT:
       DRIFTDAT 	: PHTDRIFT like dynamical structure

 KEYWORDS:
	none

 OUTPUTS:
	TMPDRIFT	: A temporary structure of SCP type

 RESTRICTIONS:
       DRIFTDAT must exist

 MODIFICATION HISTORY:
       Written by:	J.Acosta (ESA/MPIA/IAC)          October 1996
	Oct 96 Version 5.x

(See pia_load_idrift.pro)


READ_IDRIFT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       READ_IDRIFT
 PURPOSE:
	READ a PHTIDRIFT (Interactive Signal per Chopper Plateau) file 
	into the dynamical structure PHTDRIFT  
 CATEGORY:
	PIA - I/O
 CALLING SEQUENCE:
       READ_IDRIFT, NAME, IPOS, [PATH = PATH]

 INPUT:
       NAME 	: DRIFT-savefile name
 OPTIONAL INPUT:
	PATH    : path for the file


 RESTRICTIONS:
       NAME must be a valid PHTIDRIFT file 

 PROCEDURES USED: 
       Common Block(s) or @ procedure(s):
               adm
               phtdrift

 MODIFICATION HISTORY:
       Written by: J.Acosta (ESA/MPIA/IAC)		October 1996
	Oct 96 Version 5.x

(See read_idrift.pro)


SAVE_DRIFT_STR

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

 PURPOSE:
	Save a given drift fit parameter set into a structure per pixel drift 
	parameter fit 

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	SAVE_DRIFT_STR, 

 INPUT:
	drift_par: 	Structure containing the last fit parameters

 KEYWORD PARAMETERS:
	PIXEL:		The pixel number of the data to be used
	ABS_TSTEP:	The absolute chopper/raster position 
	FF_ERROR:	Error of the fitting function (third and leftmost bits)
	LPAR_ERROR:	Fitting parameters out of limits (second bit)
	
 OUTPUT:
			
 SIDE EFFECT: 
	fit_par_str:	Structure containing the fitting information. 
			It should be defined before input.
	
 COMMON BLOCKS:
	none 
		
 PROCEDURES USED:
	PIA LIB:

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)		September 1996 
	Inclusion of new flag code		December 1996
	Version 5.0 - Aug.96
			

(See save_drift_str.pro)


SET_DRIFTPAR_SRD

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

 PURPOSE:
	Call a drift modelling routine returning the modelled signal

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	SET_DRIFTPAR_SRD, fitpar_srd, drift_par, pix, abs_tstep

 INPUT:
	fitpar_srd:	Initial values coming from a particular measurement
	abs_tstep:	Absolute chopper/raster position for which the output
			parameters will be derived
	pix:		Pixel number for which initial params. are required,
			if not specified it will take 1 (eg. 1-pix detectors)

 KEYWORD PARAMETERS:
	DEFAULT:	It returns a dummy structure based on the common block
			DFFUNCT_INFO. The keyword DET has to be set simultaneously.
	DET:		It must be used in combination with the keyword DEFAULT 
			to specify a detector. It is mandatory when /DEFAULT is set.
	FFUNCT:		The name of the drift modelling function. If not used the
			function which is default for the detector specified. 
	
 OUTPUT:
	drift_par:	Structure containing the fitting information:
			 p_label:	Label of parameters
			 a_var:		flag for variation [0:fixed, 1:free]
			 ffunc:		function used
			 minp_ext:	Minimum number of points used for fit
			 fract_left:  	fraction of measurement not used 
			 p_field:	parameter to be fitted
			 s_field:	error of fitted parameters
		  	 p_range:	limits of variation for fitting params.
			 t_zero:	Initial time of meas. If chopped keyword
					is set then it contains two values
			 temp_zero:	Initial temp. of meas. If chopped keyword
					is set then it contains two values
			 flag:		output fit flag
                	 chisq:		chi-squares of the fit
			 chisqt:	limiting chi-square to accept the fit
			
	
 COMMON BLOCKS:
	dffunct_info 
		
 RESTRICTIONS:
	The structure fitpar_srd has to be defined prior to access this routine

 PROCEDURES USED:
	PIA LIB:

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)		   October 1996 
	keyword long_sTR included and order of
	input parameters			   January 1997
       Added keywords DEFAULT, FFUNCT and DET	   June 1997
	Bug correction			(JAcosta)  June 1997	
	Version 5.x - Oct.96
			

(See set_driftpar_srd.pro)


S_INI_FINAL

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

 PURPOSE:
	Estimate initial and final value for a stream of signals  

 CATEGORY:
	PIA - processing

 CALLING SEQUENCE:
	S_ini_final, time, slop, flag, s_ini, s_final, ERROR=error, 
	     T_ZERO=t_zero, DETECTOR = detector

 INPUT:
	slop:	Signal slopes array (it can be 2-dimensional)
	flag;   Flag signal array (it can be 2-dimensional, same dims as slop)

 KEYWORD PARAMETERS:
	ERROR:	Results of computation
	INI_EXTPOL: extrapolate to obtain initial value
	FIN_EXTPOL: extrapolate to obtain final value
	
 OUTPUT:
	s_ini: Initial signal
	s_final: Final signal
	DerS_ini: estimate of derivative at t_zero
	
 COMMON BLOCKS:
	(none) 
		

 MODIFICATION HISTORY:
	Written by: J. Acosta (IAC)	  October 1996
	Version 5.2 - Oct.96
			

(See s_ini_final.pro)


WRITE_IDRIT

[Previous Routine] [List of Routines]
 NAME:
       WRITE_IDRIT
 PURPOSE:
	Write a PHTDRIFT (Signal Drift Data) measurement from the dynamical 
	structure PHTDRIFT onto an IDL savefile  
 CATEGORY:
	PIA - I/O
 CALLING SEQUENCE:
       WRITE_IDRIFT, PHTDRIFT_INDEX, PATH = path, FNAME = fname

 INPUT:
       PHTDRIFT_INDEX 	: Index of the measurement within PHTDRIFT

 OUTPUT:
	IDL save file

 RESTRICTIONS:
       PHTDRIFT(PHTDRIFT_INDEX) must exist

 PROCEDURES USED:
       Common Block(s) or @ procedure(s):
               phtdrift

 MODIFICATION HISTORY:
       Written by: J. Acosta
	Oct 96 Version 5.x

(See write_idrift.pro)