Added spin factor scaling, fixed dostring for atoms per volume.

This commit is contained in:
jupfi 2024-06-11 17:42:01 +02:00
parent f0ce8840b7
commit fd20542c57
3 changed files with 9 additions and 5 deletions

View file

@ -38,7 +38,7 @@ class Sample:
name : str
The name of the sample.
atoms : float
The number of atoms in the sample.
The number of atoms per unit volume of the sample (1/m^3).
resonant_frequency : float
The resonant frequency of the sample in MHz.
gamma : float
@ -94,7 +94,7 @@ class Sample:
def calculate_atoms(self):
"""
Calculate the number of atoms in the sample per volume unit. This only works if the sample volume and atom density are provided.
Calculate the number of atoms in the sample per volume unit (1/m^3). This only works if the sample volume and atom density are provided.
Also the sample should be cylindrical.
If atom density and sample volume are provided, use these to calculate the number of atoms.

View file

@ -278,6 +278,10 @@ class Simulation:
* self.number_turns
/ self.length_coil
)
# Spin Factor Scaling
B1 = B1 * self.sample.spin_factor
return B1
def calc_xdis(self) -> np.array:

View file

@ -19,7 +19,7 @@ class TestSimulation(unittest.TestCase):
resonant_frequency=83.56e6, # Hz
gamma=43.42, # MHz/T
nuclear_spin= "9/2",
spin_factor=1.94
spin_factor=1.94,
powder_factor=0.75,
filling_factor=0.7,
T1=83.5, # µs
@ -76,8 +76,8 @@ class TestSimulation(unittest.TestCase):
def test_spin_factor_calculation(self):
spin = self.sample.nuclear_spin
transition = 1
spin = 2.5
transition = 2
spin_factor = self.sample.calculate_spin_transition_factor(spin, transition)
logger.info("Spin factor: " + str(spin_factor))