forked from thommevans/planetc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tomevans
committed
Nov 12, 2013
0 parents
commit c1975cd
Showing
32 changed files
with
18,504 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.pyc | ||
build/* | ||
dist/* | ||
*.egg-info/ | ||
*~ | ||
/__init__.py | ||
*.csv | ||
*.ipac | ||
*.fits | ||
*.eph | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
Nov2012 TME | ||
|
||
** planetc | ||
|
||
A Python module with C extensions for exoplanet-related tasks such as computing transit | ||
light curves and radial velocity variations. | ||
|
||
All *.py and *.c source files (along with all *.h headers) are located in the planetc/ folder. | ||
It is possible to carry out all installation steps using the Makefile in the top level | ||
directory; see below for instructions. | ||
|
||
|
||
** External dependencies | ||
|
||
- numpy (Python library) | ||
- gsl, gslcblas (C library) | ||
|
||
|
||
** INSTALLING THE PACKAGE | ||
|
||
1. planetc/keporb.c and planetc/ma02.c are the Python/C API wrappers for the underlying C extensions. | ||
These should already be present, but if they aren't, it will be necessary to construct them | ||
from the corresponding planetc/keporb.pyx and planetc/ma02.pyx files using cython. Also, if the *.pyx | ||
files get changed, you will similarly need to recompile the *.c files. The latter is important | ||
to note, because you must make sure you do this manually. It's not hard at all though, just a | ||
matter of remembering to do it, and you must have cython installed (or else you have no option | ||
but to rely on the *.c files that have been provided). Supposing, however, that you do have | ||
cython intstalled, then you can recompile the keporb.c and ma02.c files from within the top-level | ||
directory by entering the following command at the shell command line: | ||
|
||
>> make cython_files | ||
|
||
If you don't have Cython installed, and you want to install it, it's very simple. Perhaps the | ||
easiest way to do this is to download the Cython package from the online Python Package Index | ||
and install it on your system in one command using pip: | ||
|
||
>> pip install --user Cython | ||
|
||
where the '--user' flag here what I use, telling Python to install the package in the default | ||
location under the 'user' scheme. For further options (eg --prefix=<PATHNAME> etc) see the pip | ||
documentation. | ||
|
||
2. Once the planetc/keporb.c and planetc/ma02.c files have been created, the distribution can be built | ||
with the command: | ||
|
||
>> make build | ||
|
||
3. The distribution can then be installed using: | ||
|
||
>> make install INSTALL_OPT='<user-input>' | ||
|
||
where <user-input> is a string containing an instruction for where the distribution is to be | ||
installed, using standard distutils syntax. Specifically, the above command will be | ||
translated by the Makefile to carry out the following: | ||
|
||
>> python setup.py install '<user-input>' | ||
|
||
For example, the following command: | ||
|
||
>> make install INSTALL_OPT='--prefix=/some/user/specified/folder/' | ||
|
||
would install the package lib/ wherever the user would like using the --prefix option. For | ||
me personally, I prefer to use: | ||
|
||
>> make install INSTALL_OPT='--user' | ||
|
||
to make use of the '--user' option, which is what I use for all Python packages that I | ||
install manually. | ||
|
||
4. Note of course that steps 2 and 3 could be completed in one go using step 3 only, because | ||
it will generate the intermediate build/ folder if necessary. | ||
|
||
5. Once the package has been installed, at the command line you can run: | ||
|
||
>> make clean | ||
|
||
which will remove the intermediate build/ folder. Of course, you could just do this yourself | ||
using: | ||
|
||
>> rm -rf build | ||
|
||
|
||
** FURTHER NOTES ON INSTALLATION: | ||
|
||
It is possible that the setup.py script may need to be tweaked if you encounted problems | ||
with any of the above steps. For instance, the locations of the Python and Numpy installations | ||
are found by default using: | ||
|
||
>> from distutils.sysconfig import get_python_inc | ||
>> python_inc = get_python_inc() | ||
>> import numpy as np | ||
>> numpy_inc = np.get_include() | ||
|
||
This is designed to be portable for all systems, but may need to be adjusted if you have an | ||
unusual setup. Also, it is assumed that the gsl and gslcblas libraries are installed on the | ||
$CPATH and $LIBRARY_PATH, respectively, so that they will be located during the compilation. | ||
If this is not the case by default on your system, you will need to append the either the | ||
$PATH or $CPATH variable appropriately. | ||
|
||
|
||
** RE-PACKAGING FOR RE-DISTRIBUTION: | ||
|
||
If you would like to edit any of the source files and repackage planetc for redistribution, then | ||
the following easy steps can be taken. | ||
|
||
1. Edit any of the source files in the planetc/ folder however you would like. | ||
|
||
2. Edit the MANIFEST.in file appropriately to make sure that all of the files you want will be | ||
bundled into the distribution archive. Currently, this is achieved by including a single line | ||
|
||
"graft planetc/" | ||
|
||
to tell setup.py to include all of the files (*.py, *.pyx, *.c, *.h etc) in the planetc folder when | ||
generating the distribution. Note that the MANIFEST.in file is the one that you edit to tell | ||
setup.py what to do, but the MANIFEST (without the *.in suffix) is part of the output generated | ||
by setup.py, which you don't need to touch. | ||
|
||
3. Change back into the top level directory and make any necessary changes to the setup.py file. | ||
If you've just edited files that already existed, this step should be pretty minimal if it is | ||
required at all. Otherwise, if you've added new files, you'll have to make sure the setup.py | ||
file reflects this update. One important change to make, however, is updating the **version** | ||
variable in the setup() call. The convention is planetc-X.Y, where relatively minor changes | ||
result in increasing the value of Y by 1, and substantial changes result in increasing the value | ||
of X by 1 and resetting Y to 0. | ||
|
||
4. Staying in the top level directory, at the shell command line enter: | ||
|
||
>> python setup.py sdist | ||
|
||
This will generate a subfolder dist/ that contains the planetc | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
graft planetc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
|
||
INSTALL_OPT = '--prefix=.' | ||
|
||
|
||
.PHONY: install build cython_files clean | ||
|
||
install: | ||
python setup.py install ${INSTALL_OPT} | ||
|
||
build: | ||
python setup.py build | ||
|
||
cython_files: | ||
rm planetc/keporb.c | ||
rm planetc/ma02.c | ||
cython planetc/keporb.pyx | ||
cython planetc/ma02.pyx | ||
|
||
clean: | ||
rm -rf build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
planetc | ||
======= | ||
|
||
This module contains code for implementing the analytic Mandel & Agol (2002) equations | ||
for planetary transit lightcurves. Uses a C backend with Python/Cython wrappers. | ||
|
||
The C backend of planetc was originally based on the one written by Neale Gibson, as part | ||
of his "MyFunctions" package. There has been a fairly substantial reformatting of those | ||
original C backends for the ones contained in planetc, but the content remains essentially | ||
the same. On the other hand, the Python routines that perform calls to the C backend routines | ||
have been modified significantly, and the Python/C API wrappers have been completely rewritten | ||
with the nicer Cython syntax. Tests confirm that the output from planetc exactly matches the | ||
output from the original MyFunctions routines, with identical computation time. | ||
|
||
See INSTALL for instructions on how to install the package. Once the package | ||
has been installed, you can cd into the examples folder that comes with this | ||
distribution to check out some basic usage of the planetc routines. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.