159 lines
6.0 KiB
PowerShell
159 lines
6.0 KiB
PowerShell
|
|
# Parse probe output and create CSV - Clean version that handles ANSI codes
|
||
|
|
param(
|
||
|
|
[string]$InputFile = "probe_output_20260311_220349.txt",
|
||
|
|
[string]$OutputCSV = "probe_analytics_clean.csv"
|
||
|
|
)
|
||
|
|
|
||
|
|
Write-Host "Parsing probe data from: $InputFile"
|
||
|
|
Write-Host "Output CSV: $OutputCSV"
|
||
|
|
|
||
|
|
if (-not (Test-Path $InputFile)) {
|
||
|
|
Write-Host "Error: Input file not found: $InputFile" -ForegroundColor Red
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
|
||
|
|
# Read file and remove ANSI escape sequences
|
||
|
|
$content = Get-Content $InputFile -Raw
|
||
|
|
# Remove ANSI escape sequences (ESC[ followed by numbers and m)
|
||
|
|
$cleanContent = $content -replace '\x1b\[[0-9;]*[a-zA-Z]', ''
|
||
|
|
$lines = $cleanContent -split "`n"
|
||
|
|
|
||
|
|
Write-Host "Found $($lines.Count) lines to process..."
|
||
|
|
|
||
|
|
# Write CSV header
|
||
|
|
"Cycle,Time,Omega,Enstrophy,RhoMin,RhoMax,Power,Guardians,Mass,MTotal,Probe" | Out-File -FilePath $OutputCSV -Encoding UTF8
|
||
|
|
|
||
|
|
$cycles = @()
|
||
|
|
$count = 0
|
||
|
|
foreach ($line in $lines) {
|
||
|
|
# Parse cycle data lines - handle various formats
|
||
|
|
if ($line -match '^\s*(\d+)\s*\|\s*(\d+:\d+:\d+)\s*\|\s*([\d\.\-]+)\s*\|\s*([\d\.eE\+\-]+)\s*\|\s*\[([\d\.\-]+),([\d\.\-]+)\]\s*\|\s*([\d\.eE\+\-]+)\s*\|\s*(\d+)\s*\|\s*([\d\.\-]+)\s*\|\s*([\d\.\-]+)\s*\|\s*(\w+)') {
|
||
|
|
$cycle = [PSCustomObject]@{
|
||
|
|
Cycle = [int]$Matches[1]
|
||
|
|
Time = $Matches[2]
|
||
|
|
Omega = [float]$Matches[3]
|
||
|
|
Enstrophy = $Matches[4]
|
||
|
|
RhoMin = [float]$Matches[5]
|
||
|
|
RhoMax = [float]$Matches[6]
|
||
|
|
Power = $Matches[7]
|
||
|
|
Guardians = [int]$Matches[8]
|
||
|
|
Mass = [float]$Matches[9]
|
||
|
|
MTotal = [float]$Matches[10]
|
||
|
|
Probe = $Matches[11]
|
||
|
|
}
|
||
|
|
|
||
|
|
$cycles += $cycle
|
||
|
|
|
||
|
|
# Write to CSV
|
||
|
|
"$($cycle.Cycle),$($cycle.Time),$($cycle.Omega),$($cycle.Enstrophy),$($cycle.RhoMin),$($cycle.RhoMax),$($cycle.Power),$($cycle.Guardians),$($cycle.Mass),$($cycle.MTotal),$($cycle.Probe)" | Out-File -FilePath $OutputCSV -Append -Encoding UTF8
|
||
|
|
|
||
|
|
$count++
|
||
|
|
if ($count % 100 -eq 0) {
|
||
|
|
Write-Host "Processed $count cycles... (last: $($cycle.Cycle))"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "`nParsing complete!"
|
||
|
|
Write-Host "Total cycles found: $($cycles.Count)"
|
||
|
|
|
||
|
|
if ($cycles.Count -gt 0) {
|
||
|
|
$first = $cycles[0]
|
||
|
|
$last = $cycles[-1]
|
||
|
|
|
||
|
|
Write-Host "`nFirst cycle: $($first.Cycle)"
|
||
|
|
Write-Host "Last cycle: $($last.Cycle)"
|
||
|
|
Write-Host "Time range: $($first.Time) to $($last.Time)"
|
||
|
|
Write-Host "Omega range: $($first.Omega) to $($last.Omega)"
|
||
|
|
Write-Host "Guardians: $($first.Guardians) to $($last.Guardians)"
|
||
|
|
Write-Host "Mass: $($first.Mass) to $($last.Mass)"
|
||
|
|
|
||
|
|
# Calculate statistics
|
||
|
|
$omegaAvg = ($cycles | Measure-Object -Property Omega -Average).Average
|
||
|
|
$massAvg = ($cycles | Measure-Object -Property Mass -Average).Average
|
||
|
|
$guardiansAvg = ($cycles | Measure-Object -Property Guardians -Average).Average
|
||
|
|
|
||
|
|
Write-Host "`nStatistics:"
|
||
|
|
Write-Host " Average Omega: $($omegaAvg.ToString('F4'))"
|
||
|
|
Write-Host " Average Mass: $($massAvg.ToString('F2'))"
|
||
|
|
Write-Host " Average Guardians: $($guardiansAvg.ToString('F1'))"
|
||
|
|
|
||
|
|
# Check for probe phases
|
||
|
|
$probeA = $cycles | Where-Object { $_.Cycle -ge 600 -and $_.Cycle -le 649 -and $_.Probe -eq "INJ" }
|
||
|
|
$probeB = $cycles | Where-Object { $_.Cycle -eq 800 }
|
||
|
|
$probeC = $cycles | Where-Object { $_.Cycle -ge 1100 -and $_.Cycle -le 1199 -and $_.Probe -eq "SILENT" }
|
||
|
|
$probeD = $cycles | Where-Object { $_.Cycle -ge 1400 -and $_.Cycle -le 1499 }
|
||
|
|
|
||
|
|
Write-Host "`nProbe phases found:"
|
||
|
|
Write-Host " Probe A (600-649 INJ): $($probeA.Count) cycles"
|
||
|
|
Write-Host " Probe B (800): $($probeB.Count) cycles"
|
||
|
|
Write-Host " Probe C (1100-1199 SILENT): $($probeC.Count) cycles"
|
||
|
|
Write-Host " Probe D (1400-1499): $($probeD.Count) cycles"
|
||
|
|
|
||
|
|
# Check if reached target
|
||
|
|
if ($last.Cycle -ge 1700) {
|
||
|
|
Write-Host "`n✅ SUCCESS: Reached target 1700 cycles!" -ForegroundColor Green
|
||
|
|
} else {
|
||
|
|
Write-Host "`n⚠️ WARNING: Only reached cycle $($last.Cycle), target was 1700" -ForegroundColor Yellow
|
||
|
|
|
||
|
|
# Check if crashed during SILENT probe
|
||
|
|
if ($last.Cycle -ge 1100 -and $last.Cycle -le 1199 -and $last.Probe -eq "SILENT") {
|
||
|
|
Write-Host "🔴 CRASH DETECTED: SILENT probe crash at cycle $($last.Cycle)" -ForegroundColor Red
|
||
|
|
Write-Host " Expected crash zone: 1100-1199 (omega locked at 1.25)" -ForegroundColor Yellow
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# Save summary report
|
||
|
|
$summaryFile = "probe_summary_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
|
||
|
|
$summary = @"
|
||
|
|
PROBE ANALYTICS SUMMARY
|
||
|
|
=======================
|
||
|
|
Run time: $(Get-Date)
|
||
|
|
Input file: $InputFile
|
||
|
|
Output CSV: $OutputCSV
|
||
|
|
|
||
|
|
DATA SUMMARY:
|
||
|
|
-------------
|
||
|
|
Total cycles: $($cycles.Count)
|
||
|
|
First cycle: $($first.Cycle)
|
||
|
|
Last cycle: $($last.Cycle)
|
||
|
|
Time range: $($first.Time) to $($last.Time)
|
||
|
|
Omega range: $($first.Omega) to $($last.Omega)
|
||
|
|
Mass range: $($first.Mass) to $($last.Mass)
|
||
|
|
Guardians: $($first.Guardians) to $($last.Guardians)
|
||
|
|
|
||
|
|
STATISTICS:
|
||
|
|
-----------
|
||
|
|
Average Omega: $($omegaAvg.ToString('F4'))
|
||
|
|
Average Mass: $($massAvg.ToString('F2'))
|
||
|
|
Average Guardians: $($guardiansAvg.ToString('F1'))
|
||
|
|
|
||
|
|
PROBE PHASES:
|
||
|
|
-------------
|
||
|
|
Probe A (600-649 INJ): $($probeA.Count) cycles
|
||
|
|
Probe B (800): $($probeB.Count) cycles
|
||
|
|
Probe C (1100-1199 SILENT): $($probeC.Count) cycles
|
||
|
|
Probe D (1400-1499): $($probeD.Count) cycles
|
||
|
|
|
||
|
|
COMPLETION STATUS:
|
||
|
|
------------------
|
||
|
|
Target cycles: 1700
|
||
|
|
Actual cycles: $($last.Cycle)
|
||
|
|
"@
|
||
|
|
|
||
|
|
if ($last.Cycle -ge 1700) {
|
||
|
|
$summary += "`n✅ SUCCESS: Reached target 1700 cycles!"
|
||
|
|
} else {
|
||
|
|
$summary += "`n⚠️ WARNING: Only reached cycle $($last.Cycle), target was 1700"
|
||
|
|
|
||
|
|
if ($last.Cycle -ge 1100 -and $last.Cycle -le 1199 -and $last.Probe -eq "SILENT") {
|
||
|
|
$summary += "`n🔴 CRASH DETECTED: SILENT probe crash at cycle $($last.Cycle)"
|
||
|
|
$summary += "`n Expected crash zone: 1100-1199 (omega locked at 1.25)"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$summary | Out-File -FilePath $summaryFile -Encoding UTF8
|
||
|
|
Write-Host "`nSummary saved to: $summaryFile"
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "`nCSV saved to: $OutputCSV"
|