PRO DIG_DISK,mereni,middlesp,noframes,speed ; ; Finds the first and last spectrum where the solar disk is present. ; Finds the spectrum MIDDLESP passing through the disk centre and measures its height. ; Determines the number of selected spectra NOFRAMES. ; ; INPUTS: mereni - directory (full path) containing the spectra ; OUTPUTS: middlesp - array with the spectrum passing through the disk centre ; noframes - number of frames to be selected by DIG_SELECT ; speed - string with speed description ; ; Copyright M. Klvana and M. Sobotka, ASU AVCR Ondrejov, Czech Rep., 2008 on_error,1 list=findfile(mereni + '*.dig') nsp=n_elements(list) ;first spectrum with solar disk i=0 repeat begin i=i+10 if i gt nsp then goto,bad ;wrong measurement DIG_2,list(i),sp ;reading spectra scuk=total(sp,1) ;wavelength-integrated intensity ma=max(scuk) mi=min(scuk) endrep until ma/mi gt 2 i=i-10 repeat begin i=i+1 DIG_2,list(i),sp ;reading spectra scuk=total(sp,1) ;wavelength-integrated intensity ma=max(scuk) mi=min(scuk) endrep until ma/mi gt 2 first=i ;last spectrum with solar disk i=nsp-1 repeat begin i=i-10 if i lt 0 then goto,bad ;wrong measurement DIG_2,list(i),sp ;reading spectra scuk=total(sp,1) ;wavelength-integrated intensity ma=max(scuk) mi=min(scuk) endrep until ma/mi gt 2 i=i+10 repeat begin i=i-1 DIG_2,list(i),sp ;reading spectra scuk=total(sp,1) ;wavelength-integrated intensity ma=max(scuk) mi=min(scuk) endrep until ma/mi gt 2 last=i ;spectrum MIDDLESP passing through the disk centre mids=fix((first+last)/2.) DIG_2,list(mids),middlesp scuk=total(middlesp,1) nscuk=n_elements(scuk) ;spectrum height mi=scuk(0)>scuk(nscuk-1) w=where(scuk gt 2*mi,co) if co le 600 then goto,bad ;limit 600 is specific for the current setup, ;where the solar diameter is about 830 pix ll=w(0) ul=w(co-1) vertdiam=ul-ll+1 ;vertical size of the disk (pix) ;number of selected frames 'noframes' to reach equal horizontal ; and vertical diameters of the solar disk ratio=float(nsp)/(last-first+1) noframes=round(vertdiam*ratio)+10 ;10 = a small systematic error ;test for scanning speed (normal,high) speed='normal' if nsp lt 1700 then speed='high' ; print,'No. of all spectra with disk:',last-first+1 goto,fin bad: window,2,xsiz=600,ysiz=400 xyouts,100,250,'ERROR',/device,charsize=10,charthick=10 xyouts,110,200,'Wrong measurement',/device,charsize=3,charthick=3 xyouts,50,130,mereni,/device,charsize=2,charthick=2 xyouts,50,70,'Exit IDL and remove the measurement',/device,charsize=2,charthick=2 wdelete,3 message,'ERROR - wrong measurement' fin: END