-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautosetup.sh
executable file
·71 lines (61 loc) · 1.65 KB
/
autosetup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
if [ "$#" -ne 1 ]; then
echo "Choose your OS: {linux|macos}"
echo " e.g. $> bash autosetup.sh linux"
fi
mydir=`pwd`
dl1dh_ver="v0.7.2"
ctlearn_ver="v0.3.0"
data_web="http://sagan.gae.ucm.es/~nieto/tmp2/ctlearn-aswg19/"
#Create and activate conda environment
if [[ $1 == "linux" ]]; then
conda env create -f environment-linux.yml
data_file="data-linux.tgz"
elif [[ $1 == "macos" ]]; then
conda env create -f environment-macos.yml
data_file="data-macos.tgz"
else
echo "Supported OS: linux, macos"
exit
fi
source activate ctlearn-aswg19
#Create some useful folders
mkdir -p $mydir"/logs"
mkdir -p $mydir"/code"
cd $mydir"/code"
#Install dl1-data-handler (only under linux)
if [[ $1 == "linux" ]]; then
if [ ! -d $mydir"/code/dl1-data-handler" ]; then
git clone https://github.com/cta-observatory/dl1-data-handler.git
fi
cd $mydir"/code/dl1-data-handler"
git pull
git checkout $dl1dh_ver
pip install --upgrade .
cd $mydir"/code"
fi
#Install ctlearn
if [ ! -d $mydir"/code/ctlearn" ]; then
git clone https://github.com/ctlearn-project/ctlearn.git
fi
cd $mydir"/code/ctlearn"
git pull
git checkout $ctlearn_ver
pip install --upgrade .
#Download sample data
mkdir -p $mydir/data
cd $mydir/data/
if [ ! -e $mydir/data/$data_file ]; then
wget $data_web/$data_file
fi
tar -xvzf $mydir/data/$data_file
cd $mydir
#Generate ctlearn files list
ls $mydir/data/ctlearn/*h5 > $mydir/data/ctlearn/ctlearn_input.txt
#Check versions
echo " "
echo "Checking installed version(s)"
if [[ $1 == "linux" ]]; then
echo "dl1-data-handler: "`conda list|grep 'dl1-data-handler'`
fi
echo "ctlearn: "`conda list|grep 'ctlearn'`
echo "Done"