qub_adaptive_resample.h.html mathcode2html   
 Source file:   qub_adaptive_resample.h
 Converted:   Thu Feb 26 2015 at 13:39:00
 This documentation file will not reflect any later changes in the source file.

$$\phantom{******** If you see this on the webpage then the browser could not locate *********}$$
$$\phantom{******** jsMath/easy/load.js or the variable root is set wrong in this file *********}$$
$$\newcommand{\vector}[1]{\left[\begin{array}{c} #1 \end{array}\right]}$$ $$\newenvironment{matrix}{\left[\begin{array}{cccccccccc}} {\end{array}\right]}$$ $$\newcommand{\A}{{\cal A}}$$ $$\newcommand{\W}{{\cal W}}$$

/* Copyright 2008-2011 Research Foundation State University of New York   */

/* This file is part of QUB Express.                                      */

/* QUB Express is free software; you can redistribute it and/or modify    */
/* it under the terms of the GNU General Public License as published by   */
/* the Free Software Foundation, either version 3 of the License, or      */
/* (at your option) any later version.                                    */

/* QUB Express is distributed in the hope that it will be useful,         */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of         */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
/* GNU General Public License for more details.                           */

/* You should have received a copy of the GNU General Public License,     */
/* named LICENSE.txt, in the QUB Express program directory.  If not, see  */
/* <http://www.gnu.org/licenses/>.                                        */

#ifndef QUB_ADAPTIVE_RESAMPLE_H
#define QUB_ADAPTIVE_RESAMPLE_H

#include "qubfast.h"

#ifdef __cplusplus
extern "C" {
#endif

  QUBFAST_API int    qub_adaptive_resample(float *data, int ndata, double MaxStd,
                                           float *out_mean, float *out_std,
					   int *out_first, int *out_last, int *out_closest);
  // Fills out_* with a reduced form of data, as intervals with all out_std[i] <= MaxStd (binary decomposition).
  // @param data: sampled input array
  // @param ndata: length of data array
  // @param MaxStd: desired ceiling for out_std[i]
  // @param out_mean: array of each interval's mean value; must have room for up to ndata intervals
  // @param out_std: array of each interval's standard deviation
  // @param out_first: array of each interval's first sample index, relative to start of data
  // @param out_last: array of each interval's final sample index
  // @param out_closest: array of closest sample index to mean in each interval

  // @returns: number of intervals


QUBFAST_API void*  qub_adres_create(double amp_delta, double min_dur_ms, double sampling_ms);
  // Returns a new adaptive resampling idealizer.
  // @param amp_delta: minimum distance between added levels
  // @param min_dur_ms: events shorter than this will be joined to their neighbor
  // @param sampling_ms: sampling interval

QUBFAST_API void   qub_adres_destroy(void *idlstim);
  // Frees the resources used by the idealizer.

QUBFAST_API void   qub_adres_add(void *idlstim, float *samples, int count);
  // Feeds sampled data to the idealizer.

QUBFAST_API void   qub_adres_done_add(void *idlstim);
  // After you have added all data, prepares the idealizer for output (get_*())

QUBFAST_API int    qub_adres_get_class_count(void *idlstim);
  // After done_add(), returns the number of distinct levels

QUBFAST_API int    qub_adres_get_dist(void *idlstim, double *amps, double *stds);
  // After done_add(), fills in amps[:amp_count] with all the levels (idealization class amps)

QUBFAST_API int    qub_adres_get_next_dwells(void *idlstim, int offset_in_data, int sample_count,
					       int *firsts, int *lasts, int *classes, float *durations);
  // After done_add(), fills in the dwells corresponding to the next sample_count samples.
  // @param offset_in_data: offset of the first sample requested, in the data file
  // @param sample_count: length of data chunk, in samples
  // @param firsts: array[sample_count] to hold dwell first sample index
  // @param lasts: array[sample_count] to hold dwell last sample index
  // @param classes: array[sample_count] to hold dwell class index
  // @param durations: array[sample_count] to hold dwell duration [ms], or NULL



#ifdef __cplusplus
}
#endif

#endif