Skip to content

Reference

pyradiance

pyradiance is a Python interface for Radiance. It is a collection of Python modules that provide a high level interface to Radiance. It is designed to make Radiance easier to use and accessible to Python user.

BSDF

A BSDF object

components property

Report diffuse and specular components.

info property

Report general information about the BSDF

__init__(path)

Initialize the BSDF object from a file

direct_hemi(theta, phi, sflag)

Get hemispherical integral of BSDF. Args: theta: zenith angle (degrees) phi: azimuth angle (degrees) sflag: sampling flag (t, ts, td, r, rs, rd, s) Returns: hemispherical value Examples: >>> import pyradiance as pr >>> pr.BSDF("bsdf.xml").direct_hemi(0, 0, "t") 0.01

eval(itheta, iphi, otheta, ophi)

Query BSDF for given path. Args: itheta: incident zenith angle (degrees) iphi: incident azimuth angle (degrees) otheta: outgoing zenith angle (degrees) ophi: outgoing azimuth angle (degrees) Returns: BSDF color in XYZ Examples: >>> import pyradiance as pr >>> pr.BSDF("bsdf.xml").eval(0, 0, 180, 0) 2.3, 2.3, 2.3

sample(theta, phi, randx, sflag)

Sample BSDF for given direction. Args: theta: zenith angle (degrees) phi: azimuth angle (degrees) randx: random variable [0-1) sflag: sampling flag (t, ts, td, r, rs, rd, s) Returns: Outgoing sample direction and color in XYZ. Examples: >>> pr.BSDF("bsdf.xml").sample(0, 0, 0.5, "r") [0.0, 0.0, 1.0], (0.1, 0.1, 0.1)

samples(theta, phi, nsamp, sflag)

Generate samples for a given incident direction. Args: theta: incident theta angle (degrees) phi: incident phi angle (degrees) nsamp: number of samples sflag: sampling flag {t | ts | td | r | rs | rd | s} Returns: Outgoing sample directions and colors in XYZ. Examples: >>> pr.BSDF("bsdf.xml").samples(0, 0, 10, "r") [[0.0, 0.0, 1.0], [0.0, 0.0, 1.0], ...], [(0.1, 0.1, 0.1), (0.1, 0.1, 0.1), ...]

size(theta, phi, qflags='min_max', t2=None, p2=None)

Get resolution (in proj. steradians) for given direction(s) Args: theta: zenith angle (degrees) phi: azimuth angle (degrees) qflags: query flags (min_max, min, max, avg) t2: second zenith angle (degrees) p2: second azimuth angle (degrees) Returns: resolution(s) (in proj. steradians) Examples: >>> pr.BSDF("bsdf.xml").size(0, 0) 0.0001, 0.0001

Primitive dataclass

Radiance Primitive.

Attributes one-to-one mapped from Radiance.

Attributes:

Name Type Description
modifier str

modifier, which primitive modifies this one

ptype str

primitive type

identifier str

identifier, name of this primitive

sargs Sequence[str]

string arguments

fargs Sequence[float]

real arguments

RcModifier dataclass

Modifier for rcontrib command.

Attributes:

Name Type Description
modifier Optional[str]

Modifier name, mutually exclusive with modifier_path.

modifier_path Optional[str]

File with modifier names, mutually exclusive with modifier.

calfile Optional[str]

Calc file path.

expression Optional[str]

Variable and function expressions.

nbins Optional[str]

Number of bins, can be expression.

binv Optional[str]

Bin value.

param Optional[str]

Parameter.

xres Optional[int]

X resolution.

yres Optional[int]

Y resolution.

output Optional[str]

Output file.

args()

Return modifier as a list of arguments.

Scene

Radiance Scene.

materials property

Scene materials.

octree: str property

Scene id.

sid: str property

Scene id.

sources property

Scene sources.

surfaces property

Scene surfaces.

__init__(sid, **kwargs)

Parameters:

Name Type Description Default
sid str

scene id

required

add_material(material)

Add material to the scene. Args: material: material to be added

add_sensor(sensor)

Add sensor to the scene. Args: sensor: sensor to be added

add_source(source)

Add source to the scene. Args: source: source to be added

add_surface(surface)

Add surface to the scene. Args: surface: surface to be added

add_view(view)

Add view to the scene. Args: view: view to be added

build()

Build an octree, as {sid}.oct in the current directory. Will not build if scene has not changed since last build.

remove_material(material)

Remove material from the scene. Args: material: material to be removed

remove_source(source)

Remove source from the scene. Args: source: source to be removed

remove_surface(surface)

Remove surface from the scene. Args: surface: surface to be removed

View dataclass

Radiance View.

Attributes:

Name Type Description
vtype str

view type

position Tuple[float, float, float]

view position

direction Tuple[float, float, float]

view direction

vup Tuple[float, float, float]

view up

horiz float

horizontal field of view

vert float

vertical field of view

vfore float

view fore

vaft float

view aft

hoff float

horizontal offset

voff float

vertical offset

WrapBSDFInput dataclass

Input data for wrapbsdf command.

args()

Return command as a list of strings.

bsdf2klems(*inp, spp=None, half=False, quater=False, progress_bar=False, progress_bar_length=None, maxlobes=None, forward=False, backward=True, expr=None, file=None)

Generate XML Klems matrix description of a BSDF.

Parameters:

Name Type Description Default
inp

Path to XML file

()
spp Optional[int]

number of samples for each input-output patch pair, default=1024.

None
half bool

Generate instead a half Klems basis XML.

False
quater bool

Generate instead a quater Klems basis XML.

False
progress_bar bool

toggle to show progress bar.

False
progress_bar_length Optional[int]

length of the progress bar, default=79 characters.

None
maxlobes Optional[int]

maximum number of lobes in any interpolated radial basis function (default=15000). Setting the value to 0 turns off this limit.

None
forward bool

generate forward matrix (default=off).

False
backward bool

generate backward matrixi (default=on).

True
expr Optional[str]

expression to evaluate.

None
file Optional[str]

file to write the output to

None

Returns:

Type Description

The output of the command

bsdf2ttree(*inp, isotropic=False, reciprocity_averaging=True, resolution=6, percent_cull=[90], super_samples=256, difference_threshold=0.35, progress_bar=False, progress_bar_length=None, maxlobes=15000, forward=False, backward=True, expr=None, file=None)

Generate XML tensor tree description of a BSDF.

Parameters:

Name Type Description Default
inp

Path to XML file

()
isotropic bool

Generate an isotropic ttree.

