Commit 7339bbec authored by Carl Schaffer's avatar Carl Schaffer
Browse files

Merge branch 'ulises4' into 'master'

Ulises4

See merge request !8
parents 185b0df3 5f81c932
Pipeline #2774 passed with stage
......@@ -17,14 +17,15 @@ function get_limits_slices,im,silent=silent
pos=intarr(tam[1])
ww=13
ww=5 ;13
for j=3,tam[1]-3 do begin
inf=(j-ww)>0
sup=(j+ww)<(tam[1]-1)
max_corr=max(corr[inf:sup])
min_corr=min(corr[inf:sup])
delta=max_corr-min_corr
if(corr[j] eq max(corr[inf:sup]) and delta gt 0.03) then pos[j]=1
; 20210907: changed the delta threshold from 0.03 down to 0.02
if(corr[j] eq max(corr[inf:sup]) and delta gt 0.02) then pos[j]=1
endfor
xs=where(pos eq 1)
......
function interlace2,im1,im2
function interlace2,im1,im2,stepangle
tam=size(im1)
imout=fltarr(tam[1],tam[2],2*tam[3])
z=2*indgen(tam[3])
imout[*,*,z]=im1
imout[*,*,z+1]=im2
tam=size(im1)
imout=fltarr(tam[1],tam[2],2*tam[3])
z=2*indgen(tam[3])
return,imout
if(stepangle eq 0) then begin
imout[*,*,z]=im2
imout[*,*,z+1]=im1
endif else if(abs(stepangle) eq 180) then begin
imout[*,*,z]=im1
imout[*,*,z+1]=im2
endif else begin
print,'STEPANGLE = ', stepangle
print,' '
print,"Variable STEPANGLE not 0 nor 180 degree"
print,"Do not know how to handle this value"
stop
endelse
return,imout
end
......@@ -174,6 +174,11 @@ pro gris_v8,map_in_base,fileff,filecalib,display=display,$
;use file_search (A. Lagg, May 05)
files=file_search('./level0/'+map_in_base+'*',count=cnt)
context_dir=file_search('context_data',count=cntdir)
if(cntdir eq 0) then spawn,'mkdir ./context_data'
context_dir=file_search('context_data',count=cntdir)
if (cnt eq 0) then begin
files=file_search(map_in_base+'*',count=cnt)
pathin="./"
......@@ -181,9 +186,9 @@ pro gris_v8,map_in_base,fileff,filecalib,display=display,$
dirout=file_search('level1',count=cntdir)
pathin='./level0/'
if(cntdir eq 0) then spawn,'mkdir ./level1'
context_dir=file_search('context_data',count=cntdir)
if(cntdir eq 0) then spawn,'mkdir ./context_data'
context_dir=file_search('context_data',count=cntdir)
; context_dir=file_search('context_data',count=cntdir)
; if(cntdir eq 0) then spawn,'mkdir ./context_data'
; context_dir=file_search('context_data',count=cntdir)
endelse
if(cnt eq 0) then begin
......@@ -600,7 +605,7 @@ pro gris_v8,map_in_base,fileff,filecalib,display=display,$
ccfiles=strarr(nmap_in) ;store output filenames for header writing
for jj=0,nmap_in-1 do begin
map_in=files(jj)
print,'Calibrating file : '+strtrim(map_in,2), jj,' of ',sizeof(files)
print,'Calibrating file : '+strtrim(map_in,2), jj+1,' of ',sizeof(files)
map_hdr = map_in+'cc'
dum=rfits_im(map_in,1,dd,hdr,nrhdr,/badpix)
tam=size(dum)
......
......@@ -209,6 +209,7 @@ function RFITS_IM,file,im,desc,header,nrhdr,desp=desp,badpix=badpix,slit=slit
endwhile
header=string(reform(hdr,2880,n_elements(hdr)/2880))
nrhdr=n_elements(header)
if (im lt 1 or im gt desc.naxis3) then begin
print,'La imagen debe estar comprendida entre 1 y ', desc.naxis3
......
......@@ -71,7 +71,7 @@ function mpfit_fts,par,xval=x,yval=y,errval=err,wgt=wgt,_extra=_extra, $
;interpolate fts to same grid as observation
ftsip=interpol(fts[4,*],fts[1,*],wlobs)
atmip=interpol(fts[3,*],fts[1,*],wlobs)
wgt=atmip ge 0.95
wgt=atmip ge 0.95 ;remove telluric blends
;remove first & last nb points from
;fitting (at
; nb=15
......@@ -89,6 +89,9 @@ function mpfit_fts,par,xval=x,yval=y,errval=err,wgt=wgt,_extra=_extra, $
kernel=exp(-0.5*(kernelx/sigma)^2)
kernel=kernel/total(kernel)
ftscon=convol(ftsip,kernel,/edge_truncate)
;apply convolution also for telluric line removal
wgtcon=convol(float(wgt),kernel,/edge_truncate)
wgt=wgtcon ge .99
if fitset.strayfit then if np gt 3 then begin
;add white light
......@@ -241,6 +244,7 @@ function fit2fts,iprof,show=show,lambda=lambda,order=order,npoly=npoly, $
common oldfit,oldfitpar
show=keyword_set(show)
show=1b
print,strjoin(replicate('=',80))
print,'FTS-fitting, please wait...'
if keyword_set(show) eq 0 then $
......@@ -271,10 +275,11 @@ function fit2fts,iprof,show=show,lambda=lambda,order=order,npoly=npoly, $
wlbin=(18e-3)/redir_gregor_func(lambda,order,show=show)
repeatfit=0
minfit=5
; minfit=5
minfit=1
repeat begin
infts=where(ftsfull[1,*] ge wl-wlrg and ftsfull[1,*] le wl+wlrg)
infts=where(ftsfull[1,*] ge wl-wlrg and ftsfull[1,*] le wl+wlrg) ;take only in WL-range
if infts[0] eq -1 then message,'wavelength not coverd by FTS spectrum'
fts=ftsfull[*,infts]
......@@ -338,7 +343,7 @@ function fit2fts,iprof,show=show,lambda=lambda,order=order,npoly=npoly, $
print,strjoin(replicate('=',80))
if fitness lt minfit then begin
print,'Bad FTS fitting.
print,'Bad FTS fitting.'
if repeatfit lt 5 and not keyword_set(lazy) then begin
print,'Trying again.'
endif
......
......@@ -18,7 +18,9 @@ nv=param_fits(hdr,'STEPSV =',vartype=1)
steph=param_fits(hdr,'STEPSIZH=',vartype=3)
stepv=param_fits(hdr,'STEPSIZV=',vartype=3)
steph=-6.075
stepangle=param_fits(hdr,'STEPANGL=',vartype=3)
;steph=-6.075
;stepv=100. ;only for 24sep18.001
......@@ -80,7 +82,7 @@ for k=0,nrep-1 do begin
endif else begin
im_ord2=reorder_slicer2(im)
endelse
im_ord=interlace2(im_ord2,im_ord)
im_ord=interlace2(im_ord2,im_ord,stepangle)
endif
hstart=coordh[j]*tam[2]
hend=hstart+tam[2]-1
......@@ -109,7 +111,6 @@ for k=0,nrep-1 do begin
endfor
endfor
endfor
mapa[0,*,*,*,*]=mapa[1,*,*,*,*]
if(aspect eq 0) then begin
......
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment