There will be maintenance performed on git.ligo.org, chat.ligo.org, containers.lig.org, and docs.ligo.org starting at 9am PDT on Tuesday 18th August 2020. There will be an extremely small period of downtime at the start of the maintenance window as various services are restarted. Please address any comments, questions, or concerns to computing-help@igwn.org.

Commit 20ef7e86 authored by David Keitel's avatar David Keitel

Merge branch 'lalapps-SFT-dump' into 'master'

Remove lalapps_SFTdumpall and lalapps_SFTdumpheader

See merge request lscsoft/lalsuite!1194
parents 0700e08d 070b5a31
......@@ -251,8 +251,6 @@ src/pulsar/SFTTools/lalapps_ConvertToSFTv2
src/pulsar/SFTTools/lalapps_dumpSFT
src/pulsar/SFTTools/lalapps_GetSFTVelocities
src/pulsar/SFTTools/lalapps_SFTclean
src/pulsar/SFTTools/lalapps_SFTdumpall
src/pulsar/SFTTools/lalapps_SFTdumpheader
src/pulsar/SFTTools/lalapps_SFTvalidate
src/pulsar/SFTTools/lalapps_SFTwrite
src/pulsar/SFTTools/lalapps_splitSFTs
......
......@@ -9,8 +9,6 @@ bin_PROGRAMS = \
lalapps_ConvertToSFTv2 \
lalapps_GetSFTVelocities \
lalapps_SFTclean \
lalapps_SFTdumpall \
lalapps_SFTdumpheader \
lalapps_SFTvalidate \
lalapps_SFTwrite \
lalapps_compareSFTs \
......@@ -22,8 +20,6 @@ lalapps_ComputePSD_SOURCES = ComputePSD.c
lalapps_ConvertToSFTv2_SOURCES = ConvertToSFTv2.c
lalapps_GetSFTVelocities_SOURCES = GetSFTVelocities.c
lalapps_SFTclean_SOURCES = SFTclean.c
lalapps_SFTdumpall_SOURCES = SFTdumpall.c $(SFTReferenceLibrary)
lalapps_SFTdumpheader_SOURCES = SFTdumpheader.c $(SFTReferenceLibrary)
lalapps_SFTvalidate_SOURCES = SFTvalidate.c $(SFTReferenceLibrary)
lalapps_SFTwrite_SOURCES = SFTwrite.c $(SFTReferenceLibrary)
lalapps_compareSFTs_SOURCES = compareSFTs.c
......
/*
* Copyright (C) 2004, 2008 Bruce Allen, Reinhard Prix
*
* 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 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with with program; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/**
* \author Bruce Allen, Reinhard Prix
* \file
* \ingroup lalapps_pulsar_SFTTools
* \brief
* Dump all information from a set of SFT files
*
* 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.
*/
#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(" ");
return SFTENULLFP;
}
/* and read successive SFTs blocks from the file and print headers */
for (count=0; 1; count++) {
struct headertag2 info, lastinfo;
int err=0, swapendian, move;
char *mycomment;
int whence = (int)ftell(fp);
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("Endian order: %s\n", swapendian?"reversed":"native");
printf("Start offset (bytes): %d\n", whence);
if (1 != info.version) {
printf("Detector prefix: %c%c\n", info.detector[0], info.detector[1]);
printf("64-bit CRC checksum: %llu\n", info.crc64);
printf("Comment length bytes: %d\n", info.comment_length);
}
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, info.firstfreqindex, 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 Frequency_Hz Real Imaginary\n");
for (j=0; j<info.nsamples; j++)
printf("%8d %18.18f % e % e\n",
j+info.firstfreqindex,
(double)(j+info.firstfreqindex)/(double)info.tbase,
mydata[2*j], mydata[2*j+1]);
printf("\n");
fflush(stdout);
free(mydata);
}
}
/* check that various bits of header information are consistent */
if (count && (err=CheckSFTHeaderConsistency(&lastinfo, &info))) {
fprintf(stderr, "%s is not a valid SFT. %s\n", argv[i], SFTErrorMessage(err));
return err;
}
/* keep copy of header for comparison the next time */
lastinfo=info;
/* 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;
}
/*
* Copyright (C) 2004, 2008 Bruce Allen, Reinhard Prix
*
* 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 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with with program; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/**
* \author Bruce Allen, Reinhard Prix
* \file
* \ingroup lalapps_pulsar_SFTTools
* \brief
* Dump the header information from a set of SFT files
*
* 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.
*/
#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(" ");
return SFTENULLFP;
}
/* and read successive SFTs blocks from the file and print headers */
for (count=0; 1; count++) {
struct headertag2 info,lastinfo;
int err=0, swapendian, move;
char *mycomment;
int whence = (int)ftell(fp);
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("Endian order: %s\n", swapendian?"reversed":"native");
printf("Start offset (bytes): %d\n", whence);
if (1 != info.version) {
printf("Detector prefix: %c%c\n", info.detector[0], info.detector[1]);
printf("64-bit CRC checksum: %llu\n", info.crc64);
printf("Comment length bytes: %d\n", info.comment_length);
}
if (info.comment_length) {
printf("Comment: %s\n", mycomment);
free(mycomment);
}
printf("\n");
}
/* check that various bits of header information are consistent */
if (count && (err=CheckSFTHeaderConsistency(&lastinfo, &info))) {
fprintf(stderr, "%s is not a valid SFT. %s\n", argv[i], SFTErrorMessage(err));
return err;
}
/* keep copy of header for comparison the next time */
lastinfo=info;
/* 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;
}
......@@ -188,38 +188,38 @@ int main(void) {
modify_checksum("SFT-bad14", 9944972421627148413ULL, 15720824585133081082ULL);
printf("To test SFTs, do for example:\n"
"./SFTvalidate SFT-good SFT-test[1234567]\n"
"./SFTvalidate SFT-bad1\n"
"./SFTvalidate SFT-bad2\n"
"./SFTvalidate SFT-bad3\n"
"./SFTvalidate SFT-bad4\n"
"./SFTvalidate SFT-bad5\n"
"./SFTvalidate SFT-bad6\n"
"./SFTvalidate SFT-bad7\n"
"./SFTvalidate SFT-bad8\n"
"./SFTvalidate SFT-bad9\n"
"./SFTvalidate SFT-bad10\n"
"./SFTvalidate SFT-bad11\n"
"./SFTvalidate SFT-bad12\n"
"./SFTvalidate SFT-bad13\n"
"./SFTvalidate SFT-bad14\n"
"lalapps_SFTvalidate SFT-good SFT-test[1234567]\n"
"lalapps_SFTvalidate SFT-bad1\n"
"lalapps_SFTvalidate SFT-bad2\n"
"lalapps_SFTvalidate SFT-bad3\n"
"lalapps_SFTvalidate SFT-bad4\n"
"lalapps_SFTvalidate SFT-bad5\n"
"lalapps_SFTvalidate SFT-bad6\n"
"lalapps_SFTvalidate SFT-bad7\n"
"lalapps_SFTvalidate SFT-bad8\n"
"lalapps_SFTvalidate SFT-bad9\n"
"lalapps_SFTvalidate SFT-bad10\n"
"lalapps_SFTvalidate SFT-bad11\n"
"lalapps_SFTvalidate SFT-bad12\n"
"lalapps_SFTvalidate SFT-bad13\n"
"lalapps_SFTvalidate SFT-bad14\n"
"(checking exit status after each command) or you can also try\n"
"./SFTdumpheader SFT-good SFT-test[1234567]\n"
"./SFTdumpheader SFT-bad1\n"
"./SFTdumpheader SFT-bad2\n"
"./SFTdumpheader SFT-bad3\n"
"./SFTdumpheader SFT-bad4\n"
"./SFTdumpheader SFT-bad5\n"
"./SFTdumpheader SFT-bad6\n"
"./SFTdumpheader SFT-bad7\n"
"./SFTdumpheader SFT-bad8\n"
"./SFTdumpheader SFT-bad9\n"
"./SFTdumpheader SFT-bad10\n"
"./SFTdumpheader SFT-bad11\n"
"./SFTdumpheader SFT-bad12\n"
"./SFTdumpheader SFT-bad13\n"
"./SFTdumpheader SFT-bad14\n"
"or you can also replace SFTdumpheader with SFTdumpall.\n");
"lalapps_dumpSFT -H -i SFT-good SFT-test[1234567]\n"
"lalapps_dumpSFT -H -i SFT-bad1\n"
"lalapps_dumpSFT -H -i SFT-bad2\n"
"lalapps_dumpSFT -H -i SFT-bad3\n"
"lalapps_dumpSFT -H -i SFT-bad4\n"
"lalapps_dumpSFT -H -i SFT-bad5\n"
"lalapps_dumpSFT -H -i SFT-bad6\n"
"lalapps_dumpSFT -H -i SFT-bad7\n"
"lalapps_dumpSFT -H -i SFT-bad8\n"
"lalapps_dumpSFT -H -i SFT-bad9\n"
"lalapps_dumpSFT -H -i SFT-bad10\n"
"lalapps_dumpSFT -H -i SFT-bad11\n"
"lalapps_dumpSFT -H -i SFT-bad12\n"
"lalapps_dumpSFT -H -i SFT-bad13\n"
"lalapps_dumpSFT -H -i SFT-bad14\n"
"");
return 0;
}
Markdown is supported
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