-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReading_TimeStampData_Data.py
More file actions
82 lines (71 loc) · 2.63 KB
/
Copy pathReading_TimeStampData_Data.py
File metadata and controls
82 lines (71 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022 by Crystal Instruments Corporation.
All rights reserved
@author: KevinCheng
"""
#---Pythonnet clr import
from cProfile import label
import clr
# Change file path here to whereever the DLL files are
parentPath = "C:\\MyStuff\\DevelopmentalVer\\bin\\AnyCPU\\Debug\\Utility\\CIATFXReader\\"
clr.AddReference(parentPath + "CI.ATFX.Reader.dll")
clr.AddReference(parentPath + "Common.dll")
clr.AddReference('System.Linq')
clr.AddReference('System.Collections')
import numpy as np
import matplotlib.pyplot as plt
#---C# .NET imports & dll imports
from EDM.Recording import *
from EDM.RecordingInterface import *
from ASAM.ODS.NVH import *
from EDM.Utils import *
from Common import *
from Common import _SpectrumScalingType
from Common.Spider import *
from System import *
from System.Diagnostics import *
from System.Reflection import *
from System.Text import *
from System.IO import *
# Change file path here to whereever signal or recording files are
recordingPath = "C:\\Users\\KevinCheng\\Downloads\\GRS Data Files\\Locked During Pretrigger\\"
# ATFX file path, change contain the file name and correctly reference it in RecordingManager.Manager.OpenRecording
recordingPathRegular = recordingPath + "REC0026.atfx"
#OpenRecording(string, out IRecording)
# openRecordSucceed is required for the OpenRecording as it is the returned boolean
# Make sure to reference the correct file string
openRecordSucceed, recording = RecordingManager.Manager.OpenRecording(recordingPathRegular, None)
# Grab the list of recordings that the .atfx file references
# This list should include .tsdat, which will be used to get the Time Stamp Data signal
recordingList = Utility.GetListOfAllRecordings(recording)
tsdatRec = recordingList[2]
signal = tsdatRec.Signals[0]
frame = Utility.ReadTimeStampData(signal, 0, 100)
print("X: ", frame[0][0])
print("Y: ", frame[1][0])
print("X: ", frame[0][1])
print("Y: ", frame[1][1])
print("X: ", frame[0][2])
print("Y: ", frame[1][2])
# Return List<DateTimeNano> and out ulong[] frame index
# put None in where out parameter is for python to read function correctly
dateTimeNano, frameX = Utility.ReadTimeStampDataUTCFormat(None, signal, 0, 100)
print("dateTimeNano")
print(dateTimeNano[0])
print(dateTimeNano[1])
print(dateTimeNano[2])
print("frameX")
print(frameX[0])
print(frameX[1])
print(frameX[2])
# Convert System.Double[] to numpy array
frameX = np.fromiter(frame[0], float)
frameY = np.fromiter(frame[1], float)
# Plot the signal frames
plt.plot(frameX,frameY,'r', label="Time Stamp Data")
plt.xlabel("(Points)")
plt.ylabel("(Nanoseconds)")
plt.title("Plot of the Time Stamp Data")
plt.legend()
plt.show()