:py:mod:`tape.timeseries`
=========================

.. py:module:: tape.timeseries


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

Classes
~~~~~~~

.. autoapisummary::

   tape.timeseries.TimeSeries




.. py:class:: TimeSeries(data=None)


   Represent and analyze Rubin TimeSeries data

   .. py:property:: time

      Time values stored as a Pandas Series

   .. py:property:: flux

      Flux values stored as a Pandas Series

   .. py:property:: flux_err

      Flux error values stored as a Pandas Series

   .. py:property:: band

      Band labels stored as a Pandas Index

   .. py:method:: from_dict(data_dict, time_label='time', flux_label='flux', err_label='flux_err', band_label='band')

      Build dataframe from a python dictionary

      :param data_dict: Dictionary contaning the data.
      :type data_dict: `dict`
      :param time_label: Name for column containing time information.
      :type time_label: `str`
      :param flux_label: Name for column containing signal
                         (flux, magnitude, etc) information.
      :type flux_label: `str`
      :param err_label: Name for column containing error information.
      :type err_label: `str`
      :param band_label: Name for column containing filter information.
      :type band_label: `str`


   .. py:method:: dropna(**kwargs)

      Handle NaN values, wrapper for pandas.DataFrame.dropna


   .. py:method:: from_dataframe(data, object_id, time_label='time', flux_label='flux', err_label='flux_err', band_label='band')

      Loader function for inputing data from a dataframe.

      :param data: The data for the time serires.
      :type data: `pandas.DataFrame`
      :param object_id: The ID of the current object.
      :type object_id: `str`
      :param time_label: Name for column containing time information.
      :type time_label: `str`
      :param flux_label: Name for column containing signal
                         (flux, magnitude, etc) information.
      :type flux_label: `str`
      :param err_label: Name for column containing error information.
      :type err_label: `str`
      :param band_label: Name for column containing filter information.
      :type band_label: `str`


   .. py:method:: _build_index(band)

      Build pandas multiindex from band array


   .. py:method:: stetson_J(band=None)

      Compute the stetsonJ statistic on data from one or several bands

      :param band: Single band descriptor, or list of such descriptors.
      :type band: `str` or `list` of `str`

      :returns: **stetsonJ** -- StetsonJ statistic for each of input bands.
      :rtype: `dict`

      .. note::

         In case that no value for band is passed, the function is executed
         on all available bands.


   .. py:method:: sf2(sf_method='basic', argument_container=None)

      Compute the structure function squared statistic on data

      :param bins: Manually provided bins, if not provided then bins are computed using
                   the `method` kwarg
      :type bins: `numpy.array` or `list`
      :param band_to_calc: Single band descriptor, or list of such descriptors.
      :type band_to_calc: `str` or `list` of `str`
      :param method: The binning method to apply, choices of 'size'; which seeks an even
                     distribution of samples per bin using quantiles, 'length'; which
                     creates bins of equal length in time and 'loglength'; which creates
                     bins of equal length in log time.
      :type method: 'str'
      :param sthresh: Target number of samples per bin.
      :type sthresh: 'int'

      :returns: **stetsonJ** -- Structure function squared statistic for each of input bands.
      :rtype: `dict`

      .. note::

         In case that no value for band_to_calc is passed, the function is executed
         on all available bands.



