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
74257d06
Commit
74257d06
authored
11 months ago
by
Kien Le
Browse files
Options
Downloads
Patches
Plain Diff
Stop SOH files being read twice
parent
a5dfb4c4
No related branches found
No related tags found
1 merge request
!280
Optimize reading RT130 data
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sohstationviewer/model/reftek_data/reftek.py
+10
-16
10 additions, 16 deletions
sohstationviewer/model/reftek_data/reftek.py
with
10 additions
and
16 deletions
sohstationviewer/model/reftek_data/reftek.py
+
10
−
16
View file @
74257d06
...
...
@@ -11,6 +11,8 @@ from obspy.core import Stream
from
sohstationviewer.conf
import
constants
from
sohstationviewer.conf.constants
import
SOFTWARE_VERSION
from
sohstationviewer.model.reftek_data.reftek_reader.core
import
\
DecimatedReftek130
from
sohstationviewer.model.reftek_data.reftek_reader.log_file_reader
import
(
LogFileReader
,
process_mass_poss_line
,
LogReadError
,
)
...
...
@@ -297,12 +299,6 @@ class RT130(GeneralData):
raise
ProcessingDataError
(
msg
)
selected_data_set_id
=
data_set_ids
[
0
]
if
not
self
.
on_unittest
and
len
(
data_set_ids
)
>
1
:
msg
=
(
"
There are more than one data set IDs in the given data.
\n
"
"
Please select one to display
"
)
self
.
pause_signal
.
emit
(
msg
,
data_set_ids
)
self
.
pause
()
selected_data_set_id
=
data_set_ids
[
self
.
pause_response
]
self
.
track_info
(
f
'
Select data set ID
{
selected_data_set_id
}
'
,
LogType
.
INFO
)
...
...
@@ -318,7 +314,7 @@ class RT130(GeneralData):
:param path2file: absolute path to file
"""
try
:
rt130
=
core
.
Reftek130
.
from_file
(
path2file
)
rt130
=
core
.
Decimated
Reftek130
.
from_file
(
path2file
)
except
Exception
:
fmt
=
traceback
.
format_exc
()
self
.
track_info
(
f
"
Skip file
{
path2file
}
can
'
t be read
"
...
...
@@ -329,22 +325,20 @@ class RT130(GeneralData):
nbr_packet_type
=
dict
(
zip
(
unique
,
counts
))
if
b
"
SH
"
in
nbr_packet_type
:
self
.
read_sh_packet
(
path2file
)
self
.
read_sh_packet
(
rt130
)
if
b
"
EH
"
in
nbr_packet_type
or
b
"
ET
"
in
nbr_packet_type
:
self
.
read_eh_or_et_packet
(
rt130
)
return
True
def
read_sh_packet
(
self
,
path2file
:
Path
)
->
None
:
def
read_sh_packet
(
self
,
rt130
:
DecimatedReftek130
)
->
None
:
"""
Use soh_packet library to read file with SH packet for soh data
to append tuple (time, log string) to
log_data[self.cur_data_set_id][SOH]
:param
path2file: absolute path to
file
:param
rt130: RT130 object of an SOH
file
.
"""
with
open
(
path2file
,
"
rb
"
)
as
fh
:
str
=
fh
.
read
()
data
=
soh_packet
.
_initial_unpack_packets_soh
(
str
)
data
=
rt130
.
_data
for
ind
,
d
in
enumerate
(
data
):
cur_data_set_id
=
(
d
[
'
unit_id
'
].
decode
(),
f
"
{
d
[
'
experiment_number
'
]
}
"
)
...
...
@@ -363,7 +357,7 @@ class RT130(GeneralData):
self
.
log_data
[
cur_data_set_id
][
'
SOH
'
]
=
[]
self
.
log_data
[
cur_data_set_id
][
'
SOH
'
].
append
((
d
[
'
time
'
],
logs
))
def
read_eh_or_et_packet
(
self
,
rt130
:
core
.
Reftek130
)
->
None
:
def
read_eh_or_et_packet
(
self
,
rt130
:
core
.
Decimated
Reftek130
)
->
None
:
"""
Files that contents EH or ET packets are data stream (DS and
mass position (DS 9) files.
...
...
@@ -394,7 +388,7 @@ class RT130(GeneralData):
self
.
get_mass_pos_data_and_waveform_data
(
rt130
,
data_stream
,
cur_data_set_id
)
def
get_ehet_in_log_data
(
self
,
rt130
:
core
.
Reftek130
,
def
get_ehet_in_log_data
(
self
,
rt130
:
core
.
Decimated
Reftek130
,
cur_data_set_id
:
Tuple
[
str
,
str
])
->
None
:
"""
Read event header info to add to log_data[
'
EHET
'
]
...
...
@@ -419,7 +413,7 @@ class RT130(GeneralData):
(
d
[
'
time
'
],
logs
))
def
get_mass_pos_data_and_waveform_data
(
self
,
rt130
:
core
.
Reftek130
,
data_stream
:
int
,
self
,
rt130
:
core
.
Decimated
Reftek130
,
data_stream
:
int
,
cur_data_set_id
:
Tuple
[
str
,
str
])
->
None
:
"""
Get mass_pos_data for the current data_set_id in DS 9.
...
...
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