CosmoCoffee Forum Index CosmoCoffee

 
 FAQFAQ   SearchSearch  MemberlistSmartFeed   MemberlistMemberlist    RegisterRegister 
   ProfileProfile   Log inLog in 
Arxiv New Filter | Bookmarks & clubs | Arxiv ref/author:

Python Camb Casarini Halofit
 
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Matthew Digman



Joined: 03 Feb 2017
Posts: 4
Affiliation: The Ohio State University

PostPosted: February 03 2017  Reply with quote

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?
Back to top
View user's profile [ Hidden ]
Antony Lewis



Joined: 23 Sep 2004
Posts: 1206
Affiliation: University of Sussex

PostPosted: February 03 2017  Reply with quote

The "devel" branch (on CAMB's github) supports switching the dark energy model, e.g. using wa/=0 with ppf. (requires gfortran 6+)
Back to top
View user's profile [ Hidden ] Visit poster's website
Matthew Digman



Joined: 03 Feb 2017
Posts: 4
Affiliation: The Ohio State University

PostPosted: February 04 2017  Reply with quote

Okay I downloaded the devel branch and make runs okay, but I get following when I try to run
Code:
pip install --egg .
from the pycamb directory:

Code:
  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/


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]
Back to top
View user's profile [ Hidden ]
Antony Lewis



Joined: 23 Sep 2004
Posts: 1206
Affiliation: University of Sussex

PostPosted: February 04 2017  Reply with quote

Not sure, try running setup.py directly?
Back to top
View user's profile [ Hidden ] Visit poster's website
Matthew Digman



Joined: 03 Feb 2017
Posts: 4
Affiliation: The Ohio State University

PostPosted: February 06 2017  Reply with quote

When I run
Code:
python ./setup.py install
I get this:

Code:
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
Back to top
View user's profile [ Hidden ]
Antony Lewis



Joined: 23 Sep 2004
Posts: 1206
Affiliation: University of Sussex

PostPosted: February 06 2017  Reply with quote

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Matthew Digman



Joined: 03 Feb 2017
Posts: 4
Affiliation: The Ohio State University

PostPosted: February 07 2017  Reply with quote

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:
Code:
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


I get the same error message I included before, followed by

Code:
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)


I have gfortran 6 installed:

Code:
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.


I also tried switching to gfortran 7, which doesn't run either.
Back to top
View user's profile [ Hidden ]
Antony Lewis



Joined: 23 Sep 2004
Posts: 1206
Affiliation: University of Sussex

PostPosted: February 07 2017  Reply with quote

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).
Back to top
View user's profile [ Hidden ] Visit poster's website
Federico Bianchini



Joined: 25 Jun 2013
Posts: 3
Affiliation: University of Melbourne

PostPosted: April 14 2017  Reply with quote

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!
Back to top
View user's profile   Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1206
Affiliation: University of Sussex

PostPosted: April 14 2017  Reply with quote

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Federico Bianchini



Joined: 25 Jun 2013
Posts: 3
Affiliation: University of Melbourne

PostPosted: April 15 2017  Reply with quote

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/devel/pycamb/setup.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/devel/pycamb/camb/model.py#L480 throws the following error
Code:

CAMBError: fluid dark energy model does not support wa<>0

Shouldn't lines 480−481 of the above files read as
Code:

if dark_energy_model == 'fluid' and wa:
    raise CAMBError('fluid dark energy model does not support wa<>0')

Even if I change those lines, I get the following error
Code:

ValueError: 'ppf' is not in list

thrown by L484.
Am I missing something trivial and/or I'm doing something wrong?

Thanks again for the help!

Code:

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...
Back to top
View user's profile   Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1206
Affiliation: University of Sussex

PostPosted: April 18 2017  Reply with quote

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Federico Bianchini



Joined: 25 Jun 2013
Posts: 3
Affiliation: University of Melbourne

PostPosted: April 20 2017  Reply with quote

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.
Back to top
View user's profile   Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software All times are GMT + 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group. Sponsored by WordWeb online dictionary and dictionary software.