Skip to content

settings

ConvolutionSettings

Bases: EasyDynamicsBase

Settings for numerical convolutions.

Source code in src/easydynamics/settings/convolution_settings.py
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
class ConvolutionSettings(EasyDynamicsBase):
    """
    Settings for numerical convolutions.
    """

    def __init__(
        self,
        upsample_factor: Numeric | None = 5,
        extension_factor: Numeric | None = 0.2,
        suppress_warnings: bool = False,
        display_name: str | None = 'MyConvolutionSettings',
        unique_name: str | None = None,
    ) -> None:
        """
        Initialize the ConvolutionSettings.

        Parameters
        ----------
        upsample_factor : Numeric | None, default=5
            The factor by which to upsample the input data before convolution.
        extension_factor : Numeric | None, default=0.2
            The factor by which to extend the input data range before convolution.
        suppress_warnings : bool, default=False
            Whether to suppress warnings about wide or narrow peaks in the models.
        display_name : str | None, default='MyConvolutionSettings'
            Display name of the model.
        unique_name : str | None, default=None
            Unique name of the model. If None, a unique name will be generated.

        Raises
        ------
        TypeError
            If upsample_factor is not a number or None. If extension_factor is not a number or
            None. If suppress_warnings is not a boolean.
        ValueError
            If upsample_factor is not greater than 1. If extension_factor is negative.
        """
        super().__init__(
            display_name=display_name,
            unique_name=unique_name,
        )

        if extension_factor is not None:
            if not isinstance(extension_factor, Numeric):
                raise TypeError('Extension factor must be a number.')
            extension_factor = float(extension_factor)
            if extension_factor < 0.0:
                raise ValueError('Extension factor must be non-negative.')
        self._extension_factor = extension_factor

        if upsample_factor is not None:
            if not isinstance(upsample_factor, Numeric):
                raise TypeError('Upsample factor must be a numerical value or None.')
            upsample_factor = float(upsample_factor)
            if upsample_factor <= 1.0:
                raise ValueError('Upsample factor must be greater than 1.')
        self._upsample_factor = upsample_factor

        if not isinstance(suppress_warnings, bool):
            raise TypeError('suppress_warnings must be True or False.')
        self._suppress_warnings = suppress_warnings

        self._convolution_plan_is_valid = False

    @property
    def upsample_factor(self) -> Numeric | None:
        """
        Get the upsample factor.

        Returns
        -------
        Numeric | None
            The upsample factor.
        """

        return self._upsample_factor

    @upsample_factor.setter
    def upsample_factor(self, factor: Numeric | None) -> None:
        """
        Set the upsample factor and recreate the dense grid.

        Parameters
        ----------
        factor : Numeric | None
            The new upsample factor.

        Raises
        ------
        TypeError
            If factor is not a number or None.
        ValueError
            If factor is not greater than 1.
        """
        if factor is None:
            self._upsample_factor = factor
            self.convolution_plan_is_valid = False
            return

        if not isinstance(factor, Numeric):
            raise TypeError('Upsample factor must be a numerical value or None.')
        factor = float(factor)
        if factor <= 1.0:
            raise ValueError('Upsample factor must be greater than 1.')

        self._upsample_factor = factor

        self.convolution_plan_is_valid = False

    @property
    def extension_factor(self) -> float:
        """
        Get the extension factor.

        The extension factor determines how much the energy range is extended on both sides before
        convolution. 0.2 means extending by 20% of the original energy span on each side

        Returns
        -------
        float
            The extension factor.
        """

        return self._extension_factor

    @extension_factor.setter
    def extension_factor(self, factor: Numeric) -> None:
        """
        Set the extension factor and recreate the dense grid.

        The extension factor determines how much the energy range is extended on both sides before
        convolution. 0.2 means extending by 20% of the original energy span on each side.

        Parameters
        ----------
        factor : Numeric
            The new extension factor.

        Raises
        ------
        TypeError
            If factor is not a number.
        ValueError
            If factor is negative.
        """

        if not isinstance(factor, Numeric):
            raise TypeError('Extension factor must be a number.')
        if factor < 0.0:
            raise ValueError('Extension factor must be non-negative.')

        self._extension_factor = float(factor)
        self.convolution_plan_is_valid = False

    @property
    def convolution_plan_is_valid(self) -> bool:
        """
        Get whether the convolution plan is valid.

        Returns
        -------
        bool
            Whether the convolution plan is valid.
        """
        return self._convolution_plan_is_valid

    @convolution_plan_is_valid.setter
    def convolution_plan_is_valid(self, is_valid: bool) -> None:
        """
        Set whether the convolution plan is valid.

        Parameters
        ----------
        is_valid : bool
            Whether the convolution plan is valid.

        Raises
        ------
        TypeError
            If is_valid is not a bool.
        """
        if not isinstance(is_valid, bool):
            raise TypeError('convolution_plan_is_valid must be True or False.')
        self._convolution_plan_is_valid = is_valid

    @property
    def suppress_warnings(self) -> bool:
        """
        Get whether to suppress warnings.

        Returns
        -------
        bool
            Whether to suppress warnings.
        """
        return self._suppress_warnings

    @suppress_warnings.setter
    def suppress_warnings(self, suppress: bool) -> None:
        """
        Set whether to suppress warnings.

        Parameters
        ----------
        suppress : bool
            Whether to suppress warnings.

        Raises
        ------
        TypeError
            If suppress is not a bool.
        """
        if not isinstance(suppress, bool):
            raise TypeError('suppress_warnings must be True or False.')
        self._suppress_warnings = suppress

    def __repr__(self) -> str:
        """
        Return a string representation of the ConvolutionSettings.

        Returns
        -------
        str
            A string representation of the ConvolutionSettings.
        """
        return (
            f'{self.__class__.__name__}('
            f'upsample_factor={self.upsample_factor}, '
            f'extension_factor={self.extension_factor}, '
            f'suppress_warnings={self.suppress_warnings})'
        )

