jupyter notebook をスクリプトにする
$ jupyter nbconvert something.ipynb --to script
[NbConvertApp] Converting notebook something.ipynb to script
[NbConvertApp] Writing 50748 bytes to something.py
これでPython scriptができる。
Installing haply
Binary installation with conda (RECOMMENDED)
$ conda config --add channels conda-forge
$ conda install healpy
Python matplotlib figure size
matplotlib におけるサイズ(inch, dpi)を調べる方法。
fig = pyplot.gcf()
size = fig.get_size_inches()*fig.dpi
print(fig.dpi)
print(fig.get_size_inches())
---
72.0
[ 6. 4.]
++++++
逆にこれらを設定したいときは
pyplot.rcParams['figure.dpi'] = 72 #80 -default
pyplot.rcParams['savefig.dpi'] = 72 #80 -default
pyplot.rcParams['figure.figsize'] = [6,4] # [8.0, 6.0] -default
のようにする。
情報理論
情報理論(エントロピーなど)の有益な講義資料 -- by 井上 純一 先生
https://ocw.hokudai.ac.jp/wp-content/uploads/2016/01/InformationTheory-2005-Note-11.pdf
https://ocw.hokudai.ac.jp/wp-content/uploads/2016/01/InformationTheory-2005-Note-12.pdf
非常にまとまっているので大変勉強になる。
symbolic linkをはる
$ ps2pdf 20171123_paper.ps
dyld: Library not loaded: /opt/local/lib/libgs.9.22.dylib
Referenced from: /opt/local/bin/gs
Reason: image not found
Abort trap: 6
と突然ライブラリが使えなくなった。調べると、ライブラリがアップデートされている。
$ ls -l /opt/local/lib/libgs.*
-rwxr-xr-x 1 root wheel 11779832 Mar 26 00:29 /opt/local/lib/libgs.9.23.dylib*
lrwxr-xr-x 1 root wheel 16 Mar 26 00:29 /opt/local/lib/libgs.9.dylib@ -> libgs.9.23.dylib
lrwxr-xr-x 1 root wheel 16 Mar 26 00:29 /opt/local/lib/libgs.dylib@ -> libgs.9.23.dylib
そこで、シンボリック・リンクをはる。
$ sudo ln -s /opt/local/lib/libgs.9.23.dylib /opt/local/lib/libgs.9.22.dylib
$ ls -l /opt/local/lib/libgs.*
lrwxr-xr-x 1 root wheel 31 Mar 26 01:23 /opt/local/lib/libgs.9.22.dylib@ -> /opt/local/lib/libgs.9.23.dylib
-rwxr-xr-x 1 root wheel 11779832 Mar 26 00:29 /opt/local/lib/libgs.9.23.dylib*
lrwxr-xr-x 1 root wheel 16 Mar 26 00:29 /opt/local/lib/libgs.9.dylib@ -> libgs.9.23.dylib
lrwxr-xr-x 1 root wheel 16 Mar 26 00:29 /opt/local/lib/libgs.dylib@ -> libgs.9.23.dylib
tensorflow installation
Following
https://www.tensorflow.org/install/install_mac
and some advice on pip written at
https://github.com/certbot/certbot/issues/2850
I installed tensorflow:
$ pip uninstall virtualenv
$ conda install virtualenv
Here I use " ~/tensorflow" as the target directory.
$ virtualenv --system-site-packages ~/tensorflow
$ cd ~/tensorflow
$ source ./bin/activate
(tensorflow) kohei:tensorflow khattori$
(tensorflow) kohei:tensorflow khattori$ easy_install -U pip
(tensorflow) kohei:tensorflow khattori$ pip install --upgrade tensorflow
(tensorflow) kohei:tensorflow khattori$
schwimmbad インストール
$ conda install -c conda-forge schwimmbad
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.8
latest version: 4.4.10
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: /Users/_my_user_name_/anaconda
added / updated specs:
- schwimmbad
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2018.1.18 | py27_0 143 KB conda-forge
schwimmbad-0.2.1 | py27_0 15 KB conda-forge
openssl-1.0.2n | 0 3.3 MB conda-forge
ca-certificates-2018.1.18 | 0 141 KB conda-forge
conda-4.3.34 | py27_0 507 KB conda-forge
------------------------------------------------------------
Total: 4.1 MB
The following NEW packages will be INSTALLED:
ca-certificates: 2018.1.18-0 conda-forge
schwimmbad: 0.2.1-py27_0 conda-forge
The following packages will be UPDATED:
certifi: 2017.11.5-py27_0 conda-forge --> 2018.1.18-py27_0 conda-forge
openssl: 1.0.2j-0 --> 1.0.2n-0 conda-forge
The following packages will be DOWNGRADED:
conda: 4.4.8-py27_0 anaconda --> 4.3.34-py27_0 conda-forge
Proceed ([y]/n)? y
Downloading and Extracting Packages
certifi 2018.1.18: ################################################################################################ | 100%
schwimmbad 0.2.1: ################################################################################################# | 100%
openssl 1.0.2n: ################################################################################################### | 100%
ca-certificates 2018.1.18: ######################################################################################## | 100%
conda 4.3.34: ##################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done