1.6. utils
- fitdecode.utils.scrub_method_name(method_name, convert_units=False)
Create a valid Python name out of method_name
- fitdecode.utils.get_mesg_type(mesg_name_or_num)
Get a
fitdecode.MessageTypefromprofile, by its name (str) or its global number (int).Raise
ValueErrorif type was not found.
- fitdecode.utils.get_mesg_num(mesg_name)
Get the global number of a message as defined in
profile, by its nameRaise
ValueErrorif type was not found.
- fitdecode.utils.get_mesg_field(mesg_name_or_num, field_name_or_num)
Get the
fitdecode.types.Fieldobject of a particular field from a particular message.Raise
ValueErrorif message or field was not found.
- fitdecode.utils.get_mesg_field_num(mesg_name_or_num, field_name)
Get the definition number of a particular field from a particular message.
Raise
ValueErrorif message or field was not found.
- fitdecode.utils.get_field_type(field_name)
Get
fitdecode.FieldTypeby name fromprofile.Raise
ValueErrorif type was not found.
- fitdecode.utils.compute_crc(byteslike, *, crc=0, start=0, end=None)
Compute the CRC as per FIT definition, of byteslike object, from offset start (included) to end (excluded)
- fitdecode.utils.blocking_read(istream, size=-1, nonblocking_reads_delay=0.06)
Read from istream and do not return until size
byteshave been read unless EOF has been reached.Return all the data read so far. The length of the returned data may still be less than size in case EOF has been reached.
nonblocking_reads_delay specifies the number of seconds (float) to wait before trying to read from istream again in case
BlockingIOErrorhas been raised during previous call.