PRO RH_GET_HDR, HDR, $
                FREQ, DATE, HMER, DEC, SREF, ROTP

; Lecture dans le header des parametres necessaires a init_malax_2d

    date   = intarr(3)
    chdate = sxpar(hdr,'DATE-OBS')
    reads, chdate, date, format='(i4,1x,i2,1x,i2)'
    dat=date(0)
    date(0) = date(2)
    date(2) = dat    
    freq   = sxpar(hdr,'FREQ')
    chhmer = sxpar(hdr,'HMER')
    chdec  = sxpar(hdr,'DECL')
    ihmer  = intarr(4)
    reads, chhmer, ihmer, format='(i2,1x,i2,1x,i2,1x,i2)'
    idec   = intarr(4)
    reads,  chdec, idec,  format='(i3,1x,i3,1x,i3,1x,i3)'

    hmer      = fltarr(3)
    hmer(0:2) = float  (ihmer(0:2))
    hmer(2)   = hmer(2) + float(ihmer(3)) / 100.

    dec      = fltarr  (3)
    dec(0:2) = float   (idec(0:2))
    dec(2)   = dec (2) + float(idec(3)) / 100.

    sref = 'SOLEIL'		; 'soleil' ou 'autre'.
    rotp = 1
    return
end

PRO GET_LOBE_FROM_FITS, file, zoom=zoom
; Programme modele pour superposer a l'affichage une image et son
; lobe.
; ajout zoom (25/08/2008): facteur pour agrandir l'image et son lobe affiches
;        defaut zoom=1 

; EX : GET_LOBE_FROM_FITS, 'nrh2_1640_h70_20011014_080712c00_q.fts'
;      GET_LOBE_FROM_FITS,'/festival/fits/2008/0801/nrh2_4320_h60_20080131_085431c08_i.fts',zoom=4

    a = mrdfits(file,1,hdr, status=status)

    if status ne 0 then begin
       print,' File not Found : ',file
       return
    endif

    solar=sxpar(hdr,'SOLAR_R')
    RH_GET_HDR, hdr, freq, date, hmer, dec, sref, rotp
    INIT_MALAX_2D,  date,  hmer,  dec,  sref, rotp 
print,format=   $
   "(2(i2.2,'/'),i4.4,3x,f6.1,'MHz ')",$
      date, freq
print,'    ELLIPSE    tableau contenant :'
print,'	        major axis,  minor axis (in solar_radii),  and angle in'
print,'	        degrees of the major axis with Ox axis.'
    if n_elements(zoom) eq 0 then zoom=1
    npim = (size(a.stokesi))(1)
    for i=0,n_elements(a)-1 do begin
;print,para,a(i).time
        hmsc = mil_time(a(i).time)
        hmsc(3) = hmsc(3)/10.
        rh_ellipse_maille, para, freq , hmsc
print,'ELLIPSE : ', msh(a(i).time), para
        tvscl,rebin(a(i).stokesi,npim*zoom,npim*zoom)
;        tvscl,a(i).stokesi        
        tvellipse,solar*para(0)*zoom,solar*para(1)*zoom,25,25,para(2)
    endfor
end

