diff --git a/src/hyspecppt/hppt/hppt_model.py b/src/hyspecppt/hppt/hppt_model.py index 002bd71..788eef1 100644 --- a/src/hyspecppt/hppt/hppt_model.py +++ b/src/hyspecppt/hppt/hppt_model.py @@ -5,7 +5,7 @@ import numpy as np from scipy.constants import e, hbar, m_n -from .experiment_settings import DEFAULT_EXPERIMENT, PLOT_TYPES, MaxQ +from .experiment_settings import DEFAULT_CROSSHAIR, DEFAULT_EXPERIMENT, DEFAULT_LATTICE, DEFAULT_MODE, PLOT_TYPES, MaxQ logger = logging.getLogger("hyspecppt") @@ -13,15 +13,15 @@ class SingleCrystalParameters: """Model for single crystal calculations""" - a: float - b: float - c: float - alpha: float - beta: float - gamma: float - h: float - k: float - l: float + a: float = DEFAULT_LATTICE["a"] + b: float = DEFAULT_LATTICE["b"] + c: float = DEFAULT_LATTICE["c"] + alpha: float = DEFAULT_LATTICE["alpha"] + beta: float = DEFAULT_LATTICE["beta"] + gamma: float = DEFAULT_LATTICE["gamma"] + h: float = DEFAULT_LATTICE["h"] + k: float = DEFAULT_LATTICE["k"] + l: float = DEFAULT_LATTICE["l"] def __init__(self) -> None: """Constructor""" @@ -97,9 +97,9 @@ def calculate_modQ(self) -> float: class CrosshairParameters: """Model for the crosshair parameters""" - modQ: float - DeltaE: float - current_experiment_type: str + modQ: float = DEFAULT_CROSSHAIR["modQ"] + DeltaE: float = DEFAULT_CROSSHAIR["DeltaE"] + current_experiment_type: str = DEFAULT_MODE["current_experiment_type"] sc_parameters: SingleCrystalParameters experiment_types = ["single_crystal", "powder"] diff --git a/tests/hppt_model/test_HyspecPPTModel.py b/tests/hppt_model/test_hyspecpptmodel.py similarity index 72% rename from tests/hppt_model/test_HyspecPPTModel.py rename to tests/hppt_model/test_hyspecpptmodel.py index ef72c15..7f43c4c 100644 --- a/tests/hppt_model/test_HyspecPPTModel.py +++ b/tests/hppt_model/test_hyspecpptmodel.py @@ -1,6 +1,6 @@ import numpy as np # noqa: F401 -import hyspecppt.hppt.hppt_model as hppt_model # noqa: F401 +from hyspecppt.hppt.hppt_model import HyspecPPTModel # noqa: F401 def test_single_crystal_parameter_set_parameters(): diff --git a/tests/hppt_model/test_single_crystal_model.py b/tests/hppt_model/test_single_crystal_model.py index b4cd299..3164883 100644 --- a/tests/hppt_model/test_single_crystal_model.py +++ b/tests/hppt_model/test_single_crystal_model.py @@ -1,11 +1,11 @@ import numpy as np -import hyspecppt.hppt.hppt_model as hppt_model +from hyspecppt.hppt.hppt_model import CrosshairParameters, SingleCrystalParameters def test_single_crystal_parameter_set_parameters(): """Test SingleCrystalParameters set_parameters function""" - scp = hppt_model.SingleCrystalParameters() + scp = SingleCrystalParameters() sc_data = {"a": 1.0, "b": 1.0, "c": 1.0, "alpha": 90.0, "beta": 90, "gamma": 90, "h": 0, "k": 0, "l": 0} scp.set_parameters(sc_data) @@ -22,7 +22,7 @@ def test_single_crystal_parameter_set_parameters(): def test_single_crystal_parameter_get_parameters(): """Test SingleCrystalParameters get_parameters function""" - scp = hppt_model.SingleCrystalParameters() + scp = SingleCrystalParameters() sc_data = {"a": 1.0, "b": 1.0, "c": 1.0, "alpha": 90.0, "beta": 90, "gamma": 90, "h": 0, "k": 0, "l": 0} scp.set_parameters(sc_data) @@ -39,7 +39,7 @@ def test_single_crystal_parameter_get_parameters(): def test_single_crystal_parameter_calculate_modQ(): """Test SingleCrystalParameters calculate_modQ function""" - scp = hppt_model.SingleCrystalParameters() + scp = SingleCrystalParameters() sc_data = {"a": 1.0, "b": 1.0, "c": 1.0, "alpha": 90.0, "beta": 90, "gamma": 90, "h": 0, "k": 0, "l": 0} scp.set_parameters(sc_data) assert scp.calculate_modQ() == 0.0 @@ -65,7 +65,7 @@ def test_single_crystal_parameter_calculate_modQ(): def test_cross_hair_parameters_set_crosshair(): """Test Crosshair set_crosshair function""" - cp = hppt_model.CrosshairParameters() + cp = CrosshairParameters() current_experiment_type = "single_crystal" DeltaE = 10.0 modQ = 1.23 @@ -82,7 +82,7 @@ def test_cross_hair_parameters_set_crosshair(): def test_get_cross_hair_parameters_set_crosshair(): """Test Crosshair get_crosshair function""" - cp = hppt_model.CrosshairParameters() + cp = CrosshairParameters() current_experiment_type = "single_crystal" DeltaE = 10.0 modQ = 1.23