Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~tghosh/software/testnew.pro
Дата изменения: Thu Mar 20 19:34:19 2003
Дата индексирования: Sun Apr 10 05:09:53 2016
Кодировка:
function testnew,c
!p.multi=0
galid= ' '
str = ' '
file = ' '
yn= ' '
print, 'Galaxy ID:'
read,galid
print,'Scan #:'
read,str
print, 'New logfile (y/n)?'
read,yn
if yn eq 'y' then begin
print, 'New filename?'
read, file
openw, lun, file, /get_lun
printf,lun,galid, ' ', str
endif else begin
openu, l, 'awv.txt', /get_lun
printf,l,galid, ' ', str
endelse
print ,'give the subcorrelator number which has the galaxy'
read, cn
cn=fix(cn)
;extract the spectrum of the corresponding subcorrelator
spece=c.(cn-1).d
s_size=size(spece)
npts=(size(spece))[1]
res=fltarr(npts,2)
;print ,'s_size[0]=',s_size[0],'npts=',npts
;if(s_size[0] eq 1) then begin
print ,' Assuming this is pol-averaged'
;endif
;if(s_size[0]=2)then begin
;spece=total(spece,2)*.5
;endif
freqe=corfrq(c.(cn-1).h)
vele= corfrq(c.(cn-1).h,/retvel)
sm=''
read ,sm,prompt=' Do u want to smooth the data ? (y/n) '
if(sm eq 'y' or sm eq 'Y')then begin
print,"Enter no. of channels for smoothing --PLease give a odd no:"
noel=0
read,noel
print,"noel = ",noel
u1d2=make_array(noel,/float)
u1d2[*]=1.0/float(noel)
print,"u1d2 = ",u1d2
speces=convol(spece,u1d2,/edge_truncate)
;freqes=convol(freqe,u1d2,/edge_truncate)
;veles=convol(vele,u1d2,/edge_truncate)
spece=speces
; & freqe=freqes & vele=veles
endif
;istat= bluser(vele,specx,coef,mask,specfit) ; ask the doubt frequency or velocity and channel no)
istat= bluser(freqe,spece,coef,mask,specfit) ; ask the doubt frequency or velocity and channel no)
specfit=spece-specfit
veler=reverse(vele)
specr= reverse(specfit )
plot,specr
;Sam's addition
;calculating the RMS noise
v=getrms(specr)
;Phil/Katy's addition
;
; see if they want to change the horizontal scale
;
print,'left button to redefine hor scale, but right to quit'
nsets=cursorsubset(findgen(n_elements(specr)),indar)
if nsets gt 0 then begin
hmin=indar[0,nsets-1]
hmax=indar[1,nsets-1]
hor,hmin,hmax
plot,specr
endif else begin
hmin=0
hmax=n_elements(specr)
endelse
;plot,veler,specr
print ,'2 cursor clicks to get the range for measuring the line'
cursor,x1,y1,/down
cursor,x2,y2,/down
print,'x1,x2= ',x1,x2
yaxis=fltarr(3)
yaxis[0]=!y.crange[0]
yaxis[1]=y1
yaxis[2]=!y.crange[1]
plots,x1,yaxis,linestyle=2
plots,x2,yaxis,linestyle=2
x1i=fix(x1)
x2i=fix(x2)
res1=awv(specr,veler,x1i,x2i,1,0.5)
res2=awv(specr,veler,x1i,x2i,1,0.2)
res3=awv(specr,veler,x1i,x2i,2,0.5)
res4=awv(specr,veler,x1i,x2i,2,0.2)
res5=awv(specr,veler,x1i,x2i,3,0.2)
if yn eq 'y' then begin
printf, lun,'RMS noise = ', v
printf, lun,res1[0], ' ',res1[1],' ',res1[2]
printf, lun,res2[0], ' ',res2[1],' ',res2[2]
printf, lun,res3[0], ' ',res3[1],' ',res3[2]
printf, lun,res4[0], ' ',res4[1],' ',res4[2]
printf, lun,res5[0], ' ',res5[1],' ',res5[2]
free_lun,lun
endif else begin
printf, l, 'RMS noise = ', v
printf, l,res1[0], ' ',res1[1],' ',res1[2]
printf, l,res2[0], ' ',res2[1],' ',res2[2]
printf, l,res3[0], ' ',res3[1],' ',res3[2]
printf, l,res4[0], ' ',res4[1],' ',res4[2]
printf, l,res5[0], ' ',res5[1],' ',res5[2]
free_lun,l
endelse
res[*,0]=specr
res[*,1]=veler
hor,max(veler),min(veler)
plot,res[*,1],res[*,0],xtitle='Heliocentric Vel. (km/s)',ytitle='Jy'
if yn eq 'y' then begin
stat=makeplot(res,file)
endif else begin
print, 'Filename for hardcopy:'
read, file
stat=makeplot(res,file)
endelse
hor
ver
return,res
end