raytraverse.utility

raytraverse.utility.utility.pool_call(func, args, *fixed_args, cap=None, expandarg=True, desc='processing', workers=True, pbar=True, **kwargs)[source]

calls func for a sequence of arguments using a ProcessPool executor and a progress bar. result is equivalent to:

result = []
for arg in args:
    result.append(func(*args, *fixed_args, **kwargs))
return result
Parameters
  • func (callable) – the function to execute in parallel

  • args (Sequence[Sequence]) – list of arguments (each item is expanded with ‘*’ unless expandarg is false). first N args of func

  • fixed_args (Sequence) – arguments passed to func that are the same for all calls (next N arguments after args)

  • cap (int, optional) – execution cap for ProcessPool

  • expandarg (bool, optional) – expand args with ‘*’ when calling func

  • desc (str, optional) – label for progress bar

  • kwargs – additional keyword arguments passed to func

Return type

sequence of results from func (order preserved)

imagetools

functions for translating from mappers to hdr

raytraverse.utility.imagetools.hdr_uv2ang(imgf, useview=None)[source]
raytraverse.utility.imagetools.hdr_ang2uv(imgf, useview=True)[source]
raytraverse.utility.imagetools.uvarray2hdr(uvarray, imgf, header=None)[source]
raytraverse.utility.imagetools.hdr2uvarray(imgf, vm=None, res=None)[source]
raytraverse.utility.imagetools.hdr2vol(imgf, vm=None)[source]
raytraverse.utility.imagetools.vf_to_vm(view)[source]

view file to ViewMapper

raytraverse.utility.imagetools.hdr2vm(imgf, vpt=False)[source]

hdr to ViewMapper

raytraverse.utility.imagetools.normalize_peak(v, o, l, scale=179, peaka=6.7967e-05, peakt=100000.0, peakr=4, blursun=False)[source]

consolidate the brightest pixels represented by v, o, l up into a single source, correcting the area while maintaining equal energy

Parameters
  • v (np.array) – shape (N, 3), direction vectors of pixels (x, y, z) normalized

  • o (np.array) – shape (N,), solid angles of pixels (steradians)

  • l (np.array) – shape (N,), luminance of pixels

  • scale (Union[float, int], optional) – scale factor for l to convert to cd/m^2, default assumes radiance units

  • peaka (float, optional) – area to aggregate to

  • peakt (Union[float, int], optional) – lower threshold for possible bright pixels

  • peakr (Union[float, int], optional) – ratio, from peak pixel value to lowest value to include when aggregating partially visible sun.

  • blursun (bool, optional) – whether to correct area and luminance according to human PSF

Returns

  • v (np.array) – shape (N, 3), direction vectors of pixels (x, y, z) normalized

  • o (np.array) – shape (N,), solid angles of pixels (steradians)

  • l (np.array) – shape (N,), luminance of pixels

raytraverse.utility.imagetools.imgmetric(imgf, metrics, peakn=False, scale=179, threshold=2000.0, lowlight=False, **peakwargs)[source]

cli

raytraverse.utility.cli.np_load(ctx, param, s)[source]

read np array from command line

trys np.load (numpy binary), then np.loadtxt (space seperated txt file) then split row by spaces and columns by commas.

raytraverse.utility.cli.np_load_safe(ctx, param, s)[source]
raytraverse.utility.cli.shared_pull(ctx, lr=None, col=('metric',), ofiles=None, ptfilter=None, viewfilter=None, skyfilter=None, imgfilter=None, metricfilter=None, skyfill=None, header=True, spd=24, rowlabel=True, info=False, gridhdr=False, imgzone=None, res=480, **kwargs)[source]

used by both raytraverse.cli and raytu, add pull_decs and clk.command_decs as clk.shared_decs in main script so click can properly load options

TStqdm

class raytraverse.utility.TStqdm(*_, **__)[source]

Bases: tqdm

ts_message(s)[source]
write(s, file=None, end='\n', nolock=False)[source]

Print a message via tqdm (without overlap with bars).

set_description(desc=None, refresh=True)[source]

Set/modify description of the progress bar.

Parameters
  • desc (str, optional) –

  • refresh (bool, optional) – Forces refresh [default: True].