Commit b390b37e authored by Benoit Mours's avatar Benoit Mours
Browse files

When extending frame duration: do not convert SerData to AdcData if the...

When extending frame duration: do not convert SerData to AdcData if the SerData period is longer or equal to the frame duration.
parent cbfd14b5
Pipeline #299977 passed with stages
in 4 minutes and 27 seconds
......@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
project(
framel
LANGUAGES C
VERSION 8.41.3
VERSION 8.41.5
DESCRIPTION "LIGO/VIRGO frame library"
HOMEPAGE_URL "https://git.ligo.org/virgo/virgoapp/Fr"
)
......
project ('Fr', 'c', version: '8.41.3')
project ('Fr', 'c', version: '8.41.5')
cc = meson.get_compiler ('c')
......
......@@ -2785,7 +2785,7 @@ FrameH *FrameReshapeConvertSer(FrameH *trend,
/* This function build trend frame (i.e. convert all FrSerData from frame to
FrAdcData) of size trendPeriod (in seconds) starting from the frame *frame*/
/*---------------------------------------------------------------------------*/
{FrSerData *sms;
{FrSerData *sms, *next, *first;
FrAdcData *adc;
FrVect *isThere;
FrCList *listTrend;
......@@ -2798,13 +2798,27 @@ FrameH *FrameReshapeConvertSer(FrameH *trend,
if (frame == NULL) return(NULL);
if (frame->rawData == NULL) return(NULL);
 
if(trend == NULL) return(NULL);
listTrend = FrCListBldAdc(trend);
 
if(trend->rawData == NULL) FrRawDataNew(trend);
if(trend->rawData == NULL) return(trend);
/*------------------------convert sms data to adc vectors ---*/
 
for(sms = frame->rawData->firstSer; sms != NULL; sms = sms->next)
{if (sms->sampleRate <= 0) sms->sampleRate = 1.;
first = frame->rawData->firstSer;
if(trend == frame) trend->rawData->firstSer = NULL;
for(sms = first; sms != NULL; sms = next)
{next = sms->next;
if (sms->sampleRate <= 0) sms->sampleRate = 1.;
/*--------do not convert too slow sms data compared to frame duration---*/
if (trend->dt * sms->sampleRate <= 1) {
sms->next = trend->rawData->firstSer;
trend->rawData->firstSer = sms;
continue;}
index = (sms->timeSec + 1.e-9*sms->timeNsec) * sms->sampleRate;
nData = trendPeriod * sms->sampleRate;
if(nData < 1) nData = 1;
......@@ -2899,12 +2913,14 @@ FrameH *FrameReshapeConvertSer(FrameH *trend,
if (nRead != 3) break;
data = strstr(data+strlen(word1)+strlen(word2), word3);}
 
if(units != NULL) free(units);}
if(units != NULL) free(units);
sms->next = NULL;
FrSerDataFree(sms);}
 
FrCListFree(listTrend);
 
FrSerDataFree(frame->rawData->firstSer);
frame->rawData->firstSer = NULL;
if(trend != frame) frame->rawData->firstSer = NULL;
 
return(trend);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment