Skip to content

Commit afcb1c4

Browse files
authored
Merge pull request #2 from eswar3/py2to3
Py2to3
2 parents e434802 + c327a90 commit afcb1c4

File tree

5 files changed

+178
-65
lines changed

5 files changed

+178
-65
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
linearcorex/__pycache__/
2+
big5

Changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## March 25 - 2019
2+
3+
Changes in vis_corex.py
4+
5+
1. codebase Python 2 to Python 3 migration `
6+
7+
2. DeprecationWarning: 'U' mode is deprecated
8+
9+
10+
* Before: `with open(filename, 'rU') as csvfile:`
11+
* After: `with open(filename, 'r') as csvfile:`
12+
13+
14+
Changes in readme.md
15+
16+
3. added `graphviz` installation instructions for Ubuntu users
17+
18+
4. added `requirements.txt` which lets users to install all the dependencies with a single command `conda install --yes --file requirements.txt`

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,44 @@ The connections with the idea of "synergy" will be described in future work.
6767

6868

6969
### Troubleshooting visualization
70+
For Mac users:
71+
7072
To get the visualization of the hierarchy looking nice sometimes takes a little effort. To get graphs to compile correctly do the following.
7173
Using "brew" to install, you need to do "brew install gts" followed by "brew install --with-gts graphviz".
72-
The (hacky) way that the visualizations are produced is the following. The code, vis_corex.py, produces a text file called "graphs/graph.dot". This just encodes the edges between nodes in dot format. Then, the code calls a command line utility called sfdp that is part of graphviz, "sfdp graph.dot -Tpdf -Earrowhead=none -Nfontsize=12 -GK=2 -Gmaxiter=1000 -Goverlap=False -Gpack=True -Gpackmode=clust -Gsep=0.01 -Gsplines=False -o graph_sfdp.pdf".
74+
The (hacky) way that the visualizations are produced is the following. The code, vis_corex.py, produces a text file called "graphs/graph.dot". This just encodes the edges between nodes in dot format. Then, the code calls a command line utility called sfdp that is part of graphviz,
75+
76+
```
77+
sfdp graph.dot -Tpdf -Earrowhead=none -Nfontsize=12 -GK=2 -Gmaxiter=1000 -Goverlap=False -Gpack=True -Gpackmode=clust -Gsep=0.01 -Gsplines=False -o graph_sfdp.pdf
78+
```
79+
7380
These dot files can also be opened with OmniGraffle if you would like to be able to manipulate them by hand.
74-
If you want, you can try to recompile graphs yourself with different options to make them look nicer. Or you can edit the dot files to get effects like colored nodes, etc.
81+
If you want, you can try to recompile graphs yourself with different options to make them look nicer. Or you can edit the dot files to get effects like colored nodes, etc.
82+
83+
For Ubuntu users:
84+
85+
Credits: https://gitlab.com/graphviz/graphviz/issues/1237
86+
87+
1. Remove any existing installation with `conda uninstall graphviz`. (If you did not install with Conda, you might need to do `sudo apt purge graphviz` and/or `pip uninstall graphviz`).
88+
89+
2. run `sudo apt install libgts-dev`
90+
91+
3. run `sudo pkg-config --libs gts`
92+
93+
4. run `sudo pkg-config --cflags gts`
94+
95+
5. Download `graphviz-2.40.1.tar.gz` from [here](https://graphviz.gitlab.io/pub/graphviz/stable/SOURCES/graphviz.tar.gz)
96+
97+
6. Navigate to directory containing download, and extract with `tar -xvf graphviz-2.40.1.tar.gz` (or newer whatever the download is named.)
98+
99+
7. `cd` into extracted folder (ie `cd graphviz-2.40.1`) and run `sudo ./configure --with-gts`
100+
101+
8. Run `sudo make` in the folder
102+
103+
9. Run `sudo make install` in the folder
104+
105+
10. Reinstall library using `pip install graphviz`
106+
107+
75108

76109

77110

requirements.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This file may be used to create an environment using the following command:
2+
# $ conda create --name <env> --file <this file>
3+
# platform: linux-64
4+
blas=1.0=mkl
5+
ca-certificates=2019.1.23=0
6+
certifi=2019.3.9=py37_0
7+
cycler=0.10.0=py37_0
8+
dbus=1.13.6=h746ee38_0
9+
decorator=4.3.2=py37_0
10+
expat=2.2.6=he6710b0_0
11+
fontconfig=2.13.0=h9420a91_0
12+
freetype=2.9.1=h8a8886c_1
13+
glib=2.56.2=hd408876_0
14+
gst-plugins-base=1.14.0=hbbd80ab_1
15+
gstreamer=1.14.0=hb453b48_1
16+
icu=58.2=h9c2bf20_1
17+
intel-openmp=2019.1=144
18+
jpeg=9b=h024ee3a_2
19+
kiwisolver=1.0.1=py37hf484d3e_0
20+
libedit=3.1.20181209=hc058e9b_0
21+
libffi=3.2.1=hd88cf55_4
22+
libgcc-ng=8.2.0=hdf63c60_1
23+
libgfortran-ng=7.3.0=hdf63c60_0
24+
libpng=1.6.36=hbc83047_0
25+
libstdcxx-ng=8.2.0=hdf63c60_1
26+
libuuid=1.0.3=h1bed415_2
27+
libxcb=1.13=h1bed415_1
28+
libxml2=2.9.9=he19cac6_0
29+
matplotlib=3.0.3=py37h5429711_0
30+
mkl=2019.1=144
31+
mkl_fft=1.0.10=py37ha843d7b_0
32+
mkl_random=1.0.2=py37hd81dba3_0
33+
ncurses=6.1=he6710b0_1
34+
networkx=2.2=py37_1
35+
numpy=1.16.2=py37h7e9f1db_0
36+
numpy-base=1.16.2=py37hde5b4d6_0
37+
openssl=1.1.1b=h7b6447c_1
38+
pandas=0.24.2=py37he6710b0_0
39+
patsy=0.5.1=py37_0
40+
pcre=8.43=he6710b0_0
41+
pip=19.0.3=py37_0
42+
pyparsing=2.3.1=py37_0
43+
pyqt=5.9.2=py37h05f1152_2
44+
python=3.7.2=h0371630_0
45+
python-dateutil=2.8.0=py37_0
46+
pytz=2018.9=py37_0
47+
qt=5.9.7=h5867ecd_1
48+
readline=7.0=h7b6447c_5
49+
scipy=1.2.1=py37h7c811a0_0
50+
seaborn=0.9.0=py37_0
51+
setuptools=40.8.0=py37_0
52+
sip=4.19.8=py37hf484d3e_0
53+
six=1.12.0=py37_0
54+
sqlite=3.27.2=h7b6447c_0
55+
statsmodels=0.9.0=py37h035aef0_0
56+
tk=8.6.8=hbc83047_0
57+
tornado=6.0.1=py37h7b6447c_0
58+
wheel=0.33.1=py37_0
59+
xz=5.2.4=h14c3975_4
60+
zlib=1.2.11=h7b6447c_3

0 commit comments

Comments
 (0)