upsample_factor property writable

Get the upsample factor.

Returns:

Type Description
Numeric | None

The upsample factor.

extension_factor property writable

Get the extension factor.

The extension factor determines how much the energy range is extended on both sides before convolution. 0.2 means extending by 20% of the original energy span on each side

Returns:

Type Description
float

The extension factor.

convolution_plan_is_valid property writable

Get whether the convolution plan is valid.

Returns:

Type Description
bool

Whether the convolution plan is valid.

suppress_warnings property writable

Get whether to suppress warnings.

Returns:

Type Description
bool

Whether to suppress warnings.

__init__(upsample_factor=5, extension_factor=0.2, suppress_warnings=False, display_name='MyConvolutionSettings', unique_name=None)

Initialize the ConvolutionSettings.

Parameters:

Name Type Description Default
upsample_factor Numeric | None

The factor by which to upsample the input data before convolution.

5
extension_factor Numeric | None

The factor by which to extend the input data range before convolution.

0.2
suppress_warnings bool

Whether to suppress warnings about wide or narrow peaks in the models.

False
display_name str | None

Display name of the model.

'MyConvolutionSettings'
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None

Raises:

Type Description
TypeError

If upsample_factor is not a number or None. If extension_factor is not a number or None. If suppress_warnings is not a boolean.

ValueError

If upsample_factor is not greater than 1. If extension_factor is negative.

