Skip to content

Commit 5c3dcf1

Browse files
Jason LeakeJason Leake
Jason Leake
authored and
Jason Leake
committed
Add BSD licence
1 parent 6b63ce0 commit 5c3dcf1

File tree

1 file changed

+38
-22
lines changed

1 file changed

+38
-22
lines changed

Diff for: ax3_crunch.py

+38-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
#!/usr/bin/env python3
2+
# coding=UTF-8
3+
#
4+
# BSD 2-Clause License
5+
#
6+
# Copyright (c) 2019, Jason Leake
7+
# All rights reserved.
8+
#
9+
# Redistribution and use in source and binary forms, with or without
10+
# modification, are permitted provided that the following conditions are met:
11+
#
12+
# 1. Redistributions of source code must retain the above copyright notice, this
13+
# list of conditions and the following disclaimer.
14+
#
15+
# 2. Redistributions in binary form must reproduce the above copyright notice,
16+
# this list of conditions and the following disclaimer in the documentation
17+
# and/or other materials provided with the distribution.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
#
230

331
#
432
# Process one CWA file. The file is specified on the command line:
@@ -60,27 +88,13 @@ def process(file, configFile):
6088
for splitFile in splitFiles:
6189
datafile, nonBaselinedFile, baselinedFile = ax3_stats.stats(splitFile)
6290

63-
# Get the file titles from ax3_plot_minutes.py directly, later
64-
plotType = [ "mean_x",
65-
"peak_to_peak_x",
66-
"rms_x",
67-
"std_dev_x",
68-
"mean_y",
69-
"peak_to_peak_y",
70-
"rms_y",
71-
"std_dev_y",
72-
"mean_z",
73-
"peak_to_peak_z",
74-
"rms_z",
75-
"std_dev_z",
76-
"mean_total",
77-
"peak_to_peak_total",
78-
"rms_total",
79-
"std_dev_total"]
80-
81-
for thisPlot in plotType:
91+
plotMinutes = ax3_plot_minutes.PlotMinutes()
92+
for thisPlot in plotMinutes.fileTitles():
93+
if len(thisPlot) == 0:
94+
continue
95+
8296
if getb(config, thisPlot, "ax3_plot_minutes"):
83-
plotMinutes = ax3_plot_minutes.PlotMinutes()
97+
8498

8599
bcontrolfile = get(config, thisPlot, "bcontrolfile")
86100
nbcontrolfile = get(config, thisPlot, "nbcontrolfile")
@@ -116,7 +130,9 @@ def main():
116130
parser = argparse.ArgumentParser(description=
117131
"Processing chain for ax3_... scripts")
118132
parser.add_argument("filename", help="Input filename")
119-
parser.add_argument("--controlfile", nargs="?", help="INI file to control plotting", default="crunch_default.ini")
133+
parser.add_argument("--controlfile", nargs="?",
134+
help="INI file to control plotting",
135+
default="crunch_default.ini")
120136
args = parser.parse_args()
121137
filePath = args.filename
122138
controlFile = args.controlfile
@@ -131,7 +147,7 @@ def main():
131147
elapsed = time.time();
132148
process(filePath, controlFile)
133149
elapsed = time.time() - elapsed
134-
print(f"Elapsed time {elapsed} seconds")
150+
print(f"Elapsed time {int(round(elapsed))} seconds")
135151

136152
if __name__ == "__main__":
137153
main()

0 commit comments

Comments
 (0)