Skip to content

Commit

Permalink
fix(doc): clean up doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
taoning committed Aug 23, 2024
1 parent 88d8974 commit 800a65c
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 2 deletions.
29 changes: 27 additions & 2 deletions pyradiance/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Radiance calculation utilites
"""

from pathlib import Path
import subprocess as sp
from pathlib import Path
from typing import Optional

from .anci import BINPATH, handle_called_process_error
Expand All @@ -19,6 +19,7 @@ def cnt(
Args:
dims: list of dimensions
shuffled: if True, the output will be shuffled
Returns:
bytes: output of cnt
Expand Down Expand Up @@ -52,7 +53,30 @@ def rcalc(
exact_only=False,
ignore_newlines=False,
silent=False,
):
) -> bytes:
"""
Run rcalc
Args:
inp: input data
sep: separator
inform: input format
incount: input count
outform: output format
passive: passive mode
pass_negative: pass negative
inlimit: input limit
outlimit: output limit
source: source file
expr: expression
assign: assign
exact_only: exact only
ignore_newlines: ignore newlines
silent: silent
Returns:
bytes: output of rcalc
"""
stdin = None
cmd = [str(BINPATH / "rcalc")]
if sep is not None:
Expand Down Expand Up @@ -177,6 +201,7 @@ def rlam(
Args:
inputs: list of input files or bytes. There can
only be one bytes input.
Returns:
bytes: output of rlam
"""
Expand Down
10 changes: 10 additions & 0 deletions pyradiance/cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def obj2rad(
"o" statements in the input file. If this option is absent, and there
are no "o" statements, obj2rad will attempt to name surfaces based
on their group associations.
Returns:
The converted RADIANCE scene description in bytes
"""
Expand Down Expand Up @@ -69,6 +70,7 @@ def obj2mesh(
maxres: Maximum octree resolution
silent: Suppress warnings
stats: Print statistics
Returns:
The converted RADIANCE scene description in bytes
"""
Expand Down Expand Up @@ -102,6 +104,7 @@ def pkgbsdf(
xml: Path to XML files
frozen: produce frozen octree instance for any detail geometry.
stdout: print the output to stdout, only works for a single XML input.
Returns:
The output of the command
"""
Expand Down Expand Up @@ -152,6 +155,7 @@ def robjutil(
epsilon: Coalesce vertices that are within the given epsilon
triangulate: Turns all faces with 4 or more sides into triangles
transform: Transform the input, using xform CLI syntax.
Returns:
The output of the command
"""
Expand Down Expand Up @@ -189,11 +193,13 @@ def robjutil(
@handle_called_process_error
def mgf2rad(*inp, matfile=None, mult=None, dist=None):
"""Convert Materials and Geometry Format file to RADIANCE description.
Args:
inp: Path to MGF file
matfile: Path to material file where the translated materials will be written.
mult: multiplier for all the emission values
dist: glow distance (in meters) for all emitting surfaces.
Returns:
The output of the command
"""
Expand Down Expand Up @@ -242,6 +248,7 @@ def ies2rad(
set_default_lamp_color: set default lamp color according to the entry for lamp in the lookup table.
multiply_factor: multiply all output quantities by this factor. This is the best way to scale
fixture brightness for different lamps.
Returns:
The output of the command
"""
Expand Down Expand Up @@ -305,6 +312,7 @@ def bsdf2klems(
backward: generate backward matrixi (default=on).
expr: expression to evaluate.
file: file to write the output to
Returns:
The output of the command
"""
Expand Down Expand Up @@ -378,6 +386,7 @@ def bsdf2ttree(
backward: generate backward matrixi (default=on).
expr: expression to evaluate.
file: file to write the output to
Returns:
Tensor tree BSDF XML in bytes
"""
Expand Down Expand Up @@ -449,6 +458,7 @@ def pabopto2bsdf(
necessary to eliminate noise and edge effects that some measurements exhibit near grazing.
reverse: reverses the assumed sample orientation front-to-back, and is discussed below under
the "#intheta" header entry.
Returns:
SIR data in bytes
"""
Expand Down
5 changes: 5 additions & 0 deletions pyradiance/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def genbsdf(
geom_unit: Set to a unit to use for geometry BSDF.
dim: Set to a list of 6 numbers to use for geometry BSDF.
kwargs: Additional parameters to pass to genBSDF.
Returns:
str: Output of genBSDF.
"""
Expand Down Expand Up @@ -172,6 +173,7 @@ def gendaylit(
dirnormp: direct normal illuminance
diffhorp: diffuse horizontal illuminance
solar: if True, include solar position
Returns:
str: output of gendaylit
"""
Expand Down Expand Up @@ -405,6 +407,7 @@ def gensky(
solar_radiance: solar radiance in watts/steradian/meter^2
horizontal_direct_irradiance: horizontal direct irradiance in watts/meter^2
turbidity: turbidity factor
Returns:
str: output of gensky
"""
Expand Down Expand Up @@ -481,6 +484,7 @@ def genssky(
solar_radiance: solar radiance in watts/steradian/meter^2
horizontal_direct_irradiance: horizontal direct irradiance in watts/meter^2
turbidity: turbidity factor
Returns:
str: output of gensky
"""
Expand Down Expand Up @@ -519,6 +523,7 @@ def mkillum(
octree: octree file
nproc: number of processes
params: additional parameters
Returns:
Output of mkillum in bytes
"""
Expand Down
4 changes: 4 additions & 0 deletions pyradiance/ot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ def getbbox(
header: bool = False,
) -> List[float]:
"""Get axis-aligned bounding box of a Radiance scene.
Args:
path: path to Radiance scene
header: include header
Returns:
list: bounding box
"""
Expand All @@ -31,12 +33,14 @@ def getbbox(
@handle_called_process_error
def oconv(*paths, warning=True, stdin=None, frozen: bool = False, octree=None) -> bytes:
"""Run Radiance oconv tool to build an octree.
Args:
paths: list of Radiance files
warning: if False, warnings will be suppressed
stdin: if not None, stdin will be used
frozen: if True, the octree will be frozen
octree: if provided, the resulting octree incorporate existing one
Returns:
bytes: output of oconv
"""
Expand Down
7 changes: 7 additions & 0 deletions pyradiance/px.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def pcompos(
label_height: label height
ncols: number of columns
anchor_point: anchor point
Returns:
bytes: output of pcompos
"""
Expand Down Expand Up @@ -204,6 +205,7 @@ def pcond(
primaries: Color primaries for color loss.
macbeth: Macbeth chart file for color loss.
mapfile: Color map file for color loss.
Returns:
bytes: output of pcond
"""
Expand Down Expand Up @@ -286,6 +288,7 @@ def pfilt(
star_points: Number of points on a start pattern.
star_spread: star pattern spread
average_hot: average hot spots
Returns:
bytes: output of pfilt
"""
Expand Down Expand Up @@ -425,6 +428,7 @@ def pvalue(
interleaving: if True, interleaving will be used
brightness: if True, only brightness will be returned
outprimary: output color primaries
Returns:
bytes: output of pvalue
"""
Expand Down Expand Up @@ -489,6 +493,7 @@ def pvaluer(
header: Set to True if the picture file has a header. Default is False.
primaries: List of primaries for XYZ calculation. Default is None.
pxyz: Set to True to calculate XYZ values. Default is False.
Returns:
Bytes of the pvalue output
"""
Expand Down Expand Up @@ -551,6 +556,7 @@ def ra_tiff(
to a RADIANCE picture. Default is False.
xyze: Set to True to use XYZE output when invoking a reverse
conversion. Default is False.
Returns:
bytes: output of ra_tiff
"""
Expand Down Expand Up @@ -619,6 +625,7 @@ def ra_ppm(
exposure: Exposure value for the output image. Default is 0.
ascii: Set to True to use ASCII Pixmap output. Default is False.
outscale: Output scale value. Default is 255.
Returns:
bytes: output of ra_ppm
"""
Expand Down
6 changes: 6 additions & 0 deletions pyradiance/rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def rcontrib(
params: Optional[Sequence[str]] = None,
) -> bytes:
"""Run rcontrib command.
Args:
inp: A bytes object.
octree: A path to octree file.
Expand All @@ -244,6 +245,7 @@ def rcontrib(
inform: Input format.
outform: Output format.
params: A list of additional parameters.
Returns:
A bytes object.
"""
Expand Down Expand Up @@ -275,6 +277,7 @@ def rpict(
params: Optional[Sequence[str]] = None,
) -> bytes:
"""Get rpict command.
Args:
view: A list of view parameters in strings.
octree: A path to octree file.
Expand All @@ -283,6 +286,7 @@ def rpict(
report: Report.
report_file: Report file.
params: A list of additional parameters.
Returns:
A bytes object.
"""
Expand Down Expand Up @@ -325,6 +329,7 @@ def rtrace(
version: bool = False,
) -> bytes:
"""Run rtrace.
Args:
rays: A string of bytes representing the input rays.
octree: Path to octree file.
Expand All @@ -348,6 +353,7 @@ def rtrace(
yres: Y resolution of the output image.
nproc: Number of processors to use.
options: A SamplingParameters object.
Returns:
A string of bytes representing the output of rtrace.
"""
Expand Down
3 changes: 3 additions & 0 deletions pyradiance/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ def xform(
mirrorx: Mirror the scene about the yz plane.
mirrory: Mirror the scene about the xz plane.
mirrorz: Mirror the scene about the xy plane.
Returns:
The transformed scene description in bytes
Expand Down Expand Up @@ -1153,6 +1154,7 @@ def load_material_smd(
roughness: Roughtness of material
spectral: Output spectral primitives
metal: Material is metal
Returns:
A list of primitives
"""
Expand Down Expand Up @@ -1204,6 +1206,7 @@ def load_material_smd(

def parse_primitive(pstr: str) -> List[Primitive]:
"""Parse Radiance primitives inside a file path into a list of dictionary.
Args:
pstr: A string of Radiance primitives.
Expand Down

0 comments on commit 800a65c

Please sign in to comment.