db.sqlite3 filled with isotopes

This commit is contained in:
2025-03-20 22:05:44 +01:00
parent b849274618
commit 0d55853f03
24 changed files with 381 additions and 0 deletions

29
isotables/fill_table.py Normal file
View 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()