Source code in src/easydynamics/settings/convolution_settings.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def __init__(
    self,
    upsample_factor: Numeric | None = 5,
    extension_factor: Numeric | None = 0.2,
    suppress_warnings: bool = False,
    display_name: str | None = 'MyConvolutionSettings',
    unique_name: str | None = None,
) -> None:
    """
    Initialize the ConvolutionSettings.

    Parameters
    ----------
    upsample_factor : Numeric | None, default=5
        The factor by which to upsample the input data before convolution.
    extension_factor : Numeric | None, default=0.2
        The factor by which to extend the input data range before convolution.
    suppress_warnings : bool, default=False
        Whether to suppress warnings about wide or narrow peaks in the models.
    display_name : str | None, default='MyConvolutionSettings'
        Display name of the model.
    unique_name : str | None, default=None
        Unique name of the model. If None, a unique name will be generated.

    Raises
    ------
    TypeError
        If upsample_factor is not a number or None. If extension_factor is not a number or
        None. If suppress_warnings is not a boolean.
    ValueError
        If upsample_factor is not greater than 1. If extension_factor is negative.
    """
    super().__init__(
        display_name=display_name,
        unique_name=unique_name,
    )

    if extension_factor is not None:
        if not isinstance(extension_factor, Numeric):
            raise TypeError('Extension factor must be a number.')
        extension_factor = float(extension_factor)
        if extension_factor < 0.0:
            raise ValueError('Extension factor must be non-negative.')
    self._extension_factor = extension_factor

    if upsample_factor is not None:
        if not isinstance(upsample_factor, Numeric):
            raise TypeError('Upsample factor must be a numerical value or None.')
        upsample_factor = float(upsample_factor)
        if upsample_factor <= 1.0:
            raise ValueError('Upsample factor must be greater than 1.')
    self._upsample_factor = upsample_factor

    if not isinstance(suppress_warnings, bool):
        raise TypeError('suppress_warnings must be True or False.')
    self._suppress_warnings = suppress_warnings

    self._convolution_plan_is_valid = False

__repr__()

Return a string representation of the ConvolutionSettings.

Returns:

Type Description
str

A string representation of the ConvolutionSettings.

Source code in src/easydynamics/settings/convolution_settings.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
def __repr__(self) -> str:
    """
    Return a string representation of the ConvolutionSettings.

    Returns
    -------
    str
        A string representation of the ConvolutionSettings.
    """
    return (
        f'{self.__class__.__name__}('
        f'upsample_factor={self.upsample_factor}, '
        f'extension_factor={self.extension_factor}, '
        f'suppress_warnings={self.suppress_warnings})'
    )

DetailedBalanceSettings

Bases: EasyDynamicsBase

Class to manage detailed balance settings for a SampleModel or Analysis.

Source code in src/easydynamics/settings/detailed_balance_settings.py
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
class DetailedBalanceSettings(EasyDynamicsBase):
    """
    Class to manage detailed balance settings for a SampleModel or Analysis.
    """

    def __init__(
        self,
        use_detailed_balance: bool = True,
        normalize_detailed_balance: bool = True,
        display_name: str = 'DetailedBalanceSettings',
        unique_name: str | None = None,
    ) -> None:
        """
        Initialize the DetailedBalanceSettings.

        Parameters
        ----------
        use_detailed_balance : bool, default=True
            Whether to apply detailed balance to the model. If False, no detailed balance is
            applied.
        normalize_detailed_balance : bool, default=True
            Whether to normalize the detailed balance factor by dividing with temperature.
        display_name : str, default='DetailedBalanceSettings'
            Display name of the model.
        unique_name : str | None, default=None
            Unique name of the model. If None, a unique name will be generated.


        Raises
        ------
        TypeError
            If use_detailed_balance or normalize_detailed_balance is not a bool.
        """
        if not isinstance(use_detailed_balance, bool):
            raise TypeError('use_detailed_balance must be True or False')
        self._use_detailed_balance = use_detailed_balance

        if not isinstance(normalize_detailed_balance, bool):
            raise TypeError('normalize_detailed_balance must be True or False')
        self._normalize_detailed_balance = normalize_detailed_balance

        super().__init__(
            display_name=display_name,
            unique_name=unique_name,
        )

    # ------------------------------------------------------------------
    # Properties
    # ------------------------------------------------------------------

    @property
    def use_detailed_balance(self) -> bool:
        """
        Get whether to apply detailed balance to the model.

        Returns
        -------
        bool
            True if detailed balance is applied, False otherwise.
        """
        return self._use_detailed_balance

    @use_detailed_balance.setter
    def use_detailed_balance(self, value: bool) -> None:
        """
        Set whether to apply detailed balance to the model.

        Parameters
        ----------
        value : bool
            True to apply detailed balance, False otherwise.

        Raises
        ------
        TypeError
            If value is not a bool.
        """
        if not isinstance(value, bool):
            raise TypeError('use_detailed_balance must be True or False')
        self._use_detailed_balance = value

    @property
    def normalize_detailed_balance(self) -> bool:
        """
        Get whether to divide the detailed balance factor by temperature.

        Returns
        -------
        bool
            True if the detailed balance factor should be normalized by dividing with temperature,
            False otherwise.
        """
        return self._normalize_detailed_balance

    @normalize_detailed_balance.setter
    def normalize_detailed_balance(self, value: bool) -> None:
        """
        Set whether to normalize the detailed balance factor by dividing with temperature.

        Parameters
        ----------
        value : bool
            True to normalize the detailed balance factor by dividing with temperature, False
            otherwise.

        Raises
        ------
        TypeError
            If value is not a bool.
        """
        if not isinstance(value, bool):
            raise TypeError('normalize_detailed_balance must be True or False')
        self._normalize_detailed_balance = value

    def __repr__(self) -> str:
        """
        Return a string representation of the DetailedBalanceSettings.

        Returns
        -------
        str
            A string representation of the DetailedBalanceSettings.
        """
        return (
            f'DetailedBalanceSettings(use_detailed_balance={self.use_detailed_balance}, '
            f'normalize_detailed_balance={self.normalize_detailed_balance})'
        )

