Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 3e2c75f

Browse files
author
Daniel Cogswell
committed
This commit is for debugging purposes only. It tells you where to look
in BTSDA to get the correct range multiplier when a missing range is encountered. It finds the first instance of the missing range with a non-zero current and prints an error message.
1 parent 485671c commit 3e2c75f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

NewareNDA/NewareNDA.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,13 @@ def _bytes_to_list(bytes):
256256
if Index == 0 or Status == 0:
257257
return []
258258

259-
multiplier = multiplier_dict[Range]
259+
try:
260+
multiplier = multiplier_dict[Range]
261+
except KeyError:
262+
multiplier = float('nan')
263+
if Current != 0:
264+
raise KeyError(f"Missing range multiplier {Range}. Using BTSDA, get the current at index {Index} and divide by {Current}.")
265+
pass
260266

261267
# Create a dictionary for the record
262268
list = [

NewareNDA/NewareNDAx.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,13 @@ def _bytes_to_list_ndc(bytes):
497497
[Y, M, D, h, m, s] = struct.unpack('<HBBBBB', bytes[75:82])
498498
[Range] = struct.unpack('<i', bytes[82:86])
499499

500-
multiplier = multiplier_dict[Range]
500+
try:
501+
multiplier = multiplier_dict[Range]
502+
except KeyError:
503+
multiplier = float('nan')
504+
if Current != 0:
505+
raise KeyError(f"Missing range multiplier {Range}. Using BTSDA, get the current at index {Index} and divide by {Current}.")
506+
pass
501507

502508
# Create a record
503509
list = [

NewareNDA/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = 'v2024.12.02'
1+
__version__ = '0.0.0'

0 commit comments

Comments
 (0)