PRO load_star_coef ,file,field,n
;
;+
; NAME:
;  load_star_coef
;
; PURPOSE:
;  loading the stellar weight coefficients from Ariel's 
;
; CALLING SEQUENCE:
;  called from within stellar_weight.pro 
;  load_star_coef, file_name, field, n_line
;
; OPTIONAL INPUTS:
;
; OUTPUTS:
;  field (which is loaded into memory) 
;                                
; COMMENTS:
;
; EXAMPLES:
;
; REQUIREMENTS:
; 
; REVISION HISTORY:
;   26-sep-2012 Written by Shirley Ho (CMU)
;-

print, 'begin reading star systematics file.'
close,10
openr,10,file
n=0L
imin= 0.0   ; i_fib2_min
imax = 0.0  ; i_fib2_max 
imean = 0.0 ; i_fib2 
A = 0.0     ; A (coef for stellar weighting) 
delta_A = 0.0; error on A ; we are not using them here 
B = 0.0     ; B (coef for stellar weighting)
delta_B = 0.0; error on B ; we are not using them here 

;; format is one line of header.
hdr = strarr(1)
readf,10,hdr
print,'read this header',hdr
while not(eof(10)) do begin
    readf,10,imin, imax, imean, A, delta_A, B, delta_B
    n=n+1L
endwhile

close,10
openr,10,file
print,'n is ',n
tag_size=n
field=fltarr(tag_size,7)
tmp = fltarr(7,tag_size)
;; read off the header
readf,10,hdr
readf,10,tmp
field = transpose(tmp)

close,10

print,'done with reading the star systematics file'

end
