wasatch 2.3.2__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 (53) hide show
  1. wasatch/AbstractUSBDevice.py +29 -0
  2. wasatch/AndorDevice.py +910 -0
  3. wasatch/AreaScanImage.py +19 -0
  4. wasatch/AutoRaman.py +457 -0
  5. wasatch/AutoRamanRequest.py +96 -0
  6. wasatch/BLEDevice.py +1032 -0
  7. wasatch/BalanceAcquisition.py +136 -0
  8. wasatch/CSVLoader.py +188 -0
  9. wasatch/CommandSettings.py +95 -0
  10. wasatch/ControlObject.py +17 -0
  11. wasatch/DetectorROI.py +36 -0
  12. wasatch/DetectorRegions.py +158 -0
  13. wasatch/DeviceFinderBLE.py +107 -0
  14. wasatch/DeviceFinderTCP.py +20 -0
  15. wasatch/DeviceFinderUSB.py +236 -0
  16. wasatch/DeviceID.py +344 -0
  17. wasatch/EEPROM.py +1450 -0
  18. wasatch/EEPROM_multical.sav +48 -0
  19. wasatch/FPGAOptions.py +125 -0
  20. wasatch/FeatureIdentificationDevice.py +3961 -0
  21. wasatch/FirmwareRequirements.py +76 -0
  22. wasatch/HardwareInfo.py +36 -0
  23. wasatch/IDSCamera.py +916 -0
  24. wasatch/IDSDevice.py +329 -0
  25. wasatch/IMX385.py +179 -0
  26. wasatch/InterfaceDevice.py +40 -0
  27. wasatch/MockUSBDevice.py +353 -0
  28. wasatch/OceanDevice.py +215 -0
  29. wasatch/PollStatus.py +15 -0
  30. wasatch/ProcessedReading.py +352 -0
  31. wasatch/ROI.py +33 -0
  32. wasatch/Reading.py +80 -0
  33. wasatch/RealUSBDevice.py +64 -0
  34. wasatch/SPIDevice.py +628 -0
  35. wasatch/SpectrometerRequest.py +15 -0
  36. wasatch/SpectrometerResponse.py +38 -0
  37. wasatch/SpectrometerSettings.py +446 -0
  38. wasatch/SpectrometerState.py +255 -0
  39. wasatch/StatusMessage.py +14 -0
  40. wasatch/TCPDevice.py +409 -0
  41. wasatch/TakeOneRequest.py +43 -0
  42. wasatch/WasatchBus.py +87 -0
  43. wasatch/WasatchDevice.py +1060 -0
  44. wasatch/WasatchDeviceWrapper.py +452 -0
  45. wasatch/WrapperWorker.py +304 -0
  46. wasatch/__init__.py +4 -0
  47. wasatch/applog.py +177 -0
  48. wasatch/simulation_protocol.py +227 -0
  49. wasatch/utils.py +731 -0
  50. wasatch-2.3.2.dist-info/LICENSE +21 -0
  51. wasatch-2.3.2.dist-info/METADATA +347 -0
  52. wasatch-2.3.2.dist-info/RECORD +53 -0
  53. wasatch-2.3.2.dist-info/WHEEL +4 -0
