comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Creating an imcountour for a bpt
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Creating an imcountour for a bpt [message #94451] Wed, 24 May 2017 12:55 Go to previous message
Rafael Cirolini is currently offline  Rafael Cirolini
Messages: 3
Registered: May 2017
Junior Member
I need do create a spatially resolved BPT diagram. To do that i need to do make some kind of mathematical relation between curves to be able to make the contour plot. My program:

PRO BPT

lista="lista_mpl5"

readcol, lista, obj, redshift, format='A,f', skipline=0

for w=0,size(obj, /n_elements)-1 do begin
f=mrdfits(obj[w], 0, hdr)

; ### Center pixel position read in the header

x0=string(STRCOMPRESS(sxpar(hdr,'CRPIX1'), /remove_all))
y0=string(STRCOMPRESS(sxpar(hdr,'CRPIX2'), /remove_all))
r=5

; ### Mask with radius "r"

mask=f[*,*,0]*0+1
for i=0, size(f[*,0,0],/n_elements)-1, 1 do begin
for j=0, size(f[0,*,0],/n_elements)-1, 1 do begin
rad=((i-x0)^2+(j-y0)^2)^0.5
if (rad gt r) then begin
f[i,j,*]=0
mask[i,j]=0
endif
endfor
endfor

; ### Lines definitions

Stars=f[*,*,0]
OII=f[*,*,1]
Hb=f[*,*,2]
OIII=f[*,*,3]
OI_6300=f[*,*,4]
OI_6365=f[*,*,5]
Ha=f[*,*,6]
NII=f[*,*,7]
SII_6716=f[*,*,8]
SII_6730=f[*,*,9]

; ### Device for bpt

out='bptr-plot.ps'
;out=string(STRCOMPRESS(sxpar('MANGAID'), /remove_all))+"-rsbpt.ps"
SET_plot, 'ps'
DEVICE, BITS_PER_PIXEL=8, FILENAME=out, /portrait, FONT_SIZE=14, /color, xsize=18, ysize=18, /cmyk
;plot, NIIHA, OIIIHB, psym=2, xstyle=1, ystyle=1, yrange=[-1.2,1.59], xrange=[-1.49,0.49], thick=5, $
;xtitle=textoidl('log [NII]/H\alpha'), ytitle=textoidl('log [OIII]/H\beta'), charsize=1.3, position=p, /noerase

; ### Mask for the resolved bpt

p = [-1.5, -0.5, 0.0, 0.5]

; # mask1

mask=mask*0
for i=0, size(f[*,0,0],/n_elements)-1, 1 do begin
for j=0, size(f[0,*,0],/n_elements)-1, 1 do begin
if alog10(OIII[i,j]/Hb[i,j]) gt 0.0 and alog10(NII[i,j]/Ha[i,j]) gt -0.4 then begin
mask[i,j]=1
endif
endfor
endfor

; ### BPT Equations
NHA=NII/Ha
OHB=OIII/Hb

NIIHA=alog10(NHA)
OIIIHB=alog10(OHB)
endfor

loadct, 12
tvscale, mask, /KEEP_ASPECT_RATIO, POSITION=p, margin=0.001
loadct, 6
imcontour, mask, hdr, nlevels=0, /Noerase, min_value=500, max_value=501, TYPE=0, xminor=-1.5, yminor=-1.5, position=p


device, /close

end


First the program makes a mask on the central pixel of the cube and does the operations of the emission lines that are the characteristic of the diagram. Right after the mascara I'm trying to create to first create the tvscale and then the imcountour, which is exactly where I'm having difficulty. I think this part is probably wrong because it's my first time creating an imcountour. The equations of the curves where the diagram is defined are these:

x=findgen(135)*0.01-1.49
y= 0.61/(x-0.05)+1.3
oplot, x, y, color=100, thick=5
xyouts, 0.66, 0.35, 'Kauffmann+03', color=100 , /normal, charsize=1.2, charthic=3, orientation=-80

x=findgen(175)*0.01-1.49
y= 0.61/(x-0.47)+1.19
oplot, x, y, color='100', thick=6, linestyle=1
xyouts, 0.81, 0.35, 'Kewley+01', /normal, color='100', charsize=1.2, charthic=3, orientation=-78

x=findgen(94)*0.01-0.435
y= 1.01 * x + 0.48
oplot, x, y, color='100', thick=7
xyouts, 0.82, 0.62, 'Kewley+06', color='100', /normal, charsize=1.2, charthic=3, orientation=37

I have to make regions where they define the plotted points between the curves and above and below, and so on.Any idea how I can do this? Any idea is already of great help. Thanks.
[Message index]
 
Read Message
Read Message
Previous Topic: Plotting Vectors on Map Objects
Next Topic: IDL to python bridge Library not loaded: libidl.8.5.dylib

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 10:54:32 PDT 2025

Total time taken to generate the page: 0.00430 seconds