Skip to content

Pep8 naming partial compliance #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix pep8-naming violations
  • Loading branch information
mfisher87 committed Jun 3, 2023
commit 1eb35bbb81a8f3f72cf5c2cb44d3dd94d4c15c32
16 changes: 8 additions & 8 deletions viscm/bezierbuilder/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from scipy.special import binom


def Bernstein(n, k):
def bernstein(n, k):
"""Bernstein polynomial."""
coeff = binom(n, k)

Expand All @@ -14,7 +14,7 @@ def _bpoly(x):
return _bpoly


def Bezier(points, at):
def bezier(points, at):
"""Build Bézier curve from points."""
warnings.warn(
message="Deprecated. CatmulClark builds nicer splines.",
Expand All @@ -24,14 +24,14 @@ def Bezier(points, at):

at = np.asarray(at)
at_flat = at.ravel()
N = len(points)
n = len(points)
curve = np.zeros((at_flat.shape[0], 2))
for ii in range(N):
curve += np.outer(Bernstein(N - 1, ii)(at_flat), points[ii])
for ii in range(n):
curve += np.outer(bernstein(n - 1, ii)(at_flat), points[ii])
return curve.reshape((*at.shape, 2))


def CatmulClark(points, at):
def catmul_clark(points, at):
points = np.asarray(points)

while len(points) < len(at):
Expand All @@ -48,6 +48,6 @@ def CatmulClark(points, at):


curve_method = {
"Bezier": Bezier,
"CatmulClark": CatmulClark,
"Bezier": bezier,
"CatmulClark": catmul_clark,
}
12 changes: 6 additions & 6 deletions viscm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def cli():
if cm is None:
sys.exit("Please specify a colormap")
fig = plt.figure()
figureCanvas = gui.FigureCanvas(fig)
figure_canvas = gui.FigureCanvas(fig)
v = gui.viscm(cm.cmap, name=cm.name, figure=fig, uniform_space=cm.uniform_space)
mainwindow = gui.ViewerWindow(figureCanvas, v, cm.name)
mainwindow = gui.ViewerWindow(figure_canvas, v, cm.name)
if args.save is not None:
v.figure.set_size_inches(20, 12)
v.figure.savefig(args.save)
Expand All @@ -103,25 +103,25 @@ def cli():
sys.exit("Sorry, I don't know how to edit the specified colormap")
# Hold a reference so it doesn't get GC'ed
fig = plt.figure()
figureCanvas = gui.FigureCanvas(fig)
figure_canvas = gui.FigureCanvas(fig)
v = gui.viscm_editor(
figure=fig,
uniform_space=cm.uniform_space,
cmtype=cm.cmtype,
method=cm.method,
**cm.params,
)
mainwindow = gui.EditorWindow(figureCanvas, v)
mainwindow = gui.EditorWindow(figure_canvas, v)
else:
raise RuntimeError("can't happen")

if args.quit:
sys.exit()

figureCanvas.setSizePolicy(
figure_canvas.setSizePolicy(
gui.QtWidgets.QSizePolicy.Expanding, gui.QtWidgets.QSizePolicy.Expanding
)
figureCanvas.updateGeometry()
figure_canvas.updateGeometry()

mainwindow.resize(800, 600)
mainwindow.show()
Expand Down