Grid

class iadpython.grid.Grid(search=None, default=None, N=21)[source]

Bases: object

Class to track pre-calculated R & T values.

There is a long story associated with these routines. I spent a lot of time trying to find an empirical function to allow a guess at a starting value for the inversion routine. Basically nothing worked very well. There were too many special cases and what not. So I decided to calculate a whole bunch of reflection and transmission values and keep their associated optical properties linked nearby.

Spacing mirrors CWEB iad_calc.w: - b: log-spaced from exp(-8) to exp(+8) [find_ab/find_ag] or exp(+10) [find_bg] - a: nonlinear, denser near 0 and 1 - g: nonlinear, symmetric and denser near ±0.999999

Methods Summary

calc(exp[, default])

Precalculate a grid.

is_stale(exp, default[, search])

Decide if current grid is still useful.

min_abg(mr, mt[, exp])

Find a, b, g closest to mr and mt.

Methods Documentation

calc(exp, default=None)[source]

Precalculate a grid.

Albedo uses nonlinear spacing denser near 0 and 1. Optical thickness uses log spacing over exp(-8) to exp(+8) [or exp(+10) for find_bg], matching CWEB Fill_AB_Grid / Fill_BG_Grid. Anisotropy uses nonlinear symmetric spacing denser near ±0.999999.

is_stale(exp, default, search=None)[source]

Decide if current grid is still useful.

min_abg(mr, mt, exp=None)[source]

Find a, b, g closest to mr and mt.

Locates the nearest grid cell in L1 measurement space, then checks the full 3×3 neighbourhood (mirrors CWEB Near_Grid_Points + Grid_ABG loop in iad_find.w). Returns the single best candidate from that neighbourhood.