db.sqlite3 filled with isotopes
This commit is contained in:
29
isotables/fill_table.py
Normal file
29
isotables/fill_table.py
Normal file
@ -0,0 +1,29 @@
|
||||
import os
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] ='isotables.settings'
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from isotopapp.models import Isotope
|
||||
|
||||
with open("../isotopetable.dat") as f:
|
||||
for line in f:
|
||||
if line.startswith("%") or line.startswith("proton"): continue
|
||||
print(line)
|
||||
a,b,c,d,e,f,g,h,i = line.split()
|
||||
iso = Isotope.objects.create(
|
||||
n_protons=int(a),
|
||||
n_nucleons = int(b),
|
||||
stable = True if c=="-" else False,
|
||||
symbol = d,
|
||||
name = e,
|
||||
spin_quantum_number = float(f),
|
||||
gamma = float(g)*7.622593285, # MHz/T
|
||||
natural_abundance = float(h),
|
||||
)
|
||||
if i == "NaN":
|
||||
iso.quadrupole_moment = float(i)
|
||||
|
||||
iso.save()
|
||||
|
||||
|
Reference in New Issue
Block a user