Skip to content

Commit

Permalink
changed to force to convert the values to float and raise exception o…
Browse files Browse the repository at this point in the history
…therwise when creating a hydrophone
  • Loading branch information
cparcerisas committed Sep 4, 2024
1 parent 5f2004d commit 43374c9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pyhydrophone/hydrophone.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@ def __init__(self, name, model, serial_number, sensitivity, preamp_gain, Vpp, st
self.name = name
self.model = model
self.serial_number = serial_number
self.sensitivity = sensitivity
self.preamp_gain = preamp_gain
self.Vpp = Vpp
try:
self.sensitivity = float(sensitivity)
except ValueError:
raise ValueError("Sensitivity must be an integer or float")
try:
self.preamp_gain = float(preamp_gain)
except ValueError:
raise ValueError("preamp_gain must be an integer or float")
try:
self.Vpp = float(Vpp)
except ValueError:
raise ValueError("Vpp must be an integer or float")
self.string_format = string_format
self.cal_freq = 250
self.cal_value = 114
Expand Down

0 comments on commit 43374c9

Please sign in to comment.