wums 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wums/Templates/index.php +131 -0
- wums/ioutils.py +4 -0
- wums/output_tools.py +7 -8
- wums/plot_tools.py +42 -0
- {wums-0.1.3.dist-info → wums-0.1.5.dist-info}/METADATA +1 -1
- wums-0.1.5.dist-info/RECORD +11 -0
- wums-0.1.3.dist-info/RECORD +0 -10
- {wums-0.1.3.dist-info → wums-0.1.5.dist-info}/WHEEL +0 -0
- {wums-0.1.3.dist-info → wums-0.1.5.dist-info}/top_level.txt +0 -0
wums/Templates/index.php
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title><?php echo getcwd(); ?></title>
|
|
4
|
+
<style type='text/css'>
|
|
5
|
+
body {
|
|
6
|
+
font-family: "Candara", sans-serif;
|
|
7
|
+
font-size: 9pt;
|
|
8
|
+
line-height: 10.5pt;
|
|
9
|
+
}
|
|
10
|
+
div.pic h3 {
|
|
11
|
+
font-size: 11pt;
|
|
12
|
+
margin: 0.5em 1em 0.2em 1em;
|
|
13
|
+
}
|
|
14
|
+
div.pic p {
|
|
15
|
+
font-size: 11pt;
|
|
16
|
+
margin: 0.2em 1em 0.1em 1em;
|
|
17
|
+
}
|
|
18
|
+
div.pic {
|
|
19
|
+
display: block;
|
|
20
|
+
float: left;
|
|
21
|
+
background-color: white;
|
|
22
|
+
border: 1px solid #ccc;
|
|
23
|
+
padding: 2px;
|
|
24
|
+
text-align: center;
|
|
25
|
+
margin: 2px 10px 10px 2px;
|
|
26
|
+
-moz-box-shadow: 7px 5px 5px rgb(80,80,80); /* Firefox 3.5 */
|
|
27
|
+
-webkit-box-shadow: 7px 5px 5px rgb(80,80,80); /* Chrome, Safari */
|
|
28
|
+
box-shadow: 7px 5px 5px rgb(80,80,80); /* New browsers */
|
|
29
|
+
width: 320px;
|
|
30
|
+
}
|
|
31
|
+
a { text-decoration: none; color: rgb(80,0,0); }
|
|
32
|
+
a:hover { text-decoration: underline; color: rgb(255,80,80); }
|
|
33
|
+
div.dirlinks h2 { margin-bottom: 4pt; margin-left: -24pt; color: rgb(80,0,0); }
|
|
34
|
+
div.dirlinks { margin: 0 24pt; }
|
|
35
|
+
div.dirlinks a {
|
|
36
|
+
font-size: 11pt; font-weight: bold;
|
|
37
|
+
padding: 0 0.5em;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
40
|
+
</head>
|
|
41
|
+
<body>
|
|
42
|
+
<h1><?php echo getcwd(); ?></h1>
|
|
43
|
+
<?php
|
|
44
|
+
$has_subs = true;
|
|
45
|
+
foreach (glob("*") as $filename) {
|
|
46
|
+
if (is_dir($filename) && !preg_match("/^\..*|.*private.*/", $filename)) {
|
|
47
|
+
$has_subs = true;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if ($has_subs) {
|
|
52
|
+
print "<div class=\"dirlinks\">\n";
|
|
53
|
+
print "<h2>Directories</h2>\n";
|
|
54
|
+
print "<a href=\"../\">[parent]</a> ";
|
|
55
|
+
foreach (glob("*") as $filename) {
|
|
56
|
+
if (is_dir($filename) && ($_SERVER['PHP_AUTH_USER'] == 'gpetrucc' || !preg_match("/^\..*|.*private.*/", $filename))) {
|
|
57
|
+
print " <a href=\"$filename\">[$filename]</a>";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
print "</div>";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
foreach (array("00_README.txt", "README.txt", "readme.txt") as $readme) {
|
|
64
|
+
if (file_exists($readme)) {
|
|
65
|
+
print "<pre class='readme'>\n"; readfile($readme); print "</pre>";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
?>
|
|
69
|
+
|
|
70
|
+
<h2><a name="plots">Plots</a></h2>
|
|
71
|
+
<p><form>Filter: <input type="text" name="match" size="30" value="<?php if (isset($_GET['match'])) print htmlspecialchars($_GET['match']); ?>" /><input type="Submit" value="Go" /><input type="checkbox" name="regexp" <?php if ($_GET['regexp']) print "checked=\"checked\""?> >RegExp</input></form></p>
|
|
72
|
+
<div>
|
|
73
|
+
<?php
|
|
74
|
+
$displayed = array();
|
|
75
|
+
if ($_GET['noplots']) {
|
|
76
|
+
print "Plots will not be displayed.\n";
|
|
77
|
+
} else {
|
|
78
|
+
$other_exts = array('.pdf', '.cxx', '.eps', '.root', '.txt', '.log', '.dir', '.info', '.latex', '.html');
|
|
79
|
+
$filenames = glob("*.png"); sort($filenames);
|
|
80
|
+
foreach ($filenames as $filename) {
|
|
81
|
+
if (isset($_GET['match'])) {
|
|
82
|
+
if (isset($_GET['regexp']) && $_GET['regexp']) {
|
|
83
|
+
if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue;
|
|
84
|
+
} else {
|
|
85
|
+
if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
array_push($displayed, $filename);
|
|
89
|
+
$brfname = str_replace("_","_­",$filename);
|
|
90
|
+
print "<div class='pic'>\n";
|
|
91
|
+
print "<h3><a href=\"$filename\">$brfname</a></h3>";
|
|
92
|
+
print "<a href=\"$filename\"><img src=\"$filename\" style=\"border: none; width: 300px; \"></a>";
|
|
93
|
+
$others = array();
|
|
94
|
+
foreach ($other_exts as $ex) {
|
|
95
|
+
$other_filename = str_replace('.png', $ex, $filename);
|
|
96
|
+
if (file_exists($other_filename)) {
|
|
97
|
+
array_push($others, "<a class=\"file\" href=\"$other_filename\">[" . $ex . "]</a>");
|
|
98
|
+
if ($ex != '.txt') array_push($displayed, $other_filename);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if ($others) print "<p>Also as ".implode(', ',$others)."</p>";
|
|
102
|
+
print "</div>";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
?>
|
|
106
|
+
</div>
|
|
107
|
+
<div style="display: block; clear:both;">
|
|
108
|
+
<h2><a name="files">Other files</a></h2>
|
|
109
|
+
<ul>
|
|
110
|
+
<?php
|
|
111
|
+
foreach (glob("*") as $filename) {
|
|
112
|
+
if ($_GET['noplots'] || !in_array($filename, $displayed)) {
|
|
113
|
+
if (isset($_GET['match'])) {
|
|
114
|
+
if (isset($_GET['regexp']) && $_GET['regexp']) {
|
|
115
|
+
if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue;
|
|
116
|
+
} else {
|
|
117
|
+
if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (is_dir($filename)) {
|
|
121
|
+
print "<li>[DIR] <a href=\"$filename\">$filename</a></li>";
|
|
122
|
+
} else {
|
|
123
|
+
print "<li><a href=\"$filename\">$filename</a></li>";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
?>
|
|
128
|
+
</ul>
|
|
129
|
+
</div>
|
|
130
|
+
</body>
|
|
131
|
+
</html>
|
wums/ioutils.py
CHANGED
wums/output_tools.py
CHANGED
|
@@ -5,6 +5,7 @@ import pathlib
|
|
|
5
5
|
import pickle
|
|
6
6
|
import re
|
|
7
7
|
import shutil
|
|
8
|
+
import importlib.resources as pkg_resources
|
|
8
9
|
import subprocess
|
|
9
10
|
import sys
|
|
10
11
|
import tempfile
|
|
@@ -185,19 +186,17 @@ def write_logfile(
|
|
|
185
186
|
logf.write(f"{k}: {v}\n")
|
|
186
187
|
|
|
187
188
|
|
|
188
|
-
def write_indexfile(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
):
|
|
193
|
-
shutil.copyfile(f"{template_dir}/{indexname}", f"{outpath}/index.php")
|
|
189
|
+
def write_indexfile(outpath, template_dir="Templates", indexname="index.php"):
|
|
190
|
+
with pkg_resources.files("wums").joinpath(f"{template_dir}/{indexname}").open("rb") as src:
|
|
191
|
+
with open(f"{outpath}/index.php", "wb") as dst:
|
|
192
|
+
shutil.copyfileobj(src, dst)
|
|
194
193
|
|
|
195
194
|
|
|
196
195
|
def write_index_and_log(
|
|
197
196
|
outpath,
|
|
198
197
|
logname,
|
|
199
|
-
template_dir=
|
|
200
|
-
analysis_meta_info=
|
|
198
|
+
template_dir="Templates",
|
|
199
|
+
analysis_meta_info={},
|
|
201
200
|
args={},
|
|
202
201
|
wd=f"{pathlib.Path(__file__).parent}/../",
|
|
203
202
|
):
|
wums/plot_tools.py
CHANGED
|
@@ -6,6 +6,7 @@ import shutil
|
|
|
6
6
|
import socket
|
|
7
7
|
import sys
|
|
8
8
|
import textwrap
|
|
9
|
+
import importlib
|
|
9
10
|
|
|
10
11
|
import hist
|
|
11
12
|
import matplotlib as mpl
|
|
@@ -1780,3 +1781,44 @@ def make_summary_plot(
|
|
|
1780
1781
|
ax1.xaxis.set_major_locator(ticker.LinearLocator(numticks=5))
|
|
1781
1782
|
|
|
1782
1783
|
return fig
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
def load_config(config_path):
|
|
1787
|
+
if config_path is None:
|
|
1788
|
+
return {}
|
|
1789
|
+
# load a python module
|
|
1790
|
+
spec = importlib.util.spec_from_file_location("config", config_path)
|
|
1791
|
+
config = importlib.util.module_from_spec(spec)
|
|
1792
|
+
spec.loader.exec_module(config)
|
|
1793
|
+
return config
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
def read_axis_label(x, labels, with_unit=True):
|
|
1797
|
+
if x in labels:
|
|
1798
|
+
label = labels[x]
|
|
1799
|
+
if isinstance(label, str):
|
|
1800
|
+
return label
|
|
1801
|
+
elif with_unit:
|
|
1802
|
+
return f'{label["label"]} ({label["unit"]})'
|
|
1803
|
+
else:
|
|
1804
|
+
return label["label"]
|
|
1805
|
+
else:
|
|
1806
|
+
return x
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
def get_axis_label(config, default_keys=None, label=None, is_bin=False):
|
|
1810
|
+
if label is not None:
|
|
1811
|
+
return label
|
|
1812
|
+
|
|
1813
|
+
if default_keys is None:
|
|
1814
|
+
return "Bin index"
|
|
1815
|
+
|
|
1816
|
+
labels = getattr(config, "axis_labels", {})
|
|
1817
|
+
|
|
1818
|
+
if len(default_keys) == 1:
|
|
1819
|
+
if is_bin:
|
|
1820
|
+
return f"{read_axis_label(default_keys[0], labels, False)} bin"
|
|
1821
|
+
else:
|
|
1822
|
+
return read_axis_label(default_keys[0], labels)
|
|
1823
|
+
else:
|
|
1824
|
+
return f"({', '.join([read_axis_label(a, labels, False) for a in default_keys])}) bin"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
wums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
wums/boostHistHelpers.py,sha256=F4SwQEVjNObFscfs0qrJEyOHYNKqUCmusW8HIF1o-0c,38993
|
|
3
|
+
wums/ioutils.py,sha256=ziyfQQ8CB3Ir2BJKJU3_a7YMF-Jd2nGXKoMQoJ2T8fo,12334
|
|
4
|
+
wums/logging.py,sha256=zNnLVJUwG3HMvr9NeXmiheX07VmsnSt8cQ6R4q4XBk4,4534
|
|
5
|
+
wums/output_tools.py,sha256=SHcZqXAdqL9AkA57UF0b-R-U4u7rzDgL8Def4E-ulW0,6713
|
|
6
|
+
wums/plot_tools.py,sha256=a-sf0gy2xNbcHUcUBUmjkY5lq2RBm6bia0CyyPP1UDI,53920
|
|
7
|
+
wums/Templates/index.php,sha256=9EYmfc0ltMqr5oOdA4_BVIHdSbef5aA0ORoRZBEADVw,4348
|
|
8
|
+
wums-0.1.5.dist-info/METADATA,sha256=S7OCqqlGWHYGf50hrqw8fx7NlWliCFv-rVjFW9ggpEc,843
|
|
9
|
+
wums-0.1.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
10
|
+
wums-0.1.5.dist-info/top_level.txt,sha256=DCE1TVg7ySraosR3kYZkLIZ2w1Pwk2pVTdkqx6E-yRY,5
|
|
11
|
+
wums-0.1.5.dist-info/RECORD,,
|
wums-0.1.3.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
wums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
wums/boostHistHelpers.py,sha256=F4SwQEVjNObFscfs0qrJEyOHYNKqUCmusW8HIF1o-0c,38993
|
|
3
|
-
wums/ioutils.py,sha256=1o4cNXeoOzk8Hy0RePjOdCqpvJi0gOp_aa7NYhjmIVM,12209
|
|
4
|
-
wums/logging.py,sha256=zNnLVJUwG3HMvr9NeXmiheX07VmsnSt8cQ6R4q4XBk4,4534
|
|
5
|
-
wums/output_tools.py,sha256=h4HyyIVoVyusl1Br-aIjkN_IS63kH0qqqgJvYUq_yD4,6641
|
|
6
|
-
wums/plot_tools.py,sha256=67ZwcjQRsIbMYvktpG9suj-1hkya-QSuFqiuXm_Zq58,52766
|
|
7
|
-
wums-0.1.3.dist-info/METADATA,sha256=FTOYgo_f82JuoUaNnkIco39PVkXuum63AD-CFRClFco,843
|
|
8
|
-
wums-0.1.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
-
wums-0.1.3.dist-info/top_level.txt,sha256=DCE1TVg7ySraosR3kYZkLIZ2w1Pwk2pVTdkqx6E-yRY,5
|
|
10
|
-
wums-0.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|