______________________________________________________________________________

			    OK

			   OKECAL

 ______________________________________________________________________________



 Creates a calibration array to convert observed (SCRUNCHED) spectra
 (in wavelength) to absolute flux F(lambda) vs lambda.

 For each LAMBDA interval common to the observed standard spectrum
 and the flux library, OKECAL

	reads	ABv	= -2.5*LOG10(FNU) - 48.60

	and computes :

	OKEMAGx	= ABv + 48.60 - 2.5*LOG10(C/x*x)	x = lambda
							v = frequency
			__
			\
	where	RATE =	/_ COUNTS/(DWELL*LAMBDA RANGE)
		= -2.5*LOG10(Fx)

	OBSMAGx = -2.5*LOG10(RATE)	: RATE = obs counts/sec/A

	CALMAGx = OBSMAGx - EXTCO*AIRMAS - OKEMAGx
		= -2.5*LOG10(obs rate above atmos/Fx)

 This is fitted (spline or poly) to a continuous curve K(I) for
 each pixel where :

	K(I)	= -2.5*LOG10(obs rate above atmos/Fx)

 and	LAMBDA	= XST + (I-1)*XINC 


 This curve is stored in the CAL array.
 ______________________________________________________________________________

			   EXAMPLE


 OPTION .OK
 OPEN FILE WITH OBSERVED STD TO BE CALIBRATED
 FILI=SLINE
 There are   4 maps in the file       
 Reading from the file
    1 rows of 2040 pixels in R4 format
 MAPI=3
 Start value increased by 1/2 channel in BINVAL
 ROWI=1
 TYPE VALUE FOR DWELL
 DWELL=
   490.000    
 PLOT=N
 OKESTD=L930
 L930-80		DB	OKE  Ap.j.suppl.27                                                 
 LOOK=Y
 START       END            MAG(lambda)
  3360.0     3440.0         34.54
		____________	List abreviated for this example

  5600.0     5680.0         36.05

 SPECIFY 3 COEFS FOR EXTINC = A/X**4 + B/X**1.3 + C   where X = LAM/10000
 DEFAULTS ARE :
 	RAYLEIGH	A = 0.0092
 	DUST		B = 0.0
 	CONSTANT	C = 0.06
  
 EXTCO=
  0.920000E-02
  0.000000E+00
  0.600000E-01
 AIRMAS = 1.1505
    LAMBDA      OBSMAG      OKEMAG     CALMAG	   EXTINC
   1   3400.0     0.000      34.535     -35.396       0.861
   2   3480.0     1.203      34.606     -34.194       0.791
		_____________	Abreviated

  29   5640.0     0.615      36.054     -35.613       0.174
 NDEV=3
 SELECT OPTION
 	D	delete points
 	F	fit curve
 	P	plot the calibration
 	S	save the calibration curve
 OPT=D
 DEL=1,2
 SELECT OPTION
 	D	delete points
 	F	fit curve
 	P	plot the calibration
 	S	save the calibration curve
 OPT=F
 SELECT TYPE OF FIT
 	0	spline
 	n	nth order poynomial
  
 FIT=5
 COEFFS 
       97.173940    
     -0.11641583    
      3.89959047E-05
     -6.10004768E-09
      4.28635702E-13
     -9.77659330E-18

 SIGMA    2.34563E-02
 POINT       X VAL     Y VAL   CAL VAL       DIF
     1    3560.000   -34.994   -35.013    -0.019
     2    3640.000   -35.109   -35.095     0.013
		_________________	Abreviated

    24    5480.000   -35.337   -35.348    -0.011
 IS FIT OK  ?
 OK=Y
 SAVE THE CALIBRATION CURVE  ?
 SAVE=Y
 CREATE THE CALIBRATION FILE
 NMAPS=    1 NPLNS=    1 NROWS=     1 NELS=  2040
 TYPE FILENAME (<CR> FOR DEFAULT)
 FILC=SCALIB
 Creating new file
 TYPE MAPNUMBER FOR CALIBRATION ARRAY
 MAPC=1
 DO YOU WANT A HARD COPY PLOT  ?
 HARD=Y

 ______________________________________________________________________________