Skip to content

Commit

Permalink
Merge pull request #106 from scottransom/python3
Browse files Browse the repository at this point in the history
Finally merging this very long-standing set of PRs!  Thank you all, especially @matteobachetti @gijzelaerr and @paulray !  Cheers!
  • Loading branch information
scottransom authored Nov 20, 2019
2 parents 8939b1f + f3c3f18 commit 10dd818
Show file tree
Hide file tree
Showing 152 changed files with 10,341 additions and 8,488 deletions.
64 changes: 64 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
*.[oa]
*.so
*.dylib
*.pyc
*~
.DS_Store
TAGS
*egg-info
lib/fftw_wisdom.txt
bin/GBT350filterbank
bin/accelsearch
bin/bary
bin/bincand
bin/cal2mjd
bin/check_parkes_raw
bin/dat2sdat
bin/dftfold
bin/downsample
bin/dump_spigot_zerolag
bin/exploredat
bin/explorefft
bin/fitsdelcol
bin/fitsdelrow
bin/makedata
bin/makeinf
bin/mjd2cal
bin/mpiprepsubband
bin/patchdata
bin/plotbincand
bin/prepdata
bin/prepfold
bin/prepsubband
bin/psrorbit
bin/psrfits_dumparrays
bin/quicklook
bin/readfile
bin/realfft
bin/rednoise
bin/rfifind
bin/sdat2dat
bin/search_bin
bin/search_rzw
bin/shiftdata
bin/show_pfd
bin/spigot2filterbank
bin/spigotSband2filterbank
bin/split_parkes_beams
bin/swap_endian
bin/taperaw
bin/toas2dat
bin/un_sc_td
bin/weight_psrfits
bin/window
bin/zapbirds
lib/python/ppgplot/
lib/python/presto/
python/build/
src/slalib/sla_test
src/makewisdom
src/fftw_wisdom.txt
MANIFEST
.venv*/
dist/
.mypy_cache/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ python/build/
src/slalib/sla_test
src/makewisdom
src/fftw_wisdom.txt
MANIFEST
.venv*/
dist/
.mypy_cache/
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: python
matrix:
include:
- env: TARGET=py2
- env: TARGET=py3
- env: TARGET=pep8
- env: TARGET=mypy
allow_failures:
- env: TARGET=pep8
- env: TARGET=mypy
sudo: required
services:
- docker
before_install:
- true
install:
- docker build . -t ${TARGET} -f .travis/${TARGET}.docker
before_script:
- true
script:
- true
7 changes: 7 additions & 0 deletions .travis/mypy.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM kernsuite/base:4
RUN docker-apt-install python3-pip
RUN pip3 install mypy
ADD . /code
WORKDIR /code
RUN mypy --ignore-missing-imports python

7 changes: 7 additions & 0 deletions .travis/pep8.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM kernsuite/base:4
RUN docker-apt-install python3-pip
RUN pip3 install pycodestyle
ADD . /code
WORKDIR /code
RUN pycodestyle python --ignore=E501

24 changes: 24 additions & 0 deletions .travis/py2.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM kernsuite/base:4
RUN docker-apt-install \
python-pip \
python-numpy \
python-future \
python-six \
python-scipy \
python-astropy \
gfortran \
pgplot5 \
libx11-dev \
libglib2.0-dev \
libcfitsio-dev \
libpng-dev \
libfftw3-dev
RUN docker-apt-install pgplot5
ADD . /code
ENV PRESTO /code
ENV LD_LIBRARY_PATH /code/lib
WORKDIR /code/src
RUN make libpresto slalib
WORKDIR /code
RUN pip install /code
RUN python tests/test_presto_python.py
23 changes: 23 additions & 0 deletions .travis/py3.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM kernsuite/base:4
RUN docker-apt-install \
python3-pip \
python3-numpy \
python3-future \
python3-six \
python3-scipy \
python3-astropy \
gfortran \
pgplot5 \
libx11-dev \
libglib2.0-dev \
libcfitsio-dev \
libpng-dev \
libfftw3-dev
ADD . /code
ENV PRESTO /code
ENV LD_LIBRARY_PATH /code/lib
WORKDIR /code/src
RUN make libpresto slalib
WORKDIR /code
RUN pip3 install /code
RUN python3 tests/test_presto_python.py
65 changes: 34 additions & 31 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ Basic steps to install:

If you are on a modern Intel processor and have a recent version
of GCC, you can get much improved performance by adding:
--enable-sse2 --enable-avx
--enable-sse --enable-sse2 --enable-avx --enable-avx2 --enable-fma

Note that Ubuntu has good FFTW packages now (libfftw3-bin and
libfftw3-dev).
Ubuntu has good FFTW packages: libfftw3-bin and libfftw3-dev

2. Install PGPLOT. http://www.astro.caltech.edu/~tjp/pgplot/
You need the X-windows and postscript drivers at a minimum.
Expand All @@ -29,7 +28,7 @@ Basic steps to install:
environment variable specified to allow the programs to link and to
allow PGPLOT to find its important files.

