-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprintinfo.py
71 lines (57 loc) · 2.06 KB
/
printinfo.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
"""
Utility to print date, time, and version information.
Adjusted from https://github.com/empymod/example-notebooks, which in turn was
heavily inspired by:
- ipynbtools.py from qutip https://github.com/qutip
- watermark.py from https://github.com/rasbt/watermark
"""
import sys
import time
import platform
import multiprocessing
import numpy
import scipy
import IPython
import SimPEG
import empymod
import matplotlib
from IPython.display import HTML
def info():
"""Print date and version information as a html-table."""
# Define styles
style1 = " style='border: 2px solid #fff; text-align: left;'"
style2 = " style='background-color: #ccc;"
style2 += "width: 10%; border: 2px solid #fff;'"
# Print date and time info as title
html = "<h3>%s</h3>" % time.strftime('%a %b %d %H:%M:%S %Y %Z')
# Start table
html += '<table>'
# empymod, OS, threads, IPython
html += "<tr" + style1 + ">"
html += "<td" + style2 + ">%s</td>" % empymod.__version__
html += "<td" + style1 + ">empymod</td>"
html += "<td" + style2 + ">%s</td>" % numpy.__version__
html += "<td" + style1 + ">numpy</td>"
html += "<td" + style2 + ">%s</td>" % platform.system()
html += "<td" + style1 + ">OS</td>"
html += "<td" + style2 + ">%s</td>" % IPython.__version__
html += "<td" + style1 + ">IPython</td>"
html += "</tr>"
# numpy, scipy, matplotlib
html += "<tr" + style1 + ">"
html += "<td" + style2 + ">%s</td>" % SimPEG.__version__
html += "<td" + style1 + ">SimPEG</td>"
html += "<td" + style2 + ">%s</td>" % scipy.__version__
html += "<td" + style1 + ">scipy</td>"
html += "<td" + style2 + ">%s</td>" % multiprocessing.cpu_count()
html += "<td" + style1 + ">CPU(s)</td>"
html += "<td" + style2 + ">%s</td>" % matplotlib.__version__
html += "<td" + style1 + ">matplotlib</td>"
html += "</tr>"
# sys.version
html += "<tr" + style1 + ">"
html += "<td" + style1 + " colspan='8'>%s</td>" % sys.version
html += "</tr>"
# Finish table
html += "</table>"
return HTML(html)