simcats 1.1.0__py3-none-any.whl → 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. simcats/__init__.py +4 -3
  2. simcats/_default_configs.py +129 -13
  3. simcats/_simulation.py +451 -69
  4. simcats/config_samplers/_GaAs_v1_random_variations_v3_config_sampler.py +1059 -0
  5. simcats/config_samplers/__init__.py +9 -0
  6. simcats/distortions/_distortion_interfaces.py +1 -1
  7. simcats/distortions/_dot_jumps.py +8 -6
  8. simcats/distortions/_random_telegraph_noise.py +4 -4
  9. simcats/distortions/_transition_blurring.py +5 -5
  10. simcats/distortions/_white_noise.py +2 -2
  11. simcats/ideal_csd/geometric/_generate_lead_transition_mask.py +3 -3
  12. simcats/ideal_csd/geometric/_get_electron_occupation.py +5 -5
  13. simcats/ideal_csd/geometric/_ideal_csd_geometric.py +5 -5
  14. simcats/ideal_csd/geometric/_ideal_csd_geometric_class.py +9 -9
  15. simcats/ideal_csd/geometric/_tct_bezier.py +5 -5
  16. simcats/sensor/__init__.py +10 -6
  17. simcats/sensor/{_generic_sensor.py → _sensor_generic.py} +1 -1
  18. simcats/sensor/_sensor_interface.py +164 -11
  19. simcats/sensor/_sensor_rise_glf.py +229 -0
  20. simcats/sensor/_sensor_scan_sensor_generic.py +929 -0
  21. simcats/sensor/barrier_function/__init__.py +9 -0
  22. simcats/sensor/barrier_function/_barrier_function_glf.py +280 -0
  23. simcats/sensor/barrier_function/_barrier_function_interface.py +43 -0
  24. simcats/sensor/barrier_function/_barrier_function_multi_glf.py +157 -0
  25. simcats/sensor/deformation/__init__.py +9 -0
  26. simcats/sensor/deformation/_sensor_peak_deformation_circle.py +109 -0
  27. simcats/sensor/deformation/_sensor_peak_deformation_interface.py +65 -0
  28. simcats/sensor/deformation/_sensor_peak_deformation_linear.py +77 -0
  29. simcats/support_functions/__init__.py +11 -3
  30. simcats/support_functions/_generalized_logistic_function.py +146 -0
  31. simcats/support_functions/_linear_algebra.py +171 -0
  32. simcats/support_functions/_parameter_sampling.py +108 -19
  33. simcats/support_functions/_pixel_volt_transformation.py +24 -0
  34. simcats/support_functions/_reset_offset_mu_sens.py +43 -0
  35. {simcats-1.1.0.dist-info → simcats-2.0.0.dist-info}/METADATA +93 -29
  36. simcats-2.0.0.dist-info/RECORD +53 -0
  37. {simcats-1.1.0.dist-info → simcats-2.0.0.dist-info}/WHEEL +1 -1
  38. simcats-1.1.0.dist-info/RECORD +0 -37
  39. /simcats/sensor/{_gaussian_sensor_peak.py → _sensor_peak_gaussian.py} +0 -0
  40. /simcats/sensor/{_lorentzian_sensor_peak.py → _sensor_peak_lorentzian.py} +0 -0
  41. {simcats-1.1.0.dist-info → simcats-2.0.0.dist-info/licenses}/LICENSE +0 -0
  42. {simcats-1.1.0.dist-info → simcats-2.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,229 @@
1
+ """This module contains functions and a class for GLF based sensor rise functions.
2
+
3
+ @author: b.papajewski
4
+ """
5
+
6
+ import numpy as np
7
+
8
+ from simcats.sensor import SensorRiseInterface
9
+ from simcats.support_functions._generalized_logistic_function import glf, inverse_glf
10
+
11
+ __all__ = []
12
+
13
+
14
+ class SensorRiseGLF(SensorRiseInterface):
15
+ """This class realizes the SensorRiseInterface using a GLF.
16
+
17
+ For further information on the GLF see: https://en.wikipedia.org/wiki/Generalised_logistic_function.
18
+ """
19
+
20
+ def __init__(self,mu0: float, asymptote_left: float, asymptote_right: float, growth_rate: float, asymmetry: float,
21
+ shape_factor: float, denominator_offset: float = 1, fully_conductive_percentage: float = 0.99):
22
+ """Creates a new GLF sensor rise function.
23
+
24
+ Args:
25
+ mu0 (float): Potential shift of the GLF from the zero point. If the offset is positive, the function is
26
+ shifted to the right and if it is negative, it is shifted to the left.
27
+ asymptote_left (float): Originally called A. This parameter is the left horizontal asymptote of the
28
+ function. Any rational number can be used as the left asymptote.
29
+ asymptote_right (float): Originally called K. Specifies the right horizontal asymptote of the function
30
+ when denominator_offset=1. If asymptote_left=0 and denominator_offset=1 then this parameter is also
31
+ called the carrying capacity. This parameter may take any rational number.
32
+ growth_rate (float): Originally called B. The growth rate of the function. The value must be a float and can
33
+ be any rational number. Be careful with negative values, because the function is mirrored on a vertical
34
+ straight line for these. This line passes through the point where the potential equals `offset`.
35
+ asymmetry (float): Originally called nu. This parameter introduces skew and affects symmetry. It also
36
+ affects near which asymptote maximum growth occurs. The value of asymmetry must be a rational number
37
+ greater than zero. \n
38
+ - `asymmetry > 1`: the curve rises more gradually before the midpoint and more sharply after. \n
39
+ - `asymmetry < 1`: the curve rises quickly early on and levels off more slowly.
40
+ shape_factor (float): Originally called Q. is related to the value Y(0) and adjusts the curve’s value at the
41
+ y-intercept. Thereby it changes the shape of the function without changing the asymptotes. The shape
42
+ factor can be any rational number.
43
+ denominator_offset (float): Originally called C. A constant added to the denominator inside the power.
44
+ Controls the initial level of the denominator.This parameter must be a rational number. It typically
45
+ takes a value of 1. Otherwise, the upper asymptote is \n
46
+ asymptote_left + (asymptote_right-asymptote_left)/(denominator_offset^(1/asymmetry)).
47
+ """
48
+ self.mu0 = mu0
49
+ self.asymptote_left = asymptote_left
50
+ self.asymptote_right = asymptote_right
51
+ self.growth_rate = growth_rate
52
+ self.asymmetry = asymmetry
53
+ self.shape_factor = shape_factor
54
+ self.denominator_offset = denominator_offset
55
+ self.fully_conductive_percentage = fully_conductive_percentage
56
+
57
+ @property
58
+ def mu0(self):
59
+ """ Potential shift of the GLF from the zero point. If mu0 is positive, the function is shifted to the right
60
+ and if it is negative, it is shifted to the left.
61
+ """
62
+ return self.__mu0
63
+
64
+ @mu0.setter
65
+ def mu0(self, mu0: float) -> None:
66
+ """Updates mu0, which specifies the shift of the GLF from the zero point. The value of mu0 can be any rational
67
+ number.
68
+
69
+ Args:
70
+ mu0 (float): The shift of the GLF from the zero point.
71
+ """
72
+ self.__mu0 = mu0
73
+
74
+ @property
75
+ def asymptote_left(self):
76
+ """Originally called A. This parameter is the left horizontal asymptote of the function. Any rational number can
77
+ be used as the left asymptote.
78
+ """
79
+ return self.__asymptote_left
80
+
81
+ @asymptote_left.setter
82
+ def asymptote_left(self, asymptote_left: float) -> None:
83
+ """Updates the left horizontal asymptote of the GLF.
84
+
85
+ Args:
86
+ asymptote_left (float): Left horizontal asymptote of the GLF. The value must be a float and can be any
87
+ rational number.
88
+ """
89
+ self.__asymptote_left = asymptote_left
90
+
91
+ @property
92
+ def asymptote_right(self):
93
+ """Originally called K. Specifies the right horizontal asymptote of the function when denominator_offset=1. If
94
+ asymptote_left=0 and denominator_offset=1 then this parameter is also called the carrying capacity. This
95
+ parameter may take any rational number.
96
+ """
97
+ return self.__asymptote_right
98
+
99
+ @asymptote_right.setter
100
+ def asymptote_right(self, asymptote_right: float) -> None:
101
+ """Updates the right horizontal asymptote of the GLF.
102
+
103
+ Args:
104
+ asymptote_right (float): Right horizontal asymptote of the GLF. The value must be a float and can be any
105
+ rational number.
106
+ """
107
+ self.__asymptote_right = asymptote_right
108
+
109
+ @property
110
+ def growth_rate(self):
111
+ """Originally called B. The growth rate of the function. The value must be a float and can be any rational
112
+ number. Be careful with negative values, because the function is mirrored on a vertical straight line for these.
113
+ This line passes through the point where the potential equals `offset`.
114
+ """
115
+ return self.__growth_rate
116
+
117
+ @growth_rate.setter
118
+ def growth_rate(self, growth_rate: float) -> None:
119
+ """Updates the growth rate of the GLF.
120
+
121
+ Args:
122
+ growth_rate (float): Growth rate of the GLF. The value must be a float and can be any rational number.
123
+ """
124
+ self.__growth_rate = growth_rate
125
+
126
+ @property
127
+ def asymmetry(self):
128
+ """Originally called nu. This parameter introduces skew and affects symmetry. It also affects near which
129
+ asymptote maximum growth occurs. The value of asymmetry must be a rational number greater than zero. \n
130
+ - `asymmetry > 1`: the curve rises more gradually before the midpoint and more sharply after. \n
131
+ - `asymmetry < 1`: the curve rises quickly early on and levels off more slowly.
132
+ """
133
+ return self.__asymmetry
134
+
135
+ @asymmetry.setter
136
+ def asymmetry(self, asymmetry: float) -> None:
137
+ """Updates asymmetry, which affects near which asymptote maximum growth occurs. The value of asymmetry must be
138
+ a rational number greater than zero.
139
+
140
+ Args:
141
+ asymmetry (float): The asymmetry of the GLF, which affects near which asymptote maximum growth occurs. The
142
+ value of asymmetry must be a rational number greater than zero.
143
+ """
144
+ if asymmetry <= 0:
145
+ raise ValueError(f"asymmetry should be positive, but was {asymmetry}")
146
+ self.__asymmetry = asymmetry
147
+
148
+ @property
149
+ def shape_factor(self):
150
+ """Originally called Q. is related to the value Y(0) and adjusts the curve’s value at the y-intercept. Thereby
151
+ it changes the shape of the function without changing the asymptotes. The shape factor can be any rational
152
+ number.
153
+ """
154
+ return self.__shape_factor
155
+
156
+ @shape_factor.setter
157
+ def shape_factor(self, shape_factor: float) -> None:
158
+ """Updates shape_factor, which is related the value Y(0). The value can be any rational number.
159
+
160
+ Args:
161
+ shape_factor (float): The shape_factor of the GLF, which is related the value Y(0). The value can be any
162
+ rational number.
163
+ """
164
+ self.__shape_factor = shape_factor
165
+
166
+ @property
167
+ def denominator_offset(self) -> float:
168
+ """Originally called C. A constant added to the denominator inside the power. Controls the initial level of the
169
+ denominator. This parameter must be a rational number. It typically takes a value of 1. Otherwise, the upper
170
+ asymptote is asymptote_left + (asymptote_right-asymptote_left)/(denominator_offset^(1/asymmetry)).
171
+ """
172
+ return self.__denominator_offset
173
+
174
+ @denominator_offset.setter
175
+ def denominator_offset(self, denominator_offset: float) -> None:
176
+ """Originally called C. A constant added to the denominator inside the power. Controls the initial level of the
177
+ denominator. This parameter must be a rational number. It typically takes a value of 1. Otherwise, the upper
178
+ asymptote is asymptote_left + (asymptote_right-asymptote_left)/(denominator_offset^(1/asymmetry)).
179
+
180
+ Args:
181
+ denominator_offset (float): A constant added to the denominator inside the power. Controls the initial level
182
+ of the denominator. This parameter must be a rational number.
183
+ """
184
+ self.__denominator_offset = denominator_offset
185
+
186
+ @property
187
+ def fully_conductive(self) -> float:
188
+ """Potential value of the point at which the sensor rise reaches its maximum."""
189
+
190
+ return inverse_glf(
191
+ value=(self.asymptote_right - self.asymptote_left) * self.fully_conductive_percentage + self.asymptote_left,
192
+ asymptote_left=self.asymptote_left,
193
+ asymptote_right=self.asymptote_right,
194
+ growth_rate=self.growth_rate,
195
+ asymmetry=self.asymmetry,
196
+ shape_factor=self.shape_factor,
197
+ denominator_offset=self.denominator_offset,
198
+ offset=self.mu0
199
+ )
200
+
201
+ def sensor_function(self, mu_sens: np.ndarray, offset: float) -> np.ndarray:
202
+ """Returns the sensor rise function values at the given electrochemical potentials.
203
+
204
+ Args:
205
+ mu_sens (np.ndarray): The sensor potential, stored in a numpy array with the axis mapping to the scan axis.
206
+ offset (float): Potential value to which the fully conductive point is shifted.
207
+
208
+ Returns:
209
+ np.ndarray: The sensor response (for the corresponding peak), calculated from the given potential. It is
210
+ stored in a numpy array with the axis mapping to the scan axis.
211
+ """
212
+ return glf(potential=mu_sens,
213
+ asymptote_left=self.asymptote_left,
214
+ asymptote_right=self.asymptote_right,
215
+ growth_rate=self.growth_rate,
216
+ asymmetry=self.asymmetry,
217
+ shape_factor=self.shape_factor,
218
+ denominator_offset=self.denominator_offset,
219
+ offset= -self.fully_conductive + offset)
220
+
221
+ def __repr__(self):
222
+ return (
223
+ self.__class__.__name__
224
+ + f"(mu0={self.mu0}, asymptote_left={self.asymptote_left}, asymptote_right={self.asymptote_right}, "
225
+ f"growth_rate={self.growth_rate}, asymmetry={self.asymmetry}, shape_factor={self.shape_factor}, "
226
+ f"denominator_offset={self.denominator_offset}, "
227
+ f"fully_conductive_percentage={self.fully_conductive_percentage})"
228
+ )
229
+