hyrax.data_sets.hyrax_cifar_dataset
===================================

.. py:module:: hyrax.data_sets.hyrax_cifar_dataset


Attributes
----------

.. autoapisummary::

   hyrax.data_sets.hyrax_cifar_dataset.logger


Classes
-------

.. autoapisummary::

   hyrax.data_sets.hyrax_cifar_dataset.HyraxCifarBase
   hyrax.data_sets.hyrax_cifar_dataset.HyraxCifarDataset
   hyrax.data_sets.hyrax_cifar_dataset.HyraxCifarIterableDataset


Module Contents
---------------

.. py:data:: logger

.. py:class:: HyraxCifarBase(config: dict, data_location: pathlib.Path = None)

   Base class for Hyrax Cifar datasets


   .. py:attribute:: data_location


   .. py:attribute:: training_data


   .. py:attribute:: cifar


   .. py:attribute:: id_width
      :value: 0



   .. py:method:: get_image(idx)

      Get the image at the given index as a NumPy array.



   .. py:method:: get_label(idx)

      Get the label at the given index.



   .. py:method:: get_index(idx)

      Get the index of the item.



   .. py:method:: get_object_id(idx)

      Get the object ID for the item.



   .. py:method:: ids()

      This is the default IDs function you get when you derive from hyrax Dataset

      :returns: A generator yielding all the string IDs of the dataset.
      :rtype: Generator[str]



.. py:class:: HyraxCifarDataset(config: dict, data_location: pathlib.Path = None)

   Bases: :py:obj:`HyraxCifarBase`, :py:obj:`hyrax.data_sets.data_set_registry.HyraxDataset`, :py:obj:`torch.utils.data.Dataset`


   Map style CIFAR 10 dataset for Hyrax

   This is simply a version of CIFAR10 that is initialized using Hyrax config with a transformation
   that works well for example code.

   We only use the training split in the data, because it is larger (50k images). Hyrax will then divide that
   into Train/test/Validate according to configuration.

   .. py:method:: __init__

   Overall initialization for all DataSets which saves the config

   Subclasses of HyraxDataSet ought call this at the end of their __init__ like:

   .. code-block:: python

       from hyrax.data_sets import HyraxDataset
       from torch.utils.data import Dataset

       class MyDataset(HyraxDataset, Dataset):
           def __init__(config):
               <your code>
               super().__init__(config)

   If per tensor metadata is available, it is recommended that dataset authors create an
   astropy Table of that data, in the same order as their data and pass that `metadata_table`
   as shown below:

   .. code-block:: python

       from hyrax.data_sets import HyraxDataset
       from torch.utils.data import Dataset
       from astropy.table import Table

       class MyDataset(HyraxDataset, Dataset):
           def __init__(config):
               <your code>
               metadata_table = Table(<Your catalog data goes here>)
               super().__init__(config, metadata_table)

   :param config: The runtime configuration for hyrax
   :type config: dict, Optional
   :param metadata_table: An Astropy Table with
                          1. the metadata columns desired for visualization AND
                          2. in the order your data will be enumerated.
   :type metadata_table: Optional[Table], optional
   :param object_id_column_name: The name of the column containing object IDs. If None, uses the default
                                 from config or creates one from the ids() method.
   :type object_id_column_name: Optional[str], optional


   .. py:method:: __len__()


   .. py:method:: __getitem__(idx)


.. py:class:: HyraxCifarIterableDataset(config: dict, data_location: pathlib.Path = None)

   Bases: :py:obj:`HyraxCifarBase`, :py:obj:`hyrax.data_sets.data_set_registry.HyraxDataset`, :py:obj:`torch.utils.data.IterableDataset`


   Iterable style CIFAR 10 dataset for Hyrax

   This is simply a version of CIFAR10 that is initialized using Hyrax config with a transformation
   that works well for example code. This version only supports iteration, and not map-style access

   We only use the training split in the data, because it is larger (50k images). Hyrax will then divide that
   into Train/test/Validate according to configuration.

   .. py:method:: __init__

   Overall initialization for all DataSets which saves the config

   Subclasses of HyraxDataSet ought call this at the end of their __init__ like:

   .. code-block:: python

       from hyrax.data_sets import HyraxDataset
       from torch.utils.data import Dataset

       class MyDataset(HyraxDataset, Dataset):
           def __init__(config):
               <your code>
               super().__init__(config)

   If per tensor metadata is available, it is recommended that dataset authors create an
   astropy Table of that data, in the same order as their data and pass that `metadata_table`
   as shown below:

   .. code-block:: python

       from hyrax.data_sets import HyraxDataset
       from torch.utils.data import Dataset
       from astropy.table import Table

       class MyDataset(HyraxDataset, Dataset):
           def __init__(config):
               <your code>
               metadata_table = Table(<Your catalog data goes here>)
               super().__init__(config, metadata_table)

   :param config: The runtime configuration for hyrax
   :type config: dict, Optional
   :param metadata_table: An Astropy Table with
                          1. the metadata columns desired for visualization AND
                          2. in the order your data will be enumerated.
   :type metadata_table: Optional[Table], optional
   :param object_id_column_name: The name of the column containing object IDs. If None, uses the default
                                 from config or creates one from the ids() method.
   :type object_id_column_name: Optional[str], optional


   .. py:method:: __iter__()


