fix: enforce strict ruff lint (17 rule sets) across entire repo
- Expand ruff config from E/F to 17 rule sets (B, RUF, SIM, PIE, T20, ARG, ERA, A, BLE, RET, ISC, TCH, UP, C4, PERF) - Fix 907 lint errors across all Python files (GUI, FPGA cosim, schematics scripts, simulations, utilities, tools) - Replace all blind except-Exception with specific exception types - Remove commented-out dead code (ERA001) from cosim/simulation files - Modernize typing: deprecated typing.List/Dict/Tuple to builtins - Fix unused args/loop vars, ambiguous unicode, perf anti-patterns - Delete legacy GUI files V1-V4 - Add V7 test suite, requirements files - All CI jobs pass: ruff (0 errors), py_compile, pytest (92/92), MCU tests (20/20), FPGA regression (25/25)
This commit is contained in:
@@ -38,7 +38,6 @@ def generate_radar_csv(filename="pulse_compression_output.csv"):
|
||||
chirp_number = 0
|
||||
|
||||
# Generate Long Chirps (30µs duration equivalent)
|
||||
print("Generating Long Chirps...")
|
||||
for chirp in range(num_long_chirps):
|
||||
for sample in range(samples_per_chirp):
|
||||
# Base noise
|
||||
@@ -90,7 +89,6 @@ def generate_radar_csv(filename="pulse_compression_output.csv"):
|
||||
timestamp_ns += 175400 # 175.4µs guard time
|
||||
|
||||
# Generate Short Chirps (0.5µs duration equivalent)
|
||||
print("Generating Short Chirps...")
|
||||
for chirp in range(num_short_chirps):
|
||||
for sample in range(samples_per_chirp):
|
||||
# Base noise
|
||||
@@ -142,11 +140,6 @@ def generate_radar_csv(filename="pulse_compression_output.csv"):
|
||||
|
||||
# Save to CSV
|
||||
df.to_csv(filename, index=False)
|
||||
print(f"Generated CSV file: {filename}")
|
||||
print(f"Total samples: {len(df)}")
|
||||
print(f"Long chirps: {num_long_chirps}, Short chirps: {num_short_chirps}")
|
||||
print(f"Samples per chirp: {samples_per_chirp}")
|
||||
print(f"File size: {len(df) // 1000}K samples")
|
||||
|
||||
return df
|
||||
|
||||
@@ -154,15 +147,11 @@ def analyze_generated_data(df):
|
||||
"""
|
||||
Analyze the generated data to verify target detection
|
||||
"""
|
||||
print("\n=== Data Analysis ===")
|
||||
|
||||
# Basic statistics
|
||||
long_chirps = df[df['chirp_type'] == 'LONG']
|
||||
short_chirps = df[df['chirp_type'] == 'SHORT']
|
||||
df[df['chirp_type'] == 'LONG']
|
||||
df[df['chirp_type'] == 'SHORT']
|
||||
|
||||
print(f"Long chirp samples: {len(long_chirps)}")
|
||||
print(f"Short chirp samples: {len(short_chirps)}")
|
||||
print(f"Unique chirp numbers: {df['chirp_number'].nunique()}")
|
||||
|
||||
# Calculate actual magnitude and phase for analysis
|
||||
df['magnitude'] = np.sqrt(df['I_value']**2 + df['Q_value']**2)
|
||||
@@ -172,15 +161,11 @@ def analyze_generated_data(df):
|
||||
high_mag_threshold = df['magnitude'].quantile(0.95) # Top 5%
|
||||
targets_detected = df[df['magnitude'] > high_mag_threshold]
|
||||
|
||||
print(f"\nTarget detection threshold: {high_mag_threshold:.2f}")
|
||||
print(f"High magnitude samples: {len(targets_detected)}")
|
||||
|
||||
# Group by chirp type
|
||||
long_targets = targets_detected[targets_detected['chirp_type'] == 'LONG']
|
||||
short_targets = targets_detected[targets_detected['chirp_type'] == 'SHORT']
|
||||
targets_detected[targets_detected['chirp_type'] == 'LONG']
|
||||
targets_detected[targets_detected['chirp_type'] == 'SHORT']
|
||||
|
||||
print(f"Targets in long chirps: {len(long_targets)}")
|
||||
print(f"Targets in short chirps: {len(short_targets)}")
|
||||
|
||||
return df
|
||||
|
||||
@@ -191,10 +176,3 @@ if __name__ == "__main__":
|
||||
# Analyze the generated data
|
||||
analyze_generated_data(df)
|
||||
|
||||
print("\n=== CSV File Ready ===")
|
||||
print("You can now test the Python GUI with this CSV file!")
|
||||
print("The file contains:")
|
||||
print("- 16 Long chirps + 16 Short chirps")
|
||||
print("- 4 simulated targets at different ranges and velocities")
|
||||
print("- Realistic noise and clutter")
|
||||
print("- Proper I/Q data for Doppler processing")
|
||||
|
||||
Reference in New Issue
Block a user