Commit 44fe4056 authored by ballen's avatar ballen

Initial checkin

Original: 9e454a98b4e1b824ea848eaff494dd6bc2b06d10
parents
lal/test/tools/resamp_10x4.eps filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S5-L1-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/earth00-19-DE421.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/earth00-19-DE414.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/earth98.dat filter=lfs diff=lfs merge=lfs -text
lalsimulation/src/lalsimburst_btlwnbexamples.svg filter=lfs diff=lfs merge=lfs -text
lalapps/src/inspiral/MachoMasses.dat filter=lfs diff=lfs merge=lfs -text
lalapps/src/inspiral/test/HL-INJECTIONS_1234_INJ001-866088014-2633400.xml filter=lfs diff=lfs merge=lfs -text
lalapps/src/pulsar/CreateEphemeris/ephemMLDC.dat filter=lfs diff=lfs merge=lfs -text
lalframe/test/F-TEST-600000000-60.gwf filter=lfs diff=lfs merge=lfs -text
lalframe/test/H-CAL_REF_V03-734073939-64.gwf filter=lfs diff=lfs merge=lfs -text
lalapps/src/inspiral/inspsrcs100Mpc.errors filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S6-V1-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalburst/test/CLRindata.asc filter=lfs diff=lfs merge=lfs -text
lalinspiral/test/SpaceCovering.par filter=lfs diff=lfs merge=lfs -text
lalsimulation/src/lalsimburst_sinegaussianexamples.svg filter=lfs diff=lfs merge=lfs -text
lalapps/src/calibration/S4H1Filters.txt filter=lfs diff=lfs merge=lfs -text
lalapps/src/pulsar/HeterodyneSearch/H-CW_Injection-875206560-120.gwf filter=lfs diff=lfs merge=lfs -text
lalframe/test/H-CAL_FAC_V03-729273600-5094000.gwf filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/earth00-19-DE200.dat.gz filter=lfs diff=lfs merge=lfs -text
lalapps/src/calibration/S5H1_NoiseCompTimes.txt filter=lfs diff=lfs merge=lfs -text
lalapps/src/calibration/S5L1_NoiseCompTimes.txt filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S6-L1-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalframe/test/F-TEST-600000060-60.gwf filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/earth00-19-DE405.dat.gz filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S6-H1-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalframe/test/L-CAL_REF_V03-731488397-64.gwf filter=lfs diff=lfs merge=lfs -text
lalsimulation/test/reviewed_waveforms.asc filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S5-H1H2-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalapps/src/inspiral/BNSMasses.dat filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S5-V1-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalframe/test/F-TEST-600000120-60.gwf filter=lfs diff=lfs merge=lfs -text
lalframe/test/L-CAL_FAC_V03-729273600-5094000.gwf filter=lfs diff=lfs merge=lfs -text
lalapps/src/findchirp/L1response_psd.dat filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S5-H2-cat2.txt filter=lfs diff=lfs merge=lfs -text
lalapps/src/string/S5-L1segments-cat1.txt filter=lfs diff=lfs merge=lfs -text
lalinference/test/data/2016_subset.xml.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/sun00-19-DE200.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/sun00-19-DE405.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/sun00-19-DE414.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/sun00-19-DE421.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/tdb_2000-2019.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/te405_2000-2019.dat.gz filter=lfs diff=lfs merge=lfs -text
## Process this file with automake to produce Makefile.in
#
# $Id$
#
@SET_MAKE@
lib_LIBRARIES = libSFTReferenceLibrary.a
libSFTReferenceLibrary_a_SOURCES = SFTReferenceLibrary.c \
SFTReferenceLibrary.h
bin_PROGRAMS = SFTvalidate \
SFTwrite \
SFTdumpheader \
SFTdumpall
SFTvalidate_SOURCES = SFTReferenceLibrary.c \
SFTReferenceLibrary.h \
SFTvalidate.c
SFTwrite_SOURCES = SFTReferenceLibrary.c \
SFTReferenceLibrary.h \
SFTwrite.c
SFTdumpheader_SOURCES = SFTReferenceLibrary.c \
SFTReferenceLibrary.h \
SFTdumpheader.c
SFTdumpall_SOURCES = SFTReferenceLibrary.c \
SFTReferenceLibrary.h \
SFTdumpall.c
docsdir=$(docdir)
docs_DATA = README \
SFT_v2_specification
EXTRA_DIST = $(docs_DATA)
Here is a short how-to on this reference SFT version 2 library.
$Id$
TO BUILD/INSTALL
----------
./configure
make
make install (optional)
SFT SPECIFICATIONS
------------------
See the file: SFT_v2_specification
TO USE
------
Makes a test SFT (called SFT-test)
./SFTwrite
You can do this on little-endian and big-endian machines to generate
both flavors
TO MAKE CONCATENATED SFTs
-------------------------
cat SFT-test SFT-test SFT-test > SFT-merged
TO VERIFY THAT A SET OF SFT files IS VALID
-------------------------------------------
./SFTvalidate SFT1 SFT2 ... SFTn
The exit status will be zero if all SFTs are valid. The exit status
will be non-zero if any of the SFTs was invalid. grep SFTE
SFTReferenceLibrary.h will show the return values.
TO DUMP THE HEADER INFORMATION FROM A SET OF SFT FILES
------------------------------------------------------
./SFTdumpheader SFT1 SFT2 ... SFTn
The exit status will be zero if all SFTs are valid. The exit status
will be non-zero if any of the SFTs was invalid. grep SFTE
SFTReferenceLibrary.h will show the return values.
TO DUMP ALL INFORMATION FROM A SET OF SFT FILES
------------------------------------------------------
./SFTdumpall SFT1 SFT2 ... SFTn
The exit status will be zero if all SFTs are valid. The exit status
will be non-zero if any of the SFTs was invalid. grep SFTE
SFTReferenceLibrary.h will show the return values.
LIBRARY TO LINK TO
------------------
cc mycode.c -lSFTReferenceLibrary
This diff is collapsed.
/* $Id$ */
/* This is a reference library for the SFT data format
*
* Copyright (C) 2004 Bruce Allen <ballen@uwm.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* You should have received a copy of the GNU General Public License
* (for example COPYING); if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef REFERENCESFTLIBRARY_H_
#define REFERENCESFTLIBRARY_H_
/* header for version 1 SFTs (not part of SPEC, but here for backwards
compatibility and clarity) */
struct headertag1 {
double version;
int gps_sec;
int gps_nsec;
double tbase;
int firstfreqindex;
int nsamples;
};
/* header for version 2 SFTs */
struct headertag2 {
double version;
int gps_sec;
int gps_nsec;
double tbase;
int firstfreqindex;
int nsamples;
unsigned long long crc64;
int padding;
int comment_length;
};
int WriteSFT(FILE *fp, /* stream to write to. On return, is at the end of SFT */
int gps_sec, /* GPS sec of first sample */
int gps_nsec, /* GPS nsec of first sample */
double tbase, /* time baseline of SFTs */
int firstfreqindex, /* index of first frequency bin included in data (0=DC)*/
int nsamples, /* number of frequency bins to include in SFT */
char *comment, /* null-terminated comment string to include in SFT */
float *data /* points to nsamples x 2 x floats (Real/Imag) */
);
int ReadSFTHeader(FILE *fp, /* stream to read. Position unchanged on return */
struct headertag2 *info, /* address to return header */
char **comment, /* if non-NULL, put pointer to comment */
int *swapendian, /* set nonzero if data in reverse endian order */
int validate); /* validate checksum of the file */
int ReadSFTData(FILE *fp, /* data file. Position unchanged on return */
float *data, /* location where data should be written */
int offset, /* starting offset (in frequency bins) into data set */
int nsamples, /* number of frequency bin samples to retrieve */
char **comment, /* if non-NULL, will contain pointer to comment string */
struct headertag2 *info /* if non-NULL, will contain header information */
);
/* various possible error codes. See SFTErrorMessage() for decodings */
#define SFTENULLFP 1
#define SFTESEEK 2
#define SFTEGETSTREAMPOS 3
#define SFTERESTORESTREAMPOS 4
#define SFTEREAD 5
#define SFTEUNKNOWN 6
#define SFTEGPSNSEC 7
#define SFTEBADCOMMENT 8
#define SFTEBADCRC64 9
#define SFTENOMEM 10
#define SFTESIZEWRONG 11
#define SFTEWRITE 12
#define SFTENULLPOINTER 13
#define SFTENONE 14
/* takes error code from above list and returns static human-readable
description as null-terminated string */
const char *SFTErrorMessage(int errorcode);
/* returns a null-terminated string with the package version (eg, 2.0) */
const char *ReferenceSFTLibraryVersion();
#endif /* REFERENCESFTLIBRARY_H_ */
July 23, 2004
$Id$
SFT Data Format Version 2 Specification
An SFT is stored in a file. The file is composed of concurrent SFT
BLOCKS.
Each SFT BLOCK is organized as follows:
________________________
HEADER (48 bytes)
________________________
ASCII COMMENT (8*n bytes)
where n is a non-negative
integer
________________________
DATA (8*N bytes)
where N is a positive
integer
________________________
The total length of the SFT BLOCK is 48+8*n+8*N bytes. The SFT BLOCK
may be written in either big-endian or little-endian ordering. All
floats and doubles follow the IEEE-754 floating-point conventions.
The HEADER contains 48 bytes as follows:
_____________________________________
8 bytes REAL8 version
_____________________________________
4 bytes INT4 gps_sec;
_____________________________________
4 bytes INT4 gps_nsec;
_____________________________________
8 bytes REAL8 tbase;
______________________________________
4 bytes INT4 first_frequency_index;
______________________________________
4 bytes INT4 nsamples;
______________________________________
8 bytes UNSIGNED INT8 crc64;
______________________________________
4 bytes INT4 padding;
______________________________________
4 bytes INT4 comment_length;
______________________________________
Note that this HEADER corresponds to the C structure below
struct SFTtag {
REAL8 version:
INT4 gps_sec;
INT4 gps_nsec;
REAL8 tbase;
INT4 first_frequency_index;
INT4 nsamples;
UINT8 crc64;
INT4 padding;
INT4 comment_length;
} SFTheader;
when the structure is packed, ie no zero padding between fields is
allowed. Note that several of these quantities that might be taken as
unsigned are in fact signed. This makes it easier and less
error-prone for user applications and code to compute differences
between these quantities.
The structure of the ASCII COMMENT is comment_length==8*n arbitrary
ASCII bytes, where n is a non-negative integer. The following rules
apply to NULL bytes appearing in ASCII COMMENT, if n is non-zero:
(1) There must be at least one NULL byte in the ASCII COMMENT
(2) If a NULL byte appears in the ASCII COMMENT, all the following
bytes in the ASCII COMMENT must also be NULL bytes.
The reason for these two rules is so that the ASCII comment has
nonzero length then it may always be treated as a C null-terminated
string, with no information 'hidden' after the null byte.
The DATA region consists of N COMPLEX8 quantities. Each COMPLEX8 is
made of a 4-byte IEEE-754 float real part, followed by a 4-byte
IEEE-754 float imaginary part. The packing and normalization of this
data comply with the LSC specifications for frequency-domain data.
The current version of this specification may be found at
http://www.ligo.caltech.edu/docs/T/T010095-00.pdf
version: shall be 2.0 .
Note that SFTs produced before this specification will have this
field set to 1.0. Note that future versions of this specification
will have version=3.0, 4.0, etc. This field will always be an
integer value that can be exactly represented as an IEEE754
double. If this field is not an exact integer in the range 1 to
1000000, then software reading this data should assume that it is
byte-swapped and take appropriate measures to reverse the byte
swapping. If the byte swapping does NOT cause the version number
to lie between 1 and 1000000, then the SFT does not comply with
these specifications.
gps_sec: Integer part of the GPS time in seconds of the first sample used to make
this SFT.
gps_nsec: GPS nanoseconds of the first sample used to make this SFT. This
must lie in the range from 0 to 10^9-1 inclusive.
tbase: The time length of the data set used to make this SFT.
Note that if the sample interval is dt, and the number of
time-domain samples is S, then tbase=S dt. Note that if the data
is produced with heterodyning, tbase still refers to the total
time length of the data set.
first_frequency_index: This is the subscript of the first complex FFT
value that appears
in DATA. It's allowed range is 0 to (Nyquist_Frequency *
tbase)/2 = S/2 inclusive. Note: if S is odd, then in this
document S/2 shall mean the integer part of S/2.
nsamples: The number of complex samples in DATA. nsamples=N. Its
allowed range is 1 to S/2+1 inclusive
crc64: The 64-bit CRC checksum of the 48+8*n+8*N bytes that make up
the SFT, with the 8 bytes that labeled crc64 set to zero. The
CRC checksum will be evaluated using the
polynomial D800000000000000 (base-16) =
1101100000000000000000000000000000000000000000000000000000000000 (base-2).
The primitive polynomial is x^64 + x^4 + x^3 + x + 1.
The CRC will be initialized to all ones (~0ULL).
padding: These four bytes will be set to zero. They are here so that all 8-byte
quantities are byte aligned with respect to the header. This may permit
certain efficiencies and library usages on certain platforms/architectures.
comment_length: The number of bytes that appear in ASCII COMMENT.
comment_length=8*n with n a non-negative integer.. Note
that if comment_length==0 then the SFT contains no comment.
The complex quantities contained in DATA REGION are defined by the
following equations, complying with
http://www.ligo.caltech.edu/docs/T/T010095-00.pdf
The data set (with the native fundamental sample interval dt) is
denoted by x_i for i=0, ..., S-1. The x_i are all real. Let
n_k = \sum_j=0^S-1 x_j exp(-2 pi i j k/S)
be the values of the DFT with LSC sign conventions. The values in
DATA REGION are
data_k = dt * n_k
for k=first_frequency_index to k=first_frequency_index+nsamples-1.
[Note: the interesting range of k is from 0 to S/2 inclusive.]
The allowed range of first_frequency_index is from 0 to S/2 inclusive.
The allowed range of nsamples=N is 1 to S/2+1-first_frequency_index
inclusive.
[Here we assume that the window function is rectangular, eg each
sample is weighted by a window function whose value is 1. If the data
IS windowed then the normalization conventions of T010095-00.pdf still
apply.]
Note that if a data stream is band-limited (for instance by filtering)
and then decimated or down-sampled, the values stored in DATA REGION
for a given set of frequency bins will be unchanged compared to those
computed with the original data set. This is true even though the
sample interval dt' of the new downsampled data set is larger than the
original native sample time. In fact, except for the DC (k=0) and
Nyquist (k=S/2+1) frequency bins, the power spectral density may be
written as:
psd_k = (2/tbase) |data_k|^2 (except for k=0 or Nyquist)
EXAMPLE 1:
---------
Consider the case where the fundamental time-domain data set consists
of 16 samples, taken at a sample rate of 16 Hz. All 16 samples are
x_0=...=x_15=1 which gives n_0=16, n_1=...=n_8=0. Since dt=1/16, we find
data_0 = 1 + 0i
data_1 = 0
data_2 = 0
data_3 = 0
data_4 = 0
data_5 = 0
data_6 = 0
data_7 = 0
data_8 = 0
If we store only nsamples=5 frequency bins in the SFT, then DATA
REGION will contain the 40 bytes corresponding to identical values for
data_k:
data_0 = 1 + 0i
data_1 = 0
data_2 = 0
data_3 = 0
data_4 = 0
These values could be obtained by considering a subset of the original
SFT. Alternatively they could be obtained by low-pass filtering the
original time series, and downsampling it, and using the previous
definitions. For example if the downsampled time series had 8 samples
x_0=...=x_7=1 with a sample time of dt=1/8, then n_0=8, and
n_1=...=n_4=0. This gives the same values as above.
EXAMPLE 2:
---------
Sinusoid function at 2 Hz x(t)= 1 *cos (2 pi 2 t)
Using again 16 samples taken at a sample rate of 16 Hz.
x_00 = 1.000000
x_01 = 0.707107
x_02 = 0.000000
x_03 = -0.707107
x_04 = -1.000000
x_05 = -0.707107
x_06 = -0.000000
x_07 = 0.707107
x_08 = 1.000000
x_09 = 0.707107
x_10 = 0.000000
x_11 = -0.707107
x_12 = -1.000000
x_13 = -0.707107
x_14 = -0.000000
x_15 = 0.707107
giving
n_0 = n_1 =0+0i
n_2 = 8+0i
n_3 =... = n_8 = 0+0i
and data_0 = data_1 =0+0i
data_2= 0.5+0i
data_3 = ...= data_8= 0+0i
If we down-sample the original data stream by a factor of two we get:
x_00 = 1.000000
x_01 = 0.000000
x_02 = -1.000000
x_03 = -0.000000
x_04 = 1.000000
x_05 = 0.000000
x_06 = -1.000000
x_07 = -0.000000
giving
n_0 = n_1 =0+0i
n_2 = 4+0i
n_3 =... = n_4 = 0+0i
and data_0 = data_1 =0+0i
data_2= 0.5+0i
data_3 = ...= data_4=0+0i
/* $Id$ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "SFTReferenceLibrary.h"
int main(int argc, char **argv) {
int i;
/* loop over all file names on command line */
for (i=1; i<argc; i++) {
FILE *fp;
int count;
/* open the file */
if (!(fp=fopen(argv[i], "r"))) {
fprintf(stderr,"Unable to open %s ", argv[i]);
if (errno)
perror(NULL);
return SFTENULLFP;
}
/* and read successive SFTs blocks from the file and print headers */
for (count=0; 1; count++) {
struct headertag2 info;
int err=0, swapendian, move;
char *mycomment;
err=ReadSFTHeader(fp, &info, &mycomment, &swapendian, 1);
/* at end of SFT file or merged SFT file blocks */
if (err==SFTENONE && count)
break;
/* SFT was invalid: say why */
if (err) {
fprintf(stderr, "%s is not a valid SFT. %s\n", argv[i], SFTErrorMessage(err));
if (errno)
perror(NULL);
return err;
}
else {
float *mydata;
printf("File name: %s\n", argv[i]);
printf("SFT Version: %.0f\n", info.version);
printf("GPS_sec: %d\n", info.gps_sec);
printf("GPS_nsec: %d\n", info.gps_nsec);
printf("Timebase: %-16f\n", info.tbase);
printf("First frequency bin: %d\n", info.firstfreqindex);
printf("Number of freq bins: %d\n", info.nsamples);
printf("64-bit CRC checksum: %llu\n", info.crc64);
printf("Comment length bytes: %d\n", info.comment_length);
printf("Endian order: %s\n", swapendian?"reversed":"native");
if (info.comment_length) {
printf("Comment: %s\n", mycomment);
free(mycomment);
}
fflush(stdout);
mydata=(float *)calloc(info.nsamples,2*sizeof(float));
/* If you are intested in just getting the data, and not the
header, and you already know (for example) the frequency bin
offsets, etc, then you ONLY need to call ReadSFTData(). You
don't need to call ReadSFTHeader() above. */
if ((err=ReadSFTData(fp, mydata, 0, info.nsamples, NULL, NULL))){
fprintf(stderr, "ReadSFTData failed with error %s\n", SFTErrorMessage(err));
if (errno)
perror(NULL);
return err;
}
else {
int j;
printf("Freq_bin Real Imaginary\n");
for (j=0; j<info.nsamples; j++)
printf("%8d %e %e\n", j+info.firstfreqindex, mydata[2*j], mydata[2*j+1]);
printf("\n");
fflush(stdout);
free(mydata);
}
}
/* Move forward to next SFT in merged file */
if (info.version==1)
move=sizeof(struct headertag1)+info.nsamples*2*sizeof(float);
else
move=sizeof(struct headertag2)+info.nsamples*2*sizeof(float)+info.comment_length;
fseek(fp, move, SEEK_CUR);
}
fclose(fp);
}
return 0;
}
/* $Id$ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "SFTReferenceLibrary.h"
int main(int argc, char **argv) {
int i;
/* loop over all file names on command line */
for (i=1; i<argc; i++) {
FILE *fp;
int count;
/* open the file */
if (!(fp=fopen(argv[i], "r"))) {
fprintf(stderr,"Unable to open %s ", argv[i]);
if (errno)
perror(NULL);
return SFTENULLFP;
}
/* and read successive SFTs blocks from the file and print headers */
for (count=0; 1; count++) {
struct headertag2 info;
int err=0, swapendian, move;
char *mycomment;
err=ReadSFTHeader(fp, &info, &mycomment, &swapendian, 1);
/* at end of SFT file or merged SFT file blocks */
if (err==SFTENONE && count)
break;
/* SFT was invalid: say why */
if (err) {
fprintf(stderr, "%s is not a valid SFT. %s\n", argv[i], SFTErrorMessage(err));
if (errno)
perror(NULL);
return err;
}
else {
printf("File name: %s\n", argv[i]);
printf("SFT Version: %.0f\n", info.version);
printf("GPS_sec: %d\n", info.gps_sec);
printf("GPS_nsec: %d\n", info.gps_nsec);
printf("Timebase: %-16f\n", info.tbase);
printf("First frequency bin: %d\n", info.firstfreqindex);
printf("Number of freq bins: %d\n", info.nsamples);
printf("64-bit CRC checksum: %llu\n", info.crc64);
printf("Comment length bytes: %d\n", info.comment_length);
printf("Endian order: %s\n", swapendian?"reversed":"native");
if (info.comment_length) {
printf("Comment: %s\n", mycomment);
free(mycomment);
}
printf("\n");
}
/* Move forward to next SFT in merged file */
if (info.version==1)
move=sizeof(struct headertag1)+info.nsamples*2*sizeof(float);
else
move=sizeof(struct headertag2)+info.nsamples*2*sizeof(float)+info.comment_length;
fseek(fp, move, SEEK_CUR);
}
fclose(fp);
}
return 0;
}
/* $Id$ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "SFTReferenceLibrary.h"
int main(int argc, char** argv) {
int i;
/* loop over all file names on command line */
for (i=1; i<argc; i++) {
FILE *fp;
int count;
/* open the file */
if (!(fp=fopen(argv[i], "r"))) {
fprintf(stderr,"Unable to open %s ", argv[i]);
if (errno)
perror(NULL);
return SFTENULLFP;
}
/* and read successive SFTs blocks from the file and validate CRC
checksums */
for (count=0; 1; count++) {
struct headertag2 info;
int err=0, swapendian, move;
err=ReadSFTHeader(fp, &info, NULL, &swapendian, 1);
/* at end of SFT file or merged SFT file blocks */
if (err==SFTENONE && count)
break;
/* SFT was invalid: say why */
if (err) {
fprintf(stderr, "%s is not a valid SFT. %s\n", argv[i], SFTErrorMessage(err));
if (errno)
perror(NULL);
return err;
}
/* Move forward to next SFT in merged file */
if (info.version==1)
move=sizeof(struct headertag1)+info.nsamples*2*sizeof(float);
else
move=sizeof(struct headertag2)+info.nsamples*2*sizeof(float)+info.comment_length;
fseek(fp, move, SEEK_CUR);
}
fclose(fp);
}
return 0;
}
/* $Id$ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "SFTReferenceLibrary.h"
int main() {
FILE *fp;
float data[]={1.0, 0.0, 2.0, -1.0, 3.0, -2.0, 4.0, -3.0};
char comment[]="Hello world";
int err=0;
fp=fopen("SFT-test", "w");
if ((err=WriteSFT(fp, 12345, 6789, 60, 1000, sizeof(data)/(2*sizeof(float)), comment, data)))
fprintf(stderr, "WriteSFT failed with return value %d\n", err);
fclose(fp);
return err;
}
#!/bin/sh
# $Id$