False
reciprocity_averaging bool

Use reciprocity averaging.

True
resolution int

resolution of the ttree.

6
percent_cull Sequence[float]

percent of the ttree to cull.

[90]
super_samples int

number of samples for each input-output patch pair, default=1024.

256
difference_threshold float

difference threshold for culling.

0.35
progress_bar bool

toggle to show progress bar.

False
progress_bar_length Optional[int]

length of the progress bar, default=79 characters.

None
maxlobes int

maximum number of lobes in any interpolated radial basis function (default=15000). Setting the value to 0 turns off this limit.

15000
forward bool

generate forward matrix (default=off).

False
backward bool

generate backward matrixi (default=on).

True
expr Optional[str]

expression to evaluate.

None
file Optional[str]

file to write the output to

None

Returns:

Type Description

Tensor tree BSDF XML in bytes

cnt(*dims, shuffled=False)

Index counter.

Parameters:

Name Type Description Default
dims int

list of dimensions

()
shuffled bool

if True, the output will be shuffled

False

Returns:

Name Type Description
bytes bytes

output of cnt

Examples:

>>> cnt(2, 3)
b'0 0\n0 1\n0 2\n1 0\n1 1\n1 2\n'
>>> cnt(2, 3, shuffled=True)
b'1 2\n0 1\n1 0\n0 2\n1 1\n0 0\n'

dctimestep(*mtx, nstep=None, header=True, xres=None, yres=None, inform=None, outform=None, ospec=None)

Call dctimestep to perform matrix multiplication.

Parameters:

Name Type Description Default
mtx

input matrices

()
nstep Optional[int]

number of steps

None
header bool

include header

True
xres Optional[int]

x resolution

None
yres Optional[int]

y resolution

None
inform Optional[str]

input format

None
outform Optional[str]

output format

None
ospec Optional[str]

output specification

None

Returns:

Name Type Description
bytes Optional[bytes]

output of dctimestep

evalglare(inp, view=None, detailed=False, ev_only=False, ev=None, smooth=False, threshold=None, task_area=None, masking_file=None, band_lum_angle=None, check_file=None, correction_mode=None, peak_extraction=True, peak_extraction_value=50000, bg_lum_mode=0, search_radius=0.2, version=False, source_color=None)

Run evalglare on a Radiance image.

Parameters:

Name Type Description Default
inp

input image

required
view Optional[List[str]]

view parameters

None
detailed bool

detailed output

False
ev_only bool

return vertical illuminance value

False
ev Optional[float]

vertical illuminance value to use instead of the one computer from the image.

None
smooth bool

enable smoothing function.

False
threshold Optional[float]

Threshold factor.

None
task_area Optional[tuple]

task area

None
masking_file Optional[Union[str, Path]]

masking file

None
band_lum_angle Optional[float]

band luminance angle

None
check_file Optional[Union[str, Path]]

check file path.

None
correction_mode Optional[str]

correction mode

None
peak_extraction bool

enable luminance peak extraction

True
peak_extraction_value float

luminance peak extraction value

50000
bg_lum_mode int

background luminance calculation mode

0
search_radius float

search radius

0.2
version bool

print version

False
source_color Optional[Tuple[float, float, float]]

source color

None

Returns:

Type Description

Evalglare output

falsecolor(inp, pic_overlay=None, contour=None, extrema=False, scale=None, digits=None, label=None, ndivs=None, lwidth=None, lheight=None, decades=None, multiplier=None, palette=None, redv=None, grnv=None, bluv=None)

Generate a falsecolor Radiance picture.

Parameters:

Name Type Description Default
inp Union[str, Path, bytes]

Path or bytes to input picture file.

required
pic_overlay Optional[str]

Path to another picture to overlay with contours.

None
contour Optional[str]

Type of contour ('b' for bands, 'l' for lines, 'p' for posterization).

None
extrema bool

Flag to print extrema points on the brightest and darkest pixels.

False
scale Optional[str]

Scale for the false color (e.g., 'auto' or specific scale).

None
digits Optional[int]

Max number of decimal places for legend entries.

None
label Optional[str]

Label for the new image.

None
ndivs Optional[int]

Number of contours and corresponding legend entries.

None
lwidth Optional[int]

Width of the legend.

None
lheight Optional[int]

Height of the legend.

None
decades Optional[int]

Number of decades below the maximum scale for logarithmic mapping.

None
multiplier Optional[float]

Multiplier for the scale (e.g., to convert units).

None
palette Optional[str]

Color palette to use for false color.

None
redv Optional[str]

Expression for mapping values to red.

None
grnv Optional[str]

Expression for mapping values to green.

None
bluv Optional[str]

Expression for mapping values to blue.

None

Returns:

Name Type Description
bytes bytes

Output of falsecolor.

genblinds(mat, name, depth, width, height, nslats, angle, rcurv=None)

Generate a RADIANCE description of venetian blinds.

Parameters:

Name Type Description Default
mat str

Material name

required
name str

Name of the blinds

required
depth float

Depth of the blinds

required
width float

Width of the blinds

required
height float

Height of the blinds

required
nslats int

Number of slats

required
angle float

Angle of the slats

required
rcurv Optional[float]

Radius of curvature of the slats, + for upward curvature, - for downward

None

Returns:

Name Type Description
bytes bytes

RADIANCE description of the blinds

Examples:

>>> genblinds('mat', 'blinds', 0.1, 0.5, 1.0, 4, 45, 0.1)

genbsdf(*inp, nsamp=1, nproc=1, params=None, enforce_window=False, ttree_rank=None, ttree_res=None, color=False, reciprocity=True, recover_dir=None, forward=False, backward=True, mgf=None, geom=False, geom_unit=None, dim=None, **kwargs)

Generate BSDF description from Radiance or MGF input

Examples:

>>> genbsdf('material.mat', 'blinds.rad', nsamp=50, nproc=4)

Parameters:

Name Type Description Default
inp Union[str, Path]

Input files. This can be a list of files or a single string with

()
nsamp int

Number of samples to generate. Default is 1.

1
nproc int

Number of processors to use. Default is 1.

1
params Optional[Sequence[str]]

A list of parameters to pass to genBSDF.

None
enforce_window

Set to True to enforce the window. Default is False.

False
ttree_rank Optional[int]

Tensor tree rank, 3 for isotropic and 4 for anisotropic BSDF.

None
ttree_res Optional[int]

Tensor tree BSDF resolution, e.g., 5 6 7.

None
color bool

Set to True to generate color BSDF. Default is False.

False
reciprocity bool