use_detailed_balance property writable

Get whether to apply detailed balance to the model.

Returns:

Type Description
bool

True if detailed balance is applied, False otherwise.

normalize_detailed_balance property writable

Get whether to divide the detailed balance factor by temperature.

Returns:

Type Description
bool

True if the detailed balance factor should be normalized by dividing with temperature, False otherwise.

__init__(use_detailed_balance=True, normalize_detailed_balance=True, display_name='DetailedBalanceSettings', unique_name=None)

Initialize the DetailedBalanceSettings.

Parameters:

Name Type Description Default
use_detailed_balance bool

Whether to apply detailed balance to the model. If False, no detailed balance is applied.

True
normalize_detailed_balance bool

Whether to normalize the detailed balance factor by dividing with temperature.

True
display_name str

Display name of the model.

'DetailedBalanceSettings'
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None

Raises:

Type Description
TypeError

If use_detailed_balance or normalize_detailed_balance is not a bool.

Source code in src/easydynamics/settings/detailed_balance_settings.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def __init__(
    self,
    use_detailed_balance: bool = True,
    normalize_detailed_balance: bool = True,
    display_name: str = 'DetailedBalanceSettings',
    unique_name: str | None = None,
) -> None:
    """
    Initialize the DetailedBalanceSettings.

    Parameters
    ----------
    use_detailed_balance : bool, default=True
        Whether to apply detailed balance to the model. If False, no detailed balance is
        applied.
    normalize_detailed_balance : bool, default=True
        Whether to normalize the detailed balance factor by dividing with temperature.
    display_name : str, default='DetailedBalanceSettings'
        Display name of the model.
    unique_name : str | None, default=None
        Unique name of the model. If None, a unique name will be generated.


    Raises
    ------
    TypeError
        If use_detailed_balance or normalize_detailed_balance is not a bool.
    """
    if not isinstance(use_detailed_balance, bool):
        raise TypeError('use_detailed_balance must be True or False')
    self._use_detailed_balance = use_detailed_balance

    if not isinstance(normalize_detailed_balance, bool):
        raise TypeError('normalize_detailed_balance must be True or False')
    self._normalize_detailed_balance = normalize_detailed_balance

    super().__init__(
        display_name=display_name,
        unique_name=unique_name,
    )

__repr__()

Return a string representation of the DetailedBalanceSettings.

Returns:

Type Description
str

A string representation of the DetailedBalanceSettings.

Source code in src/easydynamics/settings/detailed_balance_settings.py
122
123
124
125
126
127
128
129
130
131
132
133
134
def __repr__(self) -> str:
    """
    Return a string representation of the DetailedBalanceSettings.

    Returns
    -------
    str
        A string representation of the DetailedBalanceSettings.
    """
    return (
        f'DetailedBalanceSettings(use_detailed_balance={self.use_detailed_balance}, '
        f'normalize_detailed_balance={self.normalize_detailed_balance})'
    )

