pro persefona,num,sym,right
; Eclipse observation: determination of the PSF from the
; profile of the Moon's limb.
; Philosophy: the derivative of the Moon's limb profile
; is equal to the "compressed" PSF.
;
; Creation of array of derivatives in selected regions of
; eclipse image. The input image is first rotated, to have
; the moon limb vertical. Then a derivative image is computed
; (function "derivatives" from Oslo library), and
; the regions of interest are interactively selected. An array
; of selected regions is constructed, and each row is shifted
; with sub-pixel precision (Fourier interpolation) to have a
; sample just at the maximum. Then each maximum is shifted to
; the position of the maximum of the first row, so that the
; Moon's limb irregularities are compensated. Finally, this
; "rectified" derivative image is averaged in rows to obtain
; the mean "PSF". Result: the symmetrized "PSF", normalized to
; its area (an array of 1024 elements).
;
; Parameters: 1. serial number of the observed image (input)
; image form: fltarr(1315,1035)
; 2. symmetrized "PSF" (output)
; 3. right wing of the "PSF", containing the
; granular noise, for comparison (output).
; Note: The Moon's limb must cover at least 527 pixels
; in the rotated image!
; Some routines from ASP and Oslo libs are used.
;
if n_params() ne 3 then begin
print,'usage: persefona, imag.number, output PSF name, output right part'
stop
endif
; !!!! TO BE CHANGED WITH RESPECT TO WHERE THE IMAGES ARE STORED !!!!
stra=string('/scratch/sob/')
strb=string('imc.')
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ysel=intarr(2,20) ; array containing low. and upp. limits of selected areas
window,0,xsize=657,ysize=517
; reading the input image
ima=fltarr(1315,1035)
dcn=strtrim(num,2)
if strlen(dcn) eq 3 then str='0'+dcn
if strlen(dcn) eq 2 then str='00'+dcn
if strlen(dcn) eq 1 then str='000'+dcn
print,'Now reading image:'
print,strb+str
openr,1,stra+strb+str
readu,1,ima
close,1
; rotating the image
read,'rotation angle? ',alpha
ima=rot_int(ima,alpha)
im2=rebin(ima(0:1313,0:1033),657,517)
tvscl,im2
; selection of area to compute derivatives
again:
wset,0
wdelete,1
xloadct
print,'set vertical limits of area to determine the PSF'
cur1:
cursor,x1,y1,/device,/down
print,y1
print,'accept this selection? (y/n)'
if get_kbrd(1) eq 'n' then goto,cur1
cur2:
cursor,x2,y2,/device,/down
print,y2
print,'accept this selection? (y/n)'
if get_kbrd(1) eq 'n' then goto,cur2
y1=y1*2
y2=y2*2
x=x1+x2 ; (x1+x2)/2 *2
; check if we have the Moon long enough
if x lt 527 then begin
print,' SORRY, but the distance covered by Moon is too short.'
stop
endif
print,' OK'
if y2 lt y1 then begin ; changing order if y2