Skip to content

Commit

Permalink
Docs Update, Fixed Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nick5435 committed Feb 20, 2017
1 parent 41d6358 commit d9e202a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
'navbar_links': [],

# Render the next and previous page links in navbar. (Default: true)
'navbar_sidebarrel': True,
'navbar_sidebarrel': False,

# Render the current pages TOC in the navbar. (Default: true)
'navbar_pagenav': True,
Expand All @@ -142,7 +142,7 @@
# will break.
#
# Values: "true" (default) or "false"
'globaltoc_includehidden': "false",
'globaltoc_includehidden': "true",

# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/thermoDataGrabber.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ thermoDataGrabber
CSVFluid

.. automodule:: thermoDataGrabber
:members: fluid_plot
:members: fluid_plot, rescale
22 changes: 16 additions & 6 deletions thermoDataGrabber/thermoDataGrabber/thermoDataGrabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from mpl_toolkits.mplot3d import Axes3D

import arrow
from typing import Any, Dict, List, Text, Tuple, TypeVar, Union
from typing import Any, Callable, Dict, List, Text, Tuple, TypeVar, Union


class ThermoFluid():
Expand Down Expand Up @@ -303,6 +303,9 @@ def fluid_plot(fluid: Union[CSVFluid, ThermoFluid]) -> None:
Parameters:
fluid (Union[CSVFluid, ThermoFluid]): Which fluid object to make a plot for.
Returns:
None
"""

# Plotting:
Expand All @@ -327,12 +330,19 @@ def fluid_plot(fluid: Union[CSVFluid, ThermoFluid]) -> None:
ax.set_title("{0} and {1} vs {2} of {3}".format(*fluid.vars, fluid.fluid))
plt.show()

def rescale(oldrange: List[float, int], newrange: List[float, int]) -> function:

def rescale(oldrange: List[Union[float, int]],
newrange: List[Union[float, int]]) -> Callable[[Union[float, int]],
Union[float, int]]:
"""
Creates a function that transforms a single variable from oldrange to newrange. Use it with map or Pandas.DataFrame.apply
Paramaters:
oldrange (List[float, int]): The old range of the data, [min, max]
newrange (List[float, int]): The new range of the data, [min, max]
Parameters:
oldrange (List[Union[float, int]]): The old range of the data, [min, max]
newrange (List[Union[float, int]]): The new range of the data, [min, max]
Returns:
closure (Callable[[Union[float, int]], Union[float, int]]): A function that takes in a scalar from the old range, and scales it to the new range.
"""
return lambda x: newrange[1] - newrange[0]) / (oldrange[1] - oldrange[0])*(x - oldrange[0]) + newrange[0]
return lambda x: (newrange[1] - newrange[0]) / (oldrange[1] - oldrange[0]) * (x - oldrange[0]) + newrange[0]

0 comments on commit d9e202a

Please sign in to comment.