Документ взят из кэша поисковой машины. Адрес оригинального документа : http://lnfm1.sai.msu.ru/~kupry/SOFTWARE/xdividep.pro
Дата изменения: Wed Aug 6 15:32:52 2003
Дата индексирования: Mon Oct 1 22:58:33 2012
Кодировка:

Поисковые слова: photosphere
pro save_event,event
COMMON all,draw1,draw2,cont1,cont2,savename
widget_control,event.id,get_uvalue=uvalue
case uvalue of

'OK1':begin
widget_control,draw1,get_value=val1 & wset,val1 & x=tvrd()
widget_control,savename,get_value=name
write_gif,name(0),x
widget_control,event.top,/destroy
end

'OK2':begin
widget_control,draw2,get_value=val2 & wset,val2 & x=tvrd()
widget_control,savename,get_value=name
write_gif,name(0),x
widget_control,event.top,/destroy
end

'CANCEL':widget_control,event.top,/destroy

endcase
end

pro load_event,event
COMMON all,draw1,draw2,cont1,cont2,savename
COMMON all2,lfield1,lfield2,lfield3,lfield4
COMMON buttons,f2,f3

widget_control,event.id,get_uvalue=uvalue
case uvalue of

'OK':begin
widget_control,lfield1,get_value=prof1 & widget_control,lfield2,get_value=prof2
; widget_control,lfield3,get_value=kont1 & widget_control,lfield4,get_value=kont2
widget_control,event.top,/destroy
pol1=prof1(0) & pol2=prof2(0) ;& con1=kont1(0) & con2=kont2(0)

p1=readfits(pol1)
;c1=readfits(con1)
p2=readfits(pol2)
;c2=readfits(con2)

;
; tady se vybira a pocita hodnota continui con1 a con2
;lambd=p1(*,0)
;plcon=where(lambd GE 6559.7 AND lambd LE 6560.3)

;mom1=MOMENT(c1(*,1))
;plc1=mom1(0)
;mom2=MOMENT(c2(*,1))
;plc2=mom2(0)

;widget_control,cont1,set_value=string(plc1)
;widget_control,cont2,set_value=string(plc2)



;
;rac1=p1(*,1)/c1(*,1)
;rac2=p2(*,1)/c2(*,1)
rac1=p1(*,1) ;/float(plc1)
rac2=p2(*,1) ;/float(plc2)
;
;
c=(rac1-rac2)/(rac1+rac2)
;c=b(*,1)-a(*,1)
;c=b(*,1)/a(*,1)
;x=a(*,0)
x=p1(*,0)-6562.808

widget_control,draw1,get_value=val1 & wset,val1
;----------------
; plot,-2>x<2,[-0.5,0.5],LINESTYLE=0
; oplot,x,rac1-1,LINESTYLE=1
; oplot,x,rac2-1,LINESTYLE=0
;----------------
;plot,-3>x<3,[0,1],LINESTYLE=0
maximum=max(rac1)
if max(rac2) gt maximum then maximum=max(rac2)
cislo=(maximum*100-((maximum*100) mod 20)+20)/100.0
plot,x,rac1,LINESTYLE=1,yrange=[0,cislo]
oplot,x,rac2,LINESTYLE=0


;wait,10
;pause
d=p1
d(*,1)=c
plus0=c
minus=c
;
path1=pol1
npath=STRLEN(pol1)
path2=path1;+' '
STRPUT,path2,' ',npath-4
path1=STRCOMPRESS(path2)
IF KEYWORD_SET(file) THEN BEGIN
writefits,file+'.fts',d
ENDIF
intp=0
intm=0
rp=WHERE(c LT 0,count)
IF count NE 0 THEN BEGIN
plus0(rp)=0
intp=INT_TABULATED(x,plus0)
ENDIF
;
rm=WHERE(c GE 0,count)
IF count NE 0 THEN BEGIN
minus(rm)=0
;int=INT_TABULATED(x,c)
intm=INT_TABULATED(x,minus)
ENDIF
;ab=[a(*,1),b(*,1),c]
ab=[MAX(c),MIN(c)]
miny=MIN(ab)
maxy=MAX(ab)

widget_control,draw2,get_value=val2 & wset,val2

