diff --git a/pyradiance/cal.py b/pyradiance/cal.py index 72de15e..2420b90 100644 --- a/pyradiance/cal.py +++ b/pyradiance/cal.py @@ -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 @@ -19,6 +19,7 @@ def cnt( Args: dims: list of dimensions shuffled: if True, the output will be shuffled + Returns: bytes: output of cnt @@ -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: @@ -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 """ diff --git a/pyradiance/cv.py b/pyradiance/cv.py index 848969d..7404e6c 100644 --- a/pyradiance/cv.py +++ b/pyradiance/cv.py @@ -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 """ @@ -69,6 +70,7 @@ def obj2mesh( maxres: Maximum octree resolution silent: Suppress warnings stats: Print statistics + Returns: The converted RADIANCE scene description in bytes """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ diff --git a/pyradiance/gen.py b/pyradiance/gen.py index ef6a6b0..50d27da 100644 --- a/pyradiance/gen.py +++ b/pyradiance/gen.py @@ -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. """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -519,6 +523,7 @@ def mkillum( octree: octree file nproc: number of processes params: additional parameters + Returns: Output of mkillum in bytes """ diff --git a/pyradiance/ot.py b/pyradiance/ot.py index d1ac50f..5cf246c 100644 --- a/pyradiance/ot.py +++ b/pyradiance/ot.py @@ -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 """ @@ -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 """ diff --git a/pyradiance/px.py b/pyradiance/px.py index 6b7dc79..19f06e3 100644 --- a/pyradiance/px.py +++ b/pyradiance/px.py @@ -109,6 +109,7 @@ def pcompos( label_height: label height ncols: number of columns anchor_point: anchor point + Returns: bytes: output of pcompos """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 """ diff --git a/pyradiance/rt.py b/pyradiance/rt.py index 20370b8..a2b4161 100644 --- a/pyradiance/rt.py +++ b/pyradiance/rt.py @@ -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. @@ -244,6 +245,7 @@ def rcontrib( inform: Input format. outform: Output format. params: A list of additional parameters. + Returns: A bytes object. """ @@ -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. @@ -283,6 +286,7 @@ def rpict( report: Report. report_file: Report file. params: A list of additional parameters. + Returns: A bytes object. """ @@ -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. @@ -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. """ diff --git a/pyradiance/util.py b/pyradiance/util.py index c3619f8..4179c22 100644 --- a/pyradiance/util.py +++ b/pyradiance/util.py @@ -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 @@ -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 """ @@ -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.