Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
Usage: $ python config.py compile
"""

import os
import collections
import ast
#-- Make sure the script doesn't confuse the IvS io module with the standard
# Python io module.
import sys
sys.path = sys.path[1:]
import os
import glob as glob_module

#-- You can add directories here, but be sure that the relative paths within
# those directories are correct!
data_dirs = [os.getenv('ivsdata'),'/STER/pieterd/IVSDATA/', '/STER/kristofs/IVSdata','/STER/jorisv/IVSDATA/',
'/STER/kenneth/Python_repository/','/home/ben/public_html/opacities','/STER/michelh/IVSDATA/']

data_dirs = [os.getenv('ivsdata'),'/STER/jorisv/IVSDATA/',
'/STER/kenneth/Python_repository/','/STER/michelh/IVSDATA/',
os.path.join(os.path.expanduser('~'),'ComboCode','aux','ivsdata')]

ivs_dirs = dict(coralie='/STER/coralie/',
hermes='/STER/mercator/hermes/')



def get_datafile(relative_path,basename):
"""
Reconstruct the location of a data file and check whether it exists.

If the file exists, it will return the absolute path of the filename.

If the file does not exist, it will raise an IOError.

@param relative_path: relative path starting from main data directory tree
@type relative_path: str
@param basename: filename
Expand All @@ -38,16 +38,16 @@ def get_datafile(relative_path,basename):
"""
for data_dir in data_dirs:
if data_dir is None: continue

filename = os.path.join(data_dir,relative_path,basename)

if os.path.isfile(filename):
break
else:
str_data_dirs = ", ".join([idir for idir in data_dirs if idir is not None])
relative_file = os.path.join(relative_path,basename)
raise IOError, "File %s not found in any of the specified data directories %s"%(relative_file,str_data_dirs)

return filename


Expand All @@ -56,7 +56,7 @@ def get_datafile(relative_path,basename):
def glob(relative_path,arg='*'):
"""
Glob the files in a relative path.

@param relative_path: relative path starting from main data directory tree
@type relative_path: str
@param arg: argument to use in glob
Expand All @@ -70,17 +70,15 @@ def glob(relative_path,arg='*'):
files += glob_module.glob(os.path.join(data_dir,relative_path,arg))
files.sort()
return files




if __name__=="__main__":

if __name__=="__main__":
import subprocess
from ivs.aux import loggers
import shutil
import time
logger = loggers.get_basic_logger()

to_install = ['spectra/pyrotin4',
'timeseries/deeming','timeseries/eebls','timeseries/multih',
'timeseries/pyclean','timeseries/pyKEP','timeseries/pyscargle',
Expand Down
42 changes: 27 additions & 15 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,30 @@
$ cd ivs
$ git pull

* Make sure that your python path points to the ivs folder, so that you can simply import
using, for example:

>>> from ivs.statistics import linearregression

If your python repository is in, e.g., ~/python/ivs/ , you can put in your .bash_profile:

export PYTHONPATH=/home/YOURNAME/python:$PYTHONPATH

Warning: don't put ~/python/ivs in your Python path, but just ~/python.

* For the next part of the installation, temporarily move the io folder elsewhere, e.g.

$ cd ivs
$ mv io io_backup

* In the config.py file in the ivs folder, add the path where the IvS data catalogs (variable: data_dir) can be found.

* The IvS Python repository contains mostly python routines. Some of the time-critical
functions, however, are written in fortran. To compile them you can run
functions, however, are written in fortran. This assumes you have gfortran installed on your system. To compile them you can run

$ python config.py compile

If you want to specify your own fortran compiler you can do so with
Alternatively, if you want to specify your own fortran compiler you can do so with

$ python config.py compile f77

Expand All @@ -26,21 +44,12 @@ Note: sometimes the compilation process fails. If so, try to compile spectra/pyr
$ cd ../
$ python config.py compile

* In the config file you may also change the paths where the data catalogs (variable: data_dir) can be found, if you are not using the default locations.

* Make sure that your python path points to the ivs folder, so that you can simply import
using, for example:

>>> from ivs.statistics import linearregression

If your python repository is in, e.g., ~/python/ivs/ , you can put in your .bash_profile:

export PYTHONPATH=/home/YOURNAME/python:$PYTHONPATH

Warning: don't put ~/python/ivs in your Python path, but just ~/python.
* With the installation finished, move the io folder back:

$ cd ivs
$ mv io_backup io

* To generate the documentation, simply run the script
* To generate the documentation (which, as a user, you typically do not have to do), simply run the script

$ python makedoc.py

Expand All @@ -66,3 +75,6 @@ Encountered errors and their solutions:
numpy.distutils.fcompiler.CompilerNotFound: gnu95: f90 nor f77
A: Install gfortran.

2. Q: When I run "python config.py compile", I get the following error:
/bin/sh: f2py: command not found
A: Install f2py. If you do have f2py installed, but under a different name for the executable (for instance, f2py-2.7), replace f2py with f2py-2.7 in config.py (search for cmd = ).
Loading