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 
Switch to threaded view of this topic Create a new topic Submit Reply
Creating an imcountour for a bpt [message #94451] Wed, 24 May 2017 12:55 Go to next 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.
Re: Creating an imcountour for a bpt [message #94455 is a reply to message #94451] Thu, 25 May 2017 07:24 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
You show a full program and say you are having difficulty but you don't say what the difficulty is. Are you getting an error message? Does the plot not show up? Anyway here are some suggestions?

1. I am not certain where you are getting the program TVSCALE, but it is likely a very old program from David Fanning's library that was replaced by CGIMAGE (http://www.idlcoyote.com/programs/cgimage.pro). After 2011 all improvements, and bug fixes only occurred in CGIMAGE.

2. I also suspect that you getting IMCONTOUR from https://idlastro.gsfc.nasa.gov/ftp/pro/astro/imcontour.pro Make sure you have a recent version.

3. Why are you setting NLEVELS = 0? Do you want to show a CONTOUR plot with zero levels? If you don't want contours, and are just using imcontour.pro for astronomical labeling then it is better to set the /nodata keyword.

--Wayne

On Wednesday, May 24, 2017 at 3:55:12 PM UTC-4, Rafael Cirolini wrote:

> 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:
  Switch to threaded view of this topic Create a new topic Submit Reply
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 07:14:37 PDT 2025

Total time taken to generate the page: 0.00505 seconds