Skip to content

Commit 140fda3

Browse files
author
cint-transport
committed
fix(driver): fixed flake8 errors and a few other imports
1 parent 2b4ef11 commit 140fda3

File tree

17 files changed

+36
-25
lines changed

17 files changed

+36
-25
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ per-file-ignores =
2323
pyscan/general/__init__.py:F401,F403
2424
pyscan/drivers/__init__.py:F401,F403
2525
pyscan/plotting/__init__.py:F401,F403
26+
*/__init__.py:F401,F403
2627

2728
# 120 characters is a more agreeable max line length for modern displays
2829
max-line-length=120

pyscan/drivers/exceptions/external_package_excpetion.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ class ExternalPackageException(Exception):
55
def __init__(self, message):
66

77
super().__init__(message)
8-
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import importlib.util
21
import sys
32

43
name = 'libHeLIC'
54

65
if name in sys.modules:
76
from .helioscamera import HeliosCamera
8-
else:
7+
else:
98
from .exceptions import HeliosImportException as HeliosCamera
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from itemattribute import ItemAttribute
1+
from ...general.item_attribute import ItemAttribute
22
from ..exceptions.external_package_excpetion import ExternalPackageException
33

4+
45
class HeliosImportException(ItemAttribute):
56

67
def __init__(self, *arg, **kwarg):
78

89
msg = "Helios SDK SD1 could not load this driver"
910

10-
raise ExternalPackageException(msg)
11+
raise ExternalPackageException(msg)

pyscan/drivers/heliotis/helios_sdk.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
from pyscan.general.item_attribute import ItemAttribute
22

33

4+
def sense_tqp_to_frequency(SensTqp):
5+
return 70e6 / 8 / (SensTqp + 30)
6+
7+
8+
def frequency_to_sense_tqp(frequency):
9+
10+
return 70 * 1e6 / 8 / frequency - 30
11+
12+
413
class HeliosSDK(ItemAttribute):
514

615
def __init__(self):
@@ -207,4 +216,3 @@ def SensTqp_to_frequency(SensTqp):
207216
def frequency_to_SenseTqp(frequency):
208217

209218
return 70 * 1e6 / 8 / frequency - 30
210-

pyscan/drivers/heliotis/helioscamera.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
print('Path Error' + str(err))
1616

1717
from libHeLIC import LibHeLIC
18-
from pyscan.general.item_attribute import ItemAttribute
19-
from .helios_sdk import HeliosSDK
18+
from .helios_sdk import HeliosSDK, sense_tqp_to_frequency, frequency_to_sense_tqp
2019

2120

2221
class HeliosCamera(HeliosSDK):
@@ -125,15 +124,15 @@ def initialize_properties(self):
125124
@property
126125
def frequency(self):
127126

128-
self._frequency = SensTqp_to_frequency(self.internal_tqp)
127+
self._frequency = sense_tqp_to_frequency(self.internal_tqp)
129128
return self._frequency
130129

131130
@frequency.setter
132131
def frequency(self, x):
133132

134133
if (x >= 2121) and (x <= 291666):
135-
self.internal_tqp = int(frequency_to_SenseTqp(x))
136-
self._frequency = frequency_to_SenseTqp(self.internal_tqp)
134+
self.internal_tqp = int(frequency_to_sense_tqp(x))
135+
self._frequency = frequency_to_sense_tqp(self.internal_tqp)
137136
else:
138137
print("Bad frequency, must be 2121Hz < f < 291,666 Hz")
139138

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from pyscan.general.item_attribute import ItemAttribute
22
from ..exceptions.external_package_excpetion import ExternalPackageException
33

4+
45
class KeysightSD1Error(ItemAttribute):
56

67
def __init__(self, *arg, **kwarg):
78

89
msg = "Keysight SD1 not found could not load this driver"
910

10-
raise ExternalPackageException(msg)
11+
raise ExternalPackageException(msg)

pyscan/drivers/keysight/keysightm3302aawg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
2+
import keysightSD1
23
from pyscan.general.item_attribute import ItemAttribute
34
import sys
45
sys.path.append(r'c:\Program Files (x86)\Keysight\SD1\Libraries\Python')
5-
import keysightSD1
66

77

88
class KeysightM3302AAWG(ItemAttribute):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
try:
22
from .pulse_blaster_esrpro500 import PulseBlasterESRPro500
33
except OSError:
4-
from .exceptions import SpinAPIException as PulseBlasterESRPro500
4+
from .exceptions import SpinAPIException as PulseBlasterESRPro500

pyscan/drivers/spin_core/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ def __init__(self, *arg, **kwarg):
88

99
msg = "Spin Core Spin API not found, could not load this driver"
1010

11-
raise ExternalPackageException(msg)
11+
raise ExternalPackageException(msg)

0 commit comments

Comments
 (0)