<commit_before># ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#

import numpy as np
import logging
import struct

from basil.HL.SensirionBridgeDevice import SensirionBridgeI2CDevice

logger = logging.getLogger(__name__)
logging.getLogger("sensirion_shdlc_driver.connection").setLevel(logging.ERROR)


class sensirionSHT85(SensirionBridgeI2CDevice):
    '''
    Driver for the Sensirion SHT85 temperature and humidity sensor.
    Measurements can be performed in three repeatability modes:
    low (0.15C 0.21%RH) (default), medium (0.08C 0.15%RH), high (0.04C 0.08%RH)
    with respective drawbacks in readout speed and power cosumption.
    The dew point can be estimated using humidity and temperature.
    Readout may also be performed asynchronously:
    The sensor can measure periodicly with 0.5, 1, 2, 4 or 10 measurements per second.
    A non-blocking call to the asynchrounous read function may return None if no data is available.
    In ART mode the humidity response is accelerated.
    A heater may be turned on for debugging purposes.
    '''

    def __init__(self, intf, conf):
        super(sensirionSHT85, self).__init__(intf, conf)

    def init(self):
        super(sensirionSHT85, self).init(0x44)

        try:
            import crcmod
            self.crc_func = crcmod.mkCrcFun(0x131, initCrc=0xFF, rev=False, xorOut=0x00)
        except ImportError:
            logger.warning("You have to install the package 'crcmod'! Transmission errors will not be caught.")
            self.crc_func = lambda x: 0

        self.repeatability = self._init.get('repeatability', 'low')

    def _read(self, command, read_n_words=0, timeout_us=20e3, n_tries=10):
        for _ in range(n_tries):
            rx_data = super(sensirionSHT85, self)._read(command, read_n_words * 3, timeout_us)
            data = [0] * read_n_words
            for i in range(read_n_words):
                if self.crc_func(rx_data[i * 3:(i + 1) * 3]):
                    break<commit_msg>ENH: Reverting removal of deg sign<commit_after># ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#

import numpy as np
import logging
import struct

from basil.HL.SensirionBridgeDevice import SensirionBridgeI2CDevice

logger = logging.getLogger(__name__)
logging.getLogger("sensirion_shdlc_driver.connection").setLevel(logging.ERROR)


class sensirionSHT85(SensirionBridgeI2CDevice):
    '''
    Driver for the Sensirion SHT85 temperature and humidity sensor.
    Measurements can be performed in three repeatability modes:
    low (0.15°C 0.21%RH) (default), medium (0.08°C 0.15%RH), high (0.04°C 0.08%RH)
    with respective drawbacks in readout speed and power cosumption.
    The dew point can be estimated using humidity and temperature.
    Readout may also be performed asynchronously:
    The sensor can measure periodicly with 0.5, 1, 2, 4 or 10 measurements per second.
    A non-blocking call to the asynchrounous read function may return None if no data is available.
    In ART mode the humidity response is accelerated.
    A heater may be turned on for debugging purposes.
    '''

    def __init__(self, intf, conf):
        super(sensirionSHT85, self).__init__(intf, conf)

    def init(self):
        super(sensirionSHT85, self).init(0x44)

        try:
            import crcmod
            self.crc_func = crcmod.mkCrcFun(0x131, initCrc=0xFF, rev=False, xorOut=0x00)
        except ImportError:
            logger.warning("You have to install the package 'crcmod'! Transmission errors will not be caught.")
            self.crc_func = lambda x: 0

        self.repeatability = self._init.get('repeatability', 'low')

    def _read(self, command, read_n_words=0, timeout_us=20e3, n_tries=10):
        for _ in range(n_tries):
            rx_data = super(sensirionSHT85, self)._read(command, read_n_words * 3, timeout_us)
            data = [0] * read_n_words
            for i in range(read_n_words):
                if self.crc_func(rx_data[i * 3:(i + 1) * 3]):
                    break
{'fraction_non_alphanumeric': 0.13484708063021317, 'fraction_numerical': 0.027803521779425393, 'mean_word_length': 2.5212071778140293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '939232', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1258, 'n_words': 402}