convolution_settings

ConvolutionSettings

Bases: EasyDynamicsBase

Settings for numerical convolutions.

Source code in src/easydynamics/settings/convolution_settings.py
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
class ConvolutionSettings(EasyDynamicsBase):
    """
    Settings for numerical convolutions.
    """

    def __init__(
        self,
        upsample_factor: Numeric | None = 5,
        extension_factor: Numeric | None = 0.2,
        suppress_warnings: bool = False,
        display_name: str | None = 'MyConvolutionSettings',
        unique_name: str | None = None,
    ) -> None:
        """
        Initialize the ConvolutionSettings.

        Parameters
        ----------
        upsample_factor : Numeric | None, default=5
            The factor by which to upsample the input data before convolution.
        extension_factor : Numeric | None, default=0.2
            The factor by which to extend the input data range before convolution.
        suppress_warnings : bool, default=False
            Whether to suppress warnings about wide or narrow peaks in the models.
        display_name : str | None, default='MyConvolutionSettings'
            Display name of the model.
        unique_name : str | None, default=None
            Unique name of the model. If None, a unique name will be generated.

        Raises
        ------
        TypeError
            If upsample_factor is not a number or None. If extension_factor is not a number or
            None. If suppress_warnings is not a boolean.
        ValueError
            If upsample_factor is not greater than 1. If extension_factor is negative.
        """
        super().__init__(
            display_name=display_name,
            unique_name=unique_name,
        )

        if extension_factor is not None:
            if not isinstance(extension_factor, Numeric):
                raise TypeError('Extension factor must be a number.')
            extension_factor = float(extension_factor)
            if extension_factor < 0.0:
                raise ValueError('Extension factor must be non-negative.')
        self._extension_factor = extension_factor

        if upsample_factor is not None:
            if not isinstance(upsample_factor, Numeric):
                raise TypeError('Upsample factor must be a numerical value or None.')
            upsample_factor = float(upsample_factor)
            if upsample_factor <= 1.0:
                raise ValueError('Upsample factor must be greater than 1.')
        self._upsample_factor = upsample_factor

        if not isinstance(suppress_warnings, bool):
            raise TypeError('suppress_warnings must be True or False.')
        self._suppress_warnings = suppress_warnings

        self._convolution_plan_is_valid = False

    @property
    def upsample_factor(self) -> Numeric | None:
        """
        Get the upsample factor.

        Returns
        -------
        Numeric | None
            The upsample factor.
        """

        return self._upsample_factor

    @upsample_factor.setter
    def upsample_factor(self, factor: Numeric | None) -> None:
        """
        Set the upsample factor and recreate the dense grid.

        Parameters
        ----------
        factor : Numeric | None
            The new upsample factor.

        Raises
        ------
        TypeError
            If factor is not a number or None.
        ValueError
            If factor is not greater than 1.
        """
        if factor is None:
            self._upsample_factor = factor
            self.convolution_plan_is_valid = False
            return

        if not isinstance(factor, Numeric):
            raise TypeError('Upsample factor must be a numerical value or None.')
        factor = float(factor)
        if factor <= 1.0:
            raise ValueError('Upsample factor must be greater than 1.')

        self._upsample_factor = factor

        self.convolution_plan_is_valid = False

    @property
    def extension_factor(self) -> float:
        """
        Get the extension factor.

        The extension factor determines how much the energy range is extended on both sides before
        convolution. 0.2 means extending by 20% of the original energy span on each side

        Returns
        -------
        float
            The extension factor.
        """

        return self._extension_factor

    @extension_factor.setter
    def extension_factor(self, factor: Numeric) -> None:
        """
        Set the extension factor and recreate the dense grid.

        The extension factor determines how much the energy range is extended on both sides before
        convolution. 0.2 means extending by 20% of the original energy span on each side.

        Parameters
        ----------
        factor : Numeric
            The new extension factor.

        Raises
        ------
        TypeError
            If factor is not a number.
        ValueError
            If factor is negative.
        """

        if not isinstance(factor, Numeric):
            raise TypeError('Extension factor must be a number.')
        if factor < 0.0:
            raise ValueError('Extension factor must be non-negative.')

        self._extension_factor = float(factor)
        self.convolution_plan_is_valid = False

    @property
    def convolution_plan_is_valid(self) -> bool:
        """
        Get whether the convolution plan is valid.

        Returns
        -------
        bool
            Whether the convolution plan is valid.
        """
        return self._convolution_plan_is_valid

    @convolution_plan_is_valid.setter
    def convolution_plan_is_valid(self, is_valid: bool) -> None:
        """
        Set whether the convolution plan is valid.

        Parameters
        ----------
        is_valid : bool
            Whether the convolution plan is valid.

        Raises
        ------
        TypeError
            If is_valid is not a bool.
        """
        if not isinstance(is_valid, bool):
            raise TypeError('convolution_plan_is_valid must be True or False.')
        self._convolution_plan_is_valid = is_valid

    @property
    def suppress_warnings(self) -> bool:
        """
        Get whether to suppress warnings.

        Returns
        -------
        bool
            Whether to suppress warnings.
        """
        return self._suppress_warnings

    @suppress_warnings.setter
    def suppress_warnings(self, suppress: bool) -> None:
        """
        Set whether to suppress warnings.

        Parameters
        ----------
        suppress : bool
            Whether to suppress warnings.

        Raises
        ------
        TypeError
            If suppress is not a bool.
        """
        if not isinstance(suppress, bool):
            raise TypeError('suppress_warnings must be True or False.')
        self._suppress_warnings = suppress

    def __repr__(self) -> str:
        """
        Return a string representation of the ConvolutionSettings.

        Returns
        -------
        str
            A string representation of the ConvolutionSettings.
        """
        return (
            f'{self.__class__.__name__}('
            f'upsample_factor={self.upsample_factor}, '
            f'extension_factor={self.extension_factor}, '
            f'suppress_warnings={self.suppress_warnings})'
        )