plot,-5>x<3,[miny,maxy], $
;!!!!!!!!!!!!!!
;plot,x,[miny,maxy], $
TITLE=path1+" INTEGRATED P = "+string(intp)+" / "+string(intm), $
XTITLE="!4k!3 [Angstrom.]", YTITLE="P ",/NODATA
oplot,x,c,LINESTYLE=0
oplot,[0,0],[-5,maxy],LINESTYLE=4
oplot,[-6,4],[0,0],LINESTYLE=4
;oplot,x,a(*,1),LINESTYLE=4
;oplot,x,b(*,1),LINESTYLE=1

widget_control,f2,sensitive=1
widget_control,f3,sensitive=1
end

'CANCEL':widget_control,event.top,/destroy

'PICK':begin
cesta=pickfile(/read,filter='*.fts')
widget_control,widget_info(widget_info(event.id,/parent),/child),set_value=cesta
end

endcase
end

pro xdividep_event,event
COMMON all,draw1,draw2,cont1,cont2,savename
COMMON all2,lfield1,lfield2,lfield3,lfield4
widget_control,event.id,get_uvalue=uvalue
case uvalue of

'LOAD':begin
loadbase=widget_base(/column)
loadbase1=widget_base(loadbase,/row)
lfield1=cw_field(loadbase1,title='1ST PROFILE')
lbut1=widget_button(loadbase1,value='CHOOSE A FILE',uvalue='PICK')
loadbase2=widget_base(loadbase,/row)
lfield2=cw_field(loadbase2,title='2ND PROFILE')
lbut2=widget_button(loadbase2,value='CHOOSE A FILE',uvalue='PICK')
;loadbase3=widget_base(loadbase,/row)
; lfield3=cw_field(loadbase3,title='1ST CONTINUUM')
; lbut3=widget_button(loadbase3,value='CHOOSE A FILE',uvalue='PICK')
;loadbase4=widget_base(loadbase,/row)
; lfield4=cw_field(loadbase4,title='2ND CONTINUUM')
; lbut4=widget_button(loadbase4,value='CHOOSE A FILE',uvalue='PICK')
loadbase5=widget_base(loadbase,/row)
lbut5=widget_button(loadbase5,value='OK',uvalue='OK')
lbut6=widget_button(loadbase5,value='CANCEL',uvalue='CANCEL')
widget_control,loadbase,/realize
xmanager,'load',loadbase

end

'SAVE':begin
widget_control,event.id,get_value=val
val=fix(strmid(val(0),5,1))
savebase=widget_base(/column)
savename=cw_field(savebase,title='Name of file (*.gif):')
savebase1=widget_base(savebase,/row)
if val eq 1 then savebut1=widget_button(savebase1,value='OK',uvalue='OK1') $
else savebut1=widget_button(savebase1,value='OK',uvalue='OK2')
savebut2=widget_button(savebase1,value='CANCEL',uvalue='CANCEL')
widget_control,savebase,/realize
xmanager,'save',savebase
end

'QUIT':begin
widget_control,event.top,/destroy
end

endcase
end

pro xdividep
COMMON all,draw1,draw2,cont1,cont2,savename
COMMON buttons,f2,f3

base=widget_base(/row,mbar=bar)
fmenu=widget_button(bar,value='FILE',/menu)
f1=widget_button(fmenu,value='LOAD',uvalue='LOAD')
f2=widget_button(fmenu,value='SAVE 1ST IMAGE',uvalue='SAVE')
f3=widget_button(fmenu,value='SAVE 2ND IMAGE',uvalue='SAVE')
f4=widget_button(fmenu,value='QUIT',uvalue='QUIT')

base1=widget_base(base,/column)
draw1=widget_draw(base1,xsize=400,ysize=400)
;base11=widget_base(base1,/row)
; lab1=widget_label(base11,value='AVERAGE CONTINUUM')
; cont1=widget_label(base11,value=' ',/frame,xsize=70)
; cont2=widget_label(base11,value=' ',/frame,xsize=70)
base2=widget_base(base,/column)
draw2=widget_draw(base2,xsize=400,ysize=400)

widget_control,f2,sensitive=0
widget_control,f3,sensitive=0

widget_control,base,/realize
xmanager,'xdividep',base

end