Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Change: no numerical errors returned by distance funcs. swig not …
…required. I've never found the numerical errors returned by the numerical integration routines used in the distance.py functions to be useful or accurate, so I'm no longer returning them. This should streamline usage of these function considerably. I also changed setup.py and included the swig-generated power_wrap.c and power.py so that swig is no longer required to compile the package. modified: .gitignore modified: LISCENSE modified: README new file: cosmolopy/EH/README deleted: cosmolopy/EH/install_EH.bash deleted: cosmolopy/EH/installation.txt new file: cosmolopy/EH/power.py new file: cosmolopy/EH/power_wrap.c modified: cosmolopy/constants.py modified: cosmolopy/distance.py modified: cosmolopy/reionization.py deleted: setup.cfg modified: setup.py modified: tests/test_age.py modified: tests/test_distances.py modified: tests/test_plot_Hogg.py modified: tests/test_wmap.py modified: www/index.html new file: pypi_notes.txt
- Loading branch information
Showing
19 changed files
with
4,092 additions
and
143 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,10 +1,8 @@ | |||
*~ | *~ | ||
.coverage | .coverage | ||
*.pyc | *.pyc | ||
cosmolopy/EH/power.o | cosmolopy/EH/*.o | ||
cosmolopy/EH/power.py* | cosmolopy/EH/*.so | ||
cosmolopy/EH/_power.so | |||
cosmolopy/EH/power_wrap.* | |||
CosmoloPy.egg-info/ | CosmoloPy.egg-info/ | ||
build/ | build/ | ||
dist/ | dist/ |
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
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
Original c code | |||
=============== | |||
|
|||
power.c is redistributed under the MIT License with the permission of | |||
Wayne Hu | |||
|
|||
htt://background.uchicago.edu/~whu/transfer/transferpage.html | |||
|
|||
and is described in Eisenstein, D. J., & Hu, W. "Power Spectra for | |||
Cold Dark Matter and Its Variants," 1999, ApJ, 511, 5 | |||
[astro-ph/9710252]. Please cite this paper to acknowledge use of power | |||
spectrum calculations. | |||
|
|||
See LISCENSE file. | |||
|
|||
Python Interface | |||
================ | |||
|
|||
I use swig to generate the python interface to `power.c`. | |||
|
|||
`power_wrap.c` and `power.py` are created from `power.i` and `power.c` | |||
by runing: | |||
|
|||
> swig -python power.i | |||
|
|||
I used to let distutils run swig, but that stopped working for some | |||
reason. The code was: | |||
|
|||
power_module = Extension('cosmolopy.EH._power', | |||
sources=[os.path.join(eh_dir, 'power.i'), os.path.join(eh_dir, | |||
'power.c')]) | |||
|
|||
I still let distutils do the compiling to create `_power.so`. This has | |||
the advantage of not requiring the user to install swig. | |||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,83 @@ | |||
# This file was automatically generated by SWIG (http://www.swig.org). | |||
# Version 1.3.40 | |||
# | |||
# Do not make changes to this file unless you know what you are doing--modify | |||
# the SWIG interface file instead. | |||
# This file is compatible with both classic and new-style classes. | |||
|
|||
from sys import version_info | |||
if version_info >= (2,6,0): | |||
def swig_import_helper(): | |||
from os.path import dirname | |||
import imp | |||
fp = None | |||
try: | |||
fp, pathname, description = imp.find_module('_power', [dirname(__file__)]) | |||
except ImportError: | |||
import _power | |||
return _power | |||
if fp is not None: | |||
try: | |||
_mod = imp.load_module('_power', fp, pathname, description) | |||
finally: | |||
fp.close() | |||
return _mod | |||
_power = swig_import_helper() | |||
del swig_import_helper | |||
else: | |||
import _power | |||
del version_info | |||
try: | |||
_swig_property = property | |||
except NameError: | |||
pass # Python < 2.2 doesn't have 'property'. | |||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1): | |||
if (name == "thisown"): return self.this.own(value) | |||
if (name == "this"): | |||
if type(value).__name__ == 'SwigPyObject': | |||
self.__dict__[name] = value | |||
return | |||
method = class_type.__swig_setmethods__.get(name,None) | |||
if method: return method(self,value) | |||
if (not static) or hasattr(self,name): | |||
self.__dict__[name] = value | |||
else: | |||
raise AttributeError("You cannot add attributes to %s" % self) | |||
|
|||
def _swig_setattr(self,class_type,name,value): | |||
return _swig_setattr_nondynamic(self,class_type,name,value,0) | |||
|
|||
def _swig_getattr(self,class_type,name): | |||
if (name == "thisown"): return self.this.own() | |||
method = class_type.__swig_getmethods__.get(name,None) | |||
if method: return method(self) | |||
raise AttributeError(name) | |||
|
|||
def _swig_repr(self): | |||
try: strthis = "proxy of " + self.this.__repr__() | |||
except: strthis = "" | |||
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) | |||
|
|||
try: | |||
_object = object | |||
_newclass = 1 | |||
except AttributeError: | |||
class _object : pass | |||
_newclass = 0 | |||
|
|||
|
|||
|
|||
def TFmdm_set_cosm(*args): | |||
return _power.TFmdm_set_cosm(*args) | |||
TFmdm_set_cosm = _power.TFmdm_set_cosm | |||
|
|||
def TFmdm_onek_mpc(*args): | |||
return _power.TFmdm_onek_mpc(*args) | |||
TFmdm_onek_mpc = _power.TFmdm_onek_mpc | |||
|
|||
def TFmdm_onek_hmpc(*args): | |||
return _power.TFmdm_onek_hmpc(*args) | |||
TFmdm_onek_hmpc = _power.TFmdm_onek_hmpc | |||
|
|||
cvar = _power.cvar | |||
|
Oops, something went wrong.