mirror of
https://github.com/nqrduck/nqr-blochsimulator.git
synced 2024-06-27 07:49:07 +00:00
Added spin factor scaling, fixed dostring for atoms per volume.
This commit is contained in:
parent
f0ce8840b7
commit
fd20542c57
|
@ -38,7 +38,7 @@ class Sample:
|
||||||
name : str
|
name : str
|
||||||
The name of the sample.
|
The name of the sample.
|
||||||
atoms : float
|
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
|
resonant_frequency : float
|
||||||
The resonant frequency of the sample in MHz.
|
The resonant frequency of the sample in MHz.
|
||||||
gamma : float
|
gamma : float
|
||||||
|
@ -94,7 +94,7 @@ class Sample:
|
||||||
|
|
||||||
def calculate_atoms(self):
|
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.
|
Also the sample should be cylindrical.
|
||||||
|
|
||||||
If atom density and sample volume are provided, use these to calculate the number of atoms.
|
If atom density and sample volume are provided, use these to calculate the number of atoms.
|
||||||
|
|
|
@ -278,6 +278,10 @@ class Simulation:
|
||||||
* self.number_turns
|
* self.number_turns
|
||||||
/ self.length_coil
|
/ self.length_coil
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Spin Factor Scaling
|
||||||
|
B1 = B1 * self.sample.spin_factor
|
||||||
|
|
||||||
return B1
|
return B1
|
||||||
|
|
||||||
def calc_xdis(self) -> np.array:
|
def calc_xdis(self) -> np.array:
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TestSimulation(unittest.TestCase):
|
||||||
resonant_frequency=83.56e6, # Hz
|
resonant_frequency=83.56e6, # Hz
|
||||||
gamma=43.42, # MHz/T
|
gamma=43.42, # MHz/T
|
||||||
nuclear_spin= "9/2",
|
nuclear_spin= "9/2",
|
||||||
spin_factor=1.94
|
spin_factor=1.94,
|
||||||
powder_factor=0.75,
|
powder_factor=0.75,
|
||||||
filling_factor=0.7,
|
filling_factor=0.7,
|
||||||
T1=83.5, # µs
|
T1=83.5, # µs
|
||||||
|
@ -76,8 +76,8 @@ class TestSimulation(unittest.TestCase):
|
||||||
|
|
||||||
def test_spin_factor_calculation(self):
|
def test_spin_factor_calculation(self):
|
||||||
|
|
||||||
spin = self.sample.nuclear_spin
|
spin = 2.5
|
||||||
transition = 1
|
transition = 2
|
||||||
|
|
||||||
spin_factor = self.sample.calculate_spin_transition_factor(spin, transition)
|
spin_factor = self.sample.calculate_spin_transition_factor(spin, transition)
|
||||||
logger.info("Spin factor: " + str(spin_factor))
|
logger.info("Spin factor: " + str(spin_factor))
|
||||||
|
|
Loading…
Reference in a new issue