Note that Ubuntu has good PGPLOT packages now (pgplot5).
Ubuntu has a good PGPLOT package: pgplot5

3. Install TEMPO. Make sure to set the TEMPO environment variable.
http://tempo.sourceforge.net/
Expand All @@ -50,8 +49,7 @@ Basic steps to install:
a pulsar data standard that external tools can actually
view! How about that!)

Once again, Ubuntu has CFITSIO packages (libcfitsio3 and
libcfitsio3-dev)!
Ubuntu has CFITSIO packages: libcfitsio3 and libcfitsio3-dev

6. Define the PRESTO environment variable to the top level
directory of the PRESTO distribution (i.e. this directory).
Expand All @@ -75,15 +73,17 @@ Basic steps to install:
you will need to do a 'make mpi' as well.

11. The required libraries and miscellaneous files will be
located in $PRESTO/lib. The executable will be in $PRESTO/bin.
located in $PRESTO/lib. The executables will be in $PRESTO/bin.
You may copy or move the executables wherever you like, but
the library files should stay put. (That's why you define the
PRESTO variable -- so the routines can find them).

Since dynamic linking will use $PRESTO/lib, you will need to make
sure that that is in your LD_LIBRARY_PATH environment variable (or
in some other way let your system know where to find the dynamic
libraries). Similarly, you will want $PRESTO/bin in your PATH.
libraries). Similarly, you will want $PRESTO/bin in your PATH, or
you can copy/link all of the files that are in $PRESTO/bin to
somewhere in your path.

12. If you want to save some disk space, do a 'make clean' in
the 'src' directory. This will leave the libraries and
Expand All @@ -92,21 +92,27 @@ Basic steps to install:

13. If you want to use all the python routines (which if you are
doing anything but the most rudimentary analyses you will want
to), you need Python >= version 2.7, and Numpy/Scipy
to), you need Python >= version 2.7 or >= 3.6, and Numpy/Scipy
http://www.numpy.org and http://www.scipy.org
In general, the following should work:
"cd $PRESTO/python ; make ; make fftfit"
If it doesnt, you will probably need to edit the Makefile
or setup.py (one problem that is common is that ppgplot_libraries
sometimes needs "gfortran" added...). Note that in order to
get python to find the modules and libraries, you should make
sure that your PYTHONPATH environment variable contains the
directory $PRESTO/lib/python.
"cd $PRESTO ; pip install ."
if you are using a virtual environment or have permissions for
installing normal Python packages. If not, you may need to
install as an administrator or with the "--user" flag. With
this new and better Python installation you do *not* need
to set the PYTHONPATH environment variable anymore and so you
should ensure that it doesn't contain $PRESTO/lib/python as in
the past.

If you want to test some of the Python code (especially the
trickiest bits to get compiled and installed), you can run:
"python tests/test_presto_python.py"
and you should get a bunch of tests and a bunch of "success"es.

14. Go find pulsars!

Scott Ransom
July 2019
November 2019

-----------------------------------------------------------------

Expand All @@ -120,17 +126,19 @@ compiling and running:
-- Is TEMPO set to the top-level TEMPO source directory?
-- Is PGPLOT_DIR set to the location of the PGPLOT utility files?
(Note: On Ubuntu, that should be /usr/lib/pgplot5)
-- Is $PRESTO/bin in your PATH?
-- Is $PRESTO/lib in your LD_LIBRARY_PATH?
-- Is $PRESTO/lib/python in your PYTHONPATH?
-- Is $PRESTO/bin in your PATH? (It should be!)
-- Is $PRESTO/lib in your LD_LIBRARY_PATH? (It should be!)
-- Is $PRESTO/lib/python in your PYTHONPATH? (It shouldn't be now!)

2. Have you have installed the relevant -dev packages for glib2, FFTW
and CFITSIO if you are using a Debian-based Linux distribution?
Here are the required packages:
gfortran
pgplot5
libcfitsio3-dev
libcfitsio-dev
libfftw3-dev
libpng12-dev
libpng-dev
libx11-dev
libglib2.0-dev

3. If you are using a Mac, Paul Ray has been running PRESTO a lot and
Expand All @@ -150,15 +158,10 @@ compiling and running:
src/backend_common.c

For python, you will need to install numpy, scipy, etc. using
MacPorts or pip, as you prefer. Currently this must be Python 2.7,
but soon PRESTO will switch to Python 3.6 or later.
MacPorts or pip, as you prefer.

Next, edit python/Makefile to make sure that the version of f2py
you have installed is called. Instead of f2py, you may need to
call f2py-2.7, for example.

Finally, in python/setup.py add "/opt/local/include" to
include_dirs.
Finally, in $PRESTO/setup.py you might need to add
"/opt/local/include" to the include_dirs.

Then, just follow the PRESTO installation instructions (cd src;
make; make makewisdom; cd ../python ; make)
make; make makewisdom; cd .. ; pip install .)
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
recursive-include bin *
include pyproject.toml
recursive-include include *.h
include python/presto/cosine_rand.json
Loading

0 comments on commit 10dd818

Please sign in to comment.