Skip to content

Commit 421eac0

Browse files
committed
Add some examples of extracting and manipulating the data
The pandas module is very powerful, lets give a few examples of things that can be done.
1 parent c1ef971 commit 421eac0

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

+52
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,55 @@ No comparison or validation is done on common values.
4444
## Additional uses
4545

4646
If you want to do your own thing with the data, you could import this module, access `MassTable().full_data`, then sort, slice and filter the resultant dataframe to your heart's content.
47+
48+
For example, track how the accuracy of the mass excess of 18B changes once it is experimentally measured
49+
```python
50+
>>> import pynch.mass_table as mt
51+
>>> df = mt.MassTable().full_data
52+
>>> df[(df['A'] == 18) & (df['Z'] == 5)][['Experimental', 'NubaseMassExcess', 'NubaseMassExcessError', 'NubaseRelativeError', 'DiscoveryYear']]
53+
Experimental NubaseMassExcess NubaseMassExcessError NubaseRelativeError DiscoveryYear
54+
TableYear
55+
2003 False 52320.0 800.0 0.015291 1900
56+
2012 True 51850.0 170.0 0.003279 2010
57+
2016 True 51790.0 200.0 0.003862 2010
58+
2020 True 51790.0 200.0 0.003862 2010
59+
```
60+
Or for all of the A=100 isotopes from the 2012 table that have a mass-excess error < 10.0keV, print the A, Z, symbol and year of discovery
61+
```python
62+
>>> import pynch.mass_table as mt
63+
>>> df = mt.MassTable().full_data
64+
>>> df.query('TableYear == 2012 and A == 100 and NubaseMassExcessError < 10.0')[['A', 'Z', 'Symbol', 'DiscoveryYear']]
65+
A Z Symbol DiscoveryYear
66+
TableYear
67+
2012 100 40 Zr 1970
68+
2012 100 41 Nb 1967
69+
2012 100 42 Mo 1930
70+
2012 100 43 Tc 1952
71+
2012 100 44 Ru 1931
72+
2012 100 47 Ag 1970
73+
2012 100 48 Cd 1970
74+
```
75+
Or how does the NUBASE mass-excess compare with the AME value for experimentally measured isotopes from the latest table? Which are the 10 isotopes with the biggest differences?
76+
```python
77+
>>> import pynch.mass_table as mt
78+
>>> df = mt.MassTable().full_data
79+
>>> # Create a new column comparing the measured values
80+
>>> df['NUBASE-AME'] = df['NubaseMassExcess'] - df['AMEMassExcess']
81+
>>> # Extract the data for measured isotopes and from the latest table
82+
>>> df_comparison = df.query('TableYear == 2020 and Experimental == True')
83+
>>> # Sort the difference in measured data by absolute value and print the columns we are interested in
84+
>>> df_comparison.sort_values(by=['NUBASE-AME'], key=abs, ascending=False)[['A', 'Z', 'Symbol', 'NubaseMassExcess', 'AMEMassExcess', 'NUBASE-AME']].head(n=10)
85+
A Z Symbol NubaseMassExcess AMEMassExcess NUBASE-AME
86+
TableYear
87+
2020 221 91 Pa 20370.0 20374.937 -4.937
88+
2020 57 23 V -44440.0 -44435.063 -4.937
89+
2020 102 50 Sn -64930.0 -64934.896 4.896
90+
2020 168 75 Re -35790.0 -35794.889 4.889
91+
2020 209 89 Ac 8840.0 8844.887 -4.887
92+
2020 241 93 Np 54320.0 54315.115 4.885
93+
2020 121 56 Ba -70740.0 -70744.847 4.847
94+
2020 122 55 Cs -78140.0 -78144.769 4.769
95+
2020 206 89 Ac 13480.0 13484.754 -4.754
96+
2020 23 9 F 3290.0 3285.263 4.737
97+
```
98+
These are slightly contrived examples, but hopefully you get the idea. The data can be manipulated and added to as required.

0 commit comments

Comments
 (0)