Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~rminchin/idl/masplotall2.pro
Дата изменения: Tue Dec 18 23:39:01 2012
Дата индексирования: Sun Feb 3 19:02:52 2013
Кодировка:

Поисковые слова: http www.badastronomy.com bad tv foxapollo.html
pro masplotall2,b,pollist=pollist,col=col,title=title,retvel=retvel,restFreq=restFreq,velCrdsys=velCrdSys,auto=auto, ylog=ylog

; Decode pollist


if (n_elements(pollist) EQ 1) then begin
if (pollist LT 0) then begin
plist = -1
endif $
else if (pollist LT 10) then begin
plist = pollist - 1
endif $
else if (pollist LT 100) then begin
pol1 = fix(pollist/10)
pol2 = pollist - 10*pol1
plist = [pol1,pol2] - 1
endif $
else if (pollist LT 1000) then begin
pol1 = fix(pollist/100)
pol2 = fix((pollist - 100*pol1)/10)
pol3 = pollist - 100*pol1 - 10*pol2
plist = [pol1,pol2,pol3] - 1
endif $
else if (pollist LT 10000) then begin
pol1 = fix(pollist/1000)
pol2 = fix((pollist - 1000*pol1)/100)
pol3 = fix((pollist - 1000*pol1 - 100*pol2)/10)
pol4 = pollist - 1000*pol1 - 100*pol2 - 10*pol3
plist = [pol1,pol2,pol3,pol4] - 1
endif else begin
print,'Unknown polarization specification: ',pollist
return
endelse
endif else plist = -1

if(n_elements(plist) LT 1) then plist = -1

; Get the frequencies

nbeams = n_elements(b)
freq = fltarr(b[0].nchan,n_elements(b))

for i = 0,13 do begin
freq(*,i) = masfreq(b[i].h,retvel=retvel,restFreq=restFreq,velCrdsys=velCrdSys)
endfor

; Set up colours (from Phil's corplot)

common colph,decomposedph,colph

ps= !d.flags and 1
colphLoc=colph[0:5]
if ps eq 0 then begin
tvlct,[0,1,1,0,0,1]*255,[0,1,0,1,0,1]*255,[0,1,0,0,1,0]*255
endif else begin
colphLoc=[0,1,2,3,4,5] ; force pseudo col
endelse
k=[2,3,4,5]
n=n_elements(col)
if n gt 0 then begin
for i=0,4 - 1 do begin
if i ge n then begin
k[i]=col[n-1]
endif else begin
k[i]=col[i]
endelse
endfor
endif
white=1

; plot the data

onecol = 0
allonecol = 0
if (n_elements(col) EQ 1) then begin
onecol = 1
if (col LT 0) then begin
allonecol = 1
col = -1 * col
endif
endif

if ((!y.range[0] NE 0) OR (!y.range[1] NE 0)) then begin
auto = 0
ymin = !y.range[0]
ymax = !y.range[1]
endif

if (n_elements(auto) GT 0) then $
if (auto) then begin
ymin = median(b.d)/3.
ymax = 3. * median(b.d)
; print,'Automatic scaling: ',ymin,' - ',ymax
endif

if (n_elements(ymin) LT 1) then begin
ymin = min(b.d)
ymax = max(b.d)
endif

if (ymin GT ymax) then begin
temp = ymin
ymin = ymax
ymax = temp
endif

if (onecol) then begin
if (( col LT 0) OR (col GT 5)) then col = 1
freqs= fltarr(b[0].nchan,b[0].npol,n_elements(b))
for i = 0,1 do freqs[*,i,*] = freq[*,*]
index = sort(freqs)
data = b.d
if (allonecol) then begin
plot,freqs[index],data[index],color=colphloc[col],title=title,yrange=[ymin,ymax],ylog=ylog
endif else begin
plot,freqs[index],data[index],color=colphloc[1],title=title,yrange=[ymin,ymax],/nodata,ylog=ylog
oplot,freqs[index],data[index],color=colphloc[col]
endelse

endif else begin

plot,freq,b.d[*,0],color=colphloc[1],title=title,yrange=[ymin,ymax],/nodata,ylog=ylog

if (n_elements(plist) EQ 1) then $
if (plist LT 0) then plist = indgen(b[0].npol)

if (n_elements(plist) LT 1) then begin
for j = 0,b[0].npol - 1 do begin
if (n_elements(col) LT j+1) then colour = 2+j else colour = col[j]
data = b.d[*,j]
index = sort(freq)
oplot,freq[index],data[index],color=colphloc[colour]
endfor
endif else begin
for j = 0, n_elements(plist) - 1 do begin
if ((plist[j] GE 0) AND (plist[j] LT b[0].npol)) then begin
pol = plist[j]
if (n_elements(col) LT j+1) then colour=2+j else colour=col[j]
data = b.d[*,pol]
index = sort(freq)
oplot,freq[index],data[index],color=colphloc[2+pol]
endif else print,'Polarization not found: ',plist[j]+1
endfor
endelse
endelse

return

end