raytraverse.integrator

Integrator

class raytraverse.integrator.Integrator(*lightplanes, includesky=True, includesun=True, sunviewengine=None, ds=False, dv=False)[source]

Bases: object

collection of lightplanes with KDtree structure for sun position query

Parameters

lightplanes (Sequence[raytraverse.lightfield.LightPlaneKD]) –

make_images(skydata, points, vm, viewangle=180.0, res=512, interp=False, prefix='img', namebyindex=False, suntol=10.0, blursun=False, resamprad=0.0, bandwidth=10)[source]

see namebyindex for file naming conventions

Parameters
  • skydata (raytraverse.sky.Skydata) –

  • points (np.array) – shape (N, 3)

  • vm (Union[raytraverse.mapper.ViewMapper, np.array]) – either a predefined ViewMapper (used for all points) or an array of view directions (will use a 180 degree view angle when initializing ViewMapper)

  • viewangle (float, optional) – view opening for sensor (0-180,360) when vm is given as an array of view directions.

  • res (int, optional) – image resolution

  • interp (bool, optional) – interpolate image

  • prefix (str, optional) – prefix for output file naming

  • namebyindex (bool, optional) – if False (default), names images by: <prefix>_sky-<row>_pt-<x>_<y>_<z>_vd-<dx>_<dy>_<dz>.hdr if True, names images by: <prefix>_sky-<row>_pt-<pidx>_vd-<vidx>.hdr, where pidx, vidx are refer to the order of points, and vm.

Return type

np.array of out_files shape (skies, points, views)

evaluate(skydata, points, vm, viewangle=180.0, metricclass=<class 'raytraverse.evaluate.metricset.MetricSet'>, metrics=None, datainfo=False, srconly=False, suntol=10.0, blursun=False, coercesumsafe=False, stol=10, minsun=1, emax=10000, **kwargs)[source]

apply sky data and view queries to daylightplane to return metrics parallelizes and optimizes run order.

Parameters
  • skydata (raytraverse.sky.Skydata) –

  • points (np.array) – shape (N, 3)

  • vm (Union[raytraverse.mapper.ViewMapper, np.array]) – either a predefined ViewMapper (used for all points) or an array of view directions (will use ‘viewangle’ when initializing ViewMapper)

  • viewangle (float, optional) – view opening for sensor (0-180,360) when vm is given as an array of view directions, note that for illuminance based metrics, a value of 360 may not make sense as values behind will be negative.

  • metricclass (raytraverse.evaluate.BaseMetricSet, optional) –

  • metrics (Sized, optional) –

  • srconly (bool, optional) – sun only calculations

  • suntol (float, optional) – if Integrator has an engine, resample sun views when actual sun position error is greater than this many degrees.

  • blursun (bool, optional) – apply human PSF to small bright sources

  • coercesumsafe (bool, optional) – attempt to calculate sumsafe metrics

  • datainfo (Union[Sized[str], bool], optional) – include information about source data as additional metrics. Valid values include: [“pt_err”, “pt_idx”, “src_err”, “src_idx”]. If True, includes all.

  • stol (Union[float, int], optional) – maximum angle (in degrees) for matching sun vectors (zonal)

  • minsun (int, optional) – if atleast these many suns are not returned based on stol, directly query for this number of results (regardless of sun error) (zonal)

Return type

raytraverse.lightfield.LightResult

zonal_evaluate(skydata, pm, vm, viewangle=180.0, metricclass=<class 'raytraverse.evaluate.metricset.MetricSet'>, metrics=None, srconly=False, suntol=10.0, blursun=False, coercesumsafe=False, stol=10, minsun=1, datainfo=False, calcarea=True, emax=10000, **kwargs)[source]

apply sky data and view queries to daylightplane to return metrics parallelizes and optimizes run order.

Parameters

evaluate (see) –

Return type

raytraverse.lightfield.ZonalLightResult

SensorIntegrator

class raytraverse.integrator.SensorIntegrator(*lightplanes, ptype=None, factors=None, scale=179.0, **kwargs)[source]

Bases: Integrator

collection of sensorplanes with evaluation routines

