@@ -228,7 +228,7 @@ def wrheaderfile(self, recwritefields, sigwritefields):
228228 if field in recwritefields :
229229 stringfield = str (getattr (self , field ))
230230 # If fs is float, check whether it as an integer
231- if field == 'fs' and type (self .fs ) == float :
231+ if field == 'fs' and isinstance (self .fs , float ) :
232232 if round (self .fs , 8 ) == float (int (self .fs )):
233233 stringfield = str (int (self .fs ))
234234 recordline = recordline + recfieldspecs [field ].delimiter + stringfield
@@ -371,12 +371,12 @@ def getsigsegments(self, signame=None):
371371 if signame is None :
372372 signame = self .getsignames ()
373373
374- if type (signame ) == list :
374+ if isinstance (signame , list ) :
375375 sigdict = {}
376376 for sig in signame :
377377 sigdict [sig ] = self .getsigsegments (sig )
378378 return sigdict
379- elif type (signame ) == str :
379+ elif isinstance (signame , str ) :
380380 sigsegs = []
381381 for i in range (self .nseg ):
382382 if self .segname [i ] != '~' and signame in self .segments [i ].signame :
@@ -594,38 +594,39 @@ def __init__(self, allowedtypes, delimiter, dependency, write_req, read_def, wri
594594 # so that the user doesn't need to. But when reading, it should
595595 # be clear that the fields are missing.
596596
597- inttypes = [int , np .int64 , np .int32 , np .int16 , np .int8 ]
598- floattypes = inttypes + [float , np .float64 , np .float32 ]
597+ inttypes = (int , np .int64 , np .int32 , np .int16 , np .int8 )
598+ floattypes = inttypes + (float , np .float64 , np .float32 )
599+ int_dtypes = ('int64' , 'uint64' , 'int32' , 'uint32' ,'int16' ,'uint16' )
599600
600601# Record specification fields
601- recfieldspecs = OrderedDict ([('recordname' , WFDBheaderspecs ([ str ] , '' , None , True , None , None )),
602+ recfieldspecs = OrderedDict ([('recordname' , WFDBheaderspecs (( str ) , '' , None , True , None , None )),
602603 ('nseg' , WFDBheaderspecs (inttypes , '/' , 'recordname' , True , None , None )),
603604 ('nsig' , WFDBheaderspecs (inttypes , ' ' , 'recordname' , True , None , None )),
604605 ('fs' , WFDBheaderspecs (floattypes , ' ' , 'nsig' , True , 250 , None )),
605606 ('counterfreq' , WFDBheaderspecs (floattypes , '/' , 'fs' , False , None , None )),
606607 ('basecounter' , WFDBheaderspecs (floattypes , '(' , 'counterfreq' , False , None , None )),
607608 ('siglen' , WFDBheaderspecs (inttypes , ' ' , 'fs' , True , None , None )),
608- ('basetime' , WFDBheaderspecs ([ str ] , ' ' , 'siglen' , False , None , '00:00:00' )),
609- ('basedate' , WFDBheaderspecs ([ str ] , ' ' , 'basetime' , False , None , None ))])
609+ ('basetime' , WFDBheaderspecs (( str ) , ' ' , 'siglen' , False , None , '00:00:00' )),
610+ ('basedate' , WFDBheaderspecs (( str ) , ' ' , 'basetime' , False , None , None ))])
610611
611612# Signal specification fields.
612- sigfieldspecs = OrderedDict ([('filename' , WFDBheaderspecs ([ str ] , '' , None , True , None , None )),
613- ('fmt' , WFDBheaderspecs ([ str ] , ' ' , 'filename' , True , None , None )),
613+ sigfieldspecs = OrderedDict ([('filename' , WFDBheaderspecs (( str ) , '' , None , True , None , None )),
614+ ('fmt' , WFDBheaderspecs (( str ) , ' ' , 'filename' , True , None , None )),
614615 ('sampsperframe' , WFDBheaderspecs (inttypes , 'x' , 'fmt' , False , 1 , None )),
615616 ('skew' , WFDBheaderspecs (inttypes , ':' , 'fmt' , False , None , None )),
616617 ('byteoffset' , WFDBheaderspecs (inttypes , '+' , 'fmt' , False , None , None )),
617618 ('adcgain' , WFDBheaderspecs (floattypes , ' ' , 'fmt' , True , 200. , None )),
618619 ('baseline' , WFDBheaderspecs (inttypes , '(' , 'adcgain' , True , 0 , None )),
619- ('units' , WFDBheaderspecs ([ str ] , '/' , 'adcgain' , True , 'mV' , None )),
620+ ('units' , WFDBheaderspecs (( str ) , '/' , 'adcgain' , True , 'mV' , None )),
620621 ('adcres' , WFDBheaderspecs (inttypes , ' ' , 'adcgain' , False , None , 0 )),
621622 ('adczero' , WFDBheaderspecs (inttypes , ' ' , 'adcres' , False , None , 0 )),
622623 ('initvalue' , WFDBheaderspecs (inttypes , ' ' , 'adczero' , False , None , None )),
623624 ('checksum' , WFDBheaderspecs (inttypes , ' ' , 'initvalue' , False , None , None )),
624625 ('blocksize' , WFDBheaderspecs (inttypes , ' ' , 'checksum' , False , None , 0 )),
625- ('signame' , WFDBheaderspecs ([ str ] , ' ' , 'blocksize' , False , None , None ))])
626+ ('signame' , WFDBheaderspecs (( str ) , ' ' , 'blocksize' , False , None , None ))])
626627
627628# Segment specification fields.
628- segfieldspecs = OrderedDict ([('segname' , WFDBheaderspecs ([ str ] , '' , None , True , None , None )),
629+ segfieldspecs = OrderedDict ([('segname' , WFDBheaderspecs (( str ) , '' , None , True , None , None )),
629630 ('seglen' , WFDBheaderspecs (inttypes , ' ' , 'segname' , True , None , None ))])
630631
631632
0 commit comments