@@ -415,7 +415,7 @@ def actual_freq(self, val=None):
415
415
#get the dac
416
416
writebyte = 'actual_freq\r \n '
417
417
msgbytes = self .tinySA_serial (writebyte , printBool = False )
418
- elif (isinstance (val , int )) and (self .minSADeviceFreq <= val <= self .maxSADeviceFreq ):
418
+ elif (isinstance (val , ( int , float ) )) and (self .minSADeviceFreq <= val <= self .maxSADeviceFreq ):
419
419
writebyte = 'actual_freq ' + str (val )+ '\r \n '
420
420
msgbytes = self .tinySA_serial (writebyte , printBool = False )
421
421
self .print_message ("actual_freq set to " + str (val ))
@@ -712,7 +712,7 @@ def dac(self, val=None):
712
712
#get the dac
713
713
writebyte = 'dac\r \n '
714
714
msgbytes = self .tinySA_serial (writebyte , printBool = False )
715
- elif (isinstance (val , int )) and (0 <= val <= 4095 ):
715
+ elif (isinstance (val , ( int , float ) )) and (0 <= val <= 4095 ):
716
716
writebyte = 'dac ' + str (val )+ '\r \n '
717
717
msgbytes = self .tinySA_serial (writebyte , printBool = False )
718
718
self .print_message ("dac set to " + str (val ))
@@ -833,7 +833,7 @@ def ext_gain(self, val):
833
833
# example return: ''
834
834
835
835
#check input
836
- if (isinstance (val , int )) and (- 100 <= val <= 100 ):
836
+ if (isinstance (val , ( int , float ) )) and (- 100 <= val <= 100 ):
837
837
writebyte = 'ext_gain ' + str (val )+ '\r \n '
838
838
msgbytes = self .tinySA_serial (writebyte , printBool = False )
839
839
self .print_message ("ext_gain() set to " + str (val ))
@@ -869,7 +869,7 @@ def freq(self, val):
869
869
# example return: bytearray(b'')
870
870
871
871
#check input
872
- if (isinstance (val , int )) and (self .minSADeviceFreq <= val <= self .maxSADeviceFreq ):
872
+ if (isinstance (val , ( int , float ) )) and (self .minSADeviceFreq <= val <= self .maxSADeviceFreq ):
873
873
writebyte = 'freq ' + str (val )+ '\r \n '
874
874
msgbytes = self .tinySA_serial (writebyte , printBool = False )
875
875
self .print_message ("freq() set to " + str (val ))
@@ -918,14 +918,12 @@ def hop(self, start, stop, inc, outmask=None):
918
918
# outmask: 1 is frequency, 2 is level
919
919
# example return: ''
920
920
921
- if (isinstance (start , int )) and (isinstance (stop , int )) and (isinstance (inc , int )):
921
+ if (isinstance (start , ( int , float ))) and (isinstance (stop , ( int , float ))) and (isinstance (inc , ( int , float ) )):
922
922
if (isinstance (outmask , int )) and (0 < outmask < 3 ):
923
- writebyte = 'hop ' + str (start ) + ' ' + str (stop )
924
- + ' ' + str (inc ) + ' ' + str (outmask ) + '\r \n '
923
+ writebyte = 'hop ' + str (start ) + ' ' + str (stop ) + ' ' + str (inc ) + ' ' + str (outmask ) + '\r \n '
925
924
926
925
elif outmask == None :
927
- writebyte = 'hop ' + str (start ) + ' ' + str (stop )
928
- + ' ' + str (inc ) + '\r \n '
926
+ writebyte = 'hop ' + str (start ) + ' ' + str (stop ) + ' ' + str (inc ) + '\r \n '
929
927
930
928
msgbytes = self .tinySA_serial (writebyte , printBool = False )
931
929
self .print_message ("sampling over frequency range" )
@@ -1065,7 +1063,7 @@ def line(self, val):
1065
1063
writebyte = 'line ' + str (val )+ '\r \n '
1066
1064
msgbytes = self .tinySA_serial (writebyte , printBool = False )
1067
1065
self .print_message ("horizontal line turned off" )
1068
- elif (isinstance (val , int )) or (isinstance (val , float )):
1066
+ elif (isinstance (val , ( int , float ))): # or (isinstance(val, float)):
1069
1067
writebyte = 'line ' + str (val )+ '\r \n '
1070
1068
msgbytes = self .tinySA_serial (writebyte , printBool = False )
1071
1069
self .print_message ("horizontal line turned off" )
@@ -1171,7 +1169,7 @@ def marker(self, ID, val):
1171
1169
writebyte = 'marker ' + str (ID ) + ' ' + str (val )+ '\r \n '
1172
1170
msgbytes = self .tinySA_serial (writebyte , printBool = False )
1173
1171
self .print_message ("marker set to " + str (val ))
1174
- elif (isinstance (val , int )) or (isinstance (val , float )):
1172
+ elif (isinstance (val , ( int , float ))): # or (isinstance(val, float)):
1175
1173
writebyte = 'marker ' + str (ID ) + ' ' + str (val )+ '\r \n '
1176
1174
msgbytes = self .tinySA_serial (writebyte , printBool = False )
1177
1175
self .print_message ("marker set to " + str (val ))
@@ -2109,7 +2107,7 @@ def vbat_offset(self, val=None):
2109
2107
#get the offset
2110
2108
writebyte = 'vbat_offset\r \n '
2111
2109
msgbytes = self .tinySA_serial (writebyte , printBool = False )
2112
- elif (isinstance (val , int )) and (0 <= val <= 4095 ):
2110
+ elif (isinstance (val , ( int , float ) )) and (0 <= val <= 4095 ):
2113
2111
writebyte = 'vbat_offset ' + str (val )+ '\r \n '
2114
2112
msgbytes = self .tinySA_serial (writebyte , printBool = False )
2115
2113
self .print_message ("vbat_offset set to " + str (val ))
0 commit comments