Calculating Te and Ne in each pixel of 2d image

76 views
Skip to first unread message

Arzun karkee

unread,
Mar 15, 2024, 10:34:10 AM3/15/24
to PyNeb
Dear All,

I tried to use diags.getCrossTemDen to calculate Te and Ne in each pixel of 2d image using OIII 4363/5007 and SII 6731/6716 line ratio. However, I get nan values for both Te and Ne. 

The format of my input.dat file looks like this (I am showing just first four lines here):

NAME O3_4363A O3_5007A S2_6731A S2_6716A
ID1 0.93000 0.05000 0.17224200 0.10
ID2 1.93000 0.45000 1.172 0.15
ID3 0.43000 0.6000 0.8 0.10
ID4 0.63000 0.65000 0.14 0.12

The error message I get looks is here:

Observation: No error found for line O3_4363A Observation: adding line O3_4363A Observation: No error found for line O3_5007A Observation: adding line O3_5007A Observation: No error found for line S2_6731A Observation: adding line S2_6731A Observation: No error found for line S2_6716A Observation: adding line S2_6716A Diagnostics: Adding diag [OIII] 4363/5007 Atom O3: Making atom object for O 3 Atom O3: Reading atom data from o_iii_atom_FFT04-SZ00.dat getLevelsNIST: Reading energies and stat weights from o_iii_levels.dat Atom O3: Reading coll data from o_iii_coll_SSB14.dat Diagnostics: Adding diag [SII] 6731/6716 Atom S2: Making atom object for S 2 Atom S2: Reading atom data from s_ii_atom_RGJ19.dat getLevelsNIST: Reading energies and stat weights from s_ii_levels.dat Atom S2: Reading coll data from s_ii_coll_TZ10.dat Diagnostics: Adding diag [SII] 4072+/6720+ Diagnostics: Adding diag [SIII] 6312/18.7m Atom S3: Making atom object for S 3 Atom S3: Reading atom data from s_iii_atom_FFTI06.dat getLevelsNIST: Reading energies and stat weights from s_iii_levels.dat Atom S3: Reading coll data from s_iii_coll_TG99.dat Diagnostics: Adding diag [NeIII] 3930+/15.6m Atom Ne3: Making atom object for Ne 3 Atom Ne3: Reading atom data from ne_iii_atom_GMZ97.dat getLevelsNIST: Reading energies and stat weights from ne_iii_levels.dat Atom Ne3: Reading coll data from ne_iii_coll_McLB00.dat Diag.getCrossTemDen [OIII] 4363/5007 [SII] 6731/6716: 0 (max=5): not converged 0 of 4. Te = nan K, Ne = nan cm-3


I do not know how to provide the error values for those lines. 

I am looking forward to getting suggestions from you and I would appreciate it.

Thank you,
Arjun

Jorge García Rojas

unread,
Mar 15, 2024, 11:05:49 AM3/15/24
to Arzun karkee, PyNeb
Dear Arzun,

it seems that you are providing O3_4363 being more intense that O3_5007, or in other cases, of the same order. This is unphysical. Also values of S2 lines are quite weird. It might be the reason for the nans

On the other hand, if you have real observations, you can probably have the chance of estimate uncertainties, but if not, you can include a, let’s say 5% uncertainty in all the lines when reading your observation datafile

obs_data = ‘your_datafile’
obs = pn.Observation()
obs.readData(obs_data, fileFormat=‘lines_in_cols’,err_default=0.05)

then you instantiate digs

