summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a46eff3)
raw | patch | inline | side by side (parent: a46eff3)
author | Rekhesh Mohan <reks@iiap.res.in> | |
Mon, 2 Jul 2012 17:23:30 +0000 (22:53 +0530) | ||
committer | Rekhesh Mohan <reks@iiap.res.in> | |
Mon, 2 Jul 2012 17:23:30 +0000 (22:53 +0530) |
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
AUTOMAKE_OPTIONS = foreign 1.4
SUBDIRS = src
-dist_doc_DATA = README.txt AUTHORS.txt COPYING.txt ChangeLog.txt INSTALL.txt
+
+cadsdocdir = $(datadir)/cads/@PACKAGE@
+dist_cadsdoc_DATA = README.txt AUTHORS.txt COPYING.txt ChangeLog.txt INSTALL.txt
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
-AC_PREREQ([2.68])
AC_INIT([CADS_zodiacal_model], [1.0], [cads@iiap.res.in])
+AC_LANG_C
+AM_INIT_AUTOMAKE([-Wall -Werror])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE(CADS_zodiacal_model, 1.0)
# Checks for programs.
-AC_PROG_CXX
AC_PROG_CC
-AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
-AC_PROG_RANLIB
# Checks for libraries.
# Checks for header files.
-AC_CHECK_HEADERS([stdlib.h string.h])
+AC_CHECK_HEADERS([stdio.h stdlib.h string.h math.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_FUNC_MALLOC
-LIBS="$LIBS -lm -Wall -pedantic"
-
#---------------------------------------------------------------------#
# Now we check for libnova headers and library #
#---------------------------------------------------------------------#
diff --git a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am
+++ b/src/Makefile.am
bin_PROGRAMS = uvs_zodiacal_model
-# set the include path found by configure
-INCLUDES = $(all_includes)
-
# the library search path.
uvs_zodiacal_model_SOURCES = signal_handler.c zodiacal_model.c read_write.c
-dist_doc_DATA = leinert_dist.txt zodiacal_spec.txt
noinst_HEADERS = zodiacal_model.h
+
+cadsdatadir = $(datadir)/cads/data
+dist_cadsdata_DATA = leinert_dist.txt zodiacal_spec.txt
+AM_CFLAGS = -DCADSDATA=\"$(cadsdatadir)/\"
\ No newline at end of file
diff --git a/src/read_write.c b/src/read_write.c
--- a/src/read_write.c
+++ b/src/read_write.c
"# 3. Month of the year (unitless, range: 1 - 12) \n"
"MONTH = 12\n\n"
"# 4. Year (unitless, range: 1900 - 2100 for max. accuracy) \n"
- "YEAR = 2012\n\n"
+ "YEAR = 2012\n\n\n"
);
fprintf(fparam,
"# 1. RA (deg. range: 0.0 - 360.0)\n"
"RA = 266.50\n\n"
"# 2. Declination (deg. range: -90 - +90)\n"
- "DECLINATION = -29.0\n\n"
+ "DECLINATION = -29.0\n\n\n"
);
/*The files */
"# OUTPUT FILE:\n"
"# -----------------------\n"
"# The calculated spectrum is written to this file. \n"
- "OUTPUT_FILE = zodiacal_output.txt\n\n"
+ "OUTPUT_FILE = zodiacal_output.txt\n\n\n"
);
fprintf(fparam,
"# -----------------------\n"
"# zodiacal light spectrum is read from this file. \n"
"# Data is based on the solar spectrum from Colina et al\n"
- "ZODIAC_SPECTRUM = zodiacal_spec.txt\n\n"
+ "ZODIAC_SPECTRUM = %szodiacal_spec.txt\n\n", CADSDATA
);
fprintf(fparam,
"# ZODIACAL LIGHT MODEL FILE:\n"
"# --------------------------\n"
"# zodiacal light distribution data (Leinert et al.) \n"
- "ZODIAC_MODEL = leinert_dist.txt\n"
+ "ZODIAC_MODEL = %sleinert_dist.txt\n\n", CADSDATA
+ );
+
+ fprintf(fparam,
+ "# --------------------------\n"
+ "#\n"
);
printf("Info : Default Parameter file has been generated.\n");
diff --git a/src/zodiacal_model.c b/src/zodiacal_model.c
--- a/src/zodiacal_model.c
+++ b/src/zodiacal_model.c
3. Removed parse_par => no command line options
4. Can handle comments in spectrum file and removed the 'rather strict'
ZOD_SPEC number of elements in spectrum :)
+ 5. More gnu-autotools friendly. Path to input data files are taken care of
*--------------------------------------------------------------------------*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <libnova/solar.h>
#include <libnova/transform.h>
#include <libnova/julian_day.h>
printf (" If no parameter file exists, new one will be created\n");
printf (" which may be edited as required\n\n");
printf ("-----------------------------------------------------------\n");
- printf ("Copyright (c) 2012, The CADS Team. [GPL v2.0 or later]\n");
- printf ("Bug Reports : cads.iiap.res.in/dropbux \n");
- printf ("Documentation : cads.iiap.res.in/software\n\n");
+ printf ("Copyright (c) 2012 The CADS Team, IIAp. [GPL v3.0 or later]\n");
+ printf ("Report Bugs to: http://cads.iiap.res.in/bugzilla \n");
+ printf ("Documentation : http://cads.iiap.res.in/software\n\n");
}/*End usage */
/* ------------------------------------------------------------------------- */
/* things are symmetric around 0 latitude here.. */
f_temp = fabs(eclcoords.lng - sun_ecl.lng);
-
+
/* wrap coordinates around 180 deg.*/
if (f_temp > 180) f_temp = 360 - f_temp;
hbeta_index = 0;
while (table_beta[hbeta_index] < fabs(helio_beta))
++hbeta_index;
-
+
zod_intensity = zod_dist[hecl_index + hbeta_index*ZOD_XSIZE];
/*Scale zodiacal light spectrum*/
diff --git a/src/zodiacal_model.h b/src/zodiacal_model.h
--- a/src/zodiacal_model.h
+++ b/src/zodiacal_model.h
Reks, 22 June 2012
1. Rebranded to cads software group
*--------------------------------------------------------------------------*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
-/*Maximum number of elements in a text line*/
+/* Maximum number of elements in a text line */
#define MAX_TEXT 150
-/*Define the parameters for reading the zodiacal file*/
+/* Define the parameters for reading the zodiacal file */
#define ZOD_XSIZE 19 /*Number of rows */
#define ZOD_YSIZE 10 /* Number of Columns */
#define ZOD_SPEC 25763 /* Number of elements */
#define DEFAULT_ZOD_FILE "leinert_dist.txt" /* Leinert's model */
#define DEFAULT_SPEC_FILE "zodiacal_spec.txt" /* Solar Spectrum */
#define DEFAULT_OUT_FILE "zodiacal_output.txt" /* Output file */
+
+/* path to input data files, if we were GNU-built by autotools */
+#ifndef CADSDATA
+#define CADSDATA ' '
+#endif
+
/* this is something else */
#define INITVAL -400