Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dastools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Javier Quinteros
dastools
Commits
0f2a23fb
Commit
0f2a23fb
authored
Jul 31, 2020
by
Javier Quinteros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes in tdms.py
parent
745e8395
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
dasscripts/tdms.py
dasscripts/tdms.py
+8
-10
No files found.
dasscripts/tdms.py
View file @
0f2a23fb
...
...
@@ -132,8 +132,6 @@ class TDMS(object):
# Name of file
self
.
__filename
=
filename
# FIXME directory is not properly used and is giving an Error if !='.'
self
.
__directory
=
directory
# List of available files in the directory
...
...
@@ -375,14 +373,14 @@ class TDMS(object):
try
:
if
self
.
sampling_rate
is
None
:
self
.
sampling_rate
=
self
.
metadata
[
obj
][
'SamplingFrequency[Hz]'
]
except
Exception
:
except
KeyError
:
pass
try
:
curstarttime
=
self
.
metadata
[
obj
][
'GPSTimeStamp'
]
if
self
.
starttime
is
None
:
self
.
starttime
=
self
.
metadata
[
obj
][
'GPSTimeStamp'
]
except
Exception
:
except
KeyError
:
pass
continue
...
...
@@ -409,9 +407,6 @@ class TDMS(object):
self
.
metadata
[
obj
][
'sampling_rate'
]
=
self
.
sampling_rate
self
.
metadata
[
obj
][
'starttime'
]
=
curstarttime
# logs.debug('obj %s; datatype: %s; numValues: %s; size: %s' % (obj, datatype, result['numValues'],
# self.__data2mask[datatype][1]*result['numValues']))
# channelSize = self.__data2mask[datatype][1]*numValues
self
.
__readproperties
(
self
.
metadata
[
obj
])
# Set the data type as numpy expects it
...
...
@@ -478,7 +473,7 @@ class TDMS(object):
logs
.
debug
(
'Length of channel: %d'
%
channellength
)
# New or changed objects
newobjects
=
struct
.
unpack
(
'%cI'
%
self
.
__endian
,
self
.
__fi
.
read
(
4
))[
0
]
#
newobjects = struct.unpack('%cI' % self.__endian, self.__fi.read(4))[0]
def
__iter__
(
self
):
"""Iterate through data (or metadata) and filter and decimate if requested"""
...
...
@@ -527,7 +522,7 @@ class TDMS(object):
leftover
=
len
(
nodecimation
[
ch
])
%
5
# outbuf[ch]['stats']['starttime'] += 1/outbuf[ch]['stats']['sampling_rate']
outbuf
[
ch
][
'stats'
][
'npts'
]
=
1
yield
(
nodecimation
[
ch
][
-
leftover
::
5
],
outbuf
[
ch
][
'stats'
])
yield
nodecimation
[
ch
][
-
leftover
::
5
],
outbuf
[
ch
][
'stats'
]
logs
.
debug
(
'Flushing: %s %s'
%
(
nodecimation
[
ch
][
-
leftover
::
5
],
outbuf
[
ch
][
'stats'
]))
del
outbuf
[
ch
]
# self.__buffer[ch] = None
...
...
@@ -735,7 +730,7 @@ class TDMS(object):
# logs.debug('result: %s' % result)
return
result
def
__readproperties
(
self
,
result
=
dict
()
):
def
__readproperties
(
self
,
result
=
None
):
"""For each property, the following information is stored:
Name (string)
Data type (tdsDataType)
...
...
@@ -743,6 +738,9 @@ class TDMS(object):
"""
logs
=
logging
.
getLogger
(
'readproperties'
)
if
result
is
None
:
result
=
dict
()
numprops
=
struct
.
unpack
(
'%cI'
%
self
.
__endian
,
self
.
__fi
.
read
(
4
))[
0
]
if
numprops
:
logs
.
debug
(
'%s properties'
%
numprops
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment