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
4bf37e06
Commit
4bf37e06
authored
1 year ago
by
Kien Le
Browse files
Options
Downloads
Patches
Plain Diff
Fix plotting waveform data for RT130 data
parent
7d2a2899
No related branches found
No related tags found
1 merge request
!139
Change the way RT130 data is read for better performance
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sohstationviewer/model/reftek/rt130_experiment/reftek.py
+7
-7
7 additions, 7 deletions
sohstationviewer/model/reftek/rt130_experiment/reftek.py
with
7 additions
and
7 deletions
sohstationviewer/model/reftek/rt130_experiment/reftek.py
+
7
−
7
View file @
4bf37e06
...
@@ -76,7 +76,7 @@ def get_rt130_packet_header(rt130_packet: bytes,
...
@@ -76,7 +76,7 @@ def get_rt130_packet_header(rt130_packet: bytes,
print_error
(
'
The given file does not appear to be a valid RT130 file.
'
)
print_error
(
'
The given file does not appear to be a valid RT130 file.
'
)
raise
RT130ParseError
raise
RT130ParseError
experiment_number
=
unpacker
.
unpack
(
'
b
'
,
rt130_packet
[
2
:
3
]
)[
0
]
experiment_number
=
int
(
rt130_packet
[
2
:
3
]
.
hex
())
year
=
int
(
rt130_packet
[
3
:
4
].
hex
())
year
=
int
(
rt130_packet
[
3
:
4
].
hex
())
# A call to str.upper() is needed because bytes.hex() makes any
# A call to str.upper() is needed because bytes.hex() makes any
# hexadecimal letter (i.e. ABCDEF) lowercase, while we want them to be
# hexadecimal letter (i.e. ABCDEF) lowercase, while we want them to be
...
@@ -95,9 +95,9 @@ def read_rt130_file(file_name: str, unpacker: Unpacker):
...
@@ -95,9 +95,9 @@ def read_rt130_file(file_name: str, unpacker: Unpacker):
# RT130 data looks to be all big-endian (logpeek assumes this, and it has
# RT130 data looks to be all big-endian (logpeek assumes this, and it has
# been working pretty well), so we don't have to do any endianness check.
# been working pretty well), so we don't have to do any endianness check.
if
os
.
path
.
getsize
(
file_name
)
%
1024
:
#
if os.path.getsize(file_name) % 1024:
warnings
.
warn
(
'
The size of the data is not a multiple of 1024; it
'
#
warnings.warn('The size of the data is not a multiple of 1024; it '
'
might be truncated.
'
)
#
'might be truncated.')
packets
=
[]
packets
=
[]
...
@@ -199,7 +199,7 @@ class Reftek130(core.Reftek130):
...
@@ -199,7 +199,7 @@ class Reftek130(core.Reftek130):
for
packet
in
packets_in_file
:
for
packet
in
packets_in_file
:
converted_packets
.
append
(
converted_packets
.
append
(
convert_packet_to_obspy_format
(
packet
,
rt130_unpacker
))
convert_packet_to_obspy_format
(
packet
,
rt130_unpacker
))
rt
.
_data
=
numpy
.
array
(
converted_packets
,
PACKET_FINAL_DTYPE
)
rt
.
_data
=
numpy
.
array
(
converted_packets
,
dtype
=
PACKET_FINAL_DTYPE
)
return
rt
return
rt
...
@@ -207,5 +207,5 @@ waveform_file = '/Users/kle/PycharmProjects/sohstationviewer/tests/test_data/RT1
...
@@ -207,5 +207,5 @@ waveform_file = '/Users/kle/PycharmProjects/sohstationviewer/tests/test_data/RT1
soh_file
=
'
/Users/kle/PycharmProjects/sohstationviewer/tests/test_data/RT130-sample/2017149.92EB/2017150/92EB/0/000000000_00000000
'
soh_file
=
'
/Users/kle/PycharmProjects/sohstationviewer/tests/test_data/RT130-sample/2017149.92EB/2017150/92EB/0/000000000_00000000
'
import
time
import
time
start
=
time
.
perf_counter
()
start
=
time
.
perf_counter
()
print
((
Reftek130
.
from_file
(
soh
_file
).
_data
))
print
(
repr
(
Reftek130
.
from_file
(
waveform
_file
).
_data
))
print
(
'
Time taken:
'
,
time
.
perf_counter
()
-
start
)
#
print('Time taken:', time.perf_counter() - start)
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