diags=pn.Diagnostics()
diags.addDiag('[OIII] 4363/5007','[SII] 6731/6716’)

and then do the getCrossTemDen

Te,Ne = diags.getCrossTemDen('[OIII] 4363/4959', '[SII] 6731/6716’, obs=obs)

hope it helps

Jorge
> --
> You received this message because you are subscribed to the Google Groups "PyNeb" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pyneb+un...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pyneb/6fb574c5-f3e6-4117-9df5-0561c65f72dbn%40googlegroups.com.

Arjun Karki

unread,
Mar 15, 2024, 12:01:47 PM3/15/24
to PyNeb
Dear Jorge,

Thank you so much for the quick response. After carefully inputting those numbers, it seems to be working now. I have a couple of questions again.

What is the unit of Ne here? Is it cm-1 or cm-3? When I looked at the some_example.ipynb file located in the PyNeb_devel github, I found that the unit of Ne is cm-1. Is it a typo, or do we need to transform to cm-3?

If I have the error values of those lines, how do I put them in the input.dat files so that I can calculate the error values on Te and Ne?

Warm regards,
Arjun

Jorge García Rojas

unread,
Mar 15, 2024, 1:06:01 PM3/15/24
to Arjun Karki, PyNeb
Dear Arjun,

the unit of Ne is cm-3. That is a bug in the some_examples.ipynb file

the labels for the errors in the lines are the same than the labels of the lines with an “e” at the end, i.e. O3_5007A for the line, O3_5007Ae for the error. The error can be in absolute value or in percentage (e.g. 0.05 if it is 5%) In the former case, you need to include in the instantiation of the observations that the error is absolute with errIsRelative=False (the default value is True)

cheers,

Jorge
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pyneb/46822b8e-1f72-4402-922b-d8921bd78154n%40googlegroups.com.

Arjun Karki

unread,
Mar 15, 2024, 2:02:20 PM3/15/24
to Jorge García Rojas, PyNeb
Dear Jorge,

Thank you so much for the clarification. One last question. To estimate Te, I want to use OIII 4959A too. So I modified the line:

Te,Ne = diags.getCrossTemDen('[OIII] 4363/5007+4959', '[SII] 6731/6716’, obs=obs)

This gave me an error message. However, after looking through manual, it suggest me to use:

Te,Ne = diags.getCrossTemDen('[OIII] 4363/5007+', '[SII] 6731/6716’, obs=obs)

Does adding + sign after 5007 in the above line take in account for OIII 4959A line automatically?

I am using an equation explained in Osterbrock and Ferland 2006 paper which is OIII 5007+4959 / 4363 to estimate Te here.

Also do we use

Te,Ne = diags.getCrossTemDen('[OIII] /5007+/4363', '[SII] 6731/6716’, obs=obs) because in the paper mentioned above, the terms OIII 5007+4959 is in numerator.

Please kindly let me know your thoughts.

Warm regards,
Arjun

Jorge García Rojas

unread,
Mar 15, 2024, 2:19:18 PM3/15/24
to Arjun Karki, PyNeb
Dear Arjun,

it does not matter to use a ratio or the inverse, as both have the same dependence in Te.

On the other hand, the two nebular [OIII] lines should have a constant ratio given by the ratio of transition probabilities, which for the most recent set of atomic data is around 2.98. This is easily checked if you compute the emissivities using pyneb of 5007 and 4959 and than compute the ratio

em5007 =O3.getEmissivity(10000, 10000, wave=5007)

em4959 =O3.getEmissivity(10000, 10000, wave=4959)

em5007/em4959
Out[17]: 2.9839690069718596

so using one or another is OK, and you can also use the sum, you need to add the diagnostic:

diags.addDiag('[SII] 6731/6716','[OIII] 4363/5007+’)

you can make the ratio of your 5007 and 4959 line fluxes to see if the data are OK

cheers,

Jorge

Arjun Karki

unread,
Mar 18, 2024, 12:35:04 PM3/18/24
to PyNeb
Dear Jorge,

Thank you so much for explaining my previous questions. 

I am currently using Pyneb to estimate Te and Ne for my real observation data. However, I am getting nan values for both Te and Ne in most cases. I am copying a few lines of data here:

NAME O3_4363A O3_5007A O3_4959A S2_6731A S2_6716A
ID1 17.613459080457687 50.903309397399426  32.35148213803768 11.20827336621005 19.116075988858938
ID2 13.930215276777744 67.8830000013113 36.58384218811989 5.489627681672573 19.13576928898692
ID3 16.03689394891262 77.2893594019115 40.96615865826607 6.2896848283708096 22.07397253252566
ID4 18.568594940006733 79.73030302673578 37.48535871505737 12.210168382152915 23.695646850392222
ID5 18.9664794690907 72.54866110160947 31.361287832260132 23.160460982471704 22.658460810780525

Are the Te and Ne values returned by Pyneb is sensitive to the values we provide?

Looking forward to hearing from you.

Warm regards,
Arjun

Christophe Morisset

unread,
Mar 18, 2024, 2:29:30 PM3/18/24
to PyNeb

So high values of 4363/5007 may indicate very high density gas. In this case the ratio is not anymore a density diagnostic, and looking for the crossing point with SII ratio does not work.
Ch.

Christophe Morisset

unread,
Mar 18, 2024, 2:31:05 PM3/18/24
to PyNeb
Sorry, should read:
In this case the ratio is not anymore a temperature diagnostic, but becomes a density diagnostic.

Arjun Karki

unread,
Mar 18, 2024, 3:13:21 PM3/18/24
to Christophe Morisset, PyNeb
Hi Christophe,

If the ratio becomes a density diagnostic, is it impossible to measure Te and Ne using Pyneb? Is there a way I can measure Te and Ne separately in Pyneb regardless of their ratio relationship?

Thank you,
Arjun

Christophe Morisset

unread,
Mar 18, 2024, 4:22:17 PM3/18/24
to PyNeb
It depends on the observations you have. You can have a look at this notebook where we explore some diagnostics.
Ch.

Arjun Karki

unread,
Mar 19, 2024, 10:16:35 AM3/19/24
to PyNeb
Dear Christophe,

Is it possible to just calculate Ne using [S II]λλ6716, 6731 doublet without calculating Te in Pyneb?

Please let me know what you think.

Warm regards,
Arjun

Christophe Morisset

unread,
Mar 22, 2024, 9:38:28 AM3/22/24
to PyNeb
Hi Arjun,
Sorry for the delay. This is actually described in the main PyNeb paper: http://adsabs.harvard.edu/abs/2015A%26A...573A..42L
Basically, you need to use the method getTemDen of an Atom object, giving the complementary physical property: if you want Te, you have to set den= in the calling sequence, if you want to obtain Ne, you have to provide the temperature tem=. Have a look at the help of the method.
But keep in mind that diagnistics (especially the density ones) have a validity range. This is described in the first part of the notebook I sent you in my last email.
Cheers,
Ch.
Reply all
Reply to author
Forward
0 new messages