# Path: ifcb/data/adc.py
# SCHEMA = {
#     1: SCHEMA_VERSION_1,
#     2: SCHEMA_VERSION_2,
#     SCHEMA_VERSION_1._name: SCHEMA_VERSION_1,
#     SCHEMA_VERSION_2._name: SCHEMA_VERSION_2
# }
# 
# Path: ifcb/data/hdr.py
# TEMPERATURE = 'temperature'
# 
# HUMIDITY = 'humidity'
# 
# Path: ifcb/data/utils.py
# class BaseDictlike(object):
#     """
#     Provides as complete a readonly dict interface as possible,
#     based on anything that implements ``keys`` and ``__getitem__``.
#     when overriding, override ``has_key`` rather than ```__contains__``.
# 
#     Override any method if a more efficient implementation
#     is available.
#     """
#     def keys(self):
#         """
#         Default implementation raises ``NotImplementedError``.
#         This must be overridden for correct behavior.
#         """
#         raise NotImplementedError
#     def __getitem__(self, k):
#         """
#         Default implementation raises ``NotImplementedError``.
#         This must be overridden for correct behavior.
# 
#         :param k: the key
#         :type k: hashable
#         """
#         raise NotImplementedError
#     def __iter__(self):
#         yield from self.keys()
#     def has_key(self, k):
#         """
#         Iterates over keys and returns first key for
#         which equality test passes. This method is
#         called by the ``__contains__`` special method.
# 
#         :param k: the key to test
#         :type k: hashable
#         """
#         for ek in self.keys():
#             if ek == k:
#                 return True
#         return False
#     def __contains__(self, k):
#         return self.has_key(k)
#     def items(self):
#         """
#         Yields item pairs, based on calling keys
#         and then accessing each item.
#         """
#         for k in self.keys():
#             yield k, self[k]
#     def values(self):
#         """
#         Yields all values. Calls ``items``.
#         """
#         for k, v in self.items():
#             yield v
#     def __len__(self):
#         n = 0
#         for k in self.keys():
#             n += 1
#         return n
# 
# Path: ifcb/metrics/ml_analyzed.py
# def compute_ml_analyzed(abin):
#     """returns ml_analyzed, look time, run time"""
#     s = abin.schema
#     if s is SCHEMA_VERSION_1:
#         return compute_ml_analyzed_s1(abin)
#     elif s is SCHEMA_VERSION_2:
#         return compute_ml_analyzed_s2(abin)


from functools import lru_cache
from .adc import SCHEMA
from .hdr import TEMPERATURE, HUMIDITY
from .utils import BaseDictlike
from ..metrics.ml_analyzed import compute_ml_analyzed
        from .hdf import bin2hdf
        from .zip import bin2zip
        from .matlab import bin2mat

    Also supports an "adc" property that is a Pandas DataFrame containing
    ADC data. Subclasses are required to provide this. The default dictlike
    implementation uses that property.

    Context manager support is provided for implementations
    that must open files or other data streams.
    """
    @property
    def lid(self):
        """
        :returns str: the bin's LID.
        """
        return self.pid.bin_lid
    @property
    @lru_cache()
    def images_adc(self):
        """
        :returns pandas.DataFrame: the ADC data, minus targets that
          are not associated with images
        """
        return self.adc[self.adc[self.schema.ROI_WIDTH] > 0]
    @property
    def timestamp(self):
        """
        :returns datetime: the bin's timestamp.
        """
        return self.pid.timestamp
    @property
    def schema(self):

# Path: ifcb/data/adc.py
# SCHEMA = {
#     1: SCHEMA_VERSION_1,
#     2: SCHEMA_VERSION_2,
#     SCHEMA_VERSION_1._name: SCHEMA_VERSION_1,
#     SCHEMA_VERSION_2._name: SCHEMA_VERSION_2
# }
# 
# Path: ifcb/data/hdr.py
# TEMPERATURE = 'temperature'
# 
# HUMIDITY = 'humidity'
# 
# Path: ifcb/data/utils.py
# class BaseDictlike(object):
#     """
#     Provides as complete a readonly dict interface as possible,
#     based on anything that implements ``keys`` and ``__getitem__``.
#     when overriding, override ``has_key`` rather than ```__contains__``.
# 
#     Override any method if a more efficient implementation
#     is available.
#     """
#     def keys(self):
#         """
#         Default implementation raises ``NotImplementedError``.
#         This must be overridden for correct behavior.
#         """
#         raise NotImplementedError
#     def __getitem__(self, k):
#         """
#         Default implementation raises ``NotImplementedError``.
#         This must be overridden for correct behavior.
# 
#         :param k: the key
#         :type k: hashable
#         """
#         raise NotImplementedError
#     def __iter__(self):
#         yield from self.keys()
#     def has_key(self, k):
#         """
#         Iterates over keys and returns first key for
#         which equality test passes. This method is
#         called by the ``__contains__`` special method.
# 
#         :param k: the key to test
#         :type k: hashable
#         """
#         for ek in self.keys():
#             if ek == k:
#                 return True
#         return False
#     def __contains__(self, k):
#         return self.has_key(k)
#     def items(self):
#         """
#         Yields item pairs, based on calling keys
#         and then accessing each item.
#         """
#         for k in self.keys():
#             yield k, self[k]
#     def values(self):
#         """
#         Yields all values. Calls ``items``.
#         """
#         for k, v in self.items():
#             yield v
#     def __len__(self):
#         n = 0
#         for k in self.keys():
#             n += 1
#         return n
# 
# Path: ifcb/metrics/ml_analyzed.py
# def compute_ml_analyzed(abin):
#     """returns ml_analyzed, look time, run time"""
#     s = abin.schema
#     if s is SCHEMA_VERSION_1:
#         return compute_ml_analyzed_s1(abin)
#     elif s is SCHEMA_VERSION_2:
#         return compute_ml_analyzed_s2(abin)


# Path: ifcb/data/bins.py
from functools import lru_cache
from .adc import SCHEMA
from .hdr import TEMPERATURE, HUMIDITY
from .utils import BaseDictlike
from ..metrics.ml_analyzed import compute_ml_analyzed
        from .hdf import bin2hdf
        from .zip import bin2zip
        from .matlab import bin2mat


    Also supports an "adc" property that is a Pandas DataFrame containing
    ADC data. Subclasses are required to provide this. The default dictlike
    implementation uses that property.

    Context manager support is provided for implementations
    that must open files or other data streams.
    """
    @property
    def lid(self):
        """
        :returns str: the bin's LID.
        """
        return self.pid.bin_lid
    @property
    @lru_cache()
    def images_adc(self):
        """
        :returns pandas.DataFrame: the ADC data, minus targets that
          are not associated with images
        """
        return self.adc[self.adc[self.schema.ROI_WIDTH] > 0]
    @property
    def timestamp(self):
        """
        :returns datetime: the bin's timestamp.
        """
        return self.pid.timestamp
    @property
    def schema(self):

        return SCHEMA[self.pid.schema_version]