Skip to content

Commit 3c2e0ad

Browse files
ATFX API v12.1 Changes
Added compatibility for the 15888 timestamp recordings and allowed users to view the absolute timestamps. Added access to the DateTimeNano representation of timestamps, included functionality to generate nanosecond accurate unix timestamps. Added methods to associate timestamp recordings with signals and obtain the serial numbers of spider devices used to created recordings. Added method to associate signals with their timestamp recording. Improvements for viewing RMS data and more signal properties to determine types. Fix build warnings with unused variables and adding Trace.WriteLine ATFX API Multi Spider System DRD, EDM DRD File Version Memo.txt • Fix DRD convert code with missing SYSTEMTIME1 for AoSubmatrix • Fix ATFX API Multi Spider System DRD Converter • Additional backward compability for downloading DRD NAS files with file version in memo.txt SonarQube code improvements Change label “Sqrt(Eu^2/Hz)” to “EU/Sqrt(Hz)” Replace Math.Atan2 with SafeAtan2.
1 parent 5098038 commit 3c2e0ad

File tree

9 files changed

+50
-50
lines changed

9 files changed

+50
-50
lines changed
-2.8 MB
Binary file not shown.

C# ATFX API Demo/Source/ATFXReaderDemo.cs

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public partial class ATFXReaderDemo : Form
3131
#region Fields
3232
DRDConverter drdConverter = new DRDConverter();
3333
List<string> drdOutputPath;
34-
string drdFilesSelectedPath;
34+
private string drdFilesSelectedPath;
3535
ProgressBarForm pgForm;
36-
bool DRDConvertSucceed = false;
37-
string savePath;
38-
string currentOpenFile;
36+
private bool DRDConvertSucceed = false;
37+
private string currentOpenFile;
38+
private EventHandler<DRDConverter.ProgressEventArgs> drdProgressHandler;
3939

4040
/// <summary>
4141
/// Determine whether the current datagridview for Signals should be displaying
@@ -95,7 +95,6 @@ public ATFXReaderDemo()
9595
clmLowAlarm.Visible = false;
9696
clmLowAbort.Visible = false;
9797

