Skip to content

Commit c7d6293

Browse files
committed
Docs: Remove placeholder text and fix whitespace
1 parent 7bbaa17 commit c7d6293

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

pslab/instrument/analog.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,20 @@ def resolution(self, value: int):
143143
self._resolution = 2**value - 1
144144
self._calibrate()
145145

146-
def _calibrate(self):
147-
"""
148-
Calculates the scaling coefficients based on current gain and resolution.
146+
def _calibrate(self):
147+
"""
148+
Calculates the scaling coefficients based on current gain and resolution.
149149
150-
This prepares the linear functions (_scale and _unscale) used to convert
151-
between raw integer ADC values and floating point voltages.
152-
"""
153-
A = INPUT_RANGES[self._name][0] / self._gain
154-
B = INPUT_RANGES[self._name][1] / self._gain
155-
slope = B - A
156-
intercept = A
157-
self._scale = np.poly1d([slope / self._resolution, intercept])
158-
self._unscale = np.poly1d(
150+
This updates the internal _scale and _unscale callables as a side effect,
151+
preparing them to convert between raw integer ADC values and floating
152+
point voltages.
153+
"""
154+
A = INPUT_RANGES[self._name][0] / self._gain
155+
B = INPUT_RANGES[self._name][1] / self._gain
156+
slope = B - A
157+
intercept = A
158+
self._scale = np.poly1d([slope / self._resolution, intercept])
159+
self._unscale = np.poly1d(
159160
[self._resolution / slope, -self._resolution * intercept / slope]
160161
)
161162

@@ -245,8 +246,7 @@ def lowres_waveform_table(self) -> np.ndarray:
245246
"""numpy.ndarray: 32-value waveform table loaded on this output."""
246247
# Max PWM duty cycle out of 64 clock cycles.
247248
return self._range_normalize(self._waveform_table[::16], 63)
248-
249-
def _range_normalize(self, x: np.ndarray, norm: int = 1) -> np.ndarray:
250-
"""Normalize waveform table to the digital output range."""
251-
x = (x - self.RANGE[0]) / (self.RANGE[1] - self.RANGE[0]) * norm
252-
return np.int16(np.round(x)).tolist()
249+
def _range_normalize(self, x: np.ndarray, norm: int = 1) -> np.ndarray:
250+
"""Normalize waveform table to the digital output range."""
251+
x = (x - self.RANGE[0]) / (self.RANGE[1] - self.RANGE[0]) * norm
252+
return np.int16(np.round(x)).tolist()

0 commit comments

Comments
 (0)