Use atomic data for lanthanide ions V-VII from Carvajal-Gallego et al. (MONS university)#4
Use atomic data for lanthanide ions V-VII from Carvajal-Gallego et al. (MONS university)#4ccollins22 wants to merge 25 commits intomainfrom
Conversation
lukeshingles
left a comment
There was a problem hiding this comment.
A few minor style issues, but what's really important is to add a test for the new functionality to avoid it getting broken by future changes. If the full dataset is too large, you can split out some representative data and test that. If it's under ~5MB, you can commit it directly to the repo.
| if levela is None or levela.parity is None or levelb.parity is None: | ||
| return False |
There was a problem hiding this comment.
When would levela be None?
There was a problem hiding this comment.
Because of energy_levels = [None]
Which I copied from your code to read Tanaka's data. Without initialising the array with None the lowest level doesn't get written out. With it levela doesn't have attribute parity and this fails
There was a problem hiding this comment.
Ok, that's a relic of our 1-based indexing that we inherited from the existing artis file formats. However, if any of your transitions are referencing the dummy level in the 0 index, that suggests that there is an off-by-one error in the indexing of transitions.
There was a problem hiding this comment.
Should the transitions array have a dummy value initialised too then?
There was a problem hiding this comment.
No, we don't really keep track of a transition index, and all transitions get written out in write_transition_data(). write_adata() skips the 0-index when writing out the list of levels for each ion.
There was a problem hiding this comment.
It's important to manually verify that the first couple of levels and transitions are recorded correctly in the artis output files, because indexing errors are very easy to make.
There was a problem hiding this comment.
One file with the transitions is ~30MB
There was a problem hiding this comment.
Just take a sample of a few hundred transitions and compress it with zstd.
artisatomic/__init__.py
Outdated
There was a problem hiding this comment.
This is better as far as not repeating the forbidden conditions in several places, but I'm not sure we want to pay the cost of two more Python function calls on each one of ~50 million transition. Did this affect performance in any significant way?
I think a better way (but can be left for a separate PR) would be to use a forbidden attribute on each transition.
There was a problem hiding this comment.
I didn't notice a big slow down but I didn't really check. Feel free to update
artisatomic/__init__.py
Outdated
artisatomic/readmonsdata.py
Outdated
There was a problem hiding this comment.
It's not a blocker, but I would strongly prefer to avoid using pandas in any new code (so that eventually we can remove the import and save ~500ms of startup time). Polars should be a drop-in replacement here.
There was a problem hiding this comment.
Feel free to update - I'm not used to polars yet
There was a problem hiding this comment.
I suggest getting the test in place first, and then these style fixes can be implemented safely with a big warning if anything breaks.
artisatomic/readmonsdata.py
Outdated
There was a problem hiding this comment.
Why use an iterator for lower and upper but then access transition_wavelength_A and oscillator_strength by index? Wouldn't it be better to zip all of these arrays? Shouldn't strict be True here?
There was a problem hiding this comment.
I didn't add strict - I've no idea what it does. I think it was the automated checks?
There was a problem hiding this comment.
I didn't add strict - I've no idea what it does. I think it was the automated checks?
Ruff modified it.
There was a problem hiding this comment.
Hmm, that's a bit of an annoying autofix. Strict=False will stop iterating at the shortest of any arrays, while strict=True will raise an exception if the lengths don't match. I think we almost always want strict=True.
artisatomic/readmonsdata.py
Outdated
There was a problem hiding this comment.
if you're not using the lowerlevel value from enumerate, why use enumerate? Better to zip lowerlevel, upperlevel, A_ul with strict=True to make sure they match lengths.
| @@ -0,0 +1,4 @@ | |||
| https://doi.org/10.5281/zenodo.10635803 | |||
There was a problem hiding this comment.
Please add direct URLs for the zip files that are needed as we do for other data sources.
There was a problem hiding this comment.
I'm not sure what the links are. Does it work to just add the files names to the end of the zenodo link?
There was a problem hiding this comment.
https://zenodo.org/records/10635803/files/outggf_Ln_V--VII.zip
https://zenodo.org/records/10635803/files/outglv_Ln_V--VII.zip
The readme should probably just be committed directly to the repo since it's so small.
There was a problem hiding this comment.
The info from the readme is in comments at the top of the file
| from astropy import constants as const | ||
| from astropy import units as u |
There was a problem hiding this comment.
Adding another dependency (astropy) to the package is not really necessary. hc_in_ev_cm and hc_in_ev_angstrom can be set with numeric literals.
4a34a7e to
aa59f68
Compare
610a929 to
fa9465b
Compare
No description provided.