98-
//drdConverter.ReportProgress += new EventHandler<DRDConverter.ProgressArgs>(DRDConverterCombine_ReportProgress);
9998
bgWorkerDRDCombine.DoWork += new DoWorkEventHandler(bgWorkerDRDCombine_DoWork);
10099
bgWorkerDRDCombine.ProgressChanged += new ProgressChangedEventHandler(bgWorkerDRDCombine_ProgressChanged);
101100
bgWorkerDRDCombine.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorkerDRDCombine_RunWorkerCompleted);
@@ -142,7 +141,7 @@ private void ShowSignals(IRecording rec)
142141
/// <param name="rec"></param>
143142
private void ShowRecordings(IRecording rec)
144143
{
145-
if (rec as ODSATFXMLRecording == null)
144+
if (!(rec is ODSATFXMLRecording))
146145
{
147146
lbRecordingDataInfo.Items.Clear();
148147
lbRecordingDataInfo.Items.Add(rec); // Add the initial IRecording object
@@ -484,7 +483,7 @@ private void ShowFrameData(DataGridView grid, ISignal signal, _SpectrumScalingTy
484483
{
485484
//Gets 1 framesize signal frame data I.E 1024 points
486485
//Changing the index will display the other frame data
487-
ulong[][] frame_ul = Utility.ReadTimeStampData(signal, frameIndex * (int)signal.FrameSize, (int)(frameIndex + 1) * (int)signal.FrameSize - 1);
486+
ulong[][] frame_ul = Utility.ReadTimeStampData(signal, frameIndex * (int)signal.FrameSize, (frameIndex + 1) * (int)signal.FrameSize - 1);
488487
if (frame_ul == null) return;
489488

490489
var frameSize = frame_ul[0].Length;
@@ -564,7 +563,7 @@ private void ShowFrameData(DataGridView grid, ISignal signal, _SpectrumScalingTy
564563
}
565564
catch(Exception e)
566565
{
567-
566+
Utility.Log(e);
568567
}
569568
finally
570569
{
@@ -599,7 +598,7 @@ private void ShowTSDATFrameDataUTC(ISignal signal)
599598
clmLowAbort.Visible = false;
600599

601600
//Read the TSDAT file and return list<DateTimeNano> and out ulong[] that is the index
602-
var utcTSDATpoints = Utility.ReadTimeStampDataUTCFormat(out ulong[] frame_ul, signal, frameIndex * (int)signal.FrameSize, (int)(frameIndex+1) * (int)signal.FrameSize - 1);
601+
var utcTSDATpoints = Utility.ReadTimeStampDataUTCFormat(out ulong[] frame_ul, signal, frameIndex * (int)signal.FrameSize, (frameIndex+1) * (int)signal.FrameSize - 1);
603602

604603
for(int i = 0; i < utcTSDATpoints.Count; i++)
605604
{
@@ -619,7 +618,7 @@ private void ShowTSDATFrameDataUTC(ISignal signal)
619618
/// <param name="points"></param>
620619
/// <param name="pointsUTC"></param>
621620
/// <param name="formatUTC"></param>
622-
private void ShowTSDATPoints(DataGridView grid, ulong[][] points = null, List<DateTimeNano> pointsUTC = null, ulong[] frame_ul = null, bool formatUTC = false)
621+
private static void ShowTSDATPoints(DataGridView grid, ulong[][] points = null, List<DateTimeNano> pointsUTC = null, ulong[] frame_ul = null, bool formatUTC = false)
623622
{
624623
if(!formatUTC && points == null) return;
625624
if (formatUTC && pointsUTC == null && frame_ul == null) return;
@@ -838,7 +837,7 @@ private void LbSignalParameter_SelectedIndexChanged(object sender, EventArgs e)
838837
/// <param name="e"></param>
839838
private void LbRecording_SelectedIndexChanged(object sender, EventArgs e)
840839
{
841-
if (lbRecordingDataInfo.SelectedItem is IRecording rec)
840+
if (lbRecordingDataInfo.SelectedItem is IRecording)
842841
{
843842
//Keep tracks of the displayed grid for recording if switching from recording to signal and so on
844843
switch (recordDataInfo)
@@ -879,7 +878,6 @@ private void BtnOpen_Click(object sender, EventArgs e)
879878
}
880879

881880
currentOpenFile = tbFile.Text = dlg.FileName;
882-
savePath = Path.GetDirectoryName(dlg.FileName);
883881
if (RecordingManager.Manager.OpenRecording(currentOpenFile, out IRecording rec))
884882
{
885883
LoadRecord(rec);
@@ -1138,7 +1136,7 @@ private void btnCalculateTSDAT_Click(object sender, EventArgs e)
11381136
}
11391137
catch(Exception ex)
11401138
{
1141-
1139+
Utility.Log(ex);
11421140
}
11431141
}
11441142

@@ -1184,7 +1182,7 @@ private void btnReadTSDAT_Click(object sender, EventArgs e)
11841182
}
11851183
catch(Exception ex)
11861184
{
1187-
1185+
Utility.Log(ex);
11881186
}
11891187
}
11901188

@@ -1387,15 +1385,14 @@ private void tpTSDATInfo_Enter(object sender, EventArgs e)
13871385
/// <param name="e"></param>
13881386
private void bgWorkerDRDCombine_DoWork(object sender, DoWorkEventArgs e)
13891387
{
1390-
var worker = sender as BackgroundWorker;
1391-
13921388
this.Invoke((MethodInvoker)delegate
13931389
{
13941390
pgForm = new ProgressBarForm() { Owner = this };
13951391
pgForm.Show();
13961392
});
13971393

1398-
drdConverter.ReportProgress += new EventHandler<DRDConverter.ProgressArgs>(DRDConverterCombine_ReportProgress);
1394+
drdProgressHandler = new EventHandler<DRDConverter.ProgressEventArgs>(DRDConverterCombine_ReportProgress);
1395+
drdConverter.ReportProgress += drdProgressHandler;
13991396
string[] files = Directory.GetFiles(drdFilesSelectedPath);
14001397
drdOutputPath = drdConverter.CombineDRDFiles(files, cbOnlyDATX.Checked, cbMergeAllDRD.Checked);
14011398
}
@@ -1405,7 +1402,7 @@ private void bgWorkerDRDCombine_DoWork(object sender, DoWorkEventArgs e)
14051402
/// </summary>
14061403
/// <param name="sender"></param>
14071404
/// <param name="e"></param>
1408-
protected void DRDConverterCombine_ReportProgress(object sender, DRDConverter.ProgressArgs e)
1405+
protected void DRDConverterCombine_ReportProgress(object sender, DRDConverter.ProgressEventArgs e)
14091406
{
14101407
bgWorkerDRDCombine.ReportProgress(e.Percentage, e.Message);
14111408
}
@@ -1435,7 +1432,7 @@ private void bgWorkerDRDCombine_ProgressChanged(object sender, ProgressChangedEv
14351432
/// <param name="e"></param>
14361433
protected void bgWorkerDRDCombine_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
14371434
{
1438-
drdConverter.ReportProgress -= new EventHandler<DRDConverter.ProgressArgs>(DRDConverterCombine_ReportProgress);
1435+
drdConverter.ReportProgress -= drdProgressHandler;
14391436
pgForm.ProgressBarUpdate(100, "All ods, datx, ext files combined.");
14401437
pgForm.Close();
14411438
if (drdOutputPath != null)
@@ -1467,7 +1464,7 @@ public void ReportStatus(ExportStatus eStatus)
14671464
/// </summary>
14681465
/// <param name="sender"></param>
14691466
/// <param name="e"></param>
1470-
protected void DRDConverterConvert_ReportProgress(object sender, DRDConverter.ProgressArgs e)
1467+
protected void DRDConverterConvert_ReportProgress(object sender, DRDConverter.ProgressEventArgs e)
14711468
{
14721469
bgWorkerDRDConvert.ReportProgress(e.Percentage, e.Message);
14731470
}
@@ -1485,7 +1482,9 @@ private void bgWorkerDRDConvert_DoWork(object sender, DoWorkEventArgs e)
14851482
pgForm = new ProgressBarForm() { Owner = this };
14861483
pgForm.Show();
14871484
});
1488-
drdConverter.ReportProgress += new EventHandler<DRDConverter.ProgressArgs>(DRDConverterConvert_ReportProgress);
1485+
1486+
drdProgressHandler = new EventHandler<DRDConverter.ProgressEventArgs>(DRDConverterConvert_ReportProgress);
1487+
drdConverter.ReportProgress += drdProgressHandler;
14891488
status = new ExportStatus();
14901489
delStatus = this.ReportStatus;
14911490
DRDConvertSucceed = drdConverter.ConvertDATATFXFile(drdOutputPath, delStatus, status);
@@ -1499,14 +1498,13 @@ private void bgWorkerDRDConvert_DoWork(object sender, DoWorkEventArgs e)
14991498
/// <param name="e"></param>
15001499
protected void bgWorkerDRDConvert_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
15011500
{
1502-
drdConverter.ReportProgress -= new EventHandler<DRDConverter.ProgressArgs>(DRDConverterConvert_ReportProgress);
1501+
drdConverter.ReportProgress -= drdProgressHandler;
15031502
pgForm.ProgressBarUpdate(100, "All combined files have been converted to ATFX and DAT files.");
15041503
pgForm.Close();
15051504
if (DRDConvertSucceed)
15061505
{
15071506
string[] splitPath = drdOutputPath[0].Split(new string[] { "\\" }, StringSplitOptions.None);
1508-
string drdATFXPath = drdOutputPath[0] + "\\" + splitPath[splitPath.Length - 1] + ".atfx";
1509-
savePath = drdOutputPath[0];
1507+
string drdATFXPath = $"{drdOutputPath[0]}\\{splitPath[splitPath.Length - 1]}.atfx";
15101508
currentOpenFile = drdATFXPath;
15111509
if (drdOutputPath.Count == 1)
15121510
{

C# ATFX API Demo/Source/CI.ATFX.Reader.Demo.csproj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
6+
</PropertyGroup>
47
<PropertyGroup>
58
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
69
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -58,6 +61,17 @@
5861
<PropertyGroup>
5962
<ApplicationIcon>CI.ico</ApplicationIcon>
6063
</PropertyGroup>
64+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'NoLogo|AnyCPU'">
65+
<OutputPath>..\..\..\bin\AnyCPU\NoLogo\Utility\CIATFXReader\</OutputPath>
66+
<DefineConstants>TRACE;NoLogo</DefineConstants>
67+
<NoWarn>1591,1587</NoWarn>
68+
<DebugType>pdbonly</DebugType>
69+
<PlatformTarget>AnyCPU</PlatformTarget>
70+
<LangVersion>7.3</LangVersion>
71+
<ErrorReport>prompt</ErrorReport>
72+
<Optimize>true</Optimize>
73+
<Prefer32Bit>false</Prefer32Bit>
74+
</PropertyGroup>
6175
<ItemGroup>
6276
<Reference Include="System" />
6377
<Reference Include="System.Core" />
@@ -131,16 +145,8 @@
131145
</ProjectReference>
132146
</ItemGroup>
133147
<ItemGroup>
134-
<PackageReference Include="Costura.Fody">
135-
<Version>5.7.0</Version>
136-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
137-
<PrivateAssets>all</PrivateAssets>
138-
</PackageReference>
139-
<PackageReference Include="Fody">
140-
<Version>6.7.0</Version>
141-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
142-
<PrivateAssets>all</PrivateAssets>
143-
</PackageReference>
148+
<PackageReference Include="Costura.Fody" Version="6.0.0" PrivateAssets="all" />
149+
<PackageReference Include="Fody" Version="6.9.1" PrivateAssets="all" />
144150
</ItemGroup>
145151
<ItemGroup>
146152
<BootstrapperPackage Include=".NETFramework,Version=v4.8">

C# ATFX API Demo/Source/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ static class Program
1818
[STAThread]
1919
static void Main()
2020
{
21-
//MixedDllDispatcher.Start();
22-
2321
Application.EnableVisualStyles();
2422
Application.SetCompatibleTextRenderingDefault(false);
2523
Application.Run(new ATFXReaderDemo());

C# ATFX API Demo/Source/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.8.0")]
36-
[assembly: AssemblyFileVersion("1.0.8.0")]
35+
[assembly: AssemblyVersion("2.1.0.2")]
36+
[assembly: AssemblyFileVersion("2.1.0.2")]

Python ATFX API/clrATFXAPI.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@
66
"""
77
#---Pythonnet clr import
88
from cProfile import label
9-
import pythonnet
109
import clr
1110
# Change file path here to whereever the DLL files are
12-
parentPath = "C:\\MyStuff\\DevelopmentalVer\\bin\\AnyCPU\\Debug\\Utility\\CIATFXReader\\"
11+
parentPath = "C:\\MyStuff\\Github\\CIDataFileReaderAPI\\bin\\"
1312

1413
clr.AddReference(parentPath + "CI.ATFX.Reader.dll")
1514
clr.AddReference(parentPath + "Common.dll")
15+
clr.AddReference(parentPath + "PlatformWrapEx.dll")
16+
clr.AddReference(parentPath + "System.Buffers.dll")
1617
clr.AddReference('System.Linq')
1718
clr.AddReference('System.Collections')
1819

1920
import numpy as np
2021
import matplotlib.pyplot as plt
21-
import sys
22-
import inspect
2322

2423
#---C# .NET imports & dll imports
2524
from EDM.Recording import *
@@ -119,22 +118,21 @@ def ShowFrameDataSpectrumEU(signal, spectrum, engiUnit):
119118
#---Main Code
120119
# Uncomment any prints and function calls to extract data from file
121120
print("Running Main Code")
122-
functions = inspect.getmembers(clr, inspect.isfunction)
123-
print(functions)
124-
recordingManager = RecordingManager
121+
# recordingManager = RecordingManager
125122

126123
# Change file path here to whereever signal or recording files are
127-
recordingPath = "C:\\Users\\KevinCheng\\Downloads\\gps test example\\"
124+
recordingPath = "C:\\Users\\Another CI\\Downloads\\signal files\\"
128125
# Here are multiple strings for different files, change any of them to contain the file name and correctly
129126
# reference it in RecordingManager.Manager.OpenRecording
130-
recordingPathRegular = recordingPath + "SIG0000.atfx"
127+
recordingPathRegular = recordingPath + "REC0157.atfx"
131128
recordingPathTS = recordingPath + "{4499520}_REC_{20220419}(1).atfx"
132129
recordingPathGPS = recordingPath + "REC0041.atfx"
133130

134131
#OpenRecording(string, out IRecording)
135132
# openRecordSucceed is required for the OpenRecording as it is the returned boolean
136133
# Make sure to reference the correct file string
137-
openRecordSucceed, recording = RecordingManager.Manager.OpenRecording(recordingPathRegular, None)
134+
# testrecat = CommonRecording.CreateRecording(recordingPathRegular)
135+
[openRecordSucceed, recording] = RecordingManager.Manager.OpenRecording(recordingPathRegular, None)
138136

139137
#---Print Statements
140138
# Comment or uncomment any print statements below
@@ -144,8 +142,8 @@ def ShowFrameDataSpectrumEU(signal, spectrum, engiUnit):
144142
print(prop[0], prop[1])
145143

146144
# Make sure to reference the correct file string
147-
print("\nRecording GPS Properties\n")
148-
ShowGPSInfo(recordingPathTS)
145+
#print("\nRecording GPS Properties\n")
146+
#ShowGPSInfo(recordingPathTS)
149147

150148
print("\nSignal 1 Properties\n")
151149
for prop in Utility.GetListOfProperties(recording.Signals[0].Properties):

bin/CI.ATFX.Reader.dll

-87.5 KB
Binary file not shown.

bin/Common.dll

49.5 KB
Binary file not shown.

bin/PlatformWrapEx.dll

-704 KB
Binary file not shown.

0 commit comments

Comments
 (0)