:py:mod:`tape.utils`
====================

.. py:module:: tape.utils


Subpackages
-----------
.. toctree::
   :titlesonly:
   :maxdepth: 3

   column_mapper/index.rst


Submodules
----------
.. toctree::
   :titlesonly:
   :maxdepth: 1

   utils/index.rst


Package Contents
----------------

Classes
~~~~~~~

.. autoapisummary::

   tape.utils.ColumnMapper
   tape.utils.IndexCallable




.. py:class:: ColumnMapper(id_col=None, time_col=None, flux_col=None, err_col=None, band_col=None)


   Maps columns from a given dataset into known ensemble column

   .. py:method:: _set_known_map(hipscat=True)
      :abstractmethod:

      Must be defined in a known map class


   .. py:method:: use_known_map(map_id, hipscat=True)

      Use a known mapping scheme

      :param map_id: Identifies which mapping scheme to use
      :type map_id: 'str'
      :param hipscat: Indicates whether the data is in hipscat format or not, which will
                      affect the chosen ID column (_hipscat_index will be used when
                      hipscat is true. True by default.
      :type hipscat: 'bool'

      :returns: * *A ColumnMapper subclass object dependent on the map_id provided,*
                * *ZTFColumnMapper in the case of "ZTF" for example*


   .. py:method:: is_ready(show_needed=False)

      shows whether the ColumnMapper has all critical columns assigned

      :param show_needed: Indicates whether to also return a list of missing columns
      :type show_needed: 'bool', optional

      :rtype: `bool` or tuple of (bool, list) dependent on show_needed parameter


   .. py:method:: assign(id_col=None, time_col=None, flux_col=None, err_col=None, band_col=None)

      Updates a given set of columns

      :param id_col: Identifies which column contains the Object IDs
      :type id_col: 'str', optional
      :param time_col: Identifies which column contains the time information
      :type time_col: 'str', optional
      :param flux_col: Identifies which column contains the flux/magnitude information
      :type flux_col: 'str', optional
      :param err_col: Identifies which column contains the flux/mag error information
      :type err_col: 'str', optional
      :param band_col: Identifies which column contains the band information
      :type band_col: 'str', optional
      :param nobs_col: Identifies which columns contain number of observations for each
                       band, if available in the input object file
      :type nobs_col: list of 'str', optional
      :param nobs_tot_col: Identifies which column contains the total number of observations,
                           if available in the input object file
      :type nobs_tot_col: 'str', optional



.. py:class:: IndexCallable(fn, dirty, ensemble, label)


   Provide getitem syntax for functions

   >>> def inc(x):
   ...     return x + 1

   >>> I = IndexCallable(inc)
   >>> I[3]
   4

   .. py:attribute:: __slots__
      :value: ('fn', 'dirty', 'ensemble', 'label')

      

   .. py:method:: __getitem__(key)



