; .com destretch.pro ; .r destretch.pro pro zzdestretch If ( !version.os eq 'Win32' ) Then st = '\' If ( !version.os eq 'linux' ) Then st = '/' Print, 'Where are the files after alignment?' dir_read = DIALOG_PICKFILE( /DIRECTORY ) file_mkdir,dir_read+'destretch' dir_write = dir_read+'destretch'+st list = file_search(dir_read + '*aln.fts',count=nn) pos = STRPOS(list[0], 'aln.fts') spos = Strpos( list[0], st, /reverse_search ) sn = pos - spos listname = STRMID(list, spos+1, sn-1) head = strarr(71,nn) img0 = readfits(list[0],head0) head[*,0]=head0 sz = size(img0) img = fltarr(sz[1],sz[2],nn) img[*,*,0]=img0 print,sz for i = 1,nn-1 do begin img[*,*,i] = readfits(list[i],head0) head[*,i] = head0 endfor movie,bytscl(img,2500,6000),order=0 xtvscl,img[*,*,fix(nn/2)] box_cursor,x,y,dx,dy img=img[round(x):round(x)+dx-1,round(y):round(y)+dy-1,*] img = do_destretch(img) movie,bytscl(img,2500,6000),order=0 stop ;for the img not equal bright print,'Enter y if you do not want to adjust the bright' cri = get_kbrd(60) case strupcase(cri) of 'Y' : begin i = fix(nn/2) xtvscl,img[*,*,i] box_cursor,x,y,dx,dy imgg = img[round(x):round(x)+dx-1,round(y):round(y)+dy-1,i] refb = mean(imgg) for i = 0,sz(3)-1 do begin imgg = img[*,*,i]*refb/mean(img[round(x):round(x)+dx-1,round(y):round(y)+dy-1,i]) img[*,*,i] = imgg endfor end else : endcase for i = 0,nn-1 do WRITEFITS, dir_write+listname[i]+'dstr.fts', img[*,*,i], head[*,i] end