Skip to content

Commit ff20446

Browse files
committed
Fix: Correct indentation in analog.py
1 parent c7d6293 commit ff20446

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

pslab/instrument/analog.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +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 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(
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(
160160
[self._resolution / slope, -self._resolution * intercept / slope]
161161
)
162162

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

0 commit comments

Comments
 (0)