LAL  7.5.0.1-08ee4f4
ComputeTransfer.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Duncan Brown, Jolien Creighton, Patrick Brady, Saikat Ray-Majumder, Stephen Fairhurst
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 
20 
21 #include <complex.h>
22 #include <math.h>
23 #include <lal/LALStdio.h>
24 #include <lal/LALStdlib.h>
25 #include <lal/LALError.h>
26 #include <lal/Calibration.h>
27 #include <lal/Units.h>
28 #include <lal/Date.h>
29 
30 #define CAL_S2START 729273613
31 #define CAL_S2END 734367613
32 
33 /**
34  * \defgroup ComputeTransfer_c Module ComputeTransfer.c
35  * \ingroup Calibration_h
36  * \author Patrick Brady, Jolien Creighton
37  *
38  * \brief Computes the transfer function from zero-pole-gain representation.
39  *
40  * A transfer function can either be specified as a list of coefficients or a
41  * list of poles and zeros. The function LALComputeTransfer() computes the
42  * frequency representation of the transfer function <tt>calrec->transfer</tt>
43  * described by the zeroes, poles and gain in <tt>*calrec</tt>. The memory for
44  * the frequency series should be allocated before calling this routine which uses
45  * <tt>calrec->transfer->deltaF</tt> and <tt>calrec->transfer->data->npoints</tt>.
46  *
47  * The routine LALUpdateCalibration() updates the response function
48  * and the sensing function from some reference functions to the current
49  * functions using information about the calibration lines. The two calibration
50  * lines yield two constants (as a slowly-varying function of time) that are
51  * used as coefficients to the reference response and sensing functions to
52  * compute the current response and sensing functions. These coefficients are
53  * stored in time series in the parameter structure, along with the current
54  * epoch and duration for which the calibration functions are to be computed. If
55  * the duration is zero, the calibration factors are the first ones at or after
56  * the given epoch. If the duration is non-zero, then the calibration factors are
57  * an average of all calibrations between epoch and epoch + duration.
58  *
59  * The routine LALResponseConvert() takes a given frequency series
60  * and converts it to a new frequency series by performing the following steps:
61  * (i) the original frequency series is interpolated (using linear interpolation
62  * of the real and imaginary parts independently) to the frequencies required
63  * in the output frequency series; (ii) if the output frequency series has units
64  * that are the inverse of those of the input frequency series, the data is
65  * inverted; (iii) the data is scaled by an appropriate power of ten computed
66  * from the input units and the output units. For example you can convert from
67  * strain per count to counts per atto-strain.
68  *
69  * ### Algorithm ###
70  *
71  * The transfer function is deduced from the poles and zeros as follows:
72  * \f{equation}{
73  * T(f) = c_{\mathrm{gain}}
74  * {\prod_i \textrm{zero}(f,z_i)}{ \prod_{i} \textrm{pole}(f,p_i)}
75  * \f}
76  * where
77  * \f{equation}{
78  * \textrm{zero}(f,z) = \left\{ \begin{array}{ll}
79  * (i f / z) + 1 & \textrm{ when } z\neq 0 \\
80  * i f & \textrm{ when } z = 0
81  * \end{array}
82  * \right.
83  * \f}
84  * and
85  * \f{equation}{
86  * \textrm{pole}(f,p) = \left\{ \begin{array}{ll}
87  * \frac{1}{(i f / p) + 1} & \textrm{ when } p \neq 0 \\
88  * \frac{1}{i f} & \textrm{ when } p = 0
89  * \end{array}
90  * \right.
91  * \f}
92  * For both the transfer function and the pole-zero notation the units for
93  * frequency is Hz rather than rad/s (angular frequency). In particular, poles
94  * and zeros are specified by their location in frequency space
95  *
96  * To update the response function from one epoch to another, two functions are
97  * needed. These are the sensing function \f$C(f)\f$ and the response function
98  * \f$R(f)\f$, which are related by
99  * \f{equation}{
100  * R(f) = \frac{1+H(f)}{C(f)}
101  * \f}
102  * where \f$H(f)\f$ is the open-loop gain function. If the sensing function and
103  * the open-loop gain function are known at some reference time (\f$C_0(f)\f$ and
104  * \f$H_0(f)\f$) then the sensing function and open-loop gain function can be
105  * calculated at a later time. They are \f$C(f)=\alpha C_0(f)\f$ and
106  * \f$H(f)=\alpha\beta H_0(f)\f$ where \f$\alpha\f$ and \f$\beta\f$ are slowly varying
107  * coefficients that account for overall changes in the gains of the sensing
108  * function and the open-loop gain. The coefficients \f$\alpha\f$ and \f$\alpha\beta\f$
109  * can be determined, as slowly-varying functions of time, by monitoring the
110  * two injected calibration lines. Thus, an updated sensing function and response
111  * function can be computed from reference sensing function and response function,
112  * \f$C_0(f)\f$ and \f$R_0(f)\f$ via:
113  * \f{equation}{
114  * C(f) = \alpha C_0(f)
115  * \f}
116  * and
117  * \f{equation}{
118  * R(f) = \frac{1+\alpha\beta[C_0(f)R_0(f)-1]}{\alpha C_0(f)}
119  * \f}
120  * where \f$\alpha\f$ and \f$\beta\f$ are those values of the coefficients that are
121  * appropriate for the particular epoch.
122  *
123  * ### Uses ###
124  *
125  *
126  * ### Notes ###
127  *
128  * The DC component of <tt>calrec->transfer</tt> is always filled with \f$1 + i 0\f$.
129  * In most cases, this should be irrelevant for gravitational wave data analysis,
130  * but care should be taken if DC is relevant when this function is used.
131  *
132  */
133 /** @{ */
134 
135 /** UNDOCUMENTED */
136 void
138  CalibrationRecord *calrec
139  )
140 
141 {
142  UINT4 i, j; /* indexes */
143  UINT4 jmin; /* used to handle DC */
144  REAL4 f,df; /* freq and interval */
145  REAL8 norm;
146 
147  INITSTATUS(stat);
148  ATTATCHSTATUSPTR (stat);
149 
150  /* Make sure parameter structures and their fields exist. */
151  ASSERT( calrec, stat, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
152  ASSERT( calrec->zeros, stat, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
153  ASSERT( calrec->poles, stat, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
154  ASSERT( calrec->transfer, stat, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
155 
156  /* initialise everything */
157  df = calrec->transfer->deltaF;
158  jmin = 0;
159 
160  /* compute the normalization constant */
161  norm = calrec->gain;
162 
163  for ( i=0 ; i < calrec->poles->length ; i++)
164  if ( calrec->poles->data[i] != 0 )
165  {
166  norm *= calrec->poles->data[i];
167  }
168 
169  for ( i=0 ; i < calrec->zeros->length ; i++)
170  if ( calrec->zeros->data[i] != 0 )
171  {
172  norm /= calrec->zeros->data[i];
173  }
174 
175  /* Handle DC if necessary */
176  if ( calrec->transfer->f0 == 0.0 )
177  {
178  calrec->transfer->data->data[0] = 1.0;
179  jmin = 1;
180  }
181 
182  /* loop over frequency in the output */
183  for ( j=jmin ; j<calrec->transfer->data->length ; j++)
184  {
185  COMPLEX8 T = 1.0;
186  /* the frequency */
187  f = calrec->transfer->f0 + (REAL4) j * df;
188 
189  /* loop over zeroes */
190  for (i = 0 ; i < calrec->zeros->length ; i++)
191  T *= calrec->zeros->data[i] + I * f;
192 
193  /* loop over poles */
194  for (i = 0 ; i < calrec->poles->length ; i++)
195  T /= calrec->zeros->data[i] + I * f;
196 
197  /* fill the frequency series */
198  calrec->transfer->data->data[j] = norm * T;
199  }
200 
201 
202  /* we're out of here */
203  DETATCHSTATUSPTR (stat);
204  RETURN( stat );
205 }
206 
207 
208 /** UNDOCUMENTED */
209 void
211  LALStatus *status,
213  CalibrationFunctions *input,
215  )
216 {
217  const REAL4 tiny = 1e-6;
218  COMPLEX8Vector *save;
219  COMPLEX8 *R;
220  COMPLEX8 *C;
221  COMPLEX8 *R0;
222  COMPLEX8 *C0;
223  COMPLEX8 a;
224  COMPLEX8 ab;
225  REAL8 epoch;
226  REAL8 first_cal;
227  REAL8 duration;
228  REAL4 dt;
229  REAL4 i_r4;
230  UINT4 n;
231  UINT4 i;
232  UINT4 length = 0;
233  CHAR warnMsg[512];
234 
237 
238  /* check input */
239  ASSERT( input, status, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
240  ASSERT( input->sensingFunction, status,
241  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
242  ASSERT( input->responseFunction, status,
243  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
244  ASSERT( input->sensingFunction->data, status,
245  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
247  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
249  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
251  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
252  n = input->sensingFunction->data->length;
253  ASSERT( (int)n > 0, status, CALIBRATIONH_ESIZE, CALIBRATIONH_MSGESIZE );
254  ASSERT( input->responseFunction->data->length == n, status,
255  CALIBRATIONH_ESZMM, CALIBRATIONH_MSGESZMM );
256 
257  /* check output */
258  ASSERT( output, status, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
259  ASSERT( output->sensingFunction, status,
260  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
261  ASSERT( output->responseFunction, status,
262  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
263  ASSERT( output->sensingFunction->data, status,
264  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
265  ASSERT( output->responseFunction->data, status,
266  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
267  ASSERT( output->sensingFunction->data->data, status,
268  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
269  ASSERT( output->responseFunction->data->data, status,
270  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
271  ASSERT( output->sensingFunction->data->length == n, status,
272  CALIBRATIONH_ESZMM, CALIBRATIONH_MSGESZMM );
273  ASSERT( output->responseFunction->data->length == n, status,
274  CALIBRATIONH_ESZMM, CALIBRATIONH_MSGESZMM );
275 
276  /* check params */
277  ASSERT( params, status, CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
278  ASSERT( params->sensingFactor, status,
279  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
280  ASSERT( params->openLoopFactor, status,
281  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
282  ASSERT( params->sensingFactor->deltaT, status,
283  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
284  ASSERT( params->sensingFactor->data, status,
285  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
286  ASSERT( params->openLoopFactor->data, status,
287  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
288  ASSERT( params->sensingFactor->data->data, status,
289  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
290  ASSERT( params->openLoopFactor->data->data, status,
291  CALIBRATIONH_ENULL, CALIBRATIONH_MSGENULL );
292  ASSERT( params->openLoopFactor->data->length ==
293  params->sensingFactor->data->length, status,
294  CALIBRATIONH_ESZMM, CALIBRATIONH_MSGESZMM );
295 
296  R0 = input->responseFunction->data->data;
297  C0 = input->sensingFunction->data->data;
298  R = output->responseFunction->data->data;
299  C = output->sensingFunction->data->data;
300 
301  save = output->responseFunction->data;
302  output->responseFunction = input->responseFunction;
303  output->responseFunction->data = save;
304  output->responseFunction->epoch = params->epoch;
305 
306  save = output->sensingFunction->data;
307  output->sensingFunction = input->sensingFunction;
308  output->sensingFunction->data = save;
309  output->sensingFunction->epoch = params->epoch;
310 
311  /* locate correct values of a and ab */
312  epoch = XLALGPSGetREAL8(&(params->epoch));
313  first_cal = XLALGPSGetREAL8(&(params->sensingFactor->epoch));
314  duration = XLALGPSGetREAL8(&(params->duration));
315 
316  dt = epoch - first_cal;
317 
318  /* find the first point at or before the requested time */
319  if ( (i_r4 = floor( dt / params->sensingFactor->deltaT ) ) < 0 )
320  {
321  ABORT( status, CALIBRATIONH_ETIME, CALIBRATIONH_MSGETIME );
322  }
323  else
324  {
325  i = (UINT4) i_r4;
326  }
327 
328  /* compute the sum of the calibration factors */
329  a = ab = 0;
330  length = 0;
331  do
332  {
333  COMPLEX8 this_a;
334  COMPLEX8 this_ab;
335 
336  if ( i > params->sensingFactor->data->length - 1 )
337  {
338  ABORT( status, CALIBRATIONH_ETIME, CALIBRATIONH_MSGETIME );
339  }
340 
341  this_a = params->sensingFactor->data->data[i];
342  this_ab = params->openLoopFactor->data->data[i];
343 
344  /* JC: I CHANGED THE LOGIC HERE TO WHAT I THOUGHT IT SHOULD BE! */
345  if ( ( fabs( creal(this_a) ) < tiny && fabs( cimag(this_a) ) < tiny ) ||
346  ( fabs( creal(this_ab) ) < tiny && fabs( cimag(this_ab) ) < tiny ) )
347  {
348  /* this is a hack for the broken S2 calibration frame data */
349  if ( (params->epoch.gpsSeconds >= CAL_S2START) &&
350  (params->epoch.gpsSeconds < CAL_S2END ) )
351  {
352  /* if the zero is during S2 print a warning... */
353  snprintf( warnMsg, XLAL_NUM_ELEM(warnMsg),
354  "Zero calibration factors found during S2 at GPS %10.9f",
355  first_cal + (REAL8) i * params->sensingFactor->deltaT );
356  LALWarning( status, warnMsg );
357  }
358  else
359  {
360  /* ...or abort if we are outside S2 */
361  snprintf( warnMsg, XLAL_NUM_ELEM(warnMsg),
362  "Zero calibration factor found at GPS %10.9f",
363  first_cal + (REAL8) i * params->sensingFactor->deltaT );
364  LALWarning( status, warnMsg );
365  ABORT( status, CALIBRATIONH_EZERO, CALIBRATIONH_MSGEZERO );
366  }
367  }
368  else
369  {
370  /* increment the count of factors if we are adding a non-zero value */
371  ++length;
372  }
373 
374  /* add this value to the sum */
375  a += this_a;
376  ab += this_ab;
377 
378  /* increment the calibration factor index */
379  ++i;
380  }
381  while ( (first_cal + (REAL8) i * params->sensingFactor->deltaT) <
382  (epoch + duration) );
383 
384  /* if all the calibration factors are zero the abort */
385  if ( ! length ||
386  (fabs( creal(a) ) < tiny && fabs( cimag(a) ) < tiny) ||
387  (fabs( creal(ab) ) < tiny && fabs( cimag(ab) ) < tiny) )
388  {
389  snprintf( warnMsg, XLAL_NUM_ELEM(warnMsg),
390  "Got %d calibration samples\nalpha and/or beta are zero:\n"
391  "Re a = %e\tIm a = %e\nRe ab = %e\tIm ab = %e",
392  length, creal(a), cimag(a), creal(ab), cimag(ab) );
393  LALWarning( status, warnMsg );
394  ABORT( status, CALIBRATIONH_EZERO, CALIBRATIONH_MSGEZERO );
395  }
396 
397  /* compute the mean of the calibration factors from the sum */
398  a /= length;
399  ab /= length;
400 
401  /* return the used values of alpha and alphabeta */
402  params->alpha = a;
403  params->alphabeta = ab;
404  snprintf( warnMsg, XLAL_NUM_ELEM(warnMsg),
405  "Got %d calibration samples\n"
406  "Re a = %e\tIm a = %e\nRe ab = %e\tIm ab = %e",
407  length, creal(a), cimag(a), creal(ab), cimag(ab) );
408  LALInfo( status, warnMsg );
409 
410  for ( i = 0; i < n; ++i )
411  {
412  C[i] = a * C0[i];
413  R[i] = (ab * (C0[i] * R0[i] - 1.0) + 1.0) / C[i];
414  }
416  RETURN( status );
417 }
418 
419 
420 /** UNDOCUMENTED */
421 void
423  LALStatus *status,
426  )
427 {
428  LALUnit unitOne;
429  LALUnit unitTwo;
430  UINT4 i;
431  INT4 inv;
432  INT4 fac;
433  INT4 bad;
434 
437 
438  output->epoch = input->epoch;
439 
440  /*
441  * Interpolate to requested frequencies.
442  * Just do linear interpolation of real and imag components.
443  */
444  for ( i = 0; i < output->data->length; ++i )
445  {
446  REAL4 x;
447  UINT4 j;
448  x = i * output->deltaF / input->deltaF;
449  j = floor( x );
450  if ( j > input->data->length - 2 )
451  j = input->data->length - 2;
452  x -= j;
453  output->data->data[i] = input->data->data[j]
454  + x * ( input->data->data[j+1] - input->data->data[j] );
455  }
456 
457 
458  /*
459  * Use output units to figure out:
460  * 1. Whether we want strain/ct or ct/strain
461  * 2. Overall (power of ten) factor to apply.
462  */
463 
464  /* determine if units need to be inverted or not (or if they are bad) */
465  XLALUnitNormalize( &output->sampleUnits );
466  XLALUnitNormalize( &input->sampleUnits );
467  unitOne = output->sampleUnits;
468  unitTwo = input->sampleUnits;
469 
470  bad = 0;
471  inv = -1;
472  for ( i = 0; i < LALNumUnits; ++i )
473  {
474  if ( unitOne.unitDenominatorMinusOne[i] != unitTwo.unitDenominatorMinusOne[i] )
475  {
476  bad = 1;
477  break;
478  }
479  if ( unitOne.unitNumerator[i] == unitTwo.unitNumerator[i] )
480  {
481  if ( unitOne.unitNumerator[i] ) /* if this unit exists */
482  {
483  inv = 0; /* we don't need to invert */
484  if ( inv == 1 ) /* error: some units need to be inverted, others not */
485  {
486  bad = 1;
487  break;
488  }
489  }
490  }
491  else
492  {
493  if ( unitOne.unitNumerator[i] == -unitTwo.unitNumerator[i] )
494  {
495  /* this unit needs to be inverted */
496  inv = 1;
497  }
498  else /* error: output units not equal to input or inverse of input */
499  {
500  bad = 1;
501  break;
502  }
503  }
504  }
505  if ( bad ) /* units were bad: abort */
506  {
507  ABORT( status, CALIBRATIONH_EUNIT, CALIBRATIONH_MSGEUNIT );
508  }
509 
510  /* determine if there is a scale factor that needs to be applied */
511  fac = unitOne.powerOfTen - ( inv ? -unitTwo.powerOfTen : unitTwo.powerOfTen );
512 
513  /* perform conversion(s) */
514 
515  if ( inv ) /* invert data */
516  {
517  for ( i = 0; i < output->data->length; ++i )
518  {
519  output->data->data[i] = 1.0 / output->data->data[i];
520  }
521  }
522 
523  if ( fac ) /* scale data */
524  {
525  REAL4 scale = pow( 10.0, -fac );
526  for ( i = 0; i < output->data->length; ++i )
527  {
528  output->data->data[i] *= scale;
529  }
530  }
531 
533  RETURN( status );
534 }
535 
536 /** UNDOCUMENTED */
537 INT4
541  )
542 {
543  LALUnit unitOne;
544  LALUnit unitTwo;
545  UINT4 i;
546  INT4 inv;
547  INT4 fac;
548  INT4 bad;
549 
550  output->epoch = input->epoch;
551 
552  /*
553  * Interpolate to requested frequencies.
554  * Just do linear interpolation of real and imag components.
555  */
556  for ( i = 0; i < output->data->length; ++i )
557  {
558  REAL4 x;
559  UINT4 j;
560  x = i * output->deltaF / input->deltaF;
561  j = floor( x );
562  if ( j > input->data->length - 2 )
563  j = input->data->length - 2;
564  x -= j;
565  output->data->data[i] = input->data->data[j]
566  + x * ( input->data->data[j+1] - input->data->data[j] );
567  }
568 
569 
570  /*
571  * Use output units to figure out:
572  * 1. Whether we want strain/ct or ct/strain
573  * 2. Overall (power of ten) factor to apply.
574  */
575 
576  /* determine if units need to be inverted or not (or if they are bad) */
577  XLALUnitNormalize( &output->sampleUnits );
578  XLALUnitNormalize( &input->sampleUnits );
579  unitOne = output->sampleUnits;
580  unitTwo = input->sampleUnits;
581 
582  bad = 0;
583  inv = -1;
584  for ( i = 0; i < LALNumUnits; ++i )
585  {
586  if ( unitOne.unitDenominatorMinusOne[i] != unitTwo.unitDenominatorMinusOne[i] )
587  {
588  bad = 1;
589  break;
590  }
591  if ( unitOne.unitNumerator[i] == unitTwo.unitNumerator[i] )
592  {
593  if ( unitOne.unitNumerator[i] ) /* if this unit exists */
594  {
595  inv = 0; /* we don't need to invert */
596  if ( inv == 1 ) /* error: some units need to be inverted, others not */
597  {
598  bad = 1;
599  break;
600  }
601  }
602  }
603  else
604  {
605  if ( unitOne.unitNumerator[i] == -unitTwo.unitNumerator[i] )
606  {
607  /* this unit needs to be inverted */
608  inv = 1;
609  }
610  else /* error: output units not equal to input or inverse of input */
611  {
612  bad = 1;
613  break;
614  }
615  }
616  }
617  if ( bad ) /* units were bad: abort */
618  {
620  }
621 
622  /* determine if there is a scale factor that needs to be applied */
623  fac = unitOne.powerOfTen - ( inv ? -unitTwo.powerOfTen : unitTwo.powerOfTen );
624 
625  /* perform conversion(s) */
626 
627  if ( inv ) /* invert data */
628  {
629  for ( i = 0; i < output->data->length; ++i )
630  {
631  output->data->data[i] = 1.0 / output->data->data[i];
632  }
633  }
634 
635  if ( fac ) /* scale data */
636  {
637  REAL4 scale = pow( 10.0, -fac );
638  for ( i = 0; i < output->data->length; ++i )
639  {
640  output->data->data[i] *= scale;
641  }
642  }
643 
644  return 0;
645 }
646 
647 /** @} */
#define CAL_S2START
#define CAL_S2END
#define LALInfo(statusptr, info)
Definition: LALError.h:110
#define LALWarning(statusptr, warning)
Definition: LALError.h:103
#define ABORT(statusptr, code, mesg)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
static double f(double theta, double y, double xi)
Definition: XLALMarcumQ.c:258
#define CALIBRATIONH_ENULL
Null pointer.
Definition: Calibration.h:49
#define CALIBRATIONH_ETIME
Time out of range.
Definition: Calibration.h:53
#define CALIBRATIONH_EZERO
Zero factor.
Definition: Calibration.h:52
#define CALIBRATIONH_ESIZE
Invalid size.
Definition: Calibration.h:50
#define CALIBRATIONH_EUNIT
Incompatible units.
Definition: Calibration.h:54
#define CALIBRATIONH_ESZMM
Size mismatch.
Definition: Calibration.h:51
INT4 XLALResponseConvert(COMPLEX8FrequencySeries *output, COMPLEX8FrequencySeries *input)
UNDOCUMENTED.
void LALUpdateCalibration(LALStatus *status, CalibrationFunctions *output, CalibrationFunctions *input, CalibrationUpdateParams *params)
UNDOCUMENTED.
void LALResponseConvert(LALStatus *status, COMPLEX8FrequencySeries *output, COMPLEX8FrequencySeries *input)
UNDOCUMENTED.
void LALComputeTransfer(LALStatus *stat, CalibrationRecord *calrec)
UNDOCUMENTED.
#define XLAL_NUM_ELEM(x)
MACRO which gives the number of elements in a fixed-size array.
double REAL8
Double precision real floating-point number (8 bytes).
char CHAR
One-byte signed integer, see Headers LAL(Atomic)Datatypes.h for more details.
uint32_t UINT4
Four-byte unsigned integer.
float complex COMPLEX8
Single-precision floating-point complex number (8 bytes total)
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
@ LALNumUnits
The number of units.
Definition: LALDatatypes.h:480
static const INT4 a
Definition: Random.c:79
int XLALUnitNormalize(LALUnit *unit)
Returns 0 upon success or XLAL_FAILURE if the input pointer is NULL, in which case xlalErrno is set t...
Definition: UnitNormalize.c:72
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
Definition: XLALError.h:700
@ XLAL_EINVAL
Invalid argument.
Definition: XLALError.h:409
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
Returns the GPS time as a REAL8.
Definition: XLALTime.c:91
See DATATYPE-FrequencySeries types for documentation.
Definition: LALDatatypes.h:899
COMPLEX8Sequence * data
Definition: LALDatatypes.h:905
REAL8 deltaT
The time step between samples of the time series in seconds.
Definition: LALDatatypes.h:593
LIGOTimeGPS epoch
The start time of the time series.
Definition: LALDatatypes.h:592
COMPLEX8Sequence * data
The sequence of sampled data.
Definition: LALDatatypes.h:596
Vector of type COMPLEX8, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:163
UINT4 length
Number of elements in array.
Definition: LALDatatypes.h:167
COMPLEX8 * data
Pointer to the data array.
Definition: LALDatatypes.h:168
The type CalibrationFunctions contains two calibration functions, the sensing function and the respo...
Definition: Calibration.h:136
COMPLEX8FrequencySeries * responseFunction
Definition: Calibration.h:137
COMPLEX8FrequencySeries * sensingFunction
Definition: Calibration.h:138
UNDOCUMENTED.
Definition: Calibration.h:111
REAL8Vector * zeros
Definition: Calibration.h:122
COMPLEX8FrequencySeries * transfer
Definition: Calibration.h:121
REAL8Vector * poles
Definition: Calibration.h:123
The type CalibrationUpdateParams contains two time series representing an overall gain factor for the...
Definition: Calibration.h:158
COMPLEX8TimeSeries * sensingFactor
Definition: Calibration.h:165
COMPLEX8TimeSeries * openLoopFactor
Definition: Calibration.h:164
LAL status structure, see The LALStatus structure for more details.
Definition: LALDatatypes.h:947
This structure stores units in the mksA system (plus Kelvin, Strain, and ADC Count).
Definition: LALDatatypes.h:498
INT2 powerOfTen
Overall power-of-ten scaling is 10^powerOfTen.
Definition: LALDatatypes.h:499
UINT2 unitDenominatorMinusOne[LALNumUnits]
Array of unit power denominators-minus-one.
Definition: LALDatatypes.h:501
INT2 unitNumerator[LALNumUnits]
Array of unit power numerators.
Definition: LALDatatypes.h:500
INT4 gpsSeconds
Seconds since 0h UTC 6 Jan 1980.
Definition: LALDatatypes.h:459
REAL8 * data
Pointer to the data array.
Definition: LALDatatypes.h:159
UINT4 length
Number of elements in array.
Definition: LALDatatypes.h:158
enum @1 epoch
void output(int gps_sec, int output_type)
Definition: tconvert.c:440