volcamcore  2019 march
Biblioteca volcamcore
Clases
Referencia del Archivo timeseries_analysis.h

Clase para el manejo de datos que tienen tiempo asignado. Más...

#include <QObject>
#include <QtWidgets>
#include "qmath.h"

Ir al código fuente de este archivo.

Clases

class  timeseries_analysis
 

Descripción detallada

Clase para el manejo de datos que tienen tiempo asignado.

Versión
1.0
Fecha
2019 march
Autor
Carlos Alberto Ospina Caicedo (SGC-OVSPo)

Con esta clase es posible:

  1. interpolate(): Es posible calcular la interpolación entre dos puntos p1(time,y1) y p2(time,y2) a secs_interpolate [s]
  2. findClosestDateTime_onList(): Por último, es posible obtener el índice de la lista "list2search" más próximo a el tiempo "dt", para lo cual, la diferencia de tiempo debe ser menor al valor "lessthan"
  3. set_DateTimeList(), match_DateTimeList(): En base a un par de listas/vectores de tiempo, obtener los índices de la segunda lista que se acercan en tiempo a los datos de la primer lista.

Ejemplo para obtener lista de imágenes que hay cada minuto, tomando en cuenta que la lista de imágenes en imgwc_, puede estar incompleta.

La estructura final contiene una lista de imágenes que se tomaron cada interval_sec_ [s] a lo largo de duration_sec_ [s]

ImgsWC Imagenes_WC::sortImageWCList_byseconds(ImgsWC imgwc_, QDateTime start, int duration_sec_ , double interval_sec_)
{
ImgsWC imgwc_sorted;
QDateTime dt = start;
int count = duration_sec_ / interval_sec_;
for(int i=0;i<count;i++)
{
imgwc_sorted.ids.append(i);
imgwc_sorted.datetime.append(dt.addSecs(i*interval_sec_));
imgwc_sorted.datetime.last().setOffsetFromUtc(imgwc_.datetime.last().offsetFromUtc());
imgwc_sorted.path.append("./NULL_image.png");
imgwc_sorted.second_path.append("./NULL_image.png");
imgwc_sorted.station.append("");
imgwc_sorted.edition.append("");
imgwc_sorted.paramsrelated_id.append(-1);
imgwc_sorted.classification.append("");
}
// -- Encontrando Parejas de datos
ta.set_DateTimeList(&imgwc_sorted.datetime,&imgwc_.datetime);
ta.match_DateTimeList(1.0*interval_sec_,false); //tiempo mínimo en segundos = 1.0*(timepo muestreo)
if(testFunc) qDebug()<<"Matching finalizado: " << imgwc_sorted.ids.size() << imgwc_.ids.size();
for(int i=0 ;i<ta.matching_indices_int.size() ; i++ )
{
int index = ta.matching_indices_int[i];
if(index!=-1 && index<imgwc_.ids.size() && i<imgwc_sorted.ids.size())
{
imgwc_sorted = replaceImageWCAtIndex(imgwc_sorted , i ,
imgwc_.ids[index],
imgwc_.datetime[index],
imgwc_.path[index],
imgwc_.second_path[index],
imgwc_.station[index],
imgwc_.edition[index],
imgwc_.paramsrelated_id[index],
imgwc_.classification[index]);
if(i>1430 && testFunc)
qDebug()<<"Probando" << i << index << imgwc_sorted.ids[i] << imgwc_sorted.datetime[i] << imgwc_.datetime[index] << imgwc_.paramsrelated_id[index] << imgwc_.classification[index];
}
else
if(i>1430 && testFunc)
qDebug()<<"Probando" << i << index << imgwc_sorted.datetime[i] << imgwc_sorted.path[i] ;
}
return imgwc_sorted;
}