Supported ratios

58 views
Skip to first unread message

Randolf Klein

unread,
Apr 7, 2022, 2:18:37 PM4/7/22
to PDR Toolbox
Hi,

I'm trying to run pdrtpy with measurement of FIR, OI_145, and CO_1413 (respective intensity labels). When I run the model (wk2006, z=1), it fails ungracefully (IndexError: list index out of range; in pdrutils.py line 280, in firstkey(d)). I guess that is because none of the ratios that can be formed from these measurements are in the list of supported ratios. Is there a reason why not? I mean, indirectly all these intensities are predicted by the model.
FIR and OI_145 are supported intensities and CO_1413 can be derived from e.g. CO_54*(CO_1413/CO_54).
Can I add these additional intensities? If yes, how? Or do I need to add respective ratios? 

Thanks,
Randolf

Marc W. Pound

unread,
Apr 10, 2022, 4:06:19 PM4/10/22
to Randolf Klein, PDR Toolbox
hi Randolf

Sorry for the delayed reply, this for some reason went to my spam folder.    Can you supply a minimally failing example?  If  there were not matching ratios you should have been told, i.e., it should not have gotten to an ungraceful error.   

thanks,
Marc


--
You received this message because you are subscribed to the Google Groups "PDR Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdrt+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdrt/a9ae77b5-c638-4629-a312-aefb230d5129n%40googlegroups.com.


--
Dr. Marc Pound
Research Scientist
Astronomy Department
University of Maryland, College Park

Randolf Klein

unread,
Apr 13, 2022, 12:57:10 PM4/13/22
to Marc W. Pound, PDR Toolbox
Hi Marc,

Thanks for the reply. Please find attached a minimally failing example.
I tried to follow Example 3 "Determining Radiation Field and Density”. I hope I didn’t make a stupid mistake.

Best,
Randolf

supported_line_ratios.ipynb

Marc W. Pound

unread,
Apr 18, 2022, 11:50:15 AM4/18/22
to Randolf Klein, PDR Toolbox
Hi Randolf,

This is indeed a bug.  It should have failed gracefully because there are no ratios that match your observations.  

The toolbox only does fits for the precomputed ratios (not intensities) in your chosen ModelSet.   In principle, it could figure out if a matching ratio could be made from the ratios and intensities it has available, but that seems too complicated, especially as the number of models or measurements grows.     A better way is for the user to calculate the ratio they want from available models and add it to a ModelSet.  Models (which are instances of Measurement) obey arithmetic operators, so the burden would be low for the user.  This functionality is not yet available but high on my list of features to implement since others have requested it and I also want it myself!  

Thanks for finding the bug and I'll keep you apprised of development of the desired feature.

Marc


Aaron Bryant

unread,
Jan 11, 2023, 9:49:53 AM1/11/23
to PDR Toolbox
Hello Marc,

sorry for the revival of this old thread, but I will add my predicament to this conversation as it is related to Randolf's. I have measurements for OI_63, OI_145, CII_158 and CO_1413. I arithmetically compute the ratio CII_158/CO_1413 using (CII_158/CO_65)/(CO_1413/CO_65) and added it to the modelset. ms.user_added_models returns "CII_158/CO_1413", and ms.supported_ratios shows it at the bottom of the list, so all good so far, and a quick glance at the fits file seems to make sense.

I use the modelset to make my LineRatioFit, with all 4 lines as measurements and run it. I can see the new model made it in with lrf.modelset.user_added_models returning [''CII_158/CO_1413'], and that CO_1413 made it in with lrf.measurementIDs returning dict_keys(['OI_63', 'OI_145', 'CII_158', 'CO_1413']), so again all good.

However looking at the results, the ratio is not used, and lrf.observed_ratios returns ['OI_63/CII_158', 'OI_145/OI_63', 'CII_158/OI_145']. Furthermore, lrf.modelset.model_ratios(["OI_63", "OI_145", "CII_158", "CO_1413"]) returns the same. So despite the model being available for use, and the 1413 line being included in the measurements, it seems to not want to use it.

Am I missing something obvious here?

thanks and regards,
Aaron

Marc W. Pound

unread,
Jan 11, 2023, 10:27:34 AM1/11/23
to Aaron Bryant, PDR Toolbox
Hi Aaron

Can you verify what version of pdrtpy you are using?

import pdrtpy
pdrtpy.version()

I'm pretty sure I fixed this in 2.2.9 and the current version is 2.3.0.   To make sure you have the newest:

pip install pdrtpy -U

If you still have the bug with the latest version, please send me a script or notebook so I can reproduce.

thanks
Marc


Aaron Bryant

unread,
Jan 11, 2023, 11:17:43 AM1/11/23
to PDR Toolbox
Hi Marc,


D'oh!

I was using 2.2.9, updating to 2.3.0 fixed it, thanks. However the toolbox website still lists 2.2.9 as the current version. The only remaining issue I see is that, despite setting a title for the new model like ms.add_model("CII_158/CO_1413", ciico1413, title = "[C II] 158 $\mu$m / CO(J=14-13)"), this title is not propagated to plots such as ratios_on_models:

ratios_on_models.png

thanks,
Aaron

Marc W. Pound

unread,
Jan 11, 2023, 11:35:31 AM1/11/23
to PDR Toolbox
Hi Aaron,

Glad this fixed the main problem.    I will fix the title issue, as I am working on getting 2.3.1 out very soon.    2.3.1 is mainly updates to the KOSMA-tau models, but I keep finding "little things" -- like your title problem -- that need to be fixed.     I've corrected the website. 

thanks
Marc
Reply all
Reply to author
Forward
0 new messages