raytraverse.scene

BaseScene

class raytraverse.scene.BaseScene(outdir, scene=None, frozen=True, formatter=<class 'raytraverse.formatter.formatter.Formatter'>, reload=True, overwrite=False, log=True, loglevel=10, utc=False)[source]

Bases: object

container for scene description

Parameters:
  • outdir (str) – path to store scene info and output files

  • scene (str, optional (required if not reload)) – space separated list of radiance scene files (no sky) or octree

  • frozen (bool, optional) – create a frozen octree

  • formatter (raytraverse.formatter.Formatter, optional) – intended renderer format

  • reload (bool, optional) – if True attempts to load existing scene files in new instance overrides ‘overwrite’

  • overwrite (bool, optional) – if True and outdir exists, will overwrite, else raises a FileExistsError

  • log (bool, optional) – log progress events to outdir/log.txt

  • loglevel (int, optional) – maximum sampler level to log

property scene

render scene files (octree)

Getter:

Returns this samplers’s scene file path

Setter:

Sets this samplers’s scene file path and creates run files

Type:

str

reflection_search_scene()[source]
log(instance, message, err=False, level=0)[source]

print a message to the log file or stderr

Parameters:
  • instance (Any) – the parent class for the progress bar

  • message (str, optional) – the message contents

  • err (bool, optional) – print to stderr instead of self._logf

  • level (int, optional) – the nested level of the message

progress_bar(instance, iterable=None, message=None, total=None, level=0, workers=False)[source]

generate a tqdm progress bar and concurrent.futures Executor class

Parameters:
  • instance (Any) – the parent class for the progress bar

  • iterable (Sequence, optional) – passed to tqdm, the sequence to loop over

  • message (str, optional) – the prefix message for the progress bar

  • total (int, optional) – the number of expected iterations (when interable is none)

  • level (int, optional) – the nested level of the progress bar

  • workers (Union[bool, str], optional) – if “thread/threads/t” returns a ThreadPoolExecutor, else if True returns a ProcessPoolExecutor.

Returns:

a subclass of tqdm that decorates messages and has a pool property for multiprocessing.

Return type:

TStqdm

Examples

with an iterable:

for i in self.scene.progress_bar(self, np.arange(10)):
    do stuff...

with workers=True:

with self.scene.progress_bar(self, total=len(jobs) workers=True) as pbar:

exc = pbar.pool do stuff… pbar.update(1)

Scene

class raytraverse.scene.Scene(outdir, scene=None, frozen=True, formatter=<class 'raytraverse.formatter.radianceformatter.RadianceFormatter'>, **kwargs)[source]

Bases: BaseScene

container for radiance scene description

WARNING!! if scene parameter contains and instance primitive, sunsampler will throw a segmentation fault when it tries to change the source. As scene instanciation will make a frozen octree, it is better to feed complete scene description files, or an octree.

Parameters:
reflection_search_scene()[source]
source_scene(srcfile, srcname)[source]

ImageScene

class raytraverse.scene.ImageScene(outdir, scene=None, reload=True, log=False)[source]

Bases: BaseScene

scene for image sampling

Parameters:
  • outdir (str) – path to store scene info and output files

  • scene (str, optional) – image file (hdr format -vta projection)