-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from DynamicsAndNeuralSystems/jmoo2880-add-new…
…-spi-testing New benchmarking dataset and dependency updates
- Loading branch information
Showing
11 changed files
with
135 additions
and
71 deletions.
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
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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
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
Binary file not shown.
Binary file not shown.
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,50 @@ | ||
import pytest | ||
|
||
@pytest.fixture(scope="session") | ||
def spi_warning_logger(request): | ||
warnings_log = list() | ||
|
||
def add_warning(spi, module_name, max_z, num_exceed, num_iteractions): | ||
warnings_log.append((spi, module_name, max_z, num_exceed, num_iteractions)) | ||
|
||
request.session.spi_warnings = warnings_log | ||
return add_warning | ||
|
||
def pytest_sessionfinish(session, exitstatus): | ||
# retrieve the spi warnings from the session object | ||
spi_warnings = getattr(session, 'spi_warnings', []) | ||
|
||
# styling | ||
header_line = "=" * 80 | ||
content_line = "-" * 80 | ||
footer_line = "=" * 80 | ||
header = " SPI BENCHMARKING SUMMARY" | ||
footer = f" Session completed with exit status: {exitstatus} " | ||
padded_header = f"{header:^80}" | ||
padded_footer = f"{footer:^80}" | ||
|
||
print("\n") | ||
print(header_line) | ||
print(padded_header) | ||
print(header_line) | ||
|
||
# print problematic SPIs in table format | ||
if spi_warnings: | ||
print(f"\nDetected {len(spi_warnings)} SPI(s) with outputs exceeding the specified 2 sigma threshold.\n") | ||
|
||
# table header | ||
print(f"{'SPI':<25}{'Cat':<10}{'Max ZSc.':>10}{'# Exceed. Pairs':>20}{'Unq. Pairs':>15}") | ||
print(content_line) | ||
|
||
# table content | ||
for est, module_name, max_z, num_exceed, num_iteractions in spi_warnings: | ||
# add special character for v.large zscores | ||
error = "" | ||
if max_z > 10: | ||
error = " **" | ||
print(f"{est+error:<25}{module_name:<10}{max_z:>10.4g}{num_exceed:>15}{num_iteractions:>20}") | ||
else: | ||
print("\n\nNo SPIs exceeded the sigma threshold.\n") | ||
|
||
print(footer_line) | ||
print(padded_footer) |
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