Python Camb Casarini Halofit
-
- Posts: 7
- Joined: February 03 2017
- Affiliation: The Ohio State University
Python Camb Casarini Halofit
I see that the latest update of the python camb wrapper adds halofit_casarini to the list of possible halofit versions. Setting w with set_dark_energy appears to change w0, but I cannot find a way to set wa. Is there a way to do this?
-
- Posts: 1951
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Python Camb Casarini Halofit
The "devel" branch (on CAMB's github) supports switching the dark energy model, e.g. using wa/=0 with ppf. (requires gfortran 6+)
-
- Posts: 7
- Joined: February 03 2017
- Affiliation: The Ohio State University
Python Camb Casarini Halofit
Okay I downloaded the devel branch and make runs okay, but I get following when I try to run from the pycamb directory:
I actually get the same error when I try to install from the master branch, but have no problems with the version from pypi. Do you know what is causing this?[/quote]
Code: Select all
pip install --egg .
Code: Select all
Running setup.py install for camb ... error
Complete output from command /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-KKwJ_N-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ftunUE-record/install-record.txt --compile:
running install
error: [Errno 2] No such file or directory: '/private/tmp/pip-KKwJ_N-build/fortran'
----------------------------------------
Command "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-KKwJ_N-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ftunUE-record/install-record.txt --compile" failed with error code 1 in /private/tmp/pip-KKwJ_N-build/
-
- Posts: 1951
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Python Camb Casarini Halofit
Not sure, try running setup.py directly?
-
- Posts: 7
- Joined: February 03 2017
- Affiliation: The Ohio State University
Python Camb Casarini Halofit
When I run I get this:
Code: Select all
python ./setup.py install
Code: Select all
running install
Compiling source...
mkdir -p Releaselib
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C Releaselib -f ../Makefile_main libcamb_recfast.a F90FLAGS="-shared -fPIC -O3 -fopenmp -MMD -cpp -ffree-line-length-none -fmax-errors=4"
make[1]: Circular precision.mod <- precision.mod dependency dropped.
make[1]: Circular recdata.mod <- recdata.mod dependency dropped.
make[1]: Circular recdata.mod <- recdata.mod dependency dropped.
make[1]: Circular recdata.mod <- recdata.mod dependency dropped.
make[1]: Circular recdata.mod <- recdata.mod dependency dropped.
make[1]: Circular recdata.mod <- recdata.mod dependency dropped.
make[1]: Circular redshiftspacedata.mod <- redshiftspacedata.mod dependency dropped.
make[1]: Circular modelparams.mod <- redshiftspacedata.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- redshiftspacedata.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- lvalues.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- redshiftspacedata.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- lvalues.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- massivenu.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- redshiftspacedata.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- lvalues.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- massivenu.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- modeldata.mod dependency dropped.
make[1]: Circular modeldata.mod <- modeldata.mod dependency dropped.
make[1]: Circular modeldata.mod <- modelparams.mod dependency dropped.
make[1]: Circular modeldata.mod <- massivenu.mod dependency dropped.
make[1]: Circular transfer.mod <- redshiftspacedata.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- lvalues.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- massivenu.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- modeldata.mod dependency dropped.
make[1]: Circular transfer.mod <- modeldata.mod dependency dropped.
make[1]: Circular transfer.mod <- modelparams.mod dependency dropped.
make[1]: Circular transfer.mod <- massivenu.mod dependency dropped.
make[1]: Circular transfer.mod <- transfer.mod dependency dropped.
make[1]: Circular massivenu.mod <- modelparams.mod dependency dropped.
make[1]: Circular massivenu.mod <- massivenu.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular lvalues.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular modelparams.mod <- modelparams.mod dependency dropped.
make[1]: Circular spherbessels.mod <- spherbessels.mod dependency dropped.
make[1]: Circular gaugeinterface.mod <- gaugeinterface.mod dependency dropped.
make[1]: Circular nonlinear.mod <- nonlinear.mod dependency dropped.
make[1]: Circular nonlinear.mod <- nonlinear.mod dependency dropped.
make[1]: `libcamb_recfast.a' is up to date.
gfortran -shared -fPIC -O3 -fopenmp -MMD -cpp -ffree-line-length-none -fmax-errors=4 -JReleaselib -IReleaselib/ -I/Users/mcdigman/Documents/hirata_research/forutils-master//Release/ \
camb_python.f90 Releaselib/libcamb_recfast.a -lstdc++ -L/Users/mcdigman/Documents/hirata_research/forutils-master//Release -lforutils -o pycamb/camb/camblib.so
Compilation failed
-
- Posts: 1951
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Python Camb Casarini Halofit
The silent error is not very helpful! Make sure you've downloaded a "forutils" directory with shared modules:
git clone --depth=1 https://github.com/cmbant/forutils.git forutils
(it looks as though you should have already built it into Users/mcdigman/Documents/hirata_research/forutils-master//Release/)
After doing that the automated Travis-CI test just runs tests/run_tests.sh which installs the package: it runs OK on the current devel head. Might also want to check you have an up to date gfortran.
git clone --depth=1 https://github.com/cmbant/forutils.git forutils
(it looks as though you should have already built it into Users/mcdigman/Documents/hirata_research/forutils-master//Release/)
After doing that the automated Travis-CI test just runs tests/run_tests.sh which installs the package: it runs OK on the current devel head. Might also want to check you have an up to date gfortran.
-
- Posts: 7
- Joined: February 03 2017
- Affiliation: The Ohio State University
Python Camb Casarini Halofit
It doesn't run. In case it was due to changes from the previous attempts, I changed the first part of the test file so it clones a completely clean version of everything camb related:
I get the same error message I included before, followed by
I have gfortran 6 installed:
I also tried switching to gfortran 7, which doesn't run either.
Code: Select all
git clone -b devel --depth=1 https://github.com/cmbant/CAMB.git camb
cd camb
git clone --depth=1 https://github.com/cmbant/forutils.git forutils
cd forutils
make Release
cd ..
make Release
Code: Select all
Compiling source...
Compilation failed
running test
running egg_info
creating camb.egg-info
writing camb.egg-info/PKG-INFO
writing top-level names to camb.egg-info/top_level.txt
writing dependency_links to camb.egg-info/dependency_links.txt
writing manifest file 'camb.egg-info/SOURCES.txt'
reading manifest file 'camb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.dll' found under directory 'camb'
warning: no previously-included files matching '*.dat' found under directory 'camb'
warning: no files found matching 'Makefile*' under directory 'fortran'
warning: no files found matching '*.dat' under directory 'fortran'
warning: no files found matching '*.?90' under directory 'fortran'
writing manifest file 'camb.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 124, in <module>
keywords=['cosmology', 'CAMB']
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/test.py", line 211, in run
self.run_tests()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/test.py", line 234, in run_tests
**exit_kwarg
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
Code: Select all
gfortran --version
GNU Fortran (MacPorts gcc6 6.3.0_1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- Posts: 1951
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Python Camb Casarini Halofit
setuptools installed? Only other difference I can see with the tests/run_tests.sh seems to be that you are using a Mac (can always run in CosmoBox VM instead).
-
- Posts: 13
- Joined: June 25 2013
- Affiliation: University of Melbourne
- Contact:
Python Camb Casarini Halofit
Hi there,
I was wondering whether there have been any updates on this issue.
I manage to compile the fortran CAMB-devel but when I try to install the python wrapper I get the same errors as Matthew.
FYI, I have fortran 6.3.0 installed as well as forutils and my OS is macOS Sierra 10.12.4.
Cheers!
I was wondering whether there have been any updates on this issue.
I manage to compile the fortran CAMB-devel but when I try to install the python wrapper I get the same errors as Matthew.
FYI, I have fortran 6.3.0 installed as well as forutils and my OS is macOS Sierra 10.12.4.
Cheers!
-
- Posts: 1951
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Python Camb Casarini Halofit
I can only refer to my previous message. If a Mac user could investigate and make a pull request with a fix that would be great (I use Windows).
Meanwhile, you could use CosmoBox.
Meanwhile, you could use CosmoBox.
-
- Posts: 13
- Joined: June 25 2013
- Affiliation: University of Melbourne
- Contact:
Python Camb Casarini Halofit
Hi Antony and thanks for your reply!
Just a quick update: I'm not sure as to why, but I was able to install the python wrapper for the CAMB-devel version by commenting out https://github.com/cmbant/CAMB/blob/dev ... py#L91-L92 in the setup.py file and rerunning the python setup.py install --user command (after compiling the source code of course), see the output below.
However, when I try to set wa to a value different from 0, i.e. pars.set_dark_energy(w=-1, wa=0.5, dark_energy_model='ppf'), https://github.com/cmbant/CAMB/blob/dev ... el.py#L480 throws the following error
Shouldn't lines 480-481 of the above files read as
Even if I change those lines, I get the following error
thrown by L484.
Am I missing something trivial and/or I'm doing something wrong?
Thanks again for the help!
Just a quick update: I'm not sure as to why, but I was able to install the python wrapper for the CAMB-devel version by commenting out https://github.com/cmbant/CAMB/blob/dev ... py#L91-L92 in the setup.py file and rerunning the python setup.py install --user command (after compiling the source code of course), see the output below.
However, when I try to set wa to a value different from 0, i.e. pars.set_dark_energy(w=-1, wa=0.5, dark_energy_model='ppf'), https://github.com/cmbant/CAMB/blob/dev ... el.py#L480 throws the following error
Code: Select all
CAMBError: fluid dark energy model does not support wa<>0
Code: Select all
if dark_energy_model == 'fluid' and wa:
raise CAMBError('fluid dark energy model does not support wa<>0')
Code: Select all
ValueError: 'ppf' is not in list
Am I missing something trivial and/or I'm doing something wrong?
Thanks again for the help!
Code: Select all
6400L-128763-M:pycamb fbianchini$ python setup.py install --user
running install
Compiling source...
chmod: Releaselib/camblib.so: No such file or directory
cp: Releaselib/camblib.so: No such file or directory
running build
running build_py
creating build
creating build/lib
creating build/lib/camb
copying camb/__init__.py -> build/lib/camb
copying camb/baseconfig.py -> build/lib/camb
copying camb/bbn.py -> build/lib/camb
copying camb/bispectrum.py -> build/lib/camb
copying camb/camb.py -> build/lib/camb
copying camb/constants.py -> build/lib/camb
copying camb/correlations.py -> build/lib/camb
copying camb/initialpower.py -> build/lib/camb
copying camb/lensing.py -> build/lib/camb
copying camb/model.py -> build/lib/camb
copying camb/nonlinear.py -> build/lib/camb
copying camb/recombination.py -> build/lib/camb
copying camb/reionization.py -> build/lib/camb
creating build/lib/camb_tests
copying camb_tests/__init__.py -> build/lib/camb_tests
copying camb_tests/camb_test.py -> build/lib/camb_tests
copying camb/camblib.so -> build/lib/camb
copying camb/HighLExtrapTemplate_lenspotentialCls.dat -> build/lib/camb
running install_lib
copying build/lib/camb/HighLExtrapTemplate_lenspotentialCls.dat -> /Users/fbianchini/.local/lib/python2.7/site-packages/camb
copying build/lib/camb/model.py -> /Users/fbianchini/.local/lib/python2.7/site-packages/camb
byte-compiling /Users/fbianchini/.local/lib/python2.7/site-packages/camb/model.py to model.pyc
running install_egg_info
running egg_info
writing camb.egg-info/PKG-INFO
writing top-level names to camb.egg-info/top_level.txt
writing dependency_links to camb.egg-info/dependency_links.txt
reading manifest file 'camb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.dll' found under directory 'camb'
warning: no files found matching 'Makefile*' under directory 'fortran'
warning: no files found matching '*.dat' under directory 'fortran'
warning: no files found matching '*.?90' under directory 'fortran'
writing manifest file 'camb.egg-info/SOURCES.txt'
removing '/Users/fbianchini/.local/lib/python2.7/site-packages/camb-0.1.4-py2.7.egg-info' (and everything under it)
Copying camb.egg-info to /Users/fbianchini/.local/lib/python2.7/site-packages/camb-0.1.4-py2.7.egg-info
Cleaning intermediate files...
-
- Posts: 1951
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Python Camb Casarini Halofit
Thanks, I fixed two typos preventing the ppf option from working, try it now?
The "Compilation failed" message was also a bug, since the file is already produced in the right directory in the devel branch.
The "Compilation failed" message was also a bug, since the file is already produced in the right directory in the devel branch.
-
- Posts: 13
- Joined: June 25 2013
- Affiliation: University of Melbourne
- Contact:
Python Camb Casarini Halofit
Perfect, I confirm that I could easily install the wrapper and now it works like a charm. I'll play with it a little bit more in the upcoming days.