Skip to content

Commit

Permalink
Merge pull request #32 from lifewatch/fix/float_arguments_sensitivity
Browse files Browse the repository at this point in the history
changed to force to convert the values to float and raise exception o…
  • Loading branch information
cparcerisas authored Sep 4, 2024
2 parents 9961d75 + 43374c9 commit a84ea3f
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 a84ea3f

Please sign in to comment.