Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ML
lib
Binary Storage
Commits
f909fc20
Commit
f909fc20
authored
Jan 30, 2020
by
Zhukov, Alexander P
Browse files
Started work on saving in binary format
parent
3a87579a
Changes
4
Hide whitespace changes
Inline
Side-by-side
LV/TestStorage.vi
View file @
f909fc20
No preview for this file type
py/convertBPMdata.py
0 → 100755
View file @
f909fc20
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 30 14:09:25 2020
@author: az9
"""
from
datetime
import
datetime
as
dt
def
convert_line
(
name
,
csv
):
timestamp
=
dt
.
strptime
(
csv
[
0
],
"%I:%M:%S.%f %p %m/%d/%Y"
)
result
=
[]
pv_name
=
name
+
':xAvg'
data
=
float
(
csv
[
1
])
result
.
append
({
'timsetamp'
:
timestamp
,
'name'
:
pv_name
,
'data'
:
data
})
return
result
# result[name+':yAvg'] = csv[2]
# result[name+':phaseAvg'] = csv[3]
# result[name+':ampAvg'] = csv[4]
# num = int(csv[5])
file
=
open
(
'/data/BinStorage/BPMDataRaw/2019_08_06__06-20-41_520-SCL_Diag-BPM00a.csv'
,
'r'
)
gen
=
(
x
.
split
(
','
)
for
x
in
file
)
gen
.
__next__
()
data
=
[
x
for
x
in
gen
]
print
(
convert_line
(
'SCL_Diag:BPM00a'
,
data
[
1
]))
file
.
close
()
\ No newline at end of file
py/read_random.py
View file @
f909fc20
...
...
@@ -9,12 +9,7 @@ Created on Mon Jan 27 16:14:52 2020
from
read_storage
import
BinaryStorage
# file = open('/data/BinStorage/test.bin','rb')
# bytes = file.read(12)
# print(bytes.decode())
file
=
BinaryStorage
(
'/data/BinStorage/test.bin'
)
print
(
file
[
0
::
2
])
print
(
file
[
0
:
10
:
2
])
file
.
close
()
\ No newline at end of file
py/read_storage.py
View file @
f909fc20
...
...
@@ -10,17 +10,19 @@ from datetime import datetime as dt
import
os
HEADER_SZ
=
12
class
BinaryStorage
:
HEADER_SZ
=
12
def
__init__
(
self
,
path
):
self
.
file
=
open
(
'/data/BinStorage/test.bin'
,
'rb'
)
bytes
=
self
.
file
.
read
(
BinaryStorage
.
HEADER_SZ
)
bytes
=
self
.
file
.
read
(
HEADER_SZ
)
# print(bytes.decode())
self
.
rec_table
=
BinaryStorage
.
read_epilog
(
self
.
file
)
self
.
file
.
seek
(
BinaryStorage
.
HEADER_SZ
)
self
.
file
.
seek
(
HEADER_SZ
)
def
close
(
self
):
...
...
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