forked from sflis/SSM-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
105 lines (93 loc) · 2.76 KB
/
setup.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from setuptools import setup, find_packages
import os
import sys
from shutil import copyfile, rmtree
install_requires = [
"zmq",
"numpy",
"tables",
"pyparsing",
"matplotlib",
"pyyaml",
"click",
"nsb",
"SSDAQ",
"CHECLabPy",
"astropy",
"pynverse",
"ctapipe",
"hickle",
]
if not os.path.exists("tmps"):
os.makedirs("tmps")
copyfile("ssm/version.py", "tmps/version.py")
__import__("tmps.version")
package = sys.modules["tmps"]
package.version.update_release_version("ssm")
setup(
name="ssm",
version=package.version.get_version(pep440=True),
description="A framework to analyze and monitor slow signal data from the CHEC-S camera",
author="Samuel Flis",
author_email="samuel.flis@desy.de",
url="https://github.com/sflis/SSM-analysis",
packages=find_packages(),
provides=["ssm"],
license="GNU Lesser General Public License v3 or later",
install_requires=install_requires,
dependency_links=["https://github.com/cta-chec/SSDAQ/tarball/master#egg=ssdaq"],
extras_requires={
#'encryption': ['cryptography']
},
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Topic :: Software Development :: Libraries :: Python Modules",
],
entry_points={
"console_scripts": [
# 'ssdaq = ssdaq.bin.ssdaqd:main',
]
},
)
print("Downloading Hipparcos star catalog...")
if not os.path.exists("ssm/resources"):
os.makedirs("ssm/resources")
from urllib.error import URLError
from urllib.request import urlopen
def download_resource(url, path, name):
attempts = 0
success = False
while attempts < 3:
try:
response = urlopen(url, timeout=5)
content = response.read()
f = open(path, "wb")
f.write(content)
f.close()
success = True
break
except URLError as e:
attempts += 1
print(type(e))
if not success:
print(
"Failed to download {}. \n".format(name)
+ "Try later to download it manually from {}".format(url)
+ "\n and put it in ssm/resources"
)
download_resource(
"https://www.dropbox.com/s/ydziqcia6j6xm19/HipparcosCatalog_lt9.txt?raw=1",
"ssm/resources/HipparcosCatalog_lt9.txt",
"HipparcosCatalog_lt9",
)
download_resource(
"https://www.dropbox.com/s/7on3kmh58sz9j6w/testpix_m.hkl?raw=1",
"ssm/resources/testpix_m.hkl",
"test pixel response parametrization",
)
rmtree("tmps")