@@ -0,0 +1,48 @@
1
+ # ##########################################################################
2
+ # Early implementation of multiple wavecals; not currently in use
3
+ # ##########################################################################
4
+
5
+ def multi_wavecal_page_start_NOT_USED(self, pos):
6
+ if pos == 0:
7
+ page = 1
8
+ start = 0
9
+ else:
10
+ page = 6 if pos < 5 else 7
11
+ start = ((pos - 1) % 4) * 16
12
+ return (page, start)
13
+
14
+ ##
15
+ # This has not yet been assigned a subformat code (early testing used 3, since assigned to untethered)
16
+ #
17
+ # @todo make EEPROMMultiWavecal
18
+ def read_multi_wavecal_NOT_USED(self):
19
+
20
+ # store as dict rather than array in case some positions are invalid
21
+ tmp = {}
22
+
23
+ # parse each of the 9 wavecal positions
24
+ for pos in range(9):
25
+ (page, start) = self.multi_wavecal_page_start(pos)
26
+ try:
27
+ coeffs = []
28
+ for i in range(4):
29
+ coeffs.append(self.unpack((page, start + i * 4, 4), "f"))
30
+
31
+ if utils.coeffs_look_valid(coeffs):
32
+ tmp[pos] = coeffs
33
+ except:
34
+ log.error("invalid multi-wavecal at position %d", pos, exc_info=1)
35
+
36
+ if len(tmp) > 0:
37
+ self.multi_wavecal = tmp
38
+ else:
39
+ self.multi_wavecal = None
40
+
41
+ def write_multi_wavecal_NOT_USED(self):
42
+ if self.multi_wavecal is None:
43
+ return
44
+ for pos, coeffs in self.multi_wavecal.items():
45
+ (page, start) = self.multi_wavecal_page_start(pos)
46
+ for i in range(len(coeffs)):
47
+ self.pack((page, start + i * 4, 4), "f", coeffs[i])
48
+
wasatch/FPGAOptions.py ADDED
@@ -0,0 +1,125 @@
1
+ import logging
2
+
3
+ log = logging.getLogger(__name__)
4
+
5
+ INTEG_TIME_RES_ONE_MS = 0
6
+ INTEG_TIME_RES_TEN_MS = 1
7
+ INTEG_TIME_RES_SWITCHABLE = 2
8
+
9
+ DATA_HEADER_NONE = 0
10
+ DATA_HEADER_OCEAN_OPTICS = 1
11
+ DATA_HEADER_WASATCH = 2
12
+
13
+ LASER_TYPE_NONE = 0
14
+ LASER_TYPE_INTERNAL = 1
15
+ LASER_TYPE_EXTERNAL = 2
16
+
17
+ LASER_CONTROL_MODULATION = 0
18
+ LASER_CONTROL_TRANSITION_POINTS = 1
19
+ LASER_CONTROL_RAMPING = 2
20
+
21
+ ##
22
+ # Encapsulate the set of options used to compile the FPGA code
23
+ # in the firmware of the connected spectrometer.
24
+ #
25
+ # This class is normally accessed as an attribute of SpectrometerSettings.
26
+ class FPGAOptions:
27
+
28
+ def __init__(self):
29
+ self.integration_time_resolution = INTEG_TIME_RES_ONE_MS
30
+ self.data_header = DATA_HEADER_NONE
31
+ self.has_cf_select = False
32
+ self.laser_type = LASER_TYPE_NONE
33
+ self.laser_control = LASER_CONTROL_MODULATION
34
+ self.has_area_scan = False
35
+ self.has_actual_integ_time = False
36
+ self.has_horiz_binning = False
37
+
38
+ ##
39
+ # Parse the given 24-bit register according to the following representation:
40
+ #
41
+ # @verbatim
42
+ # 0-2: IntegrationTimeResolution
43
+ # 3-5: DataHeader
44
+ # 6: HasCFSelect
45
+ # 7-8: LaserType
46
+ # 9-11: LaserControl
47
+ # 12: HasAreaScan
48
+ # 13: HasActualIntegTime
49
+ # 14: HasHorizBinning
50
+ # 23-15: Reserved
51
+ # @endverbatim
52
+ def parse(self, word):
53
+ if word is None:
54
+ log.error("can't parse NULL word")
55
+ return
56
+
57
+ self.integration_time_resolution = (word & 0x0007)
58
+ self.data_header = (word & 0x0038) >> 3
59
+ self.has_cf_select = (word & 0x0040) != 0
60
+ self.laser_type = (word & 0x0180) >> 7
61
+ self.laser_control = (word & 0x0e00) >> 9
62
+ self.has_area_scan = (word & 0x1000) != 0
63
+ self.has_actual_integ_time = (word & 0x2000) != 0
64
+ self.has_horiz_binning = (word & 0x4000) != 0
65
+
66
+ self.dump()
67
+
68
+ ## log the parsed values
69
+ def dump(self):
70
+ log.debug("FPGA Compilation Options:")
71
+ log.debug(" integration time resolution = %s", self.stringify_resolution())
72
+ log.debug(" data header = %s", self.stringify_header())
73
+ log.debug(" has cf select = %s", self.has_cf_select)
74
+ log.debug(" laser type = %s", self.stringify_laser_type())
75
+ log.debug(" laser control = %s", self.stringify_laser_control())
76
+ log.debug(" has area scan = %s", self.has_area_scan)
77
+ log.debug(" has actual integ time = %s", self.has_actual_integ_time)
78
+ log.debug(" has horiz binning = %s", self.has_horiz_binning)
79
+
80
+ def stringify_resolution(self):
81
+ v = self.integration_time_resolution
82
+ if v == INTEG_TIME_RES_ONE_MS:
83
+ return "1ms"
84
+ elif v == INTEG_TIME_RES_TEN_MS:
85
+ return "10ms"
86
+ elif v == INTEG_TIME_RES_SWITCHABLE:
87
+ return "Switchable"
88
+ else:
89
+ return "ERROR"
90
+
91
+ def stringify_header(self):
92
+ v = self.data_header
93
+ if v == DATA_HEADER_NONE:
94
+ return "None"
95
+ elif v == DATA_HEADER_OCEAN_OPTICS:
96
+ return "Ocean Optics"
97
+ elif v == DATA_HEADER_WASATCH:
98
+ return "Wasatch"
99
+ else:
100
+ return "ERROR"
101
+
102
+ def stringify_laser_type(self):
103
+ v = self.laser_type
104
+ if v == LASER_TYPE_NONE:
105
+ return "None"
106
+ elif v == LASER_TYPE_INTERNAL:
107
+ return "Internal"
108
+ elif v == LASER_TYPE_EXTERNAL:
109
+ return "External"
110
+ else:
111
+ return "ERROR"
112
+
113
+ def stringify_laser_control(self):
114
+ v = self.laser_control
115
+ if v == LASER_CONTROL_MODULATION:
116
+ return "Modulation"
117
+ elif v == LASER_CONTROL_TRANSITION_POINTS:
118
+ return "Transition Points"
119
+ elif v == LASER_CONTROL_RAMPING:
120
+ return "Ramping"
121
+ else:
122
+ return "ERROR"
123
+
124
+ def to_dict(self):
125
+ return self.__dict__