Set to False to disable reciprocity. Default is True.

True
recover_dir Optional[Union[str, Path]]

Set to a path to recover from a previous run.

None
forward bool

Set to True to generate forward BSDF. Default is False.

False
backward bool

Set to True to generate backward BSDF. Default is True.

True
mgf Optional[Union[str, Path]]

Set to a path to a MGF file to use.

None
geom bool

Set to True to generate geometry BSDF. Default is False.

False
geom_unit Optional[str]

Set to a unit to use for geometry BSDF.

None
dim Optional[Sequence[float]]

Set to a list of 6 numbers to use for geometry BSDF.

None
kwargs

Additional parameters to pass to genBSDF.

{}

Returns:

Name Type Description
str bytes

Output of genBSDF.

gendaylit(dt, latitude, longitude, timezone, year=None, dirnorm=None, diffhor=None, dirhor=None, dirnorm_illum=None, diffhor_illum=None, solar=False, sky_only=False, silent=False, grefl=None, interval=None)

Generates a RADIANCE description of the daylight sources using Perez models for direct and diffuse components.

Parameters:

Name Type Description Default
dt datetime

python datetime object

required
latitude float

latitude in degrees

required
longitude float

longitude in degrees

required
timezone int

standard meridian timezone, e.g., 120 for PST

required
year Optional[int]

Need to set it explicitly, won't use year in datetime object

None
dirnorm Optional[float]

direct normal irradiance

None
diffhor Optional[float]

diffuse horizontal irradiance

None
dirhor Optional[float]

direct horizontal irradiance, either this or dirnorm

None
dirnormp

direct normal illuminance

required
diffhorp

diffuse horizontal illuminance

required
solar bool

if True, include solar position

False

Returns:

Name Type Description
str bytes

output of gendaylit

gendaymtx(weather_data, verbose=False, header=True, average=False, sun_only=False, sky_only=False, sun_file=None, sun_mods=None, daylight_hours_only=False, dryrun=False, sky_color=None, ground_color=None, rotate=None, outform=None, onesun=False, solar_radiance=False, mfactor=1)

Generate an annual Perez sky matrix from a weather tape.

Parameters:

Name Type Description Default
weather_data Union[str, Path, bytes]

weather data

required
mfactor int

multiplication factor

1
verbose bool

verbose

False
header bool

header

True
average bool

average

False
sun_only bool

sun only

False
sky_only bool

sky only

False
sun_file Optional[str]

sun file

None
sun_mods Optional[str]

sun mods

None
daylight_hours_only bool

daylight hours only

False
dryrun bool

dryrun

False
sky_color Optional[List[float]]

sky color

None
ground_color Optional[List[float]]

ground color

None
rotate Optional[float]

rotate

None
outform Optional[str]

outform

None
onesun bool

onesun

False
solar_radiance bool

solar radiance

False

Returns:

Name Type Description
bytes

output of gendaymtx

gensdaymtx(weather_data, verbose=False, header=True, sun_only=False, sky_only=False, daylight_hours_only=False, ground_reflectance=None, rotate=None, outform=None, onesun=False, mfactor=1, nthreads=1)

Generate an annual Perez sky matrix from a weather tape.

Parameters:

Name Type Description Default
weather_data Union[str, Path, bytes]

weather data

required
mfactor int

multiplication factor

1
verbose bool

verbose

False
header bool

header

True
sun_only bool

sun only

False
sky_only bool

sky only

False
daylight_hours_only bool

daylight hours only

False
ground_reflectance Optional[List[float]]

ground color

None
rotate Optional[float]

rotate

None
outform Optional[str]

outform

None
onesun bool

onesun

False
solar_radiance

solar radiance

required

Returns:

Name Type Description
bytes

output of gendaymtx

gensky(dt=None, latitude=None, longitude=None, timezone=None, altitude=None, azimuth=None, year=None, sunny_with_sun=False, sunny_without_sun=False, cloudy=False, intermediate_with_sun=False, intermediate_without_sun=False, uniform=False, ground_reflectance=None, zenith_brightness=None, horizontal_brightness=None, solar_radiance=None, horizontal_direct_irradiance=None, turbidity=None)

Generate a RADIANCE description of the sky.

Parameters:

Name Type Description Default
dt Optional[datetime]

datetime object, mutally exclusive with altitude and azimuth

None
latitude Optional[float]

latitude, only apply if dt is not None

None
longitude Optional[float]

longitude, only apply if dt is not None

None
timezone Optional[int]

timezone, only apply if dt is not None

None
altitude Optional[float]

solar altitude, mutally exclusive with dt

None
azimuth Optional[float]

solar azimuth, mutally exclusive with dt

None
year Optional[int]

year, only apply if dt is not None

None
sunny_with_sun bool

sunny with sun

False
sunny_without_sun bool

sunny without sun

False
cloudy bool

CIE overcast sky

False
intermediate_with_sun bool

intermediate with sun

False
intermediate_without_sun bool

intermediate without sun

False
uniform bool

uniform sky

False
ground_reflectance Optional[float]

ground reflectance

None
zenith_brightness Optional[float]

zenith brightness in watts/steradian/meter^2

None
horizontal_brightness Optional[float]

horizontal brightness in watts/metere^2

None
solar_radiance Optional[float]

solar radiance in watts/steradian/meter^2

None
horizontal_direct_irradiance Optional[float]

horizontal direct irradiance in watts/meter^2

None
turbidity Optional[float]

turbidity factor

None

Returns:

Name Type Description
str bytes

output of gensky

genssky(dt, latitude=37.7, longitude=122.2, timezone=120, year=None, res=64, cloud_cover=0.0, ground_reflectance=0.2, broadband_aerosol_optical_depth=0.115, mie_file=None, nthreads=1, out_dir='.', out_name='out')

Generate a RADIANCE description of the spectral sky.

Parameters:

Name Type Description Default
dt datetime

datetime object, mutally exclusive with altitude and azimuth

required
latitude float

latitude, only apply if dt is not None

37.7
longitude float

longitude, only apply if dt is not None

122.2
timezone int

timezone, only apply if dt is not None

120
year Optional[int]

year, only apply if dt is not None

None
cloud_cover float

CIE overcast sky

0.0
ground_reflectance float

ground reflectance

0.2
solar_radiance

solar radiance in watts/steradian/meter^2

required
horizontal_direct_irradiance

horizontal direct irradiance in watts/meter^2

required
turbidity

turbidity factor

required

Returns:

Name Type Description
str bytes

output of gensky