Parameters
  • lightplanes (Sequence[raytraverse.lightfield.SensorPlaneKD]) –

  • ptype (Sequence[str]) –

    matching order of lightplanes, requires one for each:

    • ”sky”: represents sky with nsrcs = skydata

    • ”skysun”: represents sky+sun with nsrcs = skydata

    • ”patch”: represents sun contribution as patch

    • ”sun”: sun contribution

    • ”fixed”: does not respond to skydata (electric lighting)

  • factors (Sequence[int], optional) – values, for each light plane to scale contribution of eeach light plane for example, provide (1, -1, 1) for ptype: (“skysun”, “patch”, “sun”) for 2-phase DDS calculation. If not give, all are set to 1

  • scale (float, optional) – default output in lux (179)

make_images(*args, **kwargs)[source]

see namebyindex for file naming conventions

Parameters
  • skydata (raytraverse.sky.Skydata) –

  • points (np.array) – shape (N, 3)

  • vm (Union[raytraverse.mapper.ViewMapper, np.array]) – either a predefined ViewMapper (used for all points) or an array of view directions (will use a 180 degree view angle when initializing ViewMapper)

  • viewangle (float, optional) – view opening for sensor (0-180,360) when vm is given as an array of view directions.

  • res (int, optional) – image resolution

  • interp (bool, optional) – interpolate image

  • prefix (str, optional) – prefix for output file naming

  • namebyindex (bool, optional) – if False (default), names images by: <prefix>_sky-<row>_pt-<x>_<y>_<z>_vd-<dx>_<dy>_<dz>.hdr if True, names images by: <prefix>_sky-<row>_pt-<pidx>_vd-<vidx>.hdr, where pidx, vidx are refer to the order of points, and vm.

Return type

np.array of out_files shape (skies, points, views)

evaluate(skydata, points=None, vm=None, datainfo=False, stol=10, minsun=1, **kwargs)[source]

apply sky data and view queries to daylightplane to return metrics parallelizes and optimizes run order.

Parameters
  • skydata (raytraverse.sky.Skydata) –

  • points (np.array, optional) – shape (N, 3), if None evaluates zone

  • vm (ignored) –

  • datainfo (Union[Sized[str], bool], optional) – include information about source data as additional metrics. Valid values include: [“pt_err”, “pt_idx”, “src_err”, “src_idx”]. If True, includes all. zonal evaluation will only include src_err and src_idx

  • stol (Union[float, int], optional) – maximum angle (in degrees) for matching sun vectors

  • minsun (int, optional) – if atleast these many suns are not returned based on stol, directly query for this number of results (regardless of sun error)

Return type

raytraverse.lightfield.LightResult

zonal_evaluate(skydata, pm, vm=None, datainfo=False, stol=10, minsun=1, calcarea=True, **kwargs)[source]
Parameters

evaluate (see) –

Return type

raytraverse.lightfield.ZonalLightResult

helpers

parallelization functions for integration

raytraverse.integrator.helpers.evaluate_pt(lpts, skyvecs, suns, vm=None, vms=None, metricclass=None, metrics=None, srconly=False, sumsafe=False, suntol=1.0, svengine=None, blursun=False, refl=None, resamprad=0.0, **kwargs)[source]

point by point evaluation suitable for submitting to ProcessPool

raytraverse.integrator.helpers.img_pt(lpts, skyvecs, suns, vms=None, combos=None, qpts=None, skinfo=None, res=512, interp=False, prefix='img', suntol=1.0, svengine=None, refl=None, resamprad=0.0, **kwargs)[source]

point by point evaluation suitable for submitting to ProcessPool

raytraverse.integrator.helpers.prep_ds(lpts, skyvecs)[source]
raytraverse.integrator.helpers.evaluate_pt_ds(lpts, skyvecs, suns, **kwargs)[source]
raytraverse.integrator.helpers.img_pt_ds(lpts, skyvecs, suns, **kwargs)[source]
raytraverse.integrator.helpers.evaluate_pt_dv(lpts, skyvecs, suns, **kwargs)[source]
raytraverse.integrator.helpers.img_pt_dv(lpts, skyvecs, suns, **kwargs)[source]
raytraverse.integrator.helpers.prep_resamp(lpts, refl=None, resamprad=0.0)[source]
raytraverse.integrator.helpers.update_src_view(engine, lpt, sun, vm=None, tol=1.0, refl=None, resampvecs=None, reflarea=None, resamprad=0.0)[source]
raytraverse.integrator.helpers.apply_dsky_patch(skp, skd, skyvecs, skdir, dirlum=None)[source]