upsample_factor property writable

Get the upsample factor.

Returns:

Type Description
Numeric | None

The upsample factor.

extension_factor property writable

Get the extension factor.

The extension factor determines how much the energy range is extended on both sides before convolution. 0.2 means extending by 20% of the original energy span on each side

Returns:

Type Description
float

The extension factor.

convolution_plan_is_valid property writable

Get whether the convolution plan is valid.

Returns:

Type Description
bool

Whether the convolution plan is valid.

suppress_warnings property writable

Get whether to suppress warnings.

Returns:

Type Description
bool

Whether to suppress warnings.

__init__(upsample_factor=5, extension_factor=0.2, suppress_warnings=False, display_name='MyConvolutionSettings', unique_name=None)

Initialize the ConvolutionSettings.

Parameters:

Name Type Description Default
upsample_factor Numeric | None

The factor by which to upsample the input data before convolution.

5
extension_factor Numeric | None

The factor by which to extend the input data range before convolution.

0.2
suppress_warnings bool

Whether to suppress warnings about wide or narrow peaks in the models.

False
display_name str | None

Display name of the model.

'MyConvolutionSettings'
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None

Raises:

Type Description
TypeError

If upsample_factor is not a number or None. If extension_factor is not a number or None. If suppress_warnings is not a boolean.

ValueError

If upsample_factor is not greater than 1. If extension_factor is negative.