get_header(inp, dimension=False)

Get header information from a Radiance file.

Parameters:

Name Type Description Default
inp

input file or bytes

required

Returns:

Name Type Description
bytes bytes

header

get_image_dimensions(image)

Get the dimensions of an image.

Parameters:

Name Type Description Default
image Union[str, Path, bytes]

image file or bytes

required

Returns:

Type Description
Tuple[int, int]

Tuple[int, int]: width and height

get_view_resolu(path)

Get view and resolu from a view or hdr file Args: path: Path to view or hdr file Returns: A tuple of View and Resolu Examples: >>> pr.get_view_resolu("view.vf")

getinfo(*inputs, dimension_only=False, dimension=False, strip_header=False, replace='', append='', command='')

Get header information from a Radiance file.

Parameters:

Name Type Description Default
inputs Union[str, Path, bytes]

input file or bytes

()
dimension_only bool

return only the dimension

False
dimension bool

return the dimension

False
strip_header bool

strip header from the output

False
replace str

replace the header with this string

''
append str

append this string to the header

''
command str

command to use to get the header

''

Returns:

Type Description
bytes

getinfo output

ies2rad(*inp, libdir=None, prefdir=None, outname=None, stdout=False, units=None, radius=None, instancing_geometry=False, lampdat=None, lamp_type=None, lamp_color=None, set_default_lamp_color=None, multiply_factor=None)

Convert IES luminaire data to RADIANCE description.

Parameters:

Name Type Description Default
inp Union[str, Path]

Path to IES file

()
libdir Optional[str]

Path to directory where the library files are located.

None
outname Optional[str]

Output file name root.

None
stdout bool

Print the output to stdout.

False
units Optional[str]

Set the units of the output file.

None
rad

ignore the crude geometry given by the IES input file and use instead an illum sphere with radius rad.

required
instancing_geometry bool

compile MGF detail geometry into a separate octree and create a single instance referencing it.

False
lampdat Optional[str]

map lamp name to xy chromaticity and lumen depreciation data.

None
lamp_type Optional[str]

lamp type.

None
lamp_color Optional[str]

set lamp color to red green blue if lamp type is unknown.

None
set_default_lamp_color Optional[str]

set default lamp color according to the entry for lamp in the lookup table.

None
multiply_factor Optional[float]

multiply all output quantities by this factor. This is the best way to scale fixture brightness for different lamps.

None

Returns:

Type Description

The output of the command

load_material_smd(file, roughness=0.0, spectral=False, metal=False)

Generate Radiance primitives from csv file from spectral material database (spectraldb.com).

Parameters:

Name Type Description Default
file Path

Path to .csv file

required
roughness float

Roughtness of material

0.0
spectral

Output spectral primitives

False
metal

Material is metal

False

Returns:

Type Description
list[Primitive]

A list of primitives

load_views(file)

Load views from a file. One view per line.

Parameters:

Name Type Description Default
file Union[str, Path]

A file path to a view file.

required

Returns:

Type Description
List[View]

A view object.

mgf2rad(*inp, matfile=None, mult=None, dist=None)

Convert Materials and Geometry Format file to RADIANCE description.

Parameters:

Name Type Description Default
inp

Path to MGF file

()
matfile

Path to material file where the translated materials will be written.

None
mult

multiplier for all the emission values

None
dist

glow distance (in meters) for all emitting surfaces.

None

Returns:

Type Description

The output of the command

mkillum(inp, octree, nproc=1, params=None)

Compute illum sources for a RADIANCE scene

Parameters:

Name Type Description Default
inp bytes

input file content as bytes

required
octree Union[str, Path]

octree file

required
nproc int

number of processes

1
params Optional[Sequence[str]]

additional parameters

None

Returns:

Type Description
bytes

Output of mkillum in bytes

mkpmap(octree, global_map=None, caustic_map=None, volume_map=None, direct_map=None, contrib_map=None, pre_global_map=None, predistrib=None, rect_region=None, sphere_region=None, maxbounce=None, maxprepass=None, port_mod=None, port_modfile=None, precomp=None, seed=None, virtual_mod=None, virtual_modfile=None, amb_excl_mod=None, amb_excl_modfile=None, amb_incl_mod=None, amb_incl_modfile=None, backface_vis=False, sample_res=None, partition_size=None, progress_file=None, overwrite=False, maxdist=None, scattering_albedo=None, extinction_coefficient=None, scattering_eccentricity=None, nproc=1, progress_interval=None)

Mkpmap takes a RADIANCE scene description as an octree and performs Monte Carlo forward path tracing from the light sources, depositing indirect ray hitpoints along with their energy (flux) as "photons". The resulting localised energy distribution represents a global illumination solution which is written to a file for subsequent evaluation by rpict(1), rtrace(1) and rvu(1) in a backward raytracing pass. The photon map(s) can be reused for multiple viewpoints and sensor locations as long as the geometry remains unchanged. Args: octree: Octree file path. global_map: Global map file path and number of photons. caustic_map: Caustic map file path and number of photons. volume_map: Volume map file path and number of photons. direct_map: Direct map file path and number of photons. contrib_map: Contribution map file path and number of photons. pre_global_map: Precomputed global map file path, number of photons and bandwidth. predistrib: Photon predistribution factor. rect_region: Rectangular region sphere_region: Spherical region maxbounce: Maximum number of bounces. maxprepass: Maximum number of iteratiosn of distributoin prepass before terminating. port_mod: Specifies a modifier to act as a photon port. port_modfile: File with modifiers to act as photon ports. precomp: Fraction of global photons to precompute. seed: Random seed. virtual_mod: Specifies a modifier to act as a virtual source. virtual_modfile: File with modifiers to act as virtual sources. amb_excl_mod: Specifies a modifier to exclude from ambient calculation. amb_excl_modfile: File with modifiers to exclude from ambient calculation. amb_incl_mod: Specifies a modifier to include in ambient calculation. amb_incl_modfile: File with modifiers to include in ambient calculation. backface_vis: Backface visibility. sample_res: Sample resolution.

obj2mesh(inp, matfiles=None, matlib=None, objlim=9, maxres=16384, silent=False, stats=False)

Convert Wavefront .OBJ file to RADIANCE description.

Parameters:

Name Type Description Default
inp Union[bytes, str, Path]

Path to OBJ file, or bytes

required
matfiles Optional[Sequence[str]]

Radiance material files to use

None
matlib Optional[str]

Radiance material library file, RAYPATH are searched

None
objlim int

the maximum surface setsize for each voxel

