raytraverse.scene

Scene

class raytraverse.scene.Scene(outdir, scene=None, area=None, reload=True, overwrite=False, ptres=1.0, ptro=0.0, pttol=1.0, viewdir=0, 1, 0, viewangle=360, skyres=10.0, maxspec=0.3, frozen=True, **kwargs)[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

  • area (str, optional (required if not reload)) – radiance scene file containing planar geometry of analysis area or a list of points (line per point, space seperated, first 3 columns x, y, z

  • 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

  • ptres (float, optional) – final spatial resolution in scene geometry units

  • ptro (float, optional) – angle in degrees counter-clockwise to point grid

  • pttol (float, optional) – tolerance for point search when using point list for area

  • viewdir ((float, float, float), optional) – vector (x,y,z) view direction (orients UV space)

  • viewangle (float, optional) – should be 1-180 or 360

  • skyres (float, optional) – approximate square patch size (sets sun resolution too)

  • maxspec (float, optional) – maximum specular transmission in scene (used to clip pdf for sun sampling)

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

outdir = None

path to store scene info and output files

Type

str

maxspec = None

maximum specular transmission in scene

Type

float

reload = None

try to reload scene files

Type

bool

view = None

view translation class

Type

raytraverse.viewmapper.ViewMapper

property skyres
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

pts()[source]

SunSetterBase

class raytraverse.scene.SunSetterBase(scene, suns=None, prefix='suns', reload=True)[source]

Bases: object

bare bones class for on the fly sunsetter.

Parameters
  • scene (raytraverse.scene.Scene) – scene class containing geometry, location and analysis plane

  • suns (np.array) – sun (N, 5) positions, sizes, and intensities

property suns

holds sun positions

Getter

Returns the sun source array

Setter

Set the sun source array and write to files

Type

np.array

write_sun(i)[source]
_write_suns(sunfile)[source]

write suns to file

Parameters

sunfile

SunSetter

class raytraverse.scene.SunSetter(scene, srct=0.01, skyro=0.0, reload=True, sunres=10.0, **kwargs)[source]

Bases: raytraverse.scene.sunsetterbase.SunSetterBase

select suns to sample based on sky pdf and scene.

Parameters
  • scene (raytraverse.scene.Scene) – scene class containing geometry, location and analysis plane

  • srct (float, optional) – threshold of sky contribution for determining appropriate srcn

  • skyro (float, optional) – sky rotation (in degrees, ccw)

  • reload (bool) – if True reloads existing sun positions, else always generates new

srct = None

threshold of sky contribution for determining appropriate srcn

Type

float

skyro = None

ccw rotation (in degrees) for sky

Type

float

property sunres
property sun_kd

sun kdtree for directional queries

property suns

holds sun positions

Getter

Returns the sun source array

Setter

Set the sun source array and write to files

Type

np.array

choose_suns()[source]
load_sky_facs()[source]
direct_view()[source]
proxy_src(tsuns, tol=10.0)[source]

check if sun directions have matching source in SunSetter

Parameters
  • tsuns (np.array) – (N, 3) array containing sun source vectors to check

  • tol (float) – tolerance (in degrees)

Returns

  • np.array – (N,) index to proxy src

  • list – (N,) error in degrees to proxy sun

SunSetterLoc

class raytraverse.scene.SunSetterLoc(scene, loc, skyro=0.0, **kwargs)[source]

Bases: raytraverse.scene.sunsetter.SunSetter

select suns to sample based on sky pdf, scene, and location.

Parameters
  • scene (raytraverse.scene.Scene) – scene class containing geometry, location and analysis plane

  • loc (tuple) – lat, lon, tz (in degrees, west is positive)

  • srct (float, optional) – threshold of sky contribution for determining appropriate srcn

  • skyro (float, optional) – sky rotation (in degrees, ccw)

  • reload (bool) – if True reloads existing sun positions, else always generates new

sky = None

raytraverse.scene.SkyInfo

choose_suns()[source]

SunSetterPositions

class raytraverse.scene.SunSetterPositions(scene, wea, skyro=0.0, **kwargs)[source]

Bases: raytraverse.scene.sunsetter.SunSetter

select suns to sample based on sky pdf, scene, and sun positions. the wea argument provides a list of sun positions to draw from rather than randomly generating the sun position like SunSetter and SunSetterLoc.

Parameters
  • scene (raytraverse.scene.Scene) – scene class containing geometry, location and analysis plane

  • wea (str, np.array, optional) – path to sun position file or wea file, or array of sun positions

  • srct (float, optional) – threshold of sky contribution for determining appropriate srcn

  • skyro (float, optional) – sky rotation (in degrees, ccw)

  • reload (bool) – if True reloads existing sun positions, else always generates new

scene = None

raytraverse.scene.Scene

skyro = None

ccw rotation (in degrees) for sky

Type

float

property candidates

raytraverse.scene.SkyInfo

choose_suns()[source]

SkyInfo

class raytraverse.scene.SkyInfo(loc, skyro=0.0)[source]

Bases: object

sky location data object

Parameters
  • loc (tuple) – lat, lon, tz (in degrees, west is positive

  • skyro (float) – sky rotation (in degrees, ccw)

skyro = None

ccw rotation (in degrees) for sky

Type

float

property solarbounds

read only extent of solar bounds for given location set via loc

Getter

Returns solar bounds

Type

(np.array, np.array)

property loc

scene location

Getter

Returns location

Setter

Sets location and self.solarbounds

Type

(float, float, int)

in_solarbounds(uv, size=0.0)[source]

for checking if src direction is in solar transit

Parameters
  • uv (np.array) – source directions

  • size (float) – offset around UV to test

Returns

result – Truth of ray.src within solar transit

Return type

np.array