Source code in src/easydynamics/settings/convolution_settings.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def __init__(
    self,
    upsample_factor: Numeric | None = 5,
    extension_factor: Numeric | None = 0.2,
    suppress_warnings: bool = False,
    display_name: str | None = 'MyConvolutionSettings',
    unique_name: str | None = None,
) -> None:
    """
    Initialize the ConvolutionSettings.

    Parameters
    ----------
    upsample_factor : Numeric | None, default=5
        The factor by which to upsample the input data before convolution.
    extension_factor : Numeric | None, default=0.2
        The factor by which to extend the input data range before convolution.
    suppress_warnings : bool, default=False
        Whether to suppress warnings about wide or narrow peaks in the models.
    display_name : str | None, default='MyConvolutionSettings'
        Display name of the model.
    unique_name : str | None, default=None
        Unique name of the model. If None, a unique name will be generated.

    Raises
    ------
    TypeError
        If upsample_factor is not a number or None. If extension_factor is not a number or
        None. If suppress_warnings is not a boolean.
    ValueError
        If upsample_factor is not greater than 1. If extension_factor is negative.
    """
    super().__init__(
        display_name=display_name,
        unique_name=unique_name,
    )

    if extension_factor is not None:
        if not isinstance(extension_factor, Numeric):
            raise TypeError('Extension factor must be a number.')
        extension_factor = float(extension_factor)
        if extension_factor < 0.0:
            raise ValueError('Extension factor must be non-negative.')
    self._extension_factor = extension_factor

    if upsample_factor is not None:
        if not isinstance(upsample_factor, Numeric):
            raise TypeError('Upsample factor must be a numerical value or None.')
        upsample_factor = float(upsample_factor)
        if upsample_factor <= 1.0:
            raise ValueError('Upsample factor must be greater than 1.')
    self._upsample_factor = upsample_factor

    if not isinstance(suppress_warnings, bool):
        raise TypeError('suppress_warnings must be True or False.')
    self._suppress_warnings = suppress_warnings

    self._convolution_plan_is_valid = False

__repr__()

Return a string representation of the ConvolutionSettings.

Returns:

Type Description
str

A string representation of the ConvolutionSettings.

Source code in src/easydynamics/settings/convolution_settings.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
def __repr__(self) -> str:
    """
    Return a string representation of the ConvolutionSettings.

    Returns
    -------
    str
        A string representation of the ConvolutionSettings.
    """
    return (
        f'{self.__class__.__name__}('
        f'upsample_factor={self.upsample_factor}, '
        f'extension_factor={self.extension_factor}, '
        f'suppress_warnings={self.suppress_warnings})'
    )

detailed_balance_settings

DetailedBalanceSettings

Bases: EasyDynamicsBase

Class to manage detailed balance settings for a SampleModel or Analysis.

Source code in src/easydynamics/settings/detailed_balance_settings.py
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
class DetailedBalanceSettings(EasyDynamicsBase):
    """
    Class to manage detailed balance settings for a SampleModel or Analysis.
    """

    def __init__(
        self,
        use_detailed_balance: bool = True,
        normalize_detailed_balance: bool = True,
        display_name: str = 'DetailedBalanceSettings',
        unique_name: str | None = None,
    ) -> None:
        """
        Initialize the DetailedBalanceSettings.

        Parameters
        ----------
        use_detailed_balance : bool, default=True
            Whether to apply detailed balance to the model. If False, no detailed balance is
            applied.
        normalize_detailed_balance : bool, default=True
            Whether to normalize the detailed balance factor by dividing with temperature.
        display_name : str, default='DetailedBalanceSettings'
            Display name of the model.
        unique_name : str | None, default=None
            Unique name of the model. If None, a unique name will be generated.


        Raises
        ------
        TypeError
            If use_detailed_balance or normalize_detailed_balance is not a bool.
        """
        if not isinstance(use_detailed_balance, bool):
            raise TypeError('use_detailed_balance must be True or False')
        self._use_detailed_balance = use_detailed_balance

        if not isinstance(normalize_detailed_balance, bool):
            raise TypeError('normalize_detailed_balance must be True or False')
        self._normalize_detailed_balance = normalize_detailed_balance

        super().__init__(
            display_name=display_name,
            unique_name=unique_name,
        )

    # ------------------------------------------------------------------
    # Properties
    # ------------------------------------------------------------------

    @property
    def use_detailed_balance(self) -> bool:
        """
        Get whether to apply detailed balance to the model.

        Returns
        -------
        bool
            True if detailed balance is applied, False otherwise.
        """
        return self._use_detailed_balance

    @use_detailed_balance.setter
    def use_detailed_balance(self, value: bool) -> None:
        """
        Set whether to apply detailed balance to the model.

        Parameters
        ----------
        value : bool
            True to apply detailed balance, False otherwise.

        Raises
        ------
        TypeError
            If value is not a bool.
        """
        if not isinstance(value, bool):
            raise TypeError('use_detailed_balance must be True or False')
        self._use_detailed_balance = value

    @property
    def normalize_detailed_balance(self) -> bool:
        """
        Get whether to divide the detailed balance factor by temperature.

        Returns
        -------
        bool
            True if the detailed balance factor should be normalized by dividing with temperature,
            False otherwise.
        """
        return self._normalize_detailed_balance

    @normalize_detailed_balance.setter
    def normalize_detailed_balance(self, value: bool) -> None:
        """
        Set whether to normalize the detailed balance factor by dividing with temperature.

        Parameters
        ----------
        value : bool
            True to normalize the detailed balance factor by dividing with temperature, False
            otherwise.

        Raises
        ------
        TypeError
            If value is not a bool.
        """
        if not isinstance(value, bool):
            raise TypeError('normalize_detailed_balance must be True or False')
        self._normalize_detailed_balance = value

    def __repr__(self) -> str:
        """
        Return a string representation of the DetailedBalanceSettings.

        Returns
        -------
        str
            A string representation of the DetailedBalanceSettings.
        """
        return (
            f'DetailedBalanceSettings(use_detailed_balance={self.use_detailed_balance}, '
            f'normalize_detailed_balance={self.normalize_detailed_balance})'
        )

