Skip to content

Commit c210292

Browse files
committed
Merge branch 'fix_codacy_issues'
2 parents bd0e724 + 6f7cde9 commit c210292

8 files changed

Lines changed: 80 additions & 99 deletions

File tree

pybilt/bilayer_analyzer/bilayer_analyzer.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@
1818
from __future__ import print_function
1919
from builtins import object
2020
import numpy as np
21-
import warnings
2221
from six.moves import range
2322
try:
2423
import six.moves.cPickle as pickle
2524
except ImportWarning as warn:
2625
import pickle
27-
2826
import os
29-
import multiprocessing
30-
import sys
31-
27+
import ast
3228
# PyBILT imports
3329
from . import com_frame as cf
3430
from . import leaflet as lf
@@ -38,7 +34,7 @@
3834
from . import plot_protocols as pp
3935
from pybilt.common.running_stats import RunningStats
4036
from . import mda_data as md
41-
import MDAnalysis as mda
37+
4238
# import the coordinate wrapping function--for unwrapping
4339
from pybilt.mda_tools.mda_unwrap_vectorized import wrap_coordinates, \
4440
wrap_coordinates_parallel
@@ -509,7 +505,7 @@ def parse_input_script(self, input_script_name):
509505
if key in ['structure', 'trajectory', 'selection']:
510506
second_term = line.replace(key, '', 1).strip()
511507
if key == 'selection':
512-
second_term = eval(second_term)
508+
second_term = ast.literal_eval(second_term)
513509
commands[key] = second_term
514510
else:
515511
if key in self._valid_commands:
@@ -856,28 +852,19 @@ def _build_leaflets_orientation(self):
856852
'lower': lf.Leaflet('lower')}
857853
l = 0
858854
for lipcom in com_frame.lipidcom:
859-
sel_str = "resname {} and resid {}".format(lipcom.type, lipcom.resid)
860-
# residue = self._mda_data.mda_universe.select_atoms(sel_str)
861855
resname = lipcom.type
862856
resid = lipcom.resid
863857
tail_str = "resname {} and resid {} and name {}".format(resname, resid,self.rep_settings['leaflets']['orientation_atoms'][resname][0])
864858
tail = self._mda_data.mda_universe.select_atoms(tail_str)
865-
# print(tail, len(tail))
866859
tail_v = tail.center_of_mass()
867860
head_str = "resname {} and resid {} and name {}".format(resname, resid,self.rep_settings['leaflets']['orientation_atoms'][resname][1])
868861
head = self._mda_data.mda_universe.select_atoms(head_str)
869862
head_v = head.center_of_mass()
870-
# print(tail_v)
871-
# print(head_v)
872863
vec = head_v - tail_v
873-
# print(vec)
874864
norm = self.settings['norm']
875865
norm_vec = np.zeros(3)
876866
norm_vec[norm] = 1.0
877867
cost = np.dot(vec, norm_vec)/np.sqrt(np.dot(vec, vec))
878-
# print(tail_str, head_str)
879-
# print(tail_v, head_v, cost)
880-
# print(" ")
881868
pos = ""
882869
if cost > 0.0:
883870
pos = 'upper'
@@ -917,10 +904,6 @@ def __next__(self):
917904
builds the necessary objects (e.g. COMFrame) and then executes the
918905
analysis of each analysis that was initialized in the setup.
919906
920-
Args:
921-
nprocs (int): An integer specifying the number of cores to use in
922-
multithreaded parallelelization.
923-
924907
"""
925908
if self._current_frame > self._last_frame:
926909
raise StopIteration()
@@ -971,7 +954,7 @@ def __next__(self):
971954
self._oldcoords = oldcoord
972955
# print (wrapcoord)
973956
if self._analysis_protocol.use_objects['com_frame']:
974-
# now build the COMFrame
957+
# now build the COMFrame
975958
self.reps['com_frame'] = cf.COMFrame(frame, self._mda_data.bilayer_sel,
976959
wrapcoord,
977960
name_dict =

pybilt/bilayer_analyzer/com_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def coordinates(self, wrapped=True, leaflet=None):
378378
if wrapped:
379379
coords.append(item.com)
380380
else:
381-
coords.append(item.com_unwrap)
381+
coords.append(item.com_unwrap)
382382
return np.array(coords)
383383

384384
def masses(self):

pybilt/bilayer_analyzer/vector_frame.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
from builtins import object
66
import MDAnalysis as mda
77
import numpy as np
8-
from mpl_toolkits.mplot3d import axes3d
9-
import pybilt.plot_generation.plot_generation_functions as pgf
10-
import matplotlib.pyplot as plt
11-
import sys
128
from six.moves import range
139

1410
class LipidVec(object):
@@ -152,8 +148,8 @@ def __init__(self, mda_frame, mda_bilayer_selection, ref_atoms):
152148
# initialize all the LipidVec objects
153149
for dummy_i in range(nlipids):
154150
self.lipidvec.append(LipidVec())
155-
#atom indices in mda selection/frame
156-
index = mda_bilayer_selection.indices
151+
# atom indices in mda selection/frame
152+
# index = mda_bilayer_selection.indices
157153
# loop over the residues (lipids) and get the centers of mass
158154
## do the wrapped coordinates
159155

pybilt/com_trajectory/COMTraj.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@
2828
import multiprocessing as mp
2929
from scipy.spatial import Voronoi
3030
from scipy.spatial import Delaunay
31-
#import copy
32-
33-
#import running stats class
34-
from pybilt.common.running_stats import *
31+
# import running stats class
32+
from pybilt.common.running_stats import RunningStats, gen_running_average
3533
# import the coordinate wrapping function--for unwrapping
3634
from pybilt.mda_tools.mda_unwrap import wrap_coordinates,wrap_coordinates_parallel
3735
from six.moves import range
@@ -834,7 +832,7 @@ def thickness_frames(frames, fstart, fend, leaflets, nlipids, plane, norm):
834832
comclo = fr.lipidcom[idl].com
835833
distxy = 10000.0
836834
distz = 0.0
837-
mindex = 0
835+
# mindex = 0
838836
zlom = 0.0
839837
zhim = 0.0
840838
xavgm = 0.0
@@ -1344,7 +1342,7 @@ def calc_membrane_thickness(self):
13441342
comclo = fr.lipidcom[idl].com
13451343
distxy = 10000.0
13461344
distz = 0.0
1347-
mindex = 0
1345+
# mindex = 0
13481346
zlom = 0.0
13491347
zhim = 0.0
13501348
xavgm = 0.0
@@ -1509,7 +1507,7 @@ def check_clustering(self, leaflet="both",group="all", dist=15.0):
15091507
#get neighbors of the start
15101508
#mindex=0
15111509
for j in range(len(masterlistf)):
1512-
#for elem in masterlistf:
1510+
#for elem in masterlistf:
15131511
elem = masterlistf[j]
15141512
incluster = elem[1]
15151513
# print "second incluster ",incluster

pybilt/lipid_grid/lipid_grid.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
from __future__ import division
1717
from __future__ import print_function
1818
from builtins import object
19+
from six.moves import range
1920
import numpy as np
20-
import sys
2121
from scipy.ndimage.filters import gaussian_filter
2222
# pybilt imports
2323
from pybilt.common.running_stats import RunningStats
24-
from six.moves import range
25-
26-
2724

2825
def grid_curvature(x_vals, y_vals, zgrid):
2926
"""Compute the Mean and Gaussian curvature across a grid.
@@ -654,7 +651,7 @@ def write_pdb(self, pdb_name, leaflet='both', z_grid_upper=None,
654651

655652
# Open up the file to write to
656653
pdb_out = open(pdb_name, "w")
657-
npoints = (self.nbins_x*self.nbins_y)*len(do_leaflet)
654+
# npoints = (self.nbins_x*self.nbins_y)*len(do_leaflet)
658655
# First line to write is the box dimensions
659656
box = self.frame.box
660657
box_data = "CRYST1 {:06.3f} {:06.3f} {:06.3f}".format(box[0],

0 commit comments

Comments
 (0)