-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add extremely simple regression testing script
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
*.out.* | ||
*.lisp | ||
*.org | ||
*.py | ||
# *.py | ||
*.json | ||
/.gdb_history | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Script to check performance on images in given folder and prevent regression testing | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zeddie888
Author
Collaborator
|
||
# Go over all images in some folder and check performance, log it to stdout (for now) | ||
# TODO: figure out some storage plan | ||
|
||
# CLI: | ||
# test directory name, output log name | ||
# (optional) attitude estimator | ||
|
||
import subprocess | ||
import argparse | ||
import os | ||
import datetime | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("test_dir", type=str) | ||
parser.add_argument("log", type=str, default="log.txt") | ||
parser.add_argument("-att_estimator", type=str, nargs="?", default="dqm") | ||
args = parser.parse_args() | ||
|
||
print(f"Testing images in {args.test_dir}") | ||
print(f"attitude estimator: {args.att_estimator}") | ||
print(f"Logging outputs to {args.log}") | ||
|
||
|
||
def get_diff(expected, actual): | ||
"""Get element-wise angle difference between expected and actual (what we got)""" | ||
return [expected[i] - actual[i] for i in range(len(actual))] | ||
|
||
|
||
output_log = open(args.log, "a+") # append to end of log, don't overwrite | ||
for img_name in os.listdir(args.test_dir): | ||
cmd = ( | ||
f"./lost pipeline \ | ||
--png {img_name} \ | ||
--fov 17 \ | ||
--centroid-algo cog \ | ||
--centroid-filter-brightest 6 \ | ||
--star-id-algo tetra \ | ||
--database tetra-algo-12.dat \ | ||
--false-stars 0 \ | ||
--attitude-algo {args.att_estimator} \ | ||
--print-attitude attitude.txt \ | ||
--plot-output annotated-res.png", | ||
) | ||
subprocess.call(cmd, shell=True) | ||
# log attitude.txt | ||
# Log: | ||
# which image was tested | ||
# Output from attitude.txt | ||
dt = datetime.datetime.now().isoformat() | ||
output_log.write("----------------------------\n") | ||
output_log.write(f"{img_name}-{dt}-{args.att_estimator}\n") | ||
output_log.write("----------------------------\n") | ||
with open("attitude.txt") as att_log: | ||
targets = ["attitude_ra", "attitude_de", "attitude_roll"] | ||
for line in att_log: | ||
line = line.split(" ") | ||
if line[0] in targets: | ||
output_log.write(line[1]) | ||
|
||
output_log.close() |
regressions are prevented by regression testing
regression testing is prevented by regression testing testing
so this is a regression testing test
cf wikipedia
In all seriousness stuff like this is fine for testing for oresat delivery but the long-term way to do this kind of testing would be to add a new comparator to the core that's able to read expected attitudes from a file.