LAL  7.1.7.1-ab2cc12
TimeSeries.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2007 Kipp Cannon
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13  * Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 
21 #include <complex.h>
22 #include <math.h>
23 #include <string.h>
24 #include <lal/Date.h>
25 #include <lal/LALDatatypes.h>
26 #include <lal/LALStdlib.h>
27 #include <lal/Sequence.h>
28 #include <lal/TimeSeries.h>
29 #include <lal/Units.h>
30 #include <lal/XLALError.h>
31 
32 
34  const REAL8TimeSeries *series
35 )
36 {
37  REAL4TimeSeries *new = XLALCreateREAL4TimeSeries(series->name, &series->epoch, series->f0, series->deltaT, &series->sampleUnits, series->data->length);
38  unsigned i;
39 
40  if(!new)
42 
43  for(i = 0; i < new->data->length; i++)
44  new->data->data[i] = series->data->data[i];
45 
46  return new;
47 }
48 
49 
51  const REAL4TimeSeries *series
52 )
53 {
54  REAL8TimeSeries *new = XLALCreateREAL8TimeSeries(series->name, &series->epoch, series->f0, series->deltaT, &series->sampleUnits, series->data->length);
55  unsigned i;
56 
57  if(!new)
59 
60  for(i = 0; i < new->data->length; i++)
61  new->data->data[i] = series->data->data[i];
62 
63  return new;
64 }
65 
66 
67 #define DATATYPE REAL4
68 #include "TimeSeries_source.c"
69 #undef DATATYPE
70 
71 #define DATATYPE REAL8
72 #include "TimeSeries_source.c"
73 #undef DATATYPE
74 
75 #define DATATYPE COMPLEX8
76 #include "TimeSeries_source.c"
77 #undef DATATYPE
78 
79 #define DATATYPE COMPLEX16
80 #include "TimeSeries_source.c"
81 #undef DATATYPE
82 
83 #define DATATYPE INT2
84 #include "TimeSeries_source.c"
85 #undef DATATYPE
86 
87 #define DATATYPE UINT2
88 #include "TimeSeries_source.c"
89 #undef DATATYPE
90 
91 #define DATATYPE INT4
92 #include "TimeSeries_source.c"
93 #undef DATATYPE
94 
95 #define DATATYPE UINT4
96 #include "TimeSeries_source.c"
97 #undef DATATYPE
98 
99 #define DATATYPE INT8
100 #include "TimeSeries_source.c"
101 #undef DATATYPE
102 
103 #define DATATYPE UINT8
104 #include "TimeSeries_source.c"
105 #undef DATATYPE
LIGOTimeGPS epoch
The start time of the time series.
Definition: LALDatatypes.h:582
REAL8 * data
Pointer to the data array.
Definition: LALDatatypes.h:159
LALUnit sampleUnits
The physical units of the quantity being sampled.
Definition: LALDatatypes.h:575
REAL8 deltaT
The time step between samples of the time series in seconds.
Definition: LALDatatypes.h:583
REAL8TimeSeries * XLALConvertREAL4TimeSeriesToREAL8(const REAL4TimeSeries *series)
Definition: TimeSeries.c:50
REAL8 f0
The heterodyning frequency, in Hertz (zero if not heterodyned).
Definition: LALDatatypes.h:574
LIGOTimeGPS epoch
The start time of the time series.
Definition: LALDatatypes.h:572
#define XLAL_ERROR_NULL(...)
Macro to invoke a failure from a XLAL routine returning a pointer.
Definition: XLALError.h:714
LALUnit sampleUnits
The physical units of the quantity being sampled.
Definition: LALDatatypes.h:585
REAL4TimeSeries * XLALCreateREAL4TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
REAL4 * data
Pointer to the data array.
Definition: LALDatatypes.h:150
CHAR name[LALNameLength]
The name of the time series.
Definition: LALDatatypes.h:571
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
UINT4 length
Number of elements in array.
Definition: LALDatatypes.h:158
REAL4Sequence * data
The sequence of sampled data.
Definition: LALDatatypes.h:576
REAL4TimeSeries * XLALConvertREAL8TimeSeriesToREAL4(const REAL8TimeSeries *series)
Definition: TimeSeries.c:33
Time series of REAL4 data, see DATATYPE-TimeSeries types for more details.
Definition: LALDatatypes.h:570
REAL8 deltaT
The time step between samples of the time series in seconds.
Definition: LALDatatypes.h:573
Internal function call failed bit: "or" this with existing error number.
Definition: XLALError.h:463
CHAR name[LALNameLength]
The name of the time series.
Definition: LALDatatypes.h:581
REAL8 f0
The heterodyning frequency, in Hertz (zero if not heterodyned).
Definition: LALDatatypes.h:584
UINT4 length
Number of elements in array.
Definition: LALDatatypes.h:149
Time series of REAL8 data, see DATATYPE-TimeSeries types for more details.
Definition: LALDatatypes.h:580
REAL8Sequence * data
The sequence of sampled data.
Definition: LALDatatypes.h:586