Viewing contents of file '../idllib/iuedac/iuelib/pro/fmeas.pro'
;************************************************************************
;+
;*NAME:
;
;    FMEAS  (General IDL Library 01)
;  
;*CLASS:
;
;    spectral lines, measurement
;  
;*CATEGORY:
;  
;*PURPOSE:
;
;    To numerically integrate across spectral features and determine
;    common measurements and moments for the line profile.
;  
;*CALLING SEQUENCE:
;
;    FMEAS,WAVEF,FLUXF,CONT,DATAPT,RESULT
;  
;*PARAMETERS:
;
;    WAVEF  (REQ) (I) (1) (F D)
;           required input vector containing the wavelength data 
;
;    FLUXF  (REQ) (I) (1) (F D)
;           required input vector containing the flux data
;
;    CONT   (REQ) (I) (1) (F D)
;           required input vector containing continuum flux data
;
;    DATAPT (REQ) (I) (1) (F)
;           required input vector containing the vector element numbers
;           for the starting point for the integration, the extremum,
;           and the stopping point.
;           DATAPT(0)= element number corresponding to the laboratory
;                      wavelength
;           DATAPT(1)= element number corresponding to the shortwavelength
;                      integration limit for the spectral feature
;           DATAPT(2)= element number corresponding to the extremum of
;                      the spectral feature (not actually used here).
;           DATAPT(3)= element number corresponding to the long wavelength
;                      integration limit for the spectral feature.
;
;    RESULT (REQ) (O) (1) (F D)
;           required output vector containing the results of the numerical
;           integration.
;           RESULT(0)= integrated continuum flux in A or mA.
;           RESULT(1)= equivalent width of feature in A or mA.
;           RESULT(2)= total flux between start and stop points 
;           RESULT(3)= flux weighted wavelength for the feature,
;                      including the continuum flux.
;           RESULT(4)= flux weighted width (sigma) of the feature,
;                      including the continuum.
;           RESULT(5)= Net integrated flux in the feature.
;           RESULT(6)= flux weighted wavelength for the feature,
;                      using only the net flux.
;           RESULT(7)= flux weighted width (sigma) of the net feature.
;
;*EXAMPLES:
;
;     See documentation for FEATURE
;
;*SYSTEM VARIABLES USED:
;
;*INTERACTIVE INPUT:
;
;*SUBROUTINES CALLED:
;
;     PARCHECK
;     INTEG
;  
;*FILES USED:
;  
;*SIDE EFFECTS:
;
;*RESTRICTIONS:
;  
;*NOTES:
;
;	tested with IDL Version 2.1.0 (sunos sparc)  	20 Jun 91
;	tested with IDL Version 2.1.0 (ultrix mispel)	N/A
;	tested with IDL Version 2.1.0 (vms vax)      	21 Jun 91
;
;*PROCEDURE:
;
;     The following integrals and moments are calculated numerically, 
;     using the trapezoid rule.
;
;     RESULT(0)=FCONT= Integral(CONT) from datapt(1) to datapt(3)
;     RESULT(1)=EW   = Integral(1-FLUXF/CONT) from datapt(1) to datapt(3)
;     RESULT(2)=FTOT = Integral(FLUXF) from datapt(1) to datapt(3)
;     RESULT(3)=WTOT = Integral(FLUXF*WAVEF) from datapt(1) to datapt(3)
;     RESULT(4)=WIDTOT=Integral(FLUXF*(WAVEF-WTOT)*(WAVEF-WTOT)) from
;                       datapt(1) to datapt(3)
;     RESULT(5)=FNET = Integral(FLUXF-CONT) from datapt(1) to datapt(3)
;     RESULT(6)=WNET = Integral((FLUXF-CONT)*WAVEF) from datapt(1) to datapt(3)
;     RESULT(7)=WIDNET=Integral((FLUXF-CONT)*(WAVEF-WNET)*(WAVEF-WNET))
;                       from datapt(1) to datapt(3)
;     
;*INF_1:
;  
;*MODIFICATION HISTORY:
;
;     See documentation for FEATURE
;     Feb 29 1988   RWT   GSFC  Make FMEAS a separate procedure
;     Mar 10 1988   CAG   GSFC  Add VAX RDAF-style prolog, printing
;                               of calling sequence if no parameters
;                               are used, and check for correct number
;                               of parameters.
;     Jun 21 1991   PJL   GSFC  cleaned up; tested on SUN and VAx; 
;				updated prolog
;
;-
;************************************************************************
 pro fmeas,wavef,fluxf,cont,datapt,result
;
;check parameters
;
 if n_params(0) eq 0 then begin
    print,'FMEAS,WAVEF,FLUXF,CONT,DATAPT,RESULT'
    retall
 endif  ; n_params(0)
 parcheck,n_params(0),5,'FMEAS'
;
 result=fltarr(8)
;
; measurements
;
 dflux=fluxf-cont
 integ,wavef,cont ,datapt(1),datapt(3),fcont
 integ,wavef,fluxf,datapt(1), datapt(3), ftot
 integ,wavef,dflux, datapt(1), datapt(3), fnet
 integ,wavef,fluxf*wavef,datapt(1),datapt(3),wtot
 integ,wavef,dflux*wavef,datapt(1),datapt(3),wnet
 wnet=wnet/fnet
 wtot=wtot/ftot
 dw=wavef-wtot
 integ,wavef,fluxf*dw*dw,datapt(1),datapt(3),widtot
 widtot=sqrt(abs(widtot/ftot))
 dw=wavef-wnet
 integ,wavef,dflux*dw*dw,datapt(1),datapt(3),widnet
 widnet=sqrt(abs(widnet/fnet))
 if fcont le 0. then ew=0. else $
    integ,wavef,(1.-fluxf/cont),datapt(1),datapt(3),ew
 result([0,1,2,3,4,5,6,7]) = [fcont,ew,ftot,wtot,widtot,fnet,wnet,widnet]
 return
 end  ; fmeas