non valid line labels

64 views
Skip to first unread message

sherry yeh

unread,
Jun 2, 2020, 4:00:36 AM6/2/20
to pyCloudy
I am running C3D and my Cloudy grids are executed successfully. But when I tried to plot line profiles, I got errors for line labels not valid. 


warng CloudyModel /Users/syeh/temp/models/M3D_1_18: H  1 4861.33A is not a correct line reference - 1
warng C3D
: H  1 4861.33A is not a valid reference
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-7ef30cafd85f> in <module>()
     
1 plt.figure(figsize=(10,10))
----> 2 plot_profiles(m3d, 55, 55)


<ipython-input-7-8691c129768c> in plot_profiles(m3d, x_pos, y_pos)
     
1 def plot_profiles(m3d, x_pos, y_pos):
----> 2     plt.plot(m3d.vel_tab,m3d.get_profile('H  1 4861.33A', axis='x')[:,x_pos,y_pos] * 5, label = r'H$\beta$')
     
3     plt.plot(m3d.vel_tab,m3d.get_profile('N  2 6583.45A', axis='x')[:,x_pos,y_pos] * 5, label = r'[NII]$\lambda$6584')
     
4     plt.plot(m3d.vel_tab,m3d.get_profile('O  3 5006.84A', axis='x')[:,x_pos,y_pos], label = r'[OIII]$\lambda$5007')
     
5     plt.legend()


TypeError: 'NoneType' object is not subscriptable



I looked up similar problems in this group, I have tried changing the line label format to 'H  1 4861A' but it was not recognized. The format in the example notebook 'H__1_486133A' was not recognized, either. 

I am running c17.01. Am I missing something? Thanks for your help.


-Sherry


Christophe Morisset

unread,
Jun 2, 2020, 11:18:50 AM6/2/20
to pyCloudy
Hi Sherry,

You first have to look at an individual model from your grid. The models are inthe liste_of_models variable, try with the first one:
M = liste_of_models[0]

And ask the object to give you the labels of the emission lines it contains:

print(M.emis_labels)

it should give you:

array(['H__1_486133A', 'H__1_656281A', 'CA_B_587564A', 'N__2_658345A', 'O__1_630030A', 'O__2_372603A', 'O__2_372881A', 'O__3_500684A', 'BLND_436300A'], dtype='<U12')

If not the case, have a look at the output of the models. The emission line emissivities are in the .emis files.

Christophe





Christophe Morisset

unread,
Jun 2, 2020, 11:45:26 AM6/2/20
to pyCloudy
Hi Sherry,

It seems to me that the label is not the issue, but rather the symptom. You need to have a look at the output of your models, it may be that the even did not run at all.
It is a very important when developing the script that you check the models "by hand": by inspecting the .out files to see if everything run as you expect.
Hope it helps,

Christophe

sherry yeh

unread,
Jun 3, 2020, 8:27:30 PM6/3/20
to pyCloudy
Hi Christophe, 

print(M.emis_labels)

really helped to show the correct line label format. I have figured out my problem, it was because I did not have Hbeta line emissivity saved. I could pull other lines that were saved, e.g. Halpha. 

I have one more question. How do I edit the "save element" list? There seems to be a default list somewhere but I could not find it, I would like to change the elements being saved. 

Thanks for your help again. 

-Sherry


Christophe Morisset

unread,
Jun 3, 2020, 9:04:57 PM6/3/20
to pyCloudy
Sure, this is available in the config object:

pc.config.SAVE_LIST_ELEMS
[['hydrogen', '.ele_H'],
 
['helium', '.ele_He'],
 
['carbon', '.ele_C'],
 
['nitrogen', '.ele_N'],
 
['oxygen', '.ele_O'],
 
['argon', '.ele_Ar'],
 
['neon', '.ele_Ne'],
 
['sulphur', '.ele_S'],
 
['chlorin', '.ele_Cl'],
 
['iron', '.ele_Fe'],
 
['silicon', '.ele_Si']]



as well as the other save parameters:
pc.config.SAVE_LIST
[['radius', '.rad'], ['continuum', '.cont'], ['physical conditions', '.phy'], ['overview', '.ovr'], ['heating', '.heat'], ['cooling', '.cool'], ['optical depth', '.opd']]



and the dust:
pc.config.SAVE_LIST_GRAINS

[['grain temperature', '.gtemp'],
 
['grain abundances', '.gabund'],
 
['grain D/G ratio', '.gdgrat']]



Saludos,
Christophe

Reply all
Reply to author
Forward
0 new messages