Using ANN to compute Te and ne

55 views
Skip to first unread message

Grace R.

unread,
Aug 26, 2025, 10:41:09 AMAug 26
to PyNeb
Hi all,

I have been trying to calculate a Te and ne for OIII and OII temperatures using the ANN method in Pyneb for 10000 simulations (obs.addMonteCarloObs(10000))  as I am trying to propagate uncertainties for the Te calculations:

diags.ANN_init_kwargs = {'solver': 'lbfgs', 'activation': 'tanh', 'hidden_layer_sizes': (10, 30, 10), 'max_iter': 20000}
diags.ANN_inst_kwargs = {'RM_type': 'SK_ANN', 'verbose': False, 'scaling': True, 'use_log': True, 'random_seed': 42}

Te_OIII, Ne_OII = diags.getCrossTemDen('[OIII] 4363/5007', '[OII] 3726/3729', obs=obs, use_ANN=True, start_tem=1e3, end_den=1e4, limit_res=True)
Te_OII, Ne_OII = diags.getCrossTemDen('[OII] b3727/b7325', '[OII] 3726/3729', obs=obs, use_ANN=True, start_tem=1e3, end_den=1e4, limit_res=True)

However, I run into an issue when getting the mean and standard deviation for the OII temperature for each value in the map where it gives an uncertainty of '0' (i.e. no distribution of OII temperatures). This is not the case for OIII where I am able to get the OIII distribution and uncertainty with no issues.

Would you be able to advise whether I am using the ANN correctly or provide any assistance with this? Thank you so much for your time and help!

Best,
Grace

Christophe Morisset

unread,
Aug 30, 2025, 12:31:39 PMAug 30
to PyNeb
Hi Grace,
Sorry for the delay to answer. Could you tell me how you define the '[OII] b3727/b7325' diagnostic? What are the mean and std values for b3727, b7325, 3726, and 3729 intensity distributions?
Thanks,
Christophe 

Grace R.

unread,
Sep 2, 2025, 12:13:27 PMSep 2
to PyNeb
Hi Christophe,

The OII diagnostic is defined as:

diags.addDiag('[OII] b3727/b7325', ('O2', '(I(3,1)+I(2,1))/(I(5,3)+I(5,2)+I(4,3)+I(4,2))', 'RMS([E(3726)*L(3726)/(L(3726)+L(3729)), E(3729)*L(3729)/(L(3726)+L(3729)),E("7319A+")*L("7319A+")/(L("7319A+")+L("7330A+")),E("7330A+")*L("7330A+")/(L("7319A+")+L("7330A+"))])'))

I am also trying to reproduce values from this paper: https://arxiv.org/pdf/1204.4507 (see Table 2 and 5), but my values for the OII temperature and OII density only are off by a large margin, even though I am able to reproduce the final abundances correctly.

Thanks,
Grace

Christophe Morisset

unread,
Sep 8, 2025, 10:47:08 AMSep 8
to PyNeb
Hi Grace,
I do not see any problems with the OII temperature diagnostic as you defined it. You may need to check your observations, they may not be what you think. 
In this notebook I test it by generating 2000 fake observations, you can compare the distribution with what you observe.
I also plot at the den the error between the input values and the ANN-pyneb derived values, agreeing with a few percents.
Hope it helps,
Christophe

TeNe_ANN_OII.ipynb
Reply all
Reply to author
Forward
0 new messages