Refactoring and minor improvents.
This commit is contained in:
@@ -4,7 +4,6 @@ import yaml
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import json
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
from src.audio_tests import run_artifact_detection_test
|
||||
@@ -111,6 +110,14 @@ def main():
|
||||
for artifact_type, count in result['channel_1_loopback']['artifacts_by_type'].items():
|
||||
print(f" - {artifact_type}: {count}")
|
||||
|
||||
# Display frequency accuracy for channel 1
|
||||
if 'frequency_accuracy' in result['channel_1_loopback']:
|
||||
freq_acc = result['channel_1_loopback']['frequency_accuracy']
|
||||
print(f" Frequency Accuracy:")
|
||||
print(f" Expected: {freq_acc['expected_freq_hz']:.1f} Hz")
|
||||
print(f" Measured: {freq_acc['measured_freq_hz']:.2f} Hz")
|
||||
print(f" Error: {freq_acc['error_hz']:+.2f} Hz ({freq_acc['error_percent']:+.3f}%)")
|
||||
|
||||
print("\n📻 CHANNEL 2 (DUT/RADIO PATH):")
|
||||
print(f" Total Artifacts: {result['channel_2_dut']['total_artifacts']}")
|
||||
print(f" Artifact Rate: {result['channel_2_dut']['artifact_rate_per_minute']:.2f} per minute")
|
||||
@@ -119,6 +126,14 @@ def main():
|
||||
for artifact_type, count in result['channel_2_dut']['artifacts_by_type'].items():
|
||||
print(f" - {artifact_type}: {count}")
|
||||
|
||||
# Display frequency accuracy for channel 2
|
||||
if 'frequency_accuracy' in result['channel_2_dut']:
|
||||
freq_acc = result['channel_2_dut']['frequency_accuracy']
|
||||
print(f" Frequency Accuracy:")
|
||||
print(f" Expected: {freq_acc['expected_freq_hz']:.1f} Hz")
|
||||
print(f" Measured: {freq_acc['measured_freq_hz']:.2f} Hz")
|
||||
print(f" Error: {freq_acc['error_hz']:+.2f} Hz ({freq_acc['error_percent']:+.3f}%)")
|
||||
|
||||
ch1_count = result['channel_1_loopback']['total_artifacts']
|
||||
ch2_count = result['channel_2_dut']['total_artifacts']
|
||||
|
||||
@@ -151,18 +166,13 @@ def main():
|
||||
'artifact_detection_result': result
|
||||
}
|
||||
|
||||
output_file = results_dir / f"{test_id}_artifact_detection_results.yaml"
|
||||
output_file = test_output_dir / f"{test_id}_artifact_detection_results.yaml"
|
||||
with open(output_file, 'w') as f:
|
||||
yaml.dump(output_data, f, default_flow_style=False, sort_keys=False)
|
||||
|
||||
json_output_file = results_dir / f"{test_id}_artifact_detection_results.json"
|
||||
with open(json_output_file, 'w') as f:
|
||||
json.dump(output_data, f, indent=2)
|
||||
|
||||
print("\n" + "=" * 70)
|
||||
print("✅ Results saved to:")
|
||||
print(f" YAML: {output_file}")
|
||||
print(f" JSON: {json_output_file}")
|
||||
if save_plots:
|
||||
print(f" Summary plots: {test_output_dir}/")
|
||||
print(f" Individual anomaly plots: {test_output_dir}/individual_anomalies/")
|
||||
|
||||
Reference in New Issue
Block a user