Пример #1
0
 def setUp(self):
     GuanoFile.register('User', 'Answer', int)
     self.md = GuanoFile.from_string(self.MD)
Пример #2
0
from guano import GuanoFile, base64decode, base64encode

from zcant import print_timing

import logging
log = logging.getLogger(__name__)

Byte = struct.Struct('< B')

ANABAT_129_HEAD_FMT = '< H x B 2x 8s 8s 40s 50s 16s 73s 80s'  # 0x0: data_info_pointer, file_type, tape, date, loc, species, spec, note1, note2
ANABAT_129_DATA_INFO_FMT = '< H H B B'  # 0x11a: data_pointer, res1, divratio, vres
ANABAT_132_ADDL_DATA_INFO_FMT = '< H B B B B B B H 6s 32s'  # 0x120: year, month, day, hour, minute, second, second_hundredths, microseconds, id_code, gps_data

GuanoFile.register('ZCANT', 'Amplitudes',
                   lambda b64data: np.frombuffer(base64decode(b64data)),
                   lambda data: base64encode(data.tobytes()))


class DotStatus:
    """Enumeration of dot status types"""
    OUT_OF_RANGE = 0
    OFF = 1
    NORMAL = 2
    MAIN = 3


def _s(s):
    """Strip whitespace and null bytes from string"""
    return s.strip('\00\t ')