PRO filradiojopa
;=====================
; for filament height calculation
; in any instrument's data sets
;
; produced by
; Yaroslav Egorov
;
; e-mail: egorov@iszf.irk.ru
; 10-sep-2014
;=====================
;============ SETTINGS ===============
path='D:\ISTP\data\2010-06-05'; путь к папке
;path='D:\WORK\ISTP\data\test3'; путь к папке
instr='radio'; инструмент eit или mlso
xs= 700; размер окна
ys=xs
;========= END OF SETTINGS ===========
open_dir=path+'\'+instr+'\jpeg'
cd,open_dir
filelist = FINDFILE(open_dir+'\*.jpg')
count= n_elements (filelist)
WINDOW, 0, XSIZE=xs, YSIZE=ys, TITLE='filament height calculation'
read_jpeg, filelist(0), frame, /grayscale
; define radius and solar center by using 3-point method
tvplot, frame
xx= fltarr (3)
yy= fltarr (3)
for j= 0, 2 do begin
CURSOR, xxx,yyy, /data, /down
xx[j]=xxx
yy[j]=yyy
Endfor
CIR_3PNT, xx, yy, RR, x0, y0
;============================
;PLOTS, CIRCLES(x0, y0, RR), /data, THICK=3.0, NOCLIP=0
data= strarr (count, 3)
for k= 0,count- 1 do begin
read_jpeg, filelist(k), frame, /grayscale
tvplot, frame
PLOTS, CIRCLES (x0, y0, RR), /data, THICK= 3.0, NOCLIP= 0
CURSOR, Xh, Yh, /data, /DOWN
plots,[x0,Xh],[y0,Yh],color= 200,/data,THICK= 2.4
CURSOR, Xa, Ya, /data, /DOWN
plots,[x0,Xa],[y0,Ya],color= 200,/data,THICK= 2.4
CURSOR, Xb, Yb, /data, /DOWN
plots,[x0,Xb],[y0,Yb],color= 200,/data,THICK= 2.4
height= sqrt ((Xh-x0)^ 2 +(Yh-y0)^ 2)
; найдем угол по теореме косинусов
a= sqrt ((Xa-x0)^ 2 +(Ya-y0)^ 2)
b= sqrt ((Xb-x0)^ 2 +(Yb-y0)^ 2)
c= sqrt ((Xa-Xb)^ 2 +(Ya-Yb)^ 2)
angle= acos ((a^ 2 +b^ 2 -c^ 2)/(2 *a*b)) * 180. /!pi
data[k, 0 ]=k
data[k, 1 ]=height/RR
data[k, 2 ]=angle
write_jpeg, 'save\'+ strtrim (k)+'.jpg', tvrd ()
Endfor
OPENW, 1, 'data.dat'
PRINTF, 1, transpose (data),FORMAT='(A,1X,F7.2,1X,F7.2)'
CLOSE, 1
END
\
PRO filradiojopa_sdo
;=====================
; for filament height calculation
; in any instrument's data sets
;
; produced by
; Yaroslav Egorov
;
; e-mail: egorov@iszf.irk.ru
; 10-sep-2014
;=====================
;============ SETTINGS ===============
path='D:\ISTP\data\2014-05-09\304'; путь к папке
instr='sdo'; инструмент eit или mlso
xs= 700; размер окна
ys=xs
xra=[- 0, 1100 ]
yra=[- 1000, 200 ]
;========= END OF SETTINGS ===========
open_dir=path
cd,open_dir
filelist = FINDFILE(open_dir+'\*.fits')
count= n_elements (filelist)
data= fltarr (count, 3)
WINDOW, 0, XSIZE=xs, YSIZE=ys, TITLE='filament height calculation'
|
for k= 0,count- 1 do begin
;for k=0,21 do begin
frame= readfits (filelist[k],header)
;frame1=readfits(filelist[k],header)
;frame2=readfits(filelist[k-2],header)
;frame=frame2-frame1
x0= 0
y0= 0
RR= fxpar (header, 'R_SUN')* 0.6
xaxis = (findgen (fxpar (header,'NAXIS1')) - fxpar (header, 'CRPIX1'))* abs (fxpar (header, 'CDELT1'))
yaxis = (findgen (fxpar (header,'NAXIS2')) - fxpar (header, 'CRPIX2'))* abs (fxpar (header, 'CDELT1'))
axisColor = FSC_COLOR ("black",!D. Table_Size - 2)
backColor = FSC_COLOR ("white",!D. Table_Size - 3)
overColor = FSC_COLOR ("white",!D. Table_Size - 3)
;axisColor = FSC_COLOR("white",!D.Table_Size-2)
;backColor = FSC_COLOR("black",!D.Table_Size-3)
xtln=- 0.02
ytln=- 0.02
xm=[ 5, 1 ]
ym=[ 3, 1 ]
xth= 1.5
CHARSIZE= 3.0
charthick= 5.0
xticks= 0
tvplot,frame> 34 < 1200, $
; tvplot,sigrange(frame), $
xaxis, yaxis, xticklen = xtln, yticklen = ytln, $
miss = 0, CHARSIZE=CHARSIZE, charthick = charthick, ymargin=ym,xmargin=xm, $
XTHICK=xth, YTHICK=xth, XTICKINTERVAL = 50, YTICKINTERVAL = 50,$
background=backColor, color=axisColor, $
xrange=xra, yrange=yra, XTICKS=xticks, YTICKS=xticks
PLOTS, CIRCLES (0, 0, RR), /data, THICK= 3.0, NOCLIP= 0
CURSOR, Xh, Yh, /data, /DOWN
plots,[x0,Xh],[y0,Yh],color= 200,/data,THICK= 2.4
CURSOR, Xa, Ya, /data, /DOWN
plots,[x0,Xa],[y0,Ya],color= 200,/data,THICK= 2.4
CURSOR, Xb, Yb, /data, /DOWN
plots,[x0,Xb],[y0,Yb],color= 200,/data,THICK= 2.4
height= sqrt ((Xh-x0)^ 2 +(Yh-y0)^ 2)
; найдем угол по теореме косинусов
a= sqrt ((Xa-x0)^ 2 +(Ya-y0)^ 2)
b= sqrt ((Xb-x0)^ 2 +(Yb-y0)^ 2)
c= sqrt ((Xa-Xb)^ 2 +(Ya-Yb)^ 2)
angle= acos ((a^ 2 +b^ 2 -c^ 2)/(2 *a*b)) * 180. /!pi
data[k, 0 ]=k
data[k, 1 ]=height/RR
data[k, 2 ]=angle
write_jpeg, 'save\'+ strtrim (k)+'.jpg', tvrd ()
Endfor
OPENW, 1, 'data.dat'
PRINTF, 1, transpose (data),FORMAT='(A,1X,F7.2,1X,F7.2)'
CLOSE, 1
END
PRO filament_height_jpg
;=====================
; for filament height calculation
; in any instrument's data sets
;
; produced by
; Yaroslav Egorov
;
; e-mail: egorov@iszf.irk.ru
; 10-sep-2014
;=====================
;============ SETTINGS ===============
path='D:\ISTP\data\2014-04-28'; путь к папке
instr='radio'; инструмент eit или mlso
xs= 700; размер окна
ys=xs
xra=[- 200, 1300 ]; кусок изображения в угловых секундах по х
|
yra=[- 1300, 200 ]; кусок изображения в угловых секундах по y
x0= 512
y0= 512
rad= 31.96 * 60 / double (2 * 2.59)
pixs= 2.62
png= 1; сюда обращать внимание свое если что-то не так с пнг и джепеге
;========= END OF SETTINGS ===========
if png eq 1 then open_dir=path+'\'+instr+'\png' else open_dir=path+'\'+instr+'\jpeg'
cd,open_dir
if png eq 1 then filelist = FINDFILE(open_dir+'\*.png') else filelist = FINDFILE(open_dir+'\*.jpg')
count= n_elements (filelist)
WINDOW, 0, XSIZE=xs, YSIZE=ys, TITLE='filament height calculation'
data= strarr (count, 3)
for k= 0,count- 1 do begin
if png eq 1 then read_png, filelist(k), frame, /grayscale else read_jpeg, filelist(k), frame, /grayscale
Nx= 1024
Ny=Nx
xaxis = (findgen (Nx) - x0)*pixs
yaxis = (findgen (Ny) - y0)*pixs
axisColor = FSC_COLOR ("black",!D. Table_Size - 2)
backColor = FSC_COLOR ("white",!D. Table_Size - 3)
overColor = FSC_COLOR ("white",!D. Table_Size - 3)
xtln= 0.01
ytln= 0.01
xm=[ 5, 1 ]
ym=[ 3, 1 ]
xth= 1.5
CHARSIZE= 3.0
charthick= 5.0
xticks= 0
;if instr eq 'eit' then img=frame else img=alog(frame)
tvplot, sigrange (frame), $
xaxis, yaxis, xticklen = xtln, yticklen = ytln, $
miss = min (frame), CHARSIZE=CHARSIZE, charthick = charthick, ymargin=ym,xmargin=xm, $
XTHICK=xth, YTHICK=xth,$
background=backColor, color=axisColor, $
xrange=xra, yrange=yra
CURSOR, Xh, Yh, /data, /DOWN
plots,[ 0,Xh],[ 0,Yh],color= 200,/data,THICK= 2.4
CURSOR, Xa, Ya, /data, /DOWN
plots,[ 0,Xa],[ 0,Ya],color= 200,/data,THICK= 2.4
CURSOR, Xb, Yb, /data, /DOWN
plots,[ 0,Xb],[ 0,Yb],color= 200,/data,THICK= 2.4
height= sqrt ((Xh- 0)^ 2 +(Yh- 0)^ 2)
; найдем угол по теореме косинусов
a= sqrt ((Xa- 0)^ 2 +(Ya- 0)^ 2)
b= sqrt ((Xb- 0)^ 2 +(Yb- 0)^ 2)
c= sqrt ((Xa-Xb)^ 2 +(Ya-Yb)^ 2)
angle= acos ((a^ 2 +b^ 2 -c^ 2)/(2 *a*b)) * 180. /!pi
data[k, 0 ]=k
data[k, 1 ]=height/(pixs*rad)
data[k, 2 ]=angle
if png eq 1 then write_png, 'save\'+ strtrim (k)+'.png', tvrd () else write_jpeg, strtrim (k)+'.jpg', tvrd ()
Endfor
print, height/(pixs*rad)
print, angle
OPENW, 1, 'data.dat'
PRINTF, 1, transpose (data),FORMAT='(A,1X,F7.2,1X,F7.2)'
CLOSE, 1
END
PRO STRREPLACE_JPG, Strings, Find1, Replacement1
; Check integrity of input parameter
NP = N_PARAMS ()
if (NP ne 3) then message,'Must be called with 3 parameters, '+$
|
'Strings, Find, Replacement'
sz = SIZE (Strings)
ns = n_elements (sz)
if (sz(ns- 2) ne 7) then message,'Parameter must be of string type.'
Find = STRING (Find1)
pos = STRPOS (Strings,Find)
here = WHERE (pos ne - 1, nreplace)
if (nreplace eq 0) then return
Replacement= STRING (Replacement1)
Flen = strlen (Find)
for i= 0,nreplace- 1 do begin
j = here(i)
prefix = STRMID (Strings(j), 0, pos (j))
suffix = STRMID (Strings(j), pos (j)+Flen,$
strlen (Strings(j))-(pos (j)+Flen))
Strings(j) = prefix + replacement + suffix
Endfor
End
PRO filament_height_diff
;=====================
; for filament height calculation
; in any instrument's data sets
;
; produced by
; Yaroslav Egorov
;
; e-mail: egorov@iszf.irk.ru
; 10-sep-2014
;=====================
;============ SETTINGS ===============
path='D:\ISTP\data\2004-08-29'; путь к папке
instr='eit'; инструмент eit или mlso
xs= 700; размер окна
ys=xs
xra=[- 1300, 200 ]; кусок изображения в угловых секундах по х
yra=[- 200, 1300 ]; кусок изображения в угловых секундах по y
;========= END OF SETTINGS ===========
open_dir=path+'\'+instr
; ====== делаем уровень 1 =====
if instr eq 'eit05' then begin
open_dir=path+'\'+instr
cd,open_dir
filelist = FINDFILE(open_dir+'\*.fts')
count= n_elements (filelist)
for i= 0,count- 1 do begin
eit_prep,filelist[i], /outfits, outdir=path+'\eit'
Endfor
open_dir=path+'\eit'
Endif
; ====== сделали уровень 1 =====
cd,open_dir
filelist = FINDFILE(open_dir+'\*.fts')
if instr eq 'eit' then filelist = FINDFILE(open_dir+'\*.fits')
;if n_elements(filelist) eq 0 then filelist = FINDFILE(open_dir+'\*.fits')
count= n_elements (filelist)
WINDOW, 0, XSIZE=xs, YSIZE=ys, TITLE='filament height calculation'
data= strarr (count, 3)
for k= 1,count- 1 do begin
frame1= READFITS (filelist(k- 1),header1)
frame2= READFITS (filelist(k),header)
frame=frame2-frame1
IF instr EQ 'mlso' THEN frame= rot (frame,- fxpar (header,'CROTA2'))
x0 = double (fxpar (header, 'CRPIX1'))
y0 = double (fxpar (header, 'CRPIX2'))
title= fxpar (header,'FILENAME')
rad = fxpar (header, 'CRRADIUS')
pixs = sxpar (header, 'CDELT1')
if pixs eq 0 then pixs = sxpar (header, 'PLATESCL')
if rad eq 0 then begin
rad = fxpar (header, 'PLATESCL')
if rad ne 0 then rad= 31.96 * 60 / double (2 *rad) else begin
rad = fxpar (header, 'CDELT1')
if rad ne 0 then rad = 31.96 * 60 / double (2 *rad) else rad= 80
Endelse
Endif
Nx = fxpar (header,'NAXIS1')
Ny = fxpar (header,'NAXIS2')
if Nx eq 512 then begin
Nx= 1024
Ny= 1024
Endif
; Nx=1024
; Ny=Nx
xaxis = (findgen (Nx) - x0)*pixs
yaxis = (findgen (Ny) - y0)*pixs
axisColor = FSC_COLOR ("black",!D. Table_Size - 2)
backColor = FSC_COLOR ("white",!D. Table_Size - 3)
overColor = FSC_COLOR ("white",!D. Table_Size - 3)
xtln= 0.01
ytln= 0.01
xm=[ 5, 1 ]
ym=[ 3, 1 ]
xth= 1.5
CHARSIZE= 3.0
charthick= 5.0
xticks= 0
;if instr eq 'eit' then img=frame else img=alog(frame)
tvplot, sigrange (frame), $
xaxis, yaxis, xticklen = xtln, yticklen = ytln, $
miss = min (frame), CHARSIZE=CHARSIZE, charthick = charthick, ymargin=ym,xmargin=xm, $
XTHICK=xth, YTHICK=xth,$
background=backColor, color=axisColor, $
xrange=xra, yrange=yra
CURSOR, Xh, Yh, /data, /DOWN
plots,[ 0,Xh],[ 0,Yh],color= 200,/data,THICK= 2.4
CURSOR, Xa, Ya, /data, /DOWN
plots,[ 0,Xa],[ 0,Ya],color= 200,/data,THICK= 2.4
CURSOR, Xb, Yb, /data, /DOWN
plots,[ 0,Xb],[ 0,Yb],color= 200,/data,THICK= 2.4
height= sqrt ((Xh- 0)^ 2 +(Yh- 0)^ 2)
; найдем угол по теореме косинусов
a= sqrt ((Xa- 0)^ 2 +(Ya- 0)^ 2)
b= sqrt ((Xb- 0)^ 2 +(Yb- 0)^ 2)
c= sqrt ((Xa-Xb)^ 2 +(Ya-Yb)^ 2)
angle= acos ((a^ 2 +b^ 2 -c^ 2)/(2 *a*b)) * 180. /!pi
dates = fxpar (header, 'TIME-OBS')
dates2 = fxpar (header, 'DATE-OBS')
hour2 = STRMID (dates, 0, 2)
min2 = STRMID (dates, 3, 2)
sec2 = STRMID (dates, 6, 2)
time_title= strtrim (hour2+':'+min2+':'+sec2)
dateinfo= STRMID (dates2, 0, 10)
STRREPLACE, dateinfo, '/', '-'
STRREPLACE, dateinfo, '/', '-'
juldays = hour2+min2+sec2
data[k, 0 ]=time_title
data[k, 1 ]=height/(pixs*rad)
data[k, 2 ]=angle
dt=[juldays,time_title, dateinfo]
write_jpeg, 'jpg/img_'+ strtrim (dt(0))+'_'+ strtrim (dt(2))+'.jpg', tvrd ()
Endfor
;print, height/(pixs*rad)
;print, angle
OPENW, 1, 'data.dat'
PRINTF, 1, transpose (data),FORMAT='(A,1X,F7.2,1X,F7.2)'
CLOSE, 1
END
PRO STRREPLACE, Strings, Find1, Replacement1
; Check integrity of input parameter
NP = N_PARAMS ()
if (NP ne 3) then message,'Must be called with 3 parameters, '+$
'Strings, Find, Replacement'
sz = SIZE (Strings)
ns = n_elements (sz)
if (sz(ns- 2) ne 7) then message,'Parameter must be of string type.'
Find = STRING (Find1)
pos = STRPOS (Strings,Find)
here = WHERE (pos ne - 1, nreplace)
if (nreplace eq 0) then return
Replacement= STRING (Replacement1)
Flen = strlen (Find)
for i= 0,nreplace- 1 do begin
j = here(i)
prefix = STRMID (Strings(j), 0, pos (j))
suffix = STRMID (Strings(j), pos (j)+Flen,$
strlen (Strings(j))-(pos (j)+Flen))
Strings(j) = prefix + replacement + suffix
Endfor
End
PRO filament_height
;=====================
; for filament height calculation
; in any instrument's data sets
;
; produced by
; Yaroslav Egorov
;
; e-mail: egorov@iszf.irk.ru
; 10-sep-2014
;=====================
;============ SETTINGS ===============
path='D:\ISTP\data\2004-05-03(00;00)'; путь к папке
instr='mlso'; инструмент eit или mlso
xs= 700; размер окна
ys=xs
xra=[- 1300, 200 ]; кусок изображения в угловых секундах по х
yra=[- 1300, 200 ]; кусок изображения в угловых секундах по y
;========= END OF SETTINGS ===========
open_dir=path+'\'+instr
; ====== делаем уровень 1 =====
if instr eq 'eit05' then begin
open_dir=path+'\'+instr
cd,open_dir
filelist = FINDFILE(open_dir+'\*.fts')
count= n_elements (filelist)
for i= 0,count- 1 do begin
eit_prep,filelist[i], /outfits, outdir=path+'\eit'
Endfor
open_dir=path+'\eit'
Endif
; ====== сделали уровень 1 =====
cd,open_dir
filelist = FINDFILE(open_dir+'\*.fts')
if instr eq 'eit05' then filelist = FINDFILE(open_dir+'\*.fits')
count= n_elements (filelist)
WINDOW, 0, XSIZE=xs, YSIZE=ys, TITLE='filament height calculation'
data= strarr (count, 3)
for k= 0,count- 1 do begin
frame= READFITS (filelist(k),header)
IF instr EQ 'mlso' THEN frame= rot (frame, 0. - fxpar (header,'CROTA2'))
x0 = double (fxpar (header, 'CRPIX1'))
y0 = double (fxpar (header, 'CRPIX2'))
title= fxpar (header,'FILENAME')
rad = fxpar (header, 'CRRADIUS')
pixs = sxpar (header, 'CDELT1')
if rad eq 0 then begin
rad = fxpar (header, 'PLATESCL')
if rad ne 0 then rad= 31.96 * 60 / double (2 *rad) else begin
rad = fxpar (header, 'CDELT1')
if rad ne 0 then rad = 31.96 * 60 / double (2 *rad) else rad= 80
Endelse
Endif
Nx = fxpar (header,'NAXIS1')
Ny = fxpar (header,'NAXIS2')
if Nx eq 512 then begin
Nx= 1024
Ny= 1024
Endif
xaxis = (findgen (Nx) - x0)*pixs
yaxis = (findgen (Ny) - y0)*pixs
axisColor = FSC_COLOR ("black",!D. Table_Size - 2)
backColor = FSC_COLOR ("white",!D. Table_Size - 3)
overColor = FSC_COLOR ("white",!D. Table_Size - 3)
xtln= 0.01
ytln= 0.01
xm=[ 5, 1 ]
ym=[ 3, 1 ]
xth= 1.5
CHARSIZE= 3.0
charthick= 5.0
xticks= 0
;if instr eq 'eit' then img=frame else img=alog(frame)
tvplot, sigrange (frame), $
xaxis, yaxis, xticklen = xtln, yticklen = ytln, $
miss = min (frame), CHARSIZE=CHARSIZE, charthick = charthick, ymargin=ym,xmargin=xm, $
XTHICK=xth, YTHICK=xth,$
background=backColor, color=axisColor, $
xrange=xra, yrange=yra
CURSOR, Xh, Yh, /data, /DOWN
plots,[ 0,Xh],[ 0,Yh],color= 200,/data,THICK= 2.4
CURSOR, Xa, Ya, /data, /DOWN
plots,[ 0,Xa],[ 0,Ya],color= 200,/data,THICK= 2.4
CURSOR, Xb, Yb, /data, /DOWN
plots,[ 0,Xb],[ 0,Yb],color= 200,/data,THICK= 2.4
height= sqrt ((Xh- 0)^ 2 +(Yh- 0)^ 2)
; найдем угол по теореме косинусов
a= sqrt ((Xa- 0)^ 2 +(Ya- 0)^ 2)
b= sqrt ((Xb- 0)^ 2 +(Yb- 0)^ 2)
c= sqrt ((Xa-Xb)^ 2 +(Ya-Yb)^ 2)
angle= acos ((a^ 2 +b^ 2 -c^ 2)/(2 *a*b)) * 180. /!pi
dates = fxpar (header, 'TIME-OBS')
dates2 = fxpar (header, 'DATE-OBS')
hour2 = STRMID (dates, 0, 2)
min2 = STRMID (dates, 3, 2)
sec2 = STRMID (dates, 6, 2)
time_title= strtrim (hour2+':'+min2+':'+sec2)
dateinfo= STRMID (dates2, 0, 10)
STRREPLACE, dateinfo, '/', '-'
STRREPLACE, dateinfo, '/', '-'
juldays = hour2+min2+sec2
data[k, 0 ]=time_title
data[k, 1 ]=height/(pixs*rad)
data[k, 2 ]=angle
dt=[juldays,time_title, dateinfo]
write_jpeg, 'jpg/img_'+ strtrim (dt(0))+'_'+ strtrim (dt(2))+'.jpg', tvrd ()
Endfor
print, height/(pixs*rad)
print, angle
OPENW, 1, 'data.dat'
PRINTF, 1, transpose (data),FORMAT='(A,1X,F7.2,1X,F7.2)'
CLOSE, 1
END
PRO STRREPLACE, Strings, Find1, Replacement1
; Check integrity of input parameter
NP = N_PARAMS ()
if (NP ne 3) then message,'Must be called with 3 parameters, '+$
'Strings, Find, Replacement'
sz = SIZE (Strings)
ns = n_elements (sz)
if (sz(ns- 2) ne 7) then message,'Parameter must be of string type.'
Find = STRING (Find1)
pos = STRPOS (Strings,Find)
here = WHERE (pos ne - 1, nreplace)
if (nreplace eq 0) then return
Replacement= STRING (Replacement1)
Flen = strlen (Find)
for i= 0,nreplace- 1 do begin
j = here(i)
prefix = STRMID (Strings(j), 0, pos (j))
suffix = STRMID (Strings(j), pos (j)+Flen,$
strlen (Strings(j))-(pos (j)+Flen))
Strings(j) = prefix + replacement + suffix
Endfor
End