Skip to content

Commit

Permalink
fix sphinx docs format
Browse files Browse the repository at this point in the history
  • Loading branch information
sirfoga committed Oct 10, 2018
1 parent 7bd7c3d commit 4c1d76a
Show file tree
Hide file tree
Showing 49 changed files with 574 additions and 392 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.2.0 (c859d152a67f6ee338ef78feb59b846679aa1c68)
10.2.1 (83c4e4dc234e4813263dd7f1ffdcd6be368bd740)
4 changes: 2 additions & 2 deletions hal/__version__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
__title__ = 'hal'
__description__ = 'Your swiss knife to perform fast and easy pythonic stuff'
__url__ = 'https://sirfoga.github.io/pyhal/'
__version__ = '10.2.0'
__build__ = 'c859d152a67f6ee338ef78feb59b846679aa1c68'
__version__ = '10.2.1'
__build__ = '83c4e4dc234e4813263dd7f1ffdcd6be368bd740'
__author__ = 'Stefano Fogarollo'
__author_email__ = 'sirfoga@protonmail.com'
__license__ = 'MIT'
Expand Down
3 changes: 2 additions & 1 deletion hal/charts/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def create_correlation_matrix_plot(correlation_matrix, title, feature_list):
:param correlation_matrix: Correlation matrix of features
:param title: Title of plot
:param feature_list: List of names of features
:return: Shows the given correlation matrix as image
:returns: Shows the given correlation matrix as image
"""
chart = SimpleChart(title)
ax1 = chart.get_ax()
Expand Down
13 changes: 6 additions & 7 deletions hal/charts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def setup(bottom):

def get_fig(self):
"""Gets chart canvas
:return: matplotlib figure
"""
return self.fig

def get_ax(self):
"""Adds to figure
:return: operation completed successfully?
"""
return self.fig.add_subplot(111)
Expand All @@ -51,7 +51,7 @@ def create_bar_chart(self, x_labels, y_values, y_label):
:param x_labels: Names for each variable
:param y_values: Values of x labels
:param y_label: Label of y axis
:return: chart: Bar chart
:returns: chart: Bar chart
"""
self.setup(0.25)
ax1 = self.get_ax()
Expand All @@ -72,9 +72,8 @@ def create_multiple_bar_chart(self, x_labels, mul_y_values, mul_y_labels,
:param x_labels: Names for each variable
:param mul_y_values: list of values of x labels
:param mul_y_labels: list of labels for each y value
:param normalize: True iff you want to normalize each y series
:return: Bar chart
:rtype: chart
:param normalize: True iff you want to normalize each y series (Default value = False)
:returns: Bar chart
"""
self.setup(0.25)
ax1 = self.get_ax()
Expand Down Expand Up @@ -117,7 +116,7 @@ def create_sym_log_bar_chart(self, x_labels, y_values, y_label):
:param x_labels: Names for each variable
:param y_values: Values of x labels
:param y_label: Label of y axis
:return: Sym-log bar chart
:returns: Sym-log bar chart
"""
ax1 = self.create_bar_chart(x_labels, y_values, y_label)
ax1.set_yscale("sym-log", linthreshy=1e-12) # logarithmic plot
Expand Down
72 changes: 65 additions & 7 deletions hal/charts/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ def plot(self, func, mins, maxs, points):
"""Plots function
:param func: function to plot
:param mins: [] minimum of values (x, y ...)
:param maxs: [] maximum of values (x, y ...)
:param points: [] points in axis (x, y ...)
:param mins: minimum of values (x, y ...)
:param maxs: maximum of values (x, y ...)
:param points: points in axis (x, y ...)
"""
pass

@staticmethod
def show_plot():
"""Shows plot
"""
"""Shows plot"""
plt.legend()
plt.show()

Expand All @@ -56,12 +55,23 @@ class Plot2d(Plotter):
"""2d plot"""

def scatter(self, vectors):
"""
:param vectors:
"""
vector_x = vectors[0]
vector_y = vectors[1]
plt.plot(vector_x, vector_y, "-o")
self.show_plot()

def param(self, functions, min_val, max_val, points):
"""
:param functions:
:param min_val:
:param max_val:
:param points:
"""
function_x = functions[0]
function_y = functions[1]

Expand All @@ -74,6 +84,13 @@ def param(self, functions, min_val, max_val, points):
self.show_plot()

def plot(self, func, mins, maxs, points):
"""
:param func:
:param mins:
:param maxs:
:param points:
"""
min_x = mins[0]
max_x = maxs[0]
points = points[0]
Expand All @@ -86,6 +103,10 @@ class Plot3d(Plotter):
"""3D plot"""

def scatter(self, vectors):
"""
:param vectors:
"""
vector_x = vectors[0]
vector_y = vectors[1]
vector_z = vectors[2]
Expand All @@ -99,6 +120,13 @@ def scatter(self, vectors):
self.show_plot()

def param(self, functions, min_val, max_val, points):
"""
:param functions:
:param min_val:
:param max_val:
:param points:
"""
function_x = functions[0]
function_y = functions[1]
function_z = functions[2]
Expand All @@ -119,6 +147,13 @@ def param(self, functions, min_val, max_val, points):
self.show_plot()

def plot(self, func, mins, maxs, points):
"""
:param func:
:param mins:
:param maxs:
:param points:
"""
min_x, min_y = mins[0], mins[1]
max_x, max_y = maxs[0], maxs[1]
points_x, points_y = points[0], points[1]
Expand Down Expand Up @@ -147,12 +182,32 @@ class Plot4d(Plotter):
"""4D plot generator with slider"""

def scatter(self, vectors):
"""
:param vectors:
"""
raise ValueError("Cannot plot 4D vectors in 2D space")

def param(self, functions, min_val, max_val, points):
"""
:param functions:
:param min_val:
:param max_val:
:param points:
"""
raise ValueError("Cannot plot 4D function in 2D space")

def plot(self, func, mins, maxs, points, precision=0.5, kind="slice"):
"""
:param func:
:param mins:
:param maxs:
:param points:
:param precision: (Default value = 0.5)
:param kind: (Default value = "slice")
"""
min_x, min_y, min_z = mins[0], mins[1], mins[2]
max_x, max_y, max_z = maxs[0], maxs[1], maxs[2]

Expand Down Expand Up @@ -182,7 +237,7 @@ def get_precision(min_val, max_val):
:param min_val: minimum
:param max_val: maximum
:return: precision: prevision of values
:returns: precision: prevision of values
"""
return int((max_val - min_val) * (1 + precision))

Expand All @@ -191,11 +246,12 @@ def get_precision_delta(min_val, max_val):
:param min_val: minimum
:param max_val: maximum
:return: delta: Precision delta
:returns: delta: Precision delta
"""
return float(max_val - min_val) / float(10 * precision)

def plot_slice():
""" """
chart = plt.axes(projection="3d") # general settings
points_x = get_precision(min_x, max_x)
points_y = get_precision(min_y, max_z)
Expand Down Expand Up @@ -230,6 +286,8 @@ def update(val):
set_labels(chart, "y", "z", "w")

def plot_countour():
"""Plots countour
"""
# general settings
fig = plt.figure()
chart = fig.gca(projection="3d")
Expand Down
14 changes: 7 additions & 7 deletions hal/cvs/gits.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __str__(self):

def get_totals(self):
"""Calculates total additions and deletions
:return: Dictionary with totals
"""
total_added = 0
Expand Down Expand Up @@ -71,7 +71,7 @@ def __str__(self, date_format="%H:%M:%S %y-%m-%d %z"):

def get_author(self):
"""Gets author
:return: author of commit
"""
author = self.c.author
Expand All @@ -98,14 +98,14 @@ def __init__(self, repo_path):

def get_last_commit(self):
"""Gets last commit
:return: Last commit of repository
"""
return self.r.head.commit

def get_diff_amounts(self):
"""Gets list of total diff
:return: List of total diff between 2 consecutive commits since start
"""
diffs = []
Expand All @@ -126,7 +126,7 @@ def get_diff(self, commit, other_commit):
:param commit: First commit
:param other_commit: Second commit
:return: dictionary: Dictionary with total additions and deletions
:returns: dictionary: Dictionary with total additions and deletions
"""
diff = self.r.git.diff(commit.hexsha, other_commit.hexsha)
return Diff(diff).get_totals()
Expand All @@ -135,7 +135,7 @@ def get_version(self, diff_to_increase_ratio):
"""Gets version
:param diff_to_increase_ratio: Ratio to convert number of changes into
:return: Version of this code, based on commits diffs
:returns: Version of this code, based on commits diffs
"""
diffs = self.get_diff_amounts()
version = Version()
Expand All @@ -150,7 +150,7 @@ def get_pretty_version(self, diff_to_increase_ratio):
:param diff_to_increase_ratio: Ratio to convert number of changes into
version increases
:return: string: Pretty version of this repository
:returns: string: Pretty version of this repository
"""
version = self.get_version(diff_to_increase_ratio)
build = self.get_last_commit_hash()
Expand Down

0 comments on commit 4c1d76a

Please sign in to comment.