use_detailed_balance property writable

Get whether to apply detailed balance to the model.

Returns:

Type Description
bool

True if detailed balance is applied, False otherwise.

normalize_detailed_balance property writable

Get whether to divide the detailed balance factor by temperature.

Returns:

Type Description
bool

True if the detailed balance factor should be normalized by dividing with temperature, False otherwise.

__init__(use_detailed_balance=True, normalize_detailed_balance=True, display_name='DetailedBalanceSettings', unique_name=None)

Initialize the DetailedBalanceSettings.

Parameters:

Name Type Description Default
use_detailed_balance bool

Whether to apply detailed balance to the model. If False, no detailed balance is applied.

True
normalize_detailed_balance bool

Whether to normalize the detailed balance factor by dividing with temperature.

True
display_name str

Display name of the model.

'DetailedBalanceSettings'
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None

Raises:

Type Description
TypeError

If use_detailed_balance or normalize_detailed_balance is not a bool.

Source code in src/easydynamics/settings/detailed_balance_settings.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def __init__(
    self,
    use_detailed_balance: bool = True,
    normalize_detailed_balance: bool = True,
    display_name: str = 'DetailedBalanceSettings',
    unique_name: str | None = None,
) -> None:
    """
    Initialize the DetailedBalanceSettings.

    Parameters
    ----------
    use_detailed_balance : bool, default=True
        Whether to apply detailed balance to the model. If False, no detailed balance is
        applied.
    normalize_detailed_balance : bool, default=True
        Whether to normalize the detailed balance factor by dividing with temperature.
    display_name : str, default='DetailedBalanceSettings'
        Display name of the model.
    unique_name : str | None, default=None
        Unique name of the model. If None, a unique name will be generated.


    Raises
    ------
    TypeError
        If use_detailed_balance or normalize_detailed_balance is not a bool.
    """
    if not isinstance(use_detailed_balance, bool):
        raise TypeError('use_detailed_balance must be True or False')
    self._use_detailed_balance = use_detailed_balance

    if not isinstance(normalize_detailed_balance, bool):
        raise TypeError('normalize_detailed_balance must be True or False')
    self._normalize_detailed_balance = normalize_detailed_balance

    super().__init__(
        display_name=display_name,
        unique_name=unique_name,
    )

__repr__()

Return a string representation of the DetailedBalanceSettings.

Returns:

Type Description
str

A string representation of the DetailedBalanceSettings.

Source code in src/easydynamics/settings/detailed_balance_settings.py
122
123
124
125
126
127
128
129
130
131
132
133
134
def __repr__(self) -> str:
    """
    Return a string representation of the DetailedBalanceSettings.

    Returns
    -------
    str
        A string representation of the DetailedBalanceSettings.
    """
    return (
        f'DetailedBalanceSettings(use_detailed_balance={self.use_detailed_balance}, '
        f'normalize_detailed_balance={self.normalize_detailed_balance})'
    )