Skip to content

Commit

Permalink
Merge pull request #18 from gazprom-neft/pylint
Browse files Browse the repository at this point in the history
Update pylintc
  • Loading branch information
roman-kh authored Mar 4, 2020
2 parents c9568e7 + 8377ae4 commit a46de3b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
5 changes: 2 additions & 3 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ max-line-length=120
max-attributes=8
max-args=10
max-locals=25
good-names = ix, ax, df, fs, im, lc, rc, xc, xy, yc
variable-rgx=([a-z_][a-z0-9_]{2,30}|[a-z_])$ # snake_case + single letters
argument-rgx=([a-z_][a-z0-9_]{2,30}|[a-z_])$ # snake_case + single letters
variable-rgx=([a-z][a-z0-9_]{1,30}|[a-z_])$ # snake_case + single letters
argument-rgx=([a-z][a-z0-9_]{1,30}|[a-z_])$ # snake_case + single letters

[MESSAGE CONTROL]
disable=no-member, no-value-for-parameter, no-self-use, too-many-locals, too-few-public-methods,
Expand Down
16 changes: 8 additions & 8 deletions seismicpro/src/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class IndexTracker:
"""Provides onscroll and update methods for matplotlib scroll_event."""
def __init__(self, ax, frames, frame_names, scroll_step=1, **kwargs):
self.ax = ax
self._ax = ax
self.frames = frames
self.step = scroll_step
self.frame_names = frame_names
Expand All @@ -27,21 +27,21 @@ def onscroll(self, event):

def update(self):
"""Update method."""
self.ax.clear()
self._ax.clear()
img = self.frames[self.ind]
img = np.squeeze(img)
if img.ndim == 2:
self.ax.imshow(img.T, **self.img_kwargs)
self._ax.imshow(img.T, **self.img_kwargs)
elif img.ndim == 1:
self.ax.plot(img.T, **self.img_kwargs)
self._ax.plot(img.T, **self.img_kwargs)
else:
raise ValueError('Invalid ndim to plot data.')

self.ax.set_title('%s' % self.frame_names[self.ind])
self.ax.set_aspect('auto')
self._ax.set_title('%s' % self.frame_names[self.ind])
self._ax.set_aspect('auto')
if img.ndim == 2:
self.ax.set_ylim([img.shape[1], 0])
self.ax.set_xlim([0, img.shape[0]])
self._ax.set_ylim([img.shape[1], 0])
self._ax.set_xlim([0, img.shape[0]])

def seismic_plot(arrs, wiggle=False, xlim=None, ylim=None, std=1, # pylint: disable=too-many-branches, too-many-arguments
pts=None, s=None, scatter_color=None, names=None, figsize=None,
Expand Down
18 changes: 9 additions & 9 deletions seismicpro/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,14 @@ def make_1d_bin_index(dfr, dfs, dfx, bin_size, origin=None, phi=None,
if phi is None:
if np.std(pts[:, 0]) > np.std(pts[:, 1]):
reg = LinearRegression().fit(pts[:, :1], pts[:, 1])
_phi = np.arctan(reg.coef_)[0]
phi_ = np.arctan(reg.coef_)[0]
else:
reg = LinearRegression().fit(pts[:, 1:], pts[:, 0])
_phi = np.arctan(1. / reg.coef_)[0]
phi_ = np.arctan(1. / reg.coef_)[0]
else:
_phi = np.radians(phi[rline]) # pylint: disable=assignment-from-no-return
phi_ = np.radians(phi[rline]) # pylint: disable=assignment-from-no-return

pts = rotate_2d(pts, -_phi)
pts = rotate_2d(pts, - phi_)
ppx, y = pts[:, 0], np.mean(pts[:, 1])

if origin is None:
Expand All @@ -364,19 +364,19 @@ def make_1d_bin_index(dfr, dfs, dfx, bin_size, origin=None, phi=None,
raise ValueError('Unknown grid optimizer.')

s = shift + bin_size * ((np.min(ppx) - shift) // bin_size)
_origin = rotate_2d(np.array([[s, y]]), _phi)[0]
origin_ = rotate_2d(np.array([[s, y]]), phi_)[0]
else:
_origin = origin[rline]
s = rotate_2d(_origin.reshape((-1, 2)), -_phi)[0, 0]
origin_ = origin[rline]
s = rotate_2d(origin_.reshape((-1, 2)), - phi_)[0, 0]

t = np.max(ppx)
bins = np.arange(s, t + bin_size, bin_size)

index = np.digitize(ppx, bins)

dfm.loc[dfm['rline'] == rline, 'x_index'] = index
meta.update({rline: dict(origin=_origin,
phi=np.rad2deg(_phi),
meta.update({rline: dict(origin=origin_,
phi=np.rad2deg(phi_),
bin_size=bin_size)})

dfm['bin_id'] = (dfm['rline'].astype(str) + '/' + dfm['x_index'].astype(str)).values
Expand Down

0 comments on commit a46de3b

Please sign in to comment.