Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 72 additions & 36 deletions idl/graphics.pro
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PRO CWPAL2
;
R=[0,255L,234L,0 ,0 ,255L,0 ,255L,255L,0 ,175L,255L]
G=[0,255L,0 ,140L,216L,235L,235L,0 ,148L,126L,0 ,67L ]*256L
B=[0,255L,0 ,234L,0 ,0 ,228L,200L,0 ,0 ,201L,67L ]*256L*256L
R=[0,255L,234L,0 ,0 ,255L,0 ,255L,255L,0 ,175L,255L]
G=[0,255L,0 ,140L,216L,235L,235L,0 ,148L,126L,0 ,67L ]*256L
B=[0,255L,0 ,234L,0 ,0 ,228L,200L,0 ,0 ,201L,67L ]*256L*256L
TVLCT, R, G, B
;
END
Expand Down Expand Up @@ -415,7 +415,8 @@ minper=fltarr(4)+1.e30

a=strarr(15)
b='b'
openr,1,'~/bin/scales' ; RUTA DIRECTORIO SCALE FILE
sir_idl_dir = File_Dirname(Routine_Filepath(/Either),/Mark_Directory)
openr,1,sir_idl_dir + 'scales' ; RUTA DIRECTORIO SCALE FILE
for i=0,9 do readf,1,b
readf,1,a
close,1
Expand Down Expand Up @@ -595,7 +596,7 @@ lis=listado2
nel=n_elements(lis)
imod=bytarr(nel)
for i=0,nel-1 do begin
barpos=strpos(lis(i),'\')
barpos=strpos(lis(i),'\') ;'
if barpos eq -1 then begin
dotpos=strpos(lis(i),'.')
caracter=strmid(lis(i),dotpos+1,1)
Expand Down Expand Up @@ -756,38 +757,58 @@ endelse
endif


;___________________________________________________________________________
;___________________________________________________________________________'
; Leemos los perfiles
;___________________________________________________________________________

if nper ne 0 then begin
nlam=intarr(nper)
if ((ns ne 0) and (lisper(0) ne '')) then begin
for i=1,nper do begin
openr,i,lisper(i-1)
while not eof(i) do begin
readf,i,ind,lam,ii,qq,uu,vv
nlam(i-1)=nlam(i-1)+1
endwhile
close,i
endfor

resultper=fltarr(nper,ns,max(nlam))

for i=1,nper do begin
resulti=fltarr(6,nlam(i-1))
openr,i,lisper(i-1)
readf,i,resulti
insulti=resulti(where(is eq 1)+2,*)
close,i
resultper(i-1,indgen(ns),0:nlam(i-1)-1)=insulti
endfor
endif else begin
if ((ns ne 0) and (lisper(0) eq '')) then begin
texto='No profile files in current directory'
mensaje,texto
endif
endelse
nlam_valid = intarr(nper)
nlam_invalid = intarr(nper)
if ((ns ne 0) and (lisper(0) ne '')) then begin
for i=1,nper do begin
openr,i,lisper(i-1)
while not eof(i) do begin
readf,i,ind,lam,ii,qq,uu,vv
IF MAX([ii,qq,uu,vv]) GT -1 THEN nlam_valid(i-1)=nlam_valid(i-1)+1 ELSE nlam_invalid(i-1) = nlam_invalid(i-1) + 1
endwhile
close,i
endfor

nlam = nlam_valid + nlam_invalid
resultper=fltarr(nper,ns,max(nlam))

for i=1,nper do begin
resulti=fltarr(6,nlam(i-1))
openr,i,lisper(i-1)
readf,i,resulti

; --> deal with irregularly sampled (observed) profiles that have -1 values <--
; if there are wavelength positions where I,Q,U,V intensities are equal to -1
; then perform an interpolation of the valid (non-negative-one) points to create a profile
; with valid values at all points.
; This will help with plotting of these "irregularly sampled" profiles together with the
; inverted line profiles (which are calculated at all wavelength positions).
; - KPR, 02 June, 2017 - following suggestion by Momchil Molnar to interpolate over bad points,
; instead of trying to just drop them out.
for sp=2,5 do begin
valid_idx = WHERE(resulti[sp,*] GT -1,valid_count)
if valid_count LT nlam(i-1) then begin
resulti[sp,*] = INTERPOL(resulti[sp,valid_idx],resulti[1,valid_idx],resulti[1,*],Spline=1,Lsquad=0,Quad=0)
endif
endfor

insulti=resulti(where(is eq 1)+2,*)
close,i

resultper(i-1,indgen(ns),0:nlam(i-1)-1)=insulti
endfor

endif else begin
if ((ns ne 0) and (lisper(0) eq '')) then begin
texto='No profile files in current directory'
mensaje,texto
endif
endelse
endif

escalable,nmod,nper,resultmod,resultper,ntau,nlam
Expand Down Expand Up @@ -997,7 +1018,19 @@ if nstokes ne 0 then begin
miny=minper(i)
endelse

plot,profileres(0,i,0:nlam(0)-1),color=col2(icolor(0)),charsize=$
profileres_plot = REFORM(profileres(0,i,0:nlam(0)-1))

; --> deal with irregularly sampled (observed) profiles that have -1 values <--
; here is a second check, to make sure we are only plotting valid (non-negative-one) points
; these points should have been caught and interpolated over rmodprof above.
; This was actually a previous attempt to deal with these invalid points in
; irregularly sampled profiles. It works, but the problem is that the yrange is determined
; elsewhere (in escalable) where these negative values are still included, so the scaling is wrong.
; - KPR, 28 May, 2017

profileres_valid = WHERE(profileres_plot GT -1)

plot,profileres_valid,profileres_plot[profileres_valid],color=col2(icolor(0)),charsize=$
tamchar,xtitle=etiquestox,ytitle=etiquestoy(dondesto(i)),$
ystyle=1,yrange=[miny,maxy]

Expand All @@ -1013,7 +1046,9 @@ if nstokes ne 0 then begin
5: linepart=6
6: linepart=7
endcase
oplot,profileres(j,i,0:nlam(j)-1),color=col2(colopart),line=linepart
profileres_plot = REFORM(profileres(j,i,0:nlam(j)-1))
profileres_valid = WHERE(profileres_plot GT -1)
oplot,profileres_valid,profileres_plot[profileres_valid],color=col2(colopart),line=linepart
endfor
endfor

Expand Down Expand Up @@ -1592,7 +1627,8 @@ endif ;(-25)

if mag eq 'Scale' then begin ;(25)

spawn,'emacs ~/bin/scales'
sir_idl_dir = File_Dirname(Routine_Filepath(/Either),/Mark_Directory)
spawn,'emacs ' + sir_idl_dir + 'scales'

endif ;(-25)

Expand Down
34 changes: 31 additions & 3 deletions idl/graphics2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ minper=fltarr(4)+1.e30

a=strarr(15)
b='b'
openr,1,'~/bin/scales' ; RUTA DIRECTORIO SCALE FILE
sir_idl_dir = File_Dirname(Routine_Filepath(/Either),/Mark_Directory)
openr,1,sir_idl_dir + 'scales' ; RUTA DIRECTORIO SCALE FILE
for i=0,9 do readf,1,b
readf,1,a
close,1
Expand Down Expand Up @@ -778,6 +779,21 @@ for i=1,nper do begin
resulti=fltarr(6,nlam(i-1))
openr,i,lisper(i-1)
readf,i,resulti
; --> deal with irregularly sampled (observed) profiles that have -1 values <--
; if there are wavelength positions where I,Q,U,V intensities are equal to -1
; then perform an interpolation of the valid (non-negative-one) points to create a profile
; with valid values at all points.
; This will help with plotting of these "irregularly sampled" profiles together with the
; inverted line profiles (which are calculated at all wavelength positions).
; - KPR, 02 June, 2017 - following suggestion by Momchil Molnar to interpolate over bad points,
; instead of trying to just drop them out.
for sp=2,5 do begin
valid_idx = WHERE(resulti[sp,*] GT -1,valid_count)
if valid_count LT nlam(i-1) then begin
resulti[sp,*] = INTERPOL(resulti[sp,valid_idx],resulti[1,valid_idx],resulti[1,*],Spline=1,Lsquad=0,Quad=0)
endif
endfor

insulti=resulti(where(is eq 1)+2,*)
close,i
resultper(i-1,indgen(ns),0:nlam(i-1)-1)=insulti
Expand Down Expand Up @@ -997,7 +1013,18 @@ if nstokes ne 0 then begin
miny=minper(i)
endelse

plot,profileres(0,i,0:nlam(0)-1),color=col2(icolor(0)),charsize=$
; --> deal with irregularly sampled (observed) profiles that have -1 values <--
; here is a second check, to make sure we are only plotting valid (non-negative-one) points
; these points should have been caught and interpolated over rmodprof above.
; This was actually a previous attempt to deal with these invalid points in
; irregularly sampled profiles. It works, but the problem is that the yrange is determined
; elsewhere (in escalable) where these negative values are still included, so the scaling is wrong.
; - KPR, 28 May, 2017

profileres_plot = REFORM(profileres(0,i,0:nlam(0)-1))
profileres_valid = WHERE(profileres_plot GT -1)

plot,profileres_valid,profileres_plot[profileres_valid],color=col2(icolor(0)),charsize=$
tamchar,xtitle=etiquestox,ytitle=etiquestoy(dondesto(i)),$
ystyle=1,yrange=[miny,maxy]

Expand Down Expand Up @@ -1592,7 +1619,8 @@ endif ;(-25)

if mag eq 'Scale' then begin ;(25)

spawn,'emacs ~/bin/scales'
sir_idl_dir = File_Dirname(Routine_Filepath(/Either),/Mark_Directory)
spawn,'emacs ' + sir_idl_dir + 'scales'

endif ;(-25)

Expand Down