9
maxres int

Maximum octree resolution

16384
silent bool

Suppress warnings

False
stats bool

Print statistics

False

Returns:

Type Description
bytes

The converted RADIANCE scene description in bytes

obj2rad(inp, quallist=False, flatten=False, mapfile=None, objname=None)

Convert Wavefront .OBJ file to RADIANCE description.

Parameters:

Name Type Description Default
inp Union[bytes, str, Path]

Path to OBJ file

required
quallist bool

Produce a list of qualifiers from which to construct a mapping for the given .OBJ file.

False
flatten bool

Flatten all faces, effectively ignoring vertex normal information.

False
mapfile Optional[str]

Mapping rules files for assigning material names for the surfaces.

None
objname Optional[str]

Specify the name of this object, though it will be overriden by any "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.

None

Returns:

Type Description
bytes

The converted RADIANCE scene description in bytes

oconv(*paths, warning=True, stdin=None, frozen=False, octree=None)

Run Radiance oconv tool to build an octree.

Parameters:

Name Type Description Default
paths

list of Radiance files

()
warning

if False, warnings will be suppressed

True
stdin

if not None, stdin will be used

None
frozen bool

if True, the octree will be frozen

False
octree

if provided, the resulting octree incorporate existing one

None

Returns:

Name Type Description
bytes bytes

output of oconv

pabopto2bsdf(*inp, nproc=1, symmetry=None, angle=None, reverse=False)

Convert BSDF measurements to a scattering interpolant representation.

Parameters:

Name Type Description Default
inp

pab-opto Mountain files, need two or more.

()
nproc int

number of processors to use.

1
symmetry Optional[str]

BSDF symmetry, which is one of "isotropic", "quadrilateral", "bilateral", "up", or "anisotropic". Any of these may be abbreviated with as little as a single letter, and case is ignored.

None
angle Optional[Union[float, str]]

cull scattered measurements that are nearer to grazing than the given angle in degrees. If the word "auto" (which can be abbreviated as 'a' or 'A') is given instead of an angle, then the near-grazing angle will be determined by the lowest incident angle measurement present in the input data. This is sometimes necessary to eliminate noise and edge effects that some measurements exhibit near grazing.

None
reverse

reverses the assumed sample orientation front-to-back, and is discussed below under the "#intheta" header entry.

False

Returns:

Type Description
bytes

SIR data in bytes

parse_primitive(pstr)

Parse Radiance primitives inside a file path into a list of dictionary.

Parameters:

Name Type Description Default
pstr str

A string of Radiance primitives.

required

Returns:

Type Description
List[Primitive]

list of primitives

parse_view(vstr)

Parse view string into a View object.

Parameters:

Name Type Description Default
vstr str

view parameters as a string

required

Returns:

Type Description
View

A View object

pcompos(inputs, pos=None, xres=None, yres=None, spacing=0, background=None, anchors=None, header=True, lower_threashold=None, upper_threshold=None, label=None, label_height=None, ncols=None, anchor_point=None)

Composite Radiance pictures

Parameters:

Name Type Description Default
inputs Sequence[Union[Path, str, bytes]]

list of input files

required
pos Optional[Sequence[Sequence[float]]]

list of positions

None
xres Optional[int]

horizontal resolution

None
yres Optional[int]

vertical resolution

None
spacing int

spacing between images

0
background Optional[Tuple[float, float, float]]

background color

None
anchors Optional[Sequence[str]]

list of anchors

None
header bool

set to False if want to reduce header

True
lower_threashold Optional[float]

lower threshold

None
upper_threshold Optional[float]

upper threshold

None
label Optional[str]

label

None
label_height Optional[int]

label height

None
ncols Optional[int]

number of columns

None
anchor_point Optional[Sequence[str]]

anchor point

None

Returns:

Name Type Description
bytes bytes

output of pcompos

pcond(hdr, human=False, acuity=False, veiling=False, sense=False, closs=False, center_weighted=False, linear=False, fixfrac=0.0, fixpoints=None, histo='', expval='', ldmax=100.0, lddyn=100.0, primaries=None, macbeth='', mapfile='')

Condition a Radiance picture.

Parameters:

Name Type Description Default
hdr Path

input hdr

required
human bool

Mimic human visual response. This is the same as turning on all acuity, veiling, sensitivity, and color loss.

False
acuity bool

Defocus darker region.

False
veiling bool

Add veiling glare.

False
sense bool

Use human contrast sensitivity, simulating eye internal scattering.

False
center_weighted bool

Use center-weighted average for acuity and veiling.

False
linear bool

Use a linear reponse function instead of the standard dynamic range compression. This preseves the extremas.

False
fixfrac float

Fixation fraction for acuity and veiling.

0.0
histo str

Histogram file for acuity and veiling.

''
expval str

Exposure value for acuity and veiling.

''
ldmax float

Maximum luminance for acuity and veiling.

100.0
lddyn float

Luminance dynamic range for acuity and veiling.

100.0
primaries Optional[List[float]]

Color primaries for color loss.

None
macbeth str

Macbeth chart file for color loss.

''
mapfile str

Color map file for color loss.

''

Returns:

Name Type Description
bytes bytes

output of pcond

pfilt(image, xres=None, yres=None, pixel_aspect=0, pa_correct=False, exposure=0, lamp=None, lampdat=None, one_pass=False, gaussian_filter_radius=None, limitfrac=None, hot_threshold=100, star_points=0, star_spread=0.0001, average_hot=False)

filter a Radiance picture. By default, it uses two passes on the input, using a box filter.

Parameters:

Name Type Description Default
image Union[str, Path, bytes]

input image

required
xres Optional[str]

horizontal resolution

None
yres Optional[str]

vertical resolution

None
pixel_aspect float

pixel aspect ratio

0
exposure Optional[float]

exposure value

0
lamp Optional[str]

lamp file

None
lampdat Optional[str]

lamp data file

None
one_pass bool

use one pass filter

False
gaussian_filter_radius Optional[float]

gaussian filter radius

None
limitfrac Optional[float]

limit fraction

None
hot_threshold float

Set intensity considered 'hot', default 100 watts/sr/m2

100
star_points int

Number of points on a start pattern.

0
star_spread float

star pattern spread

0.0001
average_hot bool

average hot spots

False

Returns:

Name Type Description
bytes bytes

output of pfilt

pkgbsdf(*xml, frozen=False, stdout=False)

Pacakge BSDFs provided as XML for Radiance.

Parameters:

Name Type Description Default
xml Union[str, Path]

Path to XML files

