読者です 読者をやめる 読者になる 読者になる

mac Pro 初期設定 Anaconda emcee corner PyGaia GSL

(1) Anaconda インストール
https://www.continuum.io/downloads

- Download the graphical installer
- Double-click the downloaded .pkg file and follow the instructions

これで全部完了。

(2) emcee

[事前準備]
[terminal]

デフォルト:
/bin/tcsh
を以下に変更:
/bin/bash


[.bashprofile]
.bash_profile に以下の行を付け加える:
_____
# Added by [my name] when managing the Python modules that can not be accessed.
export PYTHONPATH=$PYTHONPATH:/usr/local/anaconda/lib/python2.7/site-packages/
_____

[emcee]

$ git clone https://github.com/dfm/emcee.git
$ cd emcee
$ python setup.py install
. . .
Installed /Users/kh______/anaconda/lib/python2.7/site-packages/emcee-2.2.1-py2.7.egg
Processing dependencies for emcee==2.2.1
Searching for numpy==1.11.1
Best match: numpy 1.11.1
Adding numpy 1.11.1 to easy-install.pth file

Using /Users/kh______/anaconda/lib/python2.7/site-packages
Finished processing dependencies for emcee==2.2.1
ko__i:emcee kh______$ python -c 'import emcee'
Vendor: Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 30 days
Vendor: Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 30 days

と最後によくわからないメッセージが出るが気にしないでおく。


(3)corner.py


http://corner.readthedocs.io/en/latest/install.html#dependencies

$ git clone https://github.com/dfm/corner.py.git
$ cd corner.py
$ python setup.py install

テスト
$ nosetests corner
をしてみると、

. . .
======================================================================
FAIL: corner.tests.test_corner.test_tight.test
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/usr/local/anaconda/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 51, in failer
result = f(*args, **kwargs)
File "/usr/local/anaconda/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 196, in do_test
'(RMS %(rms).3f)'%err)
ImageComparisonFailure: images not close: /Users/kh______/corner.py/result_images/test_corner/tight.png vs. /Users/kh______/corner.py/result_images/test_corner/tight-expected.png (RMS 42.126)

======================================================================
FAIL: corner.tests.test_corner.test_titles1.test
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/usr/local/anaconda/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 51, in failer
result = f(*args, **kwargs)
File "/usr/local/anaconda/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 196, in do_test
'(RMS %(rms).3f)'%err)
ImageComparisonFailure: images not close: /Users/kh______/corner.py/result_images/test_corner/titles1.png vs. /Users/kh______/corner.py/result_images/test_corner/titles1-expected.png (RMS 13.492)

----------------------------------------------------------------------
Ran 36 tests in 19.327s

FAILED (failures=2)
. . .
などと言われるが、目で図を確認するとexpectedな図とほとんど完全に一致しているので問題はない模様。


(4) PyGaia

$ git clone https://github.com/agabrown/PyGaia.git

$ python setup.py install
. . .
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/PyGaia-1.1-py2.7.egg' and adding 'build/bdist.macosx-10.6-x86_64/egg' to it
removing 'build/bdist.macosx-10.6-x86_64/egg' (and everything under it)
Processing PyGaia-1.1-py2.7.egg
Copying PyGaia-1.1-py2.7.egg to /Users/kh______/anaconda/lib/python2.7/site-packages
Adding PyGaia 1.1 to easy-install.pth file

Installed /Users/kh______/anaconda/lib/python2.7/site-packages/PyGaia-1.1-py2.7.egg
Processing dependencies for PyGaia==1.1
Searching for scipy==0.18.1
Best match: scipy 0.18.1
Adding scipy 0.18.1 to easy-install.pth file

Using /Users/kh______/anaconda/lib/python2.7/site-packages
Searching for numpy==1.11.1
Best match: numpy 1.11.1
Adding numpy 1.11.1 to easy-install.pth file

Using /Users/kh______/anaconda/lib/python2.7/site-packages
Finished processing dependencies for PyGaia==1.1
. . .

どうやらversion 1.1らしい。


(5) GSLインストール

sudo が使えないためインストールできず。

download GSL-2.2.1
>>> linear fitting with large amount of data is now available!

$ cd gsl-2.2.1
$ ./configure
$ make
---ここまで---
$ sudo make install #sudo できず!!!

と思ったら、大学の初期設定でgslがインストールされていることが判明。
gcc -o bessel bessel.c -lgsl -lgslcblas -lm -L/opt/local/lib
のようにしてコンパイルが可能だった。これを
gcc -o bessel bessel.c -lgsl -lgslcblas -lm
のように簡略化するため、
".bash_profile"に下記のように加筆する。
# Added by [my name] when trying to set the gcc options (19 November 2016)
export LIBRARY_PATH=/opt/local/lib:$LIBRARY_PATH

----
gslに関する重要事項:

https://www.gnu.org/software/gsl/manual/html_node/Linking-programs-with-the-library.html#Linking-programs-with-the-library

The library is installed as a single file, libgsl.a.
とある。丹念に探すと、
Ko__i/opt/local/lib/libgsl.a
を発見。最初のKo__iは自分の大学のマシン名であるらしい。