コード例 #1
0
ファイル: api.py プロジェクト: IKATS/ikats-pybase
    def read(tsuid_list, sd=None, ed=None):
        """
        Retrieve the data corresponding to a ts (or a list of ts) without knowing date range

        .. note::
            if omitted, *sd* (start date) and *ed* (end date) will be retrieved from meta data for each TS
            if you want a fixed windowed range, set *sd* and *ed* manually (but be aware that the TS may be
            not completely gathered)

        .. note::
            If no range is provided and no meta data are found, this method will compute the 3 elementary statistics:
               * ikats_start_date : First date of the TS
               * ikats_end_date : Last date of the TS
               * qual_nb_points : Number of points of the TS

        :param tsuid_list:
        :param sd: optional starting date (timestamp in ms from epoch)
        :param ed: optional ending date (timestamp in ms from epoch)

        :type tsuid_list: str or list
        :type sd: int
        :type ed: int

        :returns: a list of ts data as numpy array
        :rtype: list of numpy array

        :raises TypeError: if *tsuid_list* is neither a list nor a string
        """
        tdm = TemporalDataMgr()
        return tdm.get_ts(tsuid_list=tsuid_list, sd=sd, ed=ed)
コード例 #2
0
ファイル: spark_corr.py プロジェクト: fossabot/ikats-pyalgo
            def get_ts_to_accu(tsuid):
                """
                Function to be called to retrieve one TS content values
                :param tsuid: TS to get content from
                :return:
                """
                tdm = TemporalDataMgr(host=broadcast.value['host'],
                                      port=broadcast.value['port'])

                # The slice removes the timestamp column
                ts_points = tdm.get_ts(tsuid)[0][:, 1]

                accumulator.add(
                    {tsuid: {
                        "data": ts_points,
                        "nb_points": len(ts_points)
                    }})