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 2db0cda3 authored by Karl Wette's avatar Karl Wette

Remove lalapps_fits_* executables not used in Weave tests

parent 9f42f34c
......@@ -190,20 +190,10 @@ src/pulsar/CrossCorr/gsldata.dat
src/pulsar/CrossCorr/lalapps_pulsar_crosscorr
src/pulsar/CrossCorr/lalapps_pulsar_crosscorr_v2
src/pulsar/CrossCorr/toplist_crosscorr.dat
src/pulsar/FITSTools/lalapps_fits_array_copy
src/pulsar/FITSTools/lalapps_fits_array_imarith
src/pulsar/FITSTools/lalapps_fits_array_list
src/pulsar/FITSTools/lalapps_fits_array_stat
src/pulsar/FITSTools/lalapps_fits_copy
src/pulsar/FITSTools/lalapps_fits_header_delval
src/pulsar/FITSTools/lalapps_fits_header_getval
src/pulsar/FITSTools/lalapps_fits_header_list
src/pulsar/FITSTools/lalapps_fits_header_setval
src/pulsar/FITSTools/lalapps_fits_overview
src/pulsar/FITSTools/lalapps_fits_table_calc
src/pulsar/FITSTools/lalapps_fits_table_list
src/pulsar/FITSTools/lalapps_fits_table_merge
src/pulsar/FITSTools/lalapps_fits_table_select
src/pulsar/Fscan/lalapps_spec_avg
src/pulsar/Fscan/lalapps_spec_avg_long
src/pulsar/Fstatistic/lalapps_compareFstats
......
......@@ -125,20 +125,10 @@ test:
- lalapps_effdist --help
- lalapps_fftwf_wisdom --help
- lalapps_fftw_wisdom --help
- lalapps_fits_array_copy --help
- lalapps_fits_array_imarith --help
- lalapps_fits_array_list --help
- lalapps_fits_array_stat --help
- lalapps_fits_copy --help
- lalapps_fits_header_delval --help
- lalapps_fits_header_getval --help
- lalapps_fits_header_list --help
- lalapps_fits_header_setval --help
- lalapps_fits_overview --help
- lalapps_fits_table_calc --help
- lalapps_fits_table_list --help
- lalapps_fits_table_merge --help
- lalapps_fits_table_select --help
- lalapps_frjoin --help
- lalapps_fr_ninja --help
- lalapps_frview --help
......
......@@ -7,35 +7,15 @@ AM_CPPFLAGS += $(PAGER_CPPFLAGS)
if CFITSIO
bin_PROGRAMS = \
lalapps_fits_array_copy \
lalapps_fits_array_imarith \
lalapps_fits_array_list \
lalapps_fits_array_stat \
lalapps_fits_copy \
lalapps_fits_header_delval \
lalapps_fits_header_getval \
lalapps_fits_header_list \
lalapps_fits_header_setval \
lalapps_fits_overview \
lalapps_fits_table_calc \
lalapps_fits_table_list \
lalapps_fits_table_merge \
lalapps_fits_table_select \
$(END_OF_LIST)
lalapps_fits_array_copy_SOURCES = fits_array_copy.c
lalapps_fits_array_imarith_SOURCES = fits_array_imarith.c
lalapps_fits_array_list_SOURCES = fits_array_list.c
lalapps_fits_array_stat_SOURCES = fits_array_stat.c
lalapps_fits_copy_SOURCES = fits_copy.c
lalapps_fits_header_delval_SOURCES = fits_header_delval.c
lalapps_fits_header_getval_SOURCES = fits_header_getval.c
lalapps_fits_header_list_SOURCES = fits_header_list.c
lalapps_fits_header_setval_SOURCES = fits_header_setval.c
lalapps_fits_overview_SOURCES = fits_overview.c
lalapps_fits_table_calc_SOURCES = fits_table_calc.c
lalapps_fits_table_list_SOURCES = fits_table_list.c
lalapps_fits_table_merge_SOURCES = fits_table_merge.c
lalapps_fits_table_select_SOURCES = fits_table_select.c
endif
//
// From https://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples.html:
//
// FITS Tools: Handy FITS Utilities that illustrate how to use CFITSIO
// -------------------------------------------------------------------
//
// These are working programs written in ANSI C that illustrate how one can
// easily read, write, and modify FITS files using the CFITSIO library. Most of
// these programs are very short, containing only a few 10s of lines of
// executable code or less, yet they perform quite useful operations on FITS
// files. Copy the programs to your local machine, then compile, and link them
// with the CFITSIO library. A short description of how to use each program can
// be displayed by executing the program without any command line arguments.
//
// You may freely modify, reuse, and redistribute these programs as you wish. It
// is often easier to use one of these programs as a template when writing a new
// program, rather than coding the new program completely from scratch.
//
/**
* \file
* \ingroup lalapps_pulsar_FITSTools
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(HAVE_LIBCFITSIO)
// disable -Wstrict-prototypes flag for this header file as this causes
// a build failure for cfitsio-3.440+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#include <fitsio.h>
#pragma GCC diagnostic pop
#else
#error CFITSIO library is not available
#endif
int main(int argc, char *argv[])
{
fitsfile *infptr = 0, *outfptr = 0; /* FITS file pointers defined in fitsio.h */
int status = 0, ii = 1, iteration = 0, single = 0, hdupos = 0;
int hdutype = 0, bitpix = 0, bytepix = 0, naxis = 0, nkeys = 0, datatype = 0, anynul = 0;
long naxes[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
long first = 0, totpix = 0, npix = 0;
double *array = 0, bscale = 1.0, b0 = 0.0, nulval = 0.;
char card[81];
int printhelp = (argc == 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0));
if (printhelp || argc != 3) {
fprintf(stderr, "\n");
fprintf(stderr, "Usage: %s inputArray outputArray[compress]\n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, "Copy an input array to an output array, optionally compressing\n");
fprintf(stderr, "or uncompressing the array in the process. If the [compress]\n");
fprintf(stderr, "qualifier is appended to the output file name then the input array\n");
fprintf(stderr, "will be compressed using the tile-compressed format. In this format,\n");
fprintf(stderr, "the array is divided into rectangular tiles and each tile of pixels\n");
fprintf(stderr, "is compressed and stored in a variable-length row of a binary table.\n");
fprintf(stderr, "If the [compress] qualifier is omitted, and the input array is\n");
fprintf(stderr, "in tile-compressed format, then the output array will be uncompressed.\n");
fprintf(stderr, "\n");
fprintf(stderr, "If an extension name or number is appended to the input file name, \n");
fprintf(stderr, "enclosed in square brackets, then only that single extension will be\n");
fprintf(stderr, "copied to the output file. Otherwise, every extension in the input file\n");
fprintf(stderr, "will be processed in turn and copied to the output file.\n");
fprintf(stderr, "\n");
fprintf(stderr, "Examples:\n");
fprintf(stderr, "\n");
fprintf(stderr, "1) %s array.fit 'carray.fit[compress]'\n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, " This compresses the input array using the default parameters, i.e.,\n");
fprintf(stderr, " using the Rice compression algorithm and using row by row tiles.\n");
fprintf(stderr, "\n");
fprintf(stderr, "2) %s carray.fit array2.fit\n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, " This uncompress the array created in the first example.\n");
fprintf(stderr, " array2.fit should be identical to array.fit if the array\n");
fprintf(stderr, " has an integer datatype. There will be small differences\n");
fprintf(stderr, " in the pixel values if it is a floating point array.\n");
fprintf(stderr, "\n");
fprintf(stderr, "3) %s array.fit 'carray.fit[compress GZIP 100,100;4]'\n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, " This compresses the input array using the following parameters:\n");
fprintf(stderr, " GZIP compression algorithm;\n");
fprintf(stderr, " 100 X 100 pixel compression tiles;\n");
fprintf(stderr, " noise_bits = 4 (only used with floating point arrays)\n");
fprintf(stderr, "\n");
fprintf(stderr, "The full syntax of the compression qualifier is:\n");
fprintf(stderr, " [compress ALGORITHM TDIM1,TDIM2,...; NOISE_BITS]\n");
fprintf(stderr, "where the allowed ALGORITHM values are Rice, GZIP, PLIO, \n");
fprintf(stderr, "and TDIMn is the size of the compression tile in each dimension,\n");
fprintf(stderr, "and NOISE_BITS = 1, 2, 3, or 4 and controls the amount of noise\n");
fprintf(stderr, "suppression when compressing floating point arrays. \n");
fprintf(stderr, "\n");
fprintf(stderr, "Note that it may be necessary to enclose the file names\n");
fprintf(stderr, "in single quote characters on the Unix command line.\n");
return (0);
}
/* Open the input file and create output file */
fits_open_file(&infptr, argv[1], READONLY, &status);
fits_create_file(&outfptr, argv[2], &status);
if (status != 0) {
fits_report_error(stderr, status);
return (status);
}
fits_get_hdu_num(infptr, &hdupos); /* Get the current HDU position */
/* Copy only a single HDU if a specific extension was given */
if (hdupos != 1 || strchr(argv[1], '[')) {
single = 1;
}
for (; !status; hdupos++) { /* Main loop through each extension */
fits_get_hdu_type(infptr, &hdutype, &status);
if (hdutype == IMAGE_HDU) {
/* get array dimensions and total number of pixels in array */
for (ii = 0; ii < 9; ii++) {
naxes[ii] = 1;
}
fits_get_img_param(infptr, 9, &bitpix, &naxis, naxes, &status);
totpix = naxes[0] * naxes[1] * naxes[2] * naxes[3] * naxes[4]
* naxes[5] * naxes[6] * naxes[7] * naxes[8];
}
if (hdutype != IMAGE_HDU || naxis == 0 || totpix == 0) {
/* just copy tables and null arrays */
fits_copy_hdu(infptr, outfptr, 0, &status);
} else {
/* Explicitly create new array, to support compression */
fits_create_img(outfptr, bitpix, naxis, naxes, &status);
/* copy all the user keywords (not the structural keywords) */
fits_get_hdrspace(infptr, &nkeys, NULL, &status);
for (ii = 1; ii <= nkeys; ii++) {
fits_read_record(infptr, ii, card, &status);
if (fits_get_keyclass(card) > TYP_CMPRS_KEY) {
fits_write_record(outfptr, card, &status);
}
}
switch (bitpix) {
case BYTE_IMG:
datatype = TBYTE;
break;
case SHORT_IMG:
datatype = TSHORT;
break;
case LONG_IMG:
datatype = TLONG;
break;
case FLOAT_IMG:
datatype = TFLOAT;
break;
case DOUBLE_IMG:
datatype = TDOUBLE;
break;
}
bytepix = abs(bitpix) / 8;
npix = totpix;
iteration = 0;
/* try to allocate memory for the entire array */
/* use double type to force memory alignment */
array = (double *) calloc(npix, bytepix);
/* if allocation failed, divide size by 2 and try again */
while (!array && iteration < 10) {
iteration++;
npix = npix / 2;
array = (double *) calloc(npix, bytepix);
}
if (!array) {
fprintf(stderr, "Memory allocation error\n");
return (0);
}
/* turn off any scaling so that we copy the raw pixel values */
fits_set_bscale(infptr, bscale, b0, &status);
fits_set_bscale(outfptr, bscale, b0, &status);
first = 1;
while (totpix > 0 && !status) {
/* read all or part of array then write it back to the output file */
fits_read_img(infptr, datatype, first, npix,
&nulval, array, &anynul, &status);
fits_write_img(outfptr, datatype, first, npix, array, &status);
totpix = totpix - npix;
first = first + npix;
}
free(array);
}
if (single) {
break; /* quit if only copying a single HDU */
}
fits_movrel_hdu(infptr, 1, NULL, &status); /* try to move to next HDU */
}
if (status == END_OF_FILE) {
status = 0; /* Reset after normal error */
}
fits_close_file(outfptr, &status);
fits_close_file(infptr, &status);
/* if error occurred, print out error message */
if (status) {
fits_report_error(stderr, status);
}
return (status);
}
//
// From https://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples.html:
//
// FITS Tools: Handy FITS Utilities that illustrate how to use CFITSIO
// -------------------------------------------------------------------
//
// These are working programs written in ANSI C that illustrate how one can
// easily read, write, and modify FITS files using the CFITSIO library. Most of
// these programs are very short, containing only a few 10s of lines of
// executable code or less, yet they perform quite useful operations on FITS
// files. Copy the programs to your local machine, then compile, and link them
// with the CFITSIO library. A short description of how to use each program can
// be displayed by executing the program without any command line arguments.
//
// You may freely modify, reuse, and redistribute these programs as you wish. It
// is often easier to use one of these programs as a template when writing a new
// program, rather than coding the new program completely from scratch.
//
/**
* \file
* \ingroup lalapps_pulsar_FITSTools
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#if defined(HAVE_LIBCFITSIO)
// disable -Wstrict-prototypes flag for this header file as this causes
// a build failure for cfitsio-3.440+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#include <fitsio.h>
#pragma GCC diagnostic pop
#else
#error CFITSIO library is not available
#endif
/*
** 2010-08-19 modified to allow numeric second argument
(contributed by Michal Szymanski, Warsaw University Observatory)
*/
int main(int argc, char *argv[])
{
fitsfile *afptr = 0, *bfptr = 0, *outfptr = 0; /* FITS file pointers */
int status = 0; /* CFITSIO status value MUST be initialized to zero! */
int anaxis = 0, bnaxis = 0, check = 1, ii = 0, op = 0;
long npixels = 1, firstpix[3] = {1,1,1};
long anaxes[3] = {1,1,1}, bnaxes[3]= {1,1,1};
double *apix = 0, *bpix = 0, value = 0;
int array2=1;
int printhelp = (argc == 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0));
if (printhelp || argc != 5) {
fprintf(stderr, "Usage: %s array1 { array2 | value } oper outarray \n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, "Perform 'array1 oper array2' or 'array1 oper value'\n");
fprintf(stderr, "creating a new output array. Supported arithmetic\n");
fprintf(stderr, "operators are add, sub, mul, div (first character required\n");
fprintf(stderr, "\n");
fprintf(stderr, "Examples: \n");
fprintf(stderr, " %s in1.fits in2.fits a out.fits - add the 2 files\n", argv[0]);
fprintf(stderr, " %s in1.fits 1000.0 mul out.fits - mult in1 by 1000\n", argv[0]);
return (0);
}
fits_open_file(&afptr, argv[1], READONLY, &status); /* open input arrays */
if (status) {
fits_report_error(stderr, status); /* print error message */
return (status);
}
fits_open_file(&bfptr, argv[2], READONLY, &status);
if (status) {
value = atof(argv[2]);
if (value == 0.0) {
fprintf(stderr, "Error: second argument is neither an array name"
" nor a valid numerical value.\n");
return (status);
}
array2 = 0;
status = 0;
}
fits_get_img_dim(afptr, &anaxis, &status); /* read dimensions */
if (array2) {
fits_get_img_dim(bfptr, &bnaxis, &status);
}
fits_get_img_size(afptr, 3, anaxes, &status);
if (array2) {
fits_get_img_size(bfptr, 3, bnaxes, &status);
}
if (status) {
fits_report_error(stderr, status); /* print error message */
return (status);
}
if (anaxis > 3) {
fprintf(stderr, "Error: arrays with > 3 dimensions are not supported\n");
check = 0;
}
/* check that the input 2 arrays have the same size */
else if (array2 && (anaxes[0] != bnaxes[0] ||
anaxes[1] != bnaxes[1] ||
anaxes[2] != bnaxes[2])) {
fprintf(stderr, "Error: input arrays don't have same size\n");
check = 0;
}
if (*argv[3] == 'a' || *argv[3] == 'A') {
op = 1;
} else if (*argv[3] == 's' || *argv[3] == 'S') {
op = 2;
} else if (*argv[3] == 'm' || *argv[3] == 'M') {
op = 3;
} else if (*argv[3] == 'd' || *argv[3] == 'D') {
op = 4;
} else {
fprintf(stderr, "Error: unknown arithmetic operator\n");
check = 0;
}
/* create the new empty output file if the above checks are OK */
if (check && !fits_create_file(&outfptr, argv[4], &status)) {
/* copy all the header keywords from first array to new output file */
fits_copy_header(afptr, outfptr, &status);
npixels = anaxes[0]; /* no. of pixels to read in each row */
apix = (double *) malloc(npixels * sizeof(double)); /* mem for 1 row */
if (array2) {
bpix = (double *) malloc(npixels * sizeof(double));
}
if (apix == NULL || (array2 && bpix == NULL)) {
fprintf(stderr, "Memory allocation error\n");
return (1);
}
/* loop over all planes of the cube (2D arrays have 1 plane) */
for (firstpix[2] = 1; firstpix[2] <= anaxes[2]; firstpix[2]++) {
/* loop over all rows of the plane */
for (firstpix[1] = 1; firstpix[1] <= anaxes[1]; firstpix[1]++) {
/* Read both arrays as doubles, regardless of actual datatype. */
/* Give starting pixel coordinate and no. of pixels to read. */
/* This version does not support undefined pixels in the array. */
if (fits_read_pix(afptr, TDOUBLE, firstpix, npixels, NULL, apix,
NULL, &status)) {
break; /* jump out of loop on error */
}
if (array2 && fits_read_pix(bfptr, TDOUBLE, firstpix, npixels,
NULL, bpix, NULL, &status)) {
break; /* jump out of loop on error */
}
switch (op) {
case 1:
for (ii=0; ii< npixels; ii++)
if (array2) {
apix[ii] += bpix[ii];
} else {
apix[ii] += value;
}
break;
case 2:
for (ii=0; ii< npixels; ii++)
if (array2) {
apix[ii] -= bpix[ii];
} else {
apix[ii] -= value;
}
break;
case 3:
for (ii=0; ii< npixels; ii++)
if (array2) {
apix[ii] *= bpix[ii];
} else {
apix[ii] *= value;
}
break;
case 4:
for (ii=0; ii< npixels; ii++) {
if (array2) {
if (bpix[ii] !=0.) {
apix[ii] /= bpix[ii];
} else {
apix[ii] = 0.;
}
} else {
apix[ii] /= value;
}
}
}
fits_write_pix(outfptr, TDOUBLE, firstpix, npixels,
apix, &status); /* write new values to output array */
}
} /* end of loop over planes */
fits_close_file(outfptr, &status);
free(apix);
if (array2) {
free(bpix);
}
}
fits_close_file(afptr, &status);
if (array2) {
fits_close_file(bfptr, &status);
}
if (status) {
fits_report_error(stderr, status); /* print any error message */
}
return (status);
}
//
// From https://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples.html:
//
// FITS Tools: Handy FITS Utilities that illustrate how to use CFITSIO
// -------------------------------------------------------------------
//
// These are working programs written in ANSI C that illustrate how one can
// easily read, write, and modify FITS files using the CFITSIO library. Most of
// these programs are very short, containing only a few 10s of lines of
// executable code or less, yet they perform quite useful operations on FITS
// files. Copy the programs to your local machine, then compile, and link them
// with the CFITSIO library. A short description of how to use each program can
// be displayed by executing the program without any command line arguments.
//
// You may freely modify, reuse, and redistribute these programs as you wish. It
// is often easier to use one of these programs as a template when writing a new
// program, rather than coding the new program completely from scratch.
//
/**
* \file
* \ingroup lalapps_pulsar_FITSTools
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#if defined(HAVE_LIBCFITSIO)
// disable -Wstrict-prototypes flag for this header file as this causes
// a build failure for cfitsio-3.440+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#include <fitsio.h>
#pragma GCC diagnostic pop
#else
#error CFITSIO library is not available
#endif
int main(int argc, char *argv[])
{
fitsfile *fptr = 0; /* FITS file pointer, defined in fitsio.h */
int status = 0; /* CFITSIO status value MUST be initialized to zero! */
int bitpix = 0, naxis = 0, ii = 0, d = 0;
long naxes[9] = {1,1,1,1,1,1,1,1,1}, fpixel[9] = {1,1,1,1,1,1,1,1,1};
double *pixels = 0;
char format[20], hdformat[20];
int printhelp = (argc == 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0));
if (printhelp || argc != 2) {
fprintf(stderr, "Usage: %s filename[ext][section filter] \n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, "List the the pixel values in a FITS array \n");
fprintf(stderr, "\n");
fprintf(stderr, "Example: \n");
fprintf(stderr, " %s array.fits - list the whole array\n", argv[0]);
fprintf(stderr, " %s array.fits[100:110,400:410] - list a section\n", argv[0]);
fprintf(stderr, " %s table.fits[2][bin (x,y) = 32] - list the pixels in\n", argv[0]);
fprintf(stderr, " an array constructed from a 2D histogram of X and Y\n");
fprintf(stderr, " columns in a table with a binning factor = 32\n");
return (0);
}
#if defined(PAGER) && defined(HAVE_POPEN) && defined(HAVE_PCLOSE)
FILE *fout = popen(PAGER, "w");
if (fout == NULL) {
fprintf(stderr, "Could not execute '%s'\n", PAGER);
return (1);
}
#else
FILE *fout = stdout;
#endif
if (!fits_open_file(&fptr, argv[1], READONLY, &status)) {
if (!fits_get_img_param(fptr, 9, &bitpix, &naxis, naxes, &status)) {
if (naxis > 9 || naxis == 0) {
fprintf(stderr, "Error: only 1- to 9-dimensional arrays are supported\n");
} else {
/* get memory for 1 row */
pixels = (double *) malloc(naxes[0] * sizeof(double));
if (pixels == NULL) {
fprintf(stderr, "Memory allocation error\n");
return (1);
}
if (bitpix > 0) { /* set the default output format string */
strcpy(hdformat, " %7d");
strcpy(format, " %7.0g");
} else {
strcpy(hdformat, " %15d");
strcpy(format, " %15.5g");
}
if (naxis > 2) { /* label higher dimensions */
fprintf(fout, "#");
for (d = naxis - 1; d > 0; d--) {
fprintf(fout, "%1iD ", d+1);
}
fprintf(fout, "\n");
}
/* loop over all the rows in the array */
for (fpixel[8] = 1; fpixel[8] <= naxes[8]; fpixel[8]++) {
for (fpixel[7] = 1; fpixel[7] <= naxes[7]; fpixel[7]++) {
for (fpixel[6] = 1; fpixel[6] <= naxes[6]; fpixel[6]++) {
for (fpixel[5] = 1; fpixel[5] <= naxes[5]; fpixel[5]++) {
for (fpixel[4] = 1; fpixel[4] <= naxes[4]; fpixel[4]++) {
for (fpixel[3] = 1; fpixel[3] <= naxes[3]; fpixel[3]++) {
for (fpixel[2] = 1; fpixel[2] <= naxes[2]; fpixel[2]++) {
for (fpixel[1] = 1; fpixel[1] <= naxes[1]; fpixel[1]++) {
if (fits_read_pix(fptr, TDOUBLE, fpixel, naxes[0], NULL,
pixels, NULL, &status)) { /* read row of pixels */
break; /* jump out of loop on error */
}
if (naxis > 2) { /* print higher dimensions */
fprintf(fout, " ");
for (d = naxis - 1; d > 0; d--) {