;+
;                               GET_SYN_25
;
;  To load the array s25(720,28) with broadened synthetic spectra for the
;  corresponding temperature, the array s25_synth(720,28) with the raw 
;  synthetic data and to set scale variables.
;  Note the contents of s25 on return are:
;       s25(*,0)     the wavelengths
;       s25(9:27,1)  the scale factors for each spectrum ie divide by this and
;                    peak in spectrum = 1.0
;       s25(*,9:27)  the synthetic spectra
;  this is wasteful but at least the spectra can be referenced easily ie
;  s25(*,22) = spectrum for T=22 MK
;
;
;  Input:
;                s25         output array as described above
;                bwid        width of Gaussian with which to convolve spectra
;                            (13-17 about right for comparison with BCS data)
;                s25_synth   raw synthetic data from files
; 
;
;
;  Use:
;        IDL>  get_synth,s25,bwid[,s25_synth]
;
;  NB The routine fe25_temp calls this routine if it has not been called
;  previously.
;
;  
;  CDP June 92
;      V2 save s25_synth  June 92
;-
pro get_syn_25,s25,bwid,s25_synth
;
;  default broadening
;
if (n_params() lt 2) or (bwid eq 0) then bwid = 13
;
;  create array for spectra if not yet exist
;
if n_params() eq 0 or (n_elements(s25) lt 10000) then s25 = fltarr(720,28)
;
;  has synthetic data been read already?
;
if n_elements(s25_synth) gt 1000 then begin
   have_synth = 1 
   s25(*,0) = s25_synth(*,0)
endif else begin
   s25_synth = fltarr(720,28)
   have_synth = 0
endelse 
;
;  load synthetic spectra
;

for i=9,27 do begin
   if have_synth eq 1 then begin
      y = s25_synth(*,i)
   endif else begin   
      synth,2,i,x,y,/noplot
      s25(*,0) = x
      s25_synth(*,0) = x
      s25_synth(*,i) = y
   endelse
   broad,y,yb,bwid
   s25(*,i) = yb
   s25(i,1) = max(s25(0:100,i))
endfor

end