()
frozen bool

produce frozen octree instance for any detail geometry.

False
stdout bool

print the output to stdout, only works for a single XML input.

False

Returns:

Type Description
Optional[bytes]

The output of the command

pvalue(pic, unique=False, original=False, header=True, resstr=True, skip=0, exposure=0, gamma=1.0, dataonly=False, outform='', reverse_rgb=False, interleaving=True, brightness=False, outprimary=None)

convert RADIANCE picture to/from alternate formats Pvalue converts the pixels of a RADIANCE picture to or from another format. In the default mode, pixels are sent to the standard output, one per line, in the following ascii format: xpos ypos red green blue

Parameters:

Name Type Description Default
pic Union[Path, str, bytes]

hdr file path. Either path or stdin is used, path takes precedence.

required
unique bool

if True, only unique values will be returned

False
original bool

if True, print original values, before exposure compensation

False
header bool

if True, header will be returned

True
resstr bool

if True, resolution string will be returned

True
skip int

number of bytes to skip

0
exposure int

exposure value

0
gamma float

gamma value

1.0
dataonly bool

if True, only data will be returned

False
outform str

output data format

''
reverse_rgb bool

if True, RGB values will be reversed

False
interleaving bool

if True, interleaving will be used

True
brightness bool

if True, only brightness will be returned

False
outprimary Optional[str]

output color primaries

None

Returns:

Name Type Description
bytes bytes

output of pvalue

pvaluer(pic, xres=None, yres=None, inform='a', resstr=True, dataonly=False, header=False, primaries=None, pxyz=False)

Run Radiance pvalue tools reverse mode: constructing a image from pixel values.

Parameters:

Name Type Description Default
pic Union[Path, str, bytes]

Path or bytes of the input pixel data.

required
xres Optional[int]

X resolution.

None
yres Optional[int]

Y resolution.

None
inform str

input data format. Default is "a" for ascii.

'a'
header bool

Set to True if the picture file has a header. Default is False.

False
primaries Optional[List[float]]

List of primaries for XYZ calculation. Default is None.

None
pxyz bool

Set to True to calculate XYZ values. Default is False.

False

Returns:

Type Description
bytes

Bytes of the pvalue output

ra_ppm(inp, gamma=2.2, greyscale=False, reverse=False, exposure=0, ascii=False, outscale=255)

convert RADIANCE picture to/from a Poskanzer Portable Pixmap

Parameters:

Name Type Description Default
inp

Path or bytes to input picture file.

required
gamma float

Gamma value for the output image. Default is 2.2.

2.2
reverse bool

Set to True to invoke a reverse conversion, from a PPM to a RADIANCE picture. Default is False.

False
exposure int

Exposure value for the output image. Default is 0.

0
ascii bool

Set to True to use ASCII Pixmap output. Default is False.

False
outscale int

Output scale value. Default is 255.

255

Returns:

Name Type Description
bytes bytes

output of ra_ppm

ra_tiff(inp, out=None, gamma=2.2, greyscale=False, lzw=False, sgilog=False, sgilog24=False, ieee32=False, primary=False, exposure=0, reverse=False, xyze=False)

ra_tiff - convert RADIANCE picture to/from a TIFF color or greyscale image

Parameters:

Name Type Description Default
inp

Path or bytes to input picture file.

required
out Optional[str]

Path to output file, required when output is a TIFF file.

None
gamma float

Gamma value for the output image. Default is 2.2.

2.2
greyscale bool

Set to True to convert to greyscale. Default is False.

False
lzw bool

Set to True to use LZW compression. Default is False.

False
sgilog bool

Set to True to use SGI log compression. Default is False.

False
sgilog24 bool

Set to True to use SGI log 24 compression. Default is False.

False
ieee32 bool

Set to True to use IEEE 32-bit floating point compression.

False
primary bool

Set to True to use 16-bit/primary output. Default is False.

False
reverse bool

Set to True to invoke a reverse conversion, from a TIFF to a RADIANCE picture. Default is False.

False
xyze bool

Set to True to use XYZE output when invoking a reverse conversion. Default is False.

False

Returns:

Name Type Description
bytes Optional[bytes]

output of ra_tiff

rcalc(inp, sep=None, inform=None, incount=1, outform=None, passive=False, pass_negative=False, inlimit=None, outlimit=None, source=None, expr=None, assign=None, exact_only=False, ignore_newlines=False, silent=False)

Run rcalc

Parameters:

Name Type Description Default
inp

input data

required
sep

separator

None
inform

input format

None
incount

input count

1
outform

output format

None
passive

passive mode

False
pass_negative

pass negative

False
inlimit

input limit

None
outlimit

output limit

None
source

source file

None
expr

expression

None
assign

assign

None
exact_only

exact only

False
ignore_newlines

ignore newlines

False
silent

silent

False

Returns:

Name Type Description
bytes bytes

output of rcalc

rcode_depth(inp, ref_depth='1.0', inheader=True, outheader=True, inresolution=True, outresolution=True, xres=None, yres=None, inform='a', outform='a', decode=False, compute_intersection=False, per_point=False, depth_file=None, flush=False)

Encode/decode 16-bit depth map.

Parameters:

Name Type Description Default
inp Union[str, Path, bytes]

input file or bytes

required
ref_depth str

reference distance, can be follow by /unit.

'1.0'
inheader bool

Set to False to not expect header on input

True
outheader bool

Set to False to not include header on output

True
inresolution bool

Set to False to not expect resolution on input

True
outresolution bool

Set to False to not include resolution on output

True
xres Optional[int]

x resolution

None
yres Optional[int]

y resolution

None
inform str

input format

'a'
outform str

output format when decoding

'a'
decode bool

Set to True to decode instead

False
compute_intersection bool

Set to True to compute intersection instead

False
per_point bool

Set to True to compute per point instead of per pixel

False
depth_file Optional[str]

depth file

None
flush bool

Set to True to flush output

False

Returns:

Name Type Description
bytes bytes

output of rcode_depth

rcode_ident(inp, index_size=16, sep='\n', decode=False, header=True, xres=None, yres=None, resstr=True, identifiers=False, indexes=False, per_point=False, flush=False)

Store identifiers in an indexed map and retrieve from same

Parameters:

Name Type Description Default
inp Union[str, Path, bytes]

input file or bytes

required
index_size int

index size

16
sep str

separator

'\n'
decode bool

Set to True to decode instead

False
header bool

Set to False to not to expect header on input; or not to include header on output when decoding

True
xres Optional[int]

x resolution

