Skip to content

Commit

Permalink
Reformat some files to comply with psf/black#2726
Browse files Browse the repository at this point in the history
  • Loading branch information
bessman committed Mar 24, 2022
1 parent b5bb3fa commit 4a9ecfc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pslab/bus/uart.py
Expand Up @@ -36,7 +36,7 @@ class _UARTPrimitive:
"""

_MIN_BRGVAL = 0
_MAX_BRGVAL = 2 ** 16 - 1
_MAX_BRGVAL = 2**16 - 1

_brgval = _BRGVAL
_mode = _MODE
Expand Down
2 changes: 1 addition & 1 deletion pslab/external/gas_sensor.py
Expand Up @@ -109,7 +109,7 @@ def _correction(self):
t = self._temperature()
h = self._humidity()
a, b, c, d = *self._TEMPERATURE_CORRECTION, self._HUMIDITY_CORRECTION
return a * t ** 2 + b * t + c + d * (h - 0.65)
return a * t**2 + b * t + c + d * (h - 0.65)

@property
def _sensor_resistance(self):
Expand Down
2 changes: 1 addition & 1 deletion pslab/external/motor.py
Expand Up @@ -68,4 +68,4 @@ def _get_duty_cycle(self, angle):
angle /= self._angle_range # Normalize
angle *= self._max_angle_pulse - self._min_angle_pulse # Scale
angle += self._min_angle_pulse # Offset
return angle / (self._frequency ** -1 * MICROSECONDS)
return angle / (self._frequency**-1 * MICROSECONDS)
4 changes: 2 additions & 2 deletions pslab/instrument/analog.py
Expand Up @@ -74,7 +74,7 @@ class AnalogInput:

def __init__(self, name: str):
self._name = name
self._resolution = 2 ** 10 - 1
self._resolution = 2**10 - 1

if self._name == "CH1":
self.programmable_gain_amplifier = 1
Expand Down Expand Up @@ -140,7 +140,7 @@ def resolution(self) -> int:
def resolution(self, value: int):
if value not in (10, 12):
raise ValueError("Resolution must be 10 or 12 bits.")
self._resolution = 2 ** value - 1
self._resolution = 2**value - 1
self._calibrate()

def _calibrate(self):
Expand Down
8 changes: 4 additions & 4 deletions pslab/instrument/logic_analyzer.py
Expand Up @@ -92,7 +92,7 @@ def measure_frequency(

try:
period = (t[1] - t[0]) * 1e-6 / 16
frequency = period ** -1
frequency = period**-1
except IndexError:
frequency = 0

Expand Down Expand Up @@ -123,7 +123,7 @@ def _measure_frequency_firmware(
else:
return 0
else:
return period ** -1
return period**-1

def _get_high_frequency(self, channel: str) -> float:
"""Measure high frequency signals using firmware.
Expand Down Expand Up @@ -403,7 +403,7 @@ def _capture_two(self):
self._device.get_ack()

def _capture_four(self, e2e_time: float):
rollover_time = (2 ** 16 - 1) / CP.CLOCK_RATE
rollover_time = (2**16 - 1) / CP.CLOCK_RATE
e2e_time = 0 if e2e_time is None else e2e_time

if e2e_time > rollover_time * self._PRESCALERS[3]:
Expand Down Expand Up @@ -513,7 +513,7 @@ def _fetch_int(self, channel: DigitalInput) -> np.ndarray:

for i, diff in enumerate(np.diff(raw_timestamps)):
if diff <= 0: # Counter has rolled over.
raw_timestamps[i + 1 :] += 2 ** 16 - 1
raw_timestamps[i + 1 :] += 2**16 - 1

return raw_timestamps

Expand Down
2 changes: 1 addition & 1 deletion pslab/instrument/power_supply.py
Expand Up @@ -119,7 +119,7 @@ class Source:
"PV3": 1,
"PCS": 0,
}
_RESOLUTION = 2 ** 12 - 1
_RESOLUTION = 2**12 - 1
_MULTI_WRITE = 0b01000000

def __init__(self, mcp4728: I2CSlave, name: str):
Expand Down
2 changes: 1 addition & 1 deletion pslab/instrument/waveform_generator.py
Expand Up @@ -64,7 +64,7 @@ def _get_wavelength(frequency: float, table_size: int = 1) -> Tuple[int, int]:
"""
for prescaler in _PRESCALERS:
timegap = int(round(CP.CLOCK_RATE / frequency / prescaler / table_size))
if 0 < timegap < 2 ** 16:
if 0 < timegap < 2**16:
return timegap, prescaler

e = (
Expand Down

0 comments on commit 4a9ecfc

Please sign in to comment.