23 #include <lal/LALStdlib.h>
24 #include <lal/Units.h>
25 #include <lal/LALStdio.h>
26 #include <lal/FileIO.h>
27 #include <lal/Interpolate.h>
28 #include <lal/ReadNoiseSpectrum.h>
39 for (i=0 ; i<n ; i++){
40 if ( (farray[i]-target) > 0 ){
48 if ( (target - farray[i-1]) < (farray[i] - target) ){
97 REAL4 freq, myfmin, df;
112 if (fgets(line,
sizeof(line),
fp) == NULL)
118 if ( (strstr(line,
"# npoints=")) == NULL)
122 sscanf(line,
"# npoints=%i", &npoints);
131 if (fgets(line,
sizeof(line),
fp)==NULL) {
136 sscanf(line,
"%lf %lf\n",&
f[j],&s[j]);
144 myfmin = spectrum->
f0;
147 freq = myfmin + ((
REAL4) j)*df;
154 if (location > (npoints-intParams.
n)){
155 location = (npoints-intParams.
n);
157 else if ( location < (intParams.
n/2) ){
161 location-=(intParams.
n/2);
163 intParams.
x = &
f[location];
164 intParams.
y = &s[location];
#define ABORT(statusptr, code, mesg)
#define CHECKSTATUSPTR(statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
static UINT4 mylocate(REAL8 *farray, REAL8 target, UINT4 n)
#define LALREADNOISESPECTRUMH_MSGEOPEN
#define LALREADNOISESPECTRUMH_MSGEPARS
#define LALREADNOISESPECTRUM_MAXLINELENGTH
static double f(double theta, double y, double xi)
void LALDPolynomialInterpolation(LALStatus *status, DInterpolateOut *output, REAL8 target, DInterpolatePar *params)
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.
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
@ LALUnitIndexSecond
The second index.
@ LALUnitIndexStrain
The strain index.
void LALReadNoiseSpectrum(LALStatus *stat, REAL4FrequencySeries *spectrum, CHAR *fname)
Function to read in noise spectrum from a formatted ascii file and return the amplitude noise spectru...
#define LALREADNOISESPECTRUMH_EOPEN
Error opening file.
#define LALREADNOISESPECTRUMH_EPARS
Error parsing spectrum file.
These structures contain the output of the interpolation.
REAL8 y
The interpolated value.
These structures contain the interpolation parameters; These are the arrays of n domain values and t...
REAL8 * y
The array of values to interpolate.
REAL8 * x
The array of domain values.
UINT4 n
The number of points in the arrays to use in the interpolation.
LAL status structure, see The LALStatus structure for more details.
struct tagLALStatus * statusPtr
Pointer to the next node in the list; NULL if this function is not reporting a subroutine error.
This structure stores units in the mksA system (plus Kelvin, Strain, and ADC Count).
UINT2 unitDenominatorMinusOne[LALNumUnits]
Array of unit power denominators-minus-one.
INT2 unitNumerator[LALNumUnits]
Array of unit power numerators.
See DATATYPE-FrequencySeries types for documentation.
REAL4 * data
Pointer to the data array.
UINT4 length
Number of elements in array.