Skip to content

Commit

Permalink
docs: fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Taoning Wang committed Aug 31, 2023
1 parent 4d16fce commit 3f956aa
Show file tree
Hide file tree
Showing 6 changed files with 708 additions and 443 deletions.
5 changes: 3 additions & 2 deletions frads/eprad.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import datetime, timedelta
import json
from pathlib import Path
from typing import Optional, Callable
from typing import Optional, Callable, Union

from frads import sky
from frads.window import GlazingSystem
Expand Down Expand Up @@ -34,10 +34,11 @@ class EnergyPlusModel:
>>> model = EnergyPlusModel(Path("model.idf"))
"""

def __init__(self, fpath: Path):
def __init__(self, fpath: Union[str, Path]):
"""Load and parse input file into a JSON object.
If the input file is in .idf format, use command-line
energyplus program to convert it to epJSON format
Args:
fpath: input file path
"""
Expand Down
15 changes: 7 additions & 8 deletions frads/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,14 @@ def _calculate_area(self):
def _calculate_centroid(self):
return np.mean(self._vertices, axis=0)

def scale(self, scale_vect: np.ndarray, center: np.ndarray):
def scale(self, scale_vect: np.ndarray, center: np.ndarray) -> "Polygon":
"""Scale the polygon.
Parameters:
scale_vect (numpy array): scale along x, y, z;
center (numpy array): center of scaling
Args:
scale_vect: scale along x, y, z;
center: center of scaling
Returns:
Scaled polygon (Polygon)
Scaled polygon
"""

new_vertices = []
Expand Down Expand Up @@ -322,7 +321,7 @@ def get_polygon_limits(polygon_list: Sequence[Polygon], offset: float = 0.0):
return xmin, xmax, ymin, ymax, zmin, zmax


def getbbox(polygons: Sequence[Polygon], offset: float = 0.0):
def getbbox(polygons: Sequence[Polygon], offset: float = 0.0) -> List[Polygon]:
"""Get a bounding box for a list of polygons.
Return a list of polygon that is the
Expand Down Expand Up @@ -362,7 +361,7 @@ def merge_polygon(polygons: Sequence[Polygon]) -> Polygon:
Returns:
Merged polygon
Raises:
ValueError if window normals are not the same
ValueError: if windows are not co-planar
"""
normals = [p.normal for p in polygons]
if len(set(map(tuple, normals))) > 1:
Expand Down
Loading

0 comments on commit 3f956aa

Please sign in to comment.