Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nealegibson committed Feb 17, 2014
0 parents commit ae3ad34
Show file tree
Hide file tree
Showing 89 changed files with 8,283 additions and 0 deletions.
42 changes: 42 additions & 0 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

MyFunctions python module - simple collection of python functions, most usefully including functions to compute exoplanet transit light curves (quadratic and nonlinear)

Neale Gibson <[email protected]>

INSTALLATION:

**this module first needs gsl scientific (C) library installed
http://www.gnu.org/software/gsl/ and available on standard CPATH and LIBRARY_PATH
This is easy to install, just download, unpack, enter directory and
$ ./configure
$ make
$ make install
or first configure to a different directory? - see gsl install instructions
$ ./configure --prefix=<INSTALL_DIR>
**

To install MyFunctions:
Unpack and go into MyFunctions-* dir. You will need to tell gcc where to find the python and numpy C header files to include for LibHyp. These need to be added to the CPATH environment variable. You can find their locations from the command line
$ python-config --includes
and
$ python -c "import numpy; print numpy.get_include()"
Now add these to the CPATH, eg
$ setenv $CPATH <python-include-path>:<numpy-include-path>
replacing the <include-paths> with your system paths.

I haven't paid too much attention to how LibHyp is built, so you may also need to add the library paths to the environment variable LIBRARY_PATH. The python ones are found at
$ python-config --ldflags
and for numpy replace the include path /core/include/ with /lib/. This isn't necessary on my mac however, which by default dynamically links libraries. You can try and install LibHyp before making this step, it will be obvious if the libraries aren't found.

Once added to the CPATH you can install LibHyp (needed to compile MyFunctions.TransitFlux sub-package)
with the makefile
$ make -f build_libhyp

NOTE: LybHyp is required only for the non-linear limb darkening transit. To install with just the quadratic law ignore LibHyp and comment out the import of FluxNonlin and any functions that require it in LightCurveModels.py.

Then compile the python module as normal with distutils
$ python setup.py build
$ python setup.py install
or
$ python setup.py install --prefix=<INSTALL_DIR>
etc...
98 changes: 98 additions & 0 deletions LibHyp/include/cephes_names.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#ifndef CEPHES_NAMES_H
#define CEPHES_NAMES_H

#define airy cephes_airy
#define bdtrc cephes_bdtrc
#define bdtr cephes_bdtr
#define bdtri cephes_bdtri
#define beta cephes_beta
#define lbeta cephes_lbeta
#define btdtr cephes_btdtr
#define cbrt cephes_cbrt
#define chdtrc cephes_chdtrc
#define chdtr cephes_chdtr
#define chdtri cephes_chdtri
#define dawsn cephes_dawsn
#define ellie cephes_ellie
#define ellik cephes_ellik
#define ellpe cephes_ellpe
#define ellpj cephes_ellpj
#define ellpk cephes_ellpk
#define exp10 cephes_exp10
#define exp1m cephes_exp1m
#define exp2 cephes_exp2
#define expn cephes_expn
#define fabs cephes_fabs
#define fdtrc cephes_fdtrc
#define fdtr cephes_fdtr
#define fdtri cephes_fdtri
#define fresnl cephes_fresnl
#define Gamma cephes_Gamma
#define lgam cephes_lgam
#define gdtr cephes_gdtr
#define gdtrc cephes_gdtrc
#define gdtri cephes_gdtri
#define hyp2f1 cephes_hyp2f1
#define hyperg cephes_hyperg
#define hyp2f0 cephes_hyp2f0
#define onef2 cephes_onef2
#define threef0 cephes_threef0
#define i0 cephes_i0
#define i0e cephes_i0e
#define i1 cephes_i1
#define i1e cephes_i1e
#define igamc cephes_igamc
#define igam cephes_igam
#define igami cephes_igami
#define incbet cephes_incbet
#define incbi cephes_incbi
#define iv cephes_iv
#define j0 cephes_j0
#define y0 cephes_y0
#define j1 cephes_j1
#define y1 cephes_y1
#define jn cephes_jn
#define jv cephes_jv
#define k0 cephes_k0
#define k0e cephes_k0e
#define k1 cephes_k1
#define k1e cephes_k1e
#define kn cephes_kn
#define nbdtrc cephes_nbdtrc
#define nbdtr cephes_nbdtr
#define nbdtri cephes_nbdtri
#define ndtr cephes_ndtr
#define erfc cephes_erfc
#define erf cephes_erf
#define ndtri cephes_ndtri
#define pdtrc cephes_pdtrc
#define pdtr cephes_pdtr
#define pdtri cephes_pdtri
#define psi cephes_psi
#define rgamma cephes_rgamma
#define round cephes_round
#define shichi cephes_shichi
#define sici cephes_sici
#define radian cephes_radian
#define sindg cephes_sindg
#define cosdg cephes_cosdg
#define sincos cephes_sincos
#define spence cephes_spence
#define stdtr cephes_stdtr
#define stdtri cephes_stdtri
#define struve cephes_struve
#define yv cephes_yv
#define tandg cephes_tandg
#define cotdg cephes_cotdg
#define log1p cephes_log1p
#define expm1 cephes_expm1
#define cosm1 cephes_cosm1
#define yn cephes_yn
#define zeta cephes_zeta
#define zetac cephes_zetac
#define smirnov cephes_smirnov
#define smirnovi cephes_smirnovi
#define kolmogorov cephes_kolmogorov
#define kolmogi cephes_kolmogi