None
yres Optional[int]

y resolution

None
resstr bool

Set to False to not include resolution string on output

True
identifiers bool

Set to True to include identifiers on output

False
indexes bool

Set to True to instead list identifiers indexes on output

False
per_point bool

Set to True to compute per point instead of per pixel

False
flush bool

Set to True to flush output after each identifier

False

Returns:

Name Type Description
bytes bytes

output of rcode_ident

rcode_norm(inp, inheader=True, outheader=True, inresolution=True, outresolution=True, xres=None, yres=None, inform='a', outform='a', decode=False, per_point=False, norm_file=None, flush=False)

Encode/decode 32-bit surface normal map.

Parameters:

Name Type Description Default
inp

input file or bytes

required
inheader bool

Set to False to not expect header on input

True
outheader bool

Set to False to not include header on output

True
inresolution bool

Set to False to not expect resolution on input

True
outresolution bool

Set to False to not include resolution on output

True
xres Optional[int]

x resolution

None
yres Optional[int]

y resolution

None
inform str

input format

'a'
outform str

output format when decoding

'a'
decode bool

Set to True to decode instead

False
per_point bool

Set to True to compute per point instead of per pixel

False
flush bool

Set to True to flush output

False

Returns:

Name Type Description
bytes bytes

output of rcode_norm

rcomb(inps, transform=None, transform_all=None, source=None, expression=None, concat=None, outform=None, header=True, silent=False)

Combine multiple rasters.

Parameters:

Name Type Description Default
inps Sequence[RcombInput]

Sequence of RcombInput object

required
transform Optional[str]

transform

None
transform_all Optional[str]

transform all

None
source Optional[str]

source

None
expression Optional[str]

expression

None
concat Optional[Sequence[str]]

concat

None
outform Optional[str]

output format

None
header bool

include header

True
silent bool

suppress output

False

Returns:

Name Type Description
bytes bytes

output of rcomb

rcontrib(inp, octree, modifiers, nproc=1, yres=None, inform=None, outform=None, report=0, params=None)

Run rcontrib command.

Parameters:

Name Type Description Default
inp bytes

A bytes object.

required
octree Union[Path, str]

A path to octree file.

required
modifiers Sequence[RcModifier]

A list of RcModifier objects.

required
nproc int

Number of processes.

1
yres Optional[int]

Y resolution.

None
inform Optional[str]

Input format.

None
outform Optional[str]

Output format.

None
params Optional[Sequence[str]]

A list of additional parameters.

None

Returns:

Type Description
bytes

A bytes object.

read_rad(*paths, inbytes=None)

Read Radiance files and return a list of Primitives. Files order matters. Args: paths: A list of paths to Radiance files. Returns: A list of Primitives. Examples: >>> pr.read_rad("scene.rad")

render(scene, view=None, quality='Medium', variability='Medium', detail='Medium', nproc=1, resolution=None, ambbounce=None, ambcache=True, spectral=False, params=None)

Render a scene.

Parameters:

Name Type Description Default
scene

Scene object.

required
quality str

Quality level.

'Medium'
variability str

Variability level.

'Medium'
detail str

Detail level.

'Medium'
nproc int

Number of processes to use.

1
ambbounce Optional[int]

Number of ambient bounces.

None
ambcache bool

Use ambient cache.

True
params Optional[SamplingParameters]

Sampling parameters.

None

Returns:

Type Description
bytes

tuple[bytes, int, int]: output of render, width, height

rfluxmtx(receiver, surface=None, rays=None, params=None, octree=None, scene=None)

Run rfluxmtx command. Args: scene: A Scene object. sender: A Sender. receiver: A Radiance SensorGrid. option: Radiance parameters for rfluxmtx command as a list of strings. Sender: stdin, polygon Receiver: surface with -o

rlam(*inputs)

Laminate records from multiple files.

Parameters:

Name Type Description Default
inputs

list of input files or bytes. There can

()

Returns:

Name Type Description
bytes bytes

output of rlam

rmtxop(inp, outform='a', transpose=False, scale=None, transform=None, reflectance=None)

Run rmtxop command.

robjutil(inp, radout=False, verbose=False, remove_texture_coordinates=False, remove_surface_normal=False, remove_surface_by_modifier=None, keep_surface_by_modifier=None, remove_surface_by_group=None, keep_surface_by_group=None, epsilon=None, triangulate=False, transform=None)

Operate on Wavefront .OBJ file

Parameters:

Name Type Description Default
inp Union[str, Path]

Input .OBJ file path

required
radout bool

Output RADIANCE scene description

False
verbose bool

Set to True to turn on verbosity

False
remove_texture_coordinates bool

Remove texture coordinates from the output

False
remove_surface_normal bool

Remove surface normal from the output

False
remove_surface_by_modifier Optional[Sequence[str]]

Remove surfaces by modifier, mutually exclusive with keep_surface_by_modifier

None
keep_surface_by_modifier Optional[Sequence[str]]

Keep surfaces by modifier, mutually exclusive with remove_surface_by_modifier

None
remove_surface_by_group Optional[Sequence[str]]

Remove surfaces by group/object, mutually exclusive with keep_surface_by_group

None
keep_surface_by_group Optional[Sequence[str]]

Keep surfaces by group/object, mutually exclusive with remove_surface_by_group

None
epsilon Optional[float]

Coalesce vertices that are within the given epsilon

None
triangulate bool

Turns all faces with 4 or more sides into triangles

False
transform Optional[str]

Transform the input, using xform CLI syntax.

None

Returns:

Type Description
bytes

The output of the command

rpict(view, octree, xres=None, yres=None, report=0, report_file=None, params=None)

Get rpict command.

Parameters:

Name Type Description Default
view Sequence[str]

A list of view parameters in strings.

required
octree Union[Path, str]

A path to octree file.

required
xres Optional[int]

X resolution.

None
yres Optional[int]

Y resolution.

None
report float

Report.

0
report_file Optional[Path]

Report file.

None
params Optional[Sequence[str]]

A list of additional parameters.

None

Returns:

Type Description
bytes

A bytes object.

rsensor(sensor, sensor_view=None, direct_ray=None, ray_count=None, octree=None, nproc=1, params=None)

Compute sensor signal from a RADIANCE scene

Parameters:

Name Type Description Default
sensor Sequence[Union[str, Path]]

Sensor file

required
sensor_view Optional[Sequence[Union[str, Path]]]

Sensor view file

None
direct_ray Optional[Sequence[int]]

The number of rays sent to each light source per sensor

