Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
T
TooBBA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stelios Karozis
TooBBA
Commits
37c53192
Commit
37c53192
authored
Jun 04, 2021
by
Stelios Karozis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging - Real case use
parent
87b2b8d9
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
36 deletions
+154
-36
CHANGELOG
CHANGELOG
+11
-1
main.py
main.py
+86
-24
tooba_f.py
tooba_f.py
+44
-3
tooba_gmx.py
tooba_gmx.py
+13
-8
No files found.
CHANGELOG
View file @
37c53192
...
...
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.2.0] - 2021-06-04
### Added
- None
### Changed
- Use pickle5 to save data
### Removed
- None
## [0.1.2] - 2020-10-29
### Added
- add OrderedDict() function to keep input ordered independent to Python version
...
...
main.py
View file @
37c53192
This diff is collapsed.
Click to expand it.
tooba_f.py
View file @
37c53192
...
...
@@ -3,11 +3,12 @@ import numpy as np
#from mpl_toolkits.mplot3d import Axes3D
import
matplotlib.pyplot
as
plt
import
scipy.optimize
import
pickle
as
pkl
import
pickle
5
as
pkl
import
json
import
re
import
pandas
as
pd
from
progress.bar
import
Bar
import
joblib
from
pytrr
import
(
read_trr_header
,
...
...
@@ -66,15 +67,47 @@ def center_gravity(a):
cg
=
np
.
sum
(
a
)
/
m
return
cg
class
StreamFile
(
object
):
def
__init__
(
self
,
f
):
self
.
f
=
f
def
__getattr__
(
self
,
item
):
return
getattr
(
self
.
f
,
item
)
def
read
(
self
,
n
):
# print("reading total_bytes=%s" % n, flush=True)
if
n
>=
(
1
<<
31
):
buffer
=
bytearray
(
n
)
idx
=
0
while
idx
<
n
:
batch_size
=
min
(
n
-
idx
,
1
<<
31
-
1
)
# print("reading bytes [%s,%s)..." % (idx, idx + batch_size), end="", flush=True)
buffer
[
idx
:
idx
+
batch_size
]
=
self
.
f
.
read
(
batch_size
)
# print("done.", flush=True)
idx
+=
batch_size
return
buffer
return
self
.
f
.
read
(
n
)
def
write
(
self
,
buffer
):
n
=
len
(
buffer
)
print
(
"writing total_bytes=
%
s..."
%
n
,
flush
=
True
)
idx
=
0
while
idx
<
n
:
batch_size
=
min
(
n
-
idx
,
1
<<
31
-
1
)
print
(
"writing bytes [
%
s,
%
s)... "
%
(
idx
,
idx
+
batch_size
),
end
=
""
,
flush
=
True
)
self
.
f
.
write
(
buffer
[
idx
:
idx
+
batch_size
])
print
(
"done."
,
flush
=
True
)
idx
+=
batch_size
def
topickle
(
fl
,
sv_name
):
print
(
' '
)
print
(
'Save to pickle |################################| 1/1'
)
with
open
(
sv_name
+
'.pkl'
,
'wb'
)
as
handle
:
pkl
.
dump
(
fl
,
handle
,
protocol
=
pkl
.
HIGHEST_PROTOCOL
)
#joblib.dump(fl, handle)
def
frompickle
(
fl
):
with
open
(
fl
,
'rb'
)
as
handle
:
b
=
pkl
.
load
(
handle
)
#b = joblib.load(handle)
return
b
...
...
@@ -83,6 +116,14 @@ def tojson(fl, sv_name):
print
(
'Save to json |################################| 1/1'
)
with
open
(
sv_name
+
'.json'
,
'w'
)
as
file
:
file
.
write
(
json
.
dumps
(
str
(
fl
)))
#file.write(json.dumps(fl))
def
fromjson
(
fl
):
print
(
' '
)
print
(
'Load to json |################################| 1/1'
)
with
open
(
fl
,
'r'
)
as
file
:
data
=
file
.
read
()
b
=
json
.
dumps
(
data
)
return
b
def
plot_surf
(
data
,
normal
,
c
,
save_name
):
#Plot surface
...
...
tooba_gmx.py
View file @
37c53192
...
...
@@ -97,13 +97,18 @@ def rdf_peaks(TRR,TPR,IND,ST,EN,fld,arg1,arg2,dist_pk):
p
.
communicate
(
cmd
.
encode
(
'UTF-8'
))
p
.
send_signal
(
'<Ctrl>-D'
)
p
.
wait
()
try
:
f
=
open
(
fld
+
'/tmp.xvg'
)
f
.
close
()
# Do something with the file
x
,
y
=
read_xvg
(
XVG
=
fld
+
'/tmp.xvg'
)
yhat
=
savgol_filter
(
y
,
15
,
4
)
# window size 15, polynomial order 4
peaks
,
_
=
find_peaks
(
yhat
,
distance
=
dist_pk
)
pathname
=
os
.
path
.
abspath
(
os
.
path
.
join
(
fld
,
'tmp.xvg'
))
os
.
remove
(
pathname
)
except
IOError
:
peaks
=
np
.
ndarray
((
0
))
return
peaks
...
...
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