#endif
149 changes: 149 additions & 0 deletions LibHyp/include/mconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/* mconf.h
*
* Common include file for math routines
*
*
*
* SYNOPSIS:
*
* #include "mconf.h"
*
*
*
* DESCRIPTION:
*
* This file contains definitions for error codes that are
* passed to the common error handling routine mtherr()
* (which see).
*
* The file also includes a conditional assembly definition
* for the type of computer arithmetic (IEEE, DEC, Motorola
* IEEE, or UNKnown).
*
* For Digital Equipment PDP-11 and VAX computers, certain
* IBM systems, and others that use numbers with a 56-bit
* significand, the symbol DEC should be defined. In this
* mode, most floating point constants are given as arrays
* of octal integers to eliminate decimal to binary conversion
* errors that might be introduced by the compiler.
*
* For little-endian computers, such as IBM PC, that follow the
* IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
* Std 754-1985), the symbol IBMPC should be defined. These
* numbers have 53-bit significands. In this mode, constants
* are provided as arrays of hexadecimal 16 bit integers.
*
* Big-endian IEEE format is denoted MIEEE. On some RISC
* systems such as Sun SPARC, double precision constants
* must be stored on 8-byte address boundaries. Since integer
* arrays may be aligned differently, the MIEEE configuration
* may fail on such machines.
*
* To accommodate other types of computer arithmetic, all
* constants are also provided in a normal decimal radix
* which one can hope are correctly converted to a suitable
* format by the available C language compiler. To invoke
* this mode, define the symbol UNK.
*
* An important difference among these modes is a predefined
* set of machine arithmetic constants for each. The numbers
* MACHEP (the machine roundoff error), MAXNUM (largest number
* represented), and several other parameters are preset by
* the configuration symbol. Check the file const.c to
* ensure that these values are correct for your computer.
*
* Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
* may fail on many systems. Verify that they are supposed
* to work on your computer.
*/

/*
Cephes Math Library Release 2.3: June, 1995
Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
*/

#ifndef CEPHES_MCONF_H
#define CEPHES_MCONF_H

#include <Python.h>
#include <numpy/npy_math.h>

#include "cephes_names.h"
#include "protos.h"

/* Constant definitions for math error conditions
*/

#define DOMAIN 1 /* argument domain error */
#define SING 2 /* argument singularity */
#define OVERFLOW 3 /* overflow range error */
#define UNDERFLOW 4 /* underflow range error */
#define TLOSS 5 /* total loss of precision */
#define PLOSS 6 /* partial loss of precision */
#define TOOMANY 7 /* too many iterations */
#define MAXITER 500

#define EDOM 33
#define ERANGE 34

/* Long double complex numeral. */
/*
typedef struct
{
long double r;
long double i;
} cmplxl;
*/

/* Type of computer arithmetic */

/* UNKnown arithmetic, invokes coefficients given in
* normal decimal format. Beware of range boundary
* problems (MACHEP, MAXLOG, etc. in const.c) and
* roundoff problems in pow.c:
* (Sun SPARCstation)
*/

/* SciPy note: by defining UNK, we prevent the compiler from
* casting integers to floating point numbers. If the Endianness
* is detected incorrectly, this causes problems on some platforms.
*/
#define UNK 1

/* Define this `volatile' if your compiler thinks
* that floating point arithmetic obeys the associative
* and distributive laws. It will defeat some optimizations
* (but probably not enough of them).
*
* #define VOLATILE volatile
*/
#define VOLATILE

/* For 12-byte long doubles on an i386, pad a 16-bit short 0
* to the end of real constants initialized by integer arrays.
*
* #define XPD 0,
*
* Otherwise, the type is 10 bytes long and XPD should be
* defined blank (e.g., Microsoft C).
*
* #define XPD
*/
#define XPD 0,

/* Define to support tiny denormal numbers, else undefine. */
#define DENORMAL 1

/* Define to distinguish between -0.0 and +0.0. */
#define MINUSZERO 1

/* Define 1 for ANSI C atan2() function
See atan.c and clog.c. */
#define ANSIC 1

/* Variable for error reporting. See mtherr.c. */
extern int merror;

#define gamma Gamma

#endif /* CEPHES_MCONF_H */
Loading

0 comments on commit ae3ad34

Please sign in to comment.