None
ray_count Optional[Sequence[int]]

The number of ray samples sent at random

None
octree Optional[Union[str, Path]]

Octree file

None
nproc int

Number of processors to use

1
params Optional[Sequence[str]]

Additional parameters for rsensor command

None

Returns: Output of rsensor command

rtpict(view, octree, nproc=1, outform=None, outdir=None, ref_depth=None, xres=None, yres=None, params=None)

Run rtpict command. Args: view: A View object. octree: Path to octree file. nproc: Number of processors to use. outform: Output format. Default is "i". outdir: Output directory. Default is current directory. ref_depth: Maximum number of reflections. Default is 5. xres: Horizontal resolution. Default is 512. yres: Vertical resolution. Default is 512. params: Radiance parameters for rtpict command as a list of strings. Returns: Rendered image as output or None if output to directory

rtrace(rays, octree, header=True, inform='a', outform='a', irradiance=False, irradiance_lambertian=False, outspec=None, trace_exclude='', trace_include='', trace_exclude_file=None, trace_include_file=None, uncorrelated=False, xres=None, yres=None, nproc=None, params=None, report=False, version=False)

Run rtrace.

Parameters:

Name Type Description Default
rays bytes

A string of bytes representing the input rays.

required
octree Union[Path, str]

Path to octree file.

required
header bool

A boolean to indicate if the header should be included in the output.

True
inform str

Input format. Default is 'a'.

'a'
outform str

Output format. Default is 'a'.

'a'
irradiance bool

A boolean to indicate if irradiance should be calculated.

False
irradiance_lambertian bool

A boolean to indicate if irradiance should be calculated using Lambertian assumption.

False
outspec Optional[str]

Output specification. Default is None.

None
trace_exclude str

A string of space separated material names to exclude from the trace.

''
trace_include str

A string of space separated material names to include in the trace.

''
trace_exclude_file Optional[Union[str, Path]]

Path to a file containing material names to exclude from the trace.

None
trace_include_file Optional[Union[str, Path]]

Path to a file containing material names to include in the trace.

None
uncorrelated bool

A boolean to indicate if uncorrelated sampling should be used.

False
xres Optional[int]

X resolution of the output image.

None
yres Optional[int]

Y resolution of the output image.

None
nproc Optional[int]

Number of processors to use.

None
options

A SamplingParameters object.

required

Returns:

Type Description
bytes

A string of bytes representing the output of rtrace.

spec_xyz(spec, wlmin, wlmax)

Convert a spectrum into CIE XYZ. Args: spec: A list of spectral values, must be equally spaced in wavelength. wlmin: The minimum wavelength in nm. wlmax: The maximum wavelength in nm. Returns: A tuple of X, Y, Z values.

total(inp, mean=False, sumpower=0, multiply=False, find_max=False, find_min=False, inform=None, incount=1, outform=None, substep=None, substep_reset=True, inlimit=None, outlimit=None, sep=None)

Sum up columns.

Parameters:

Name Type Description Default
inp

input file or bytes

required
mean

if True, the mean value will be calculated

False
sumpower

the power of the sum, mutally exclusive with multiply, find_max, and find_min

0
multiply

if True, the values will be multiplied, mutally exclusive with sumpower, find_max, and find_min

False
find_max

if True, the maximum value will be found, mutally exclusive with sumpower, multiply, and find_min

False
find_min

if True, the minimum value will be found, mutally exclusive with sumpower, multiply, and find_max

False
inform Optional[str]

input format

None
incount

number of input values

1
outform Optional[str]

output format

None
substep Optional[int]

substep

None
substep_reset

if True, the substep will be reset

True
inlimit Optional[int]

input limit

None
outlimit Optional[int]

output limit

None
sep Optional[str]

separator

None

Returns:

Name Type Description
bytes bytes

output of total

vwrays(pixpos=None, unbuf=False, outform='a', ray_count=1, pixel_jitter=0, pixel_diameter=0, pixel_aspect=1, xres=512, yres=512, dimensions=False, view=None, pic=None, zbuf=None)

vwrays.

wrapbsdf(inxml=None, enforce_window=False, comment=None, correct_solid_angle=False, basis=None, inp=None, unlink=False, unit=None, geometry=None, **kwargs)

Wrap BSDF. Args: inp: Input file. Default is stdin. enforce_window: Enforce window convention. Default is False. comment: Comment. Default is None. correct_solid_angle: Correct solid angle. Default is False. basis: Basis. Default is None. tf: Front transmittance. Default is None. tb: Back transmittance. Default is None. rf: Front reflectance. Default is None. rb: Back reflectance. Default is None. spectr: Spectral data. Default is None. unlink: Unlink. Default is False. unit: Unit. Default is None. geometry: Geometry. Default is None. **kwargs: Additional arguments for Window tags such as n, m, t... Returns: Wrapped BSDF.

write(file_path, data, overwrite=True, mode='wb')

Write data to a file.

Parameters:

Name Type Description Default
file_path Union[str, Path]

path to file

required
data Union[str, bytes]

data to write

required
overwrite

if True, overwrite the file if it already exists

True
mode

'w' for text, 'wb' for binary

'wb'

Returns:

Name Type Description
str str

path to file

xform(inp, translate=None, expand_cmd=True, iprefix=None, modifier=None, invert=False, rotatex=None, rotatey=None, rotatez=None, scale=None, mirrorx=False, mirrory=False, mirrorz=False)

Transform a RADIANCE scene description

Notes

Iterate and arrays are not supported.

Parameters:

Name Type Description Default
inp

Input file or string

required
translate Optional[Tuple[float, float, float]]

Translation vector

None
expand_cmd bool

Set to True to expand command

True
iprefix Optional[str]

Prefix identifier

None
mprefix

Set surface modifier to this name

required
invert bool

Invert surface normal

False
rotatex Optional[float]

Rotate the scene degrees about the x axis. A positive rotation corresponds to

None
rotatey Optional[float]

Rotate the scene degrees about the y axis.

None
rotatez Optional[float]

Rotate the scene degrees about the z axis.

None
scale Optional[float]

Scale the scene by this factor

None
mirrorx bool

Mirror the scene about the yz plane.

False
mirrory bool

Mirror the scene about the xz plane.

False
mirrorz bool

Mirror the scene about the xy plane.

False

Returns:

Type Description
bytes

The transformed scene description in bytes

xyz_rgb(x, y, z)

Convert CIE XYZ to RGB (Radiance). Args: x: X value. y: Y value. z: Z value. Returns: A tuple of R, G, B values.