Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOHViewer
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Public
PASSOFT
SOHViewer
Commits
2f975cb6
Commit
2f975cb6
authored
2 years ago
by
Kien Le
Browse files
Options
Downloads
Patches
Plain Diff
Documentation
parent
cae0388c
No related branches found
No related tags found
1 merge request
!33
Add tests and refactor trim_downsample_WFChan
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sohstationviewer/model/handling_data.py
+13
-3
13 additions, 3 deletions
sohstationviewer/model/handling_data.py
with
13 additions
and
3 deletions
sohstationviewer/model/handling_data.py
+
13
−
3
View file @
2f975cb6
...
@@ -585,8 +585,9 @@ def trim_waveform_data(wf_channel_data: Dict, start_time: float,
...
@@ -585,8 +585,9 @@ def trim_waveform_data(wf_channel_data: Dict, start_time: float,
"""
"""
Trim off waveform traces whose times does not intersect the closed interval
Trim off waveform traces whose times does not intersect the closed interval
[start_time, end_time].
[start_time, end_time].
:param wf_channel_data: dict - a dictionary that contains the waveform
:param wf_channel_data: dict - a dictionary that contains the waveform
times and data
of a channel. For its structure, refer to
information
of a channel. For its structure, refer to
DataTypeModel.waveformData[key][
'
readData
'
][chan_id].
DataTypeModel.waveformData[key][
'
readData
'
][chan_id].
:param start_time: the start of the time range to trim waveform data to.
:param start_time: the start of the time range to trim waveform data to.
:param end_time: the end of the time range to trim waveform data to.
:param end_time: the end of the time range to trim waveform data to.
...
@@ -627,6 +628,17 @@ def trim_waveform_data(wf_channel_data: Dict, start_time: float,
...
@@ -627,6 +628,17 @@ def trim_waveform_data(wf_channel_data: Dict, start_time: float,
def
downsample_waveform_data
(
trimmed_traces_list
:
List
[
Dict
],
def
downsample_waveform_data
(
trimmed_traces_list
:
List
[
Dict
],
start_time
:
float
,
end_time
:
float
start_time
:
float
,
end_time
:
float
)
->
Tuple
[
List
[
np
.
ndarray
],
List
[
np
.
ndarray
]]:
)
->
Tuple
[
List
[
np
.
ndarray
],
List
[
np
.
ndarray
]]:
"""
Downsample trimmed waveform data. Works on one trace at a time instead
of combining the traces before downsampling.
:param trimmed_traces_list: a list of traces that have been trimmed to
include only those that intersect the closed interval
[start_time, end_time]
:param start_time: the start of the time range
:param end_time: the end of the time range
:return: list of downsampled times array and list of downsampled data array
"""
# Calculate the number of requested_points
# Calculate the number of requested_points
total_size
=
sum
([
tr
[
'
size
'
]
for
tr
in
trimmed_traces_list
])
total_size
=
sum
([
tr
[
'
size
'
]
for
tr
in
trimmed_traces_list
])
requested_points
=
0
requested_points
=
0
...
@@ -663,8 +675,6 @@ def trim_downsample_WFChan(chan, startTm, endTm, firsttime):
...
@@ -663,8 +675,6 @@ def trim_downsample_WFChan(chan, startTm, endTm, firsttime):
Different with soh_data where times and data are each in one np.array,
Different with soh_data where times and data are each in one np.array,
in waveform_data, times and data are each kept in a list of np.memmap
in waveform_data, times and data are each kept in a list of np.memmap
files along with startTmEpoch and endTmEpoch.
files along with startTmEpoch and endTmEpoch.
chan[
'
startIdx
'
] and chan[
'
endIdx
'
] will be identify to exclude np.memmap
files that aren
'
t in the zoom time range (startTm, endTm).
Data in np.memmap files will be trimmed again if there is still time
Data in np.memmap files will be trimmed again if there is still time
outside the zoom time range then downsampled and combined to get the
outside the zoom time range then downsampled and combined to get the
times and data with size closed to the expected const.CHAN_SIZE_LIMIT,
times and data with size closed to the expected const.CHAN_SIZE_LIMIT,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment