As a simple work around for my inability to get the defogger to start stop logs I decided to write a simple PowerShell script that will take a log and then export individual logs containing just the samples where the defogger is turned on.
Split-Log.ps1:
Code:
param (
[Parameter(Mandatory=$true)][string]$filename
)
$logNum = 0
$logStart = $false
$logSamples = @()
foreach ($sample in (ConvertFrom-Csv (Get-Content -Path $filename))) {
if ($sample.defogger_sw -eq 1) {
if($logStart -eq $false) {
$logStart = $true
$logNum++
$logSamples += $sample
} else {
$logSamples += $sample
}
} elseif ($logStart -eq $true) {
$logStart = $false
$logSamples | Export-Csv -Path "$([IO.Path]::GetFileNameWithoutExtension($filename)).$($logNum)$([IO.Path]::GetExtension($filename))" -NoTypeInformation
$logSamples = @()
}
}
if ($logSamples.length) {
Write-Host "Saving: $([IO.Path]::GetFileNameWithoutExtension($filename)).$($logNum)$([IO.Path]::GetExtension($filename))"
$logSamples | Export-Csv -Path "$([IO.Path]::GetFileNameWithoutExtension($filename)).$($logNum)$([IO.Path]::GetExtension($filename))" -NoTypeInformation
}
To run it you would do something like this:
Code:
Split-Log.ps1 -filename Log10.csv
It will then export logs for the the samples where the defogger is on and the files will be named Log10.1.scv, Log10.2.csv and so on. After it pulls out the relevant data you could then simply delete the original log. This is assuming you have named your defogger channel as deffoger_sw. You will have to edit the script if you are using some other name for your defogger channel. Hopefully this will help someone out there.