Experiment

class iadpython.iad.Experiment(r=None, t=None, u=None, sample=None, r_sphere=None, t_sphere=None, num_spheres=0, default_a=None, default_b=None, default_g=None)[source]

Bases: object

Container class for details of an experiment.

Methods Summary

check_measurements()

Make sure measurements are sane.

debug_a_little_summary([stream])

Emit the compact CWEB DEBUG_A_LITTLE final summary.

determine_one_parameter_search()

Establish proper search when only one measurement is available.

determine_search()

Determine type of search to do.

determine_two_parameter_search()

Establish proper search when 2 or 3 measurements are available.

invert_rt()

Find a,b,g for experimental measurements.

invert_scalar_rt([hot_start, initial_simplex])

Find a,b,g for a single experimental measurement.

measured_rt()

Calculate measured reflection and transmission.

measured_rt_from_raw(ur1, ut1, uru, utu[, ...])

Convert raw RT values into the measured M_R/M_T for this experiment.

measurement_distance(m_r, m_t)

Return scaled L2 distance between calculated and measured M_R/M_T.

measurement_distance_from_raw(ur1, ut1, uru, utu)

Return corrected M_R/M_T and scaled L2 distance to the measurements.

point_at([index])

Return a scalar experiment for one row of vector-valued input.

print_dot()

Print a character for each datapoint during analysis.

reset_debug_search_reported()

Reset the CWEB DEBUG_SEARCH final search marker.

useful_measurements()

Count the number of useful measurements.

what_is_b()

Find optical thickness using unscattered transmission.

Methods Documentation

check_measurements()[source]

Make sure measurements are sane.

debug_a_little_summary(stream=None)[source]

Emit the compact CWEB DEBUG_A_LITTLE final summary.

Establish proper search when only one measurement is available.

Determine type of search to do.

Establish proper search when 2 or 3 measurements are available.

invert_rt()[source]

Find a,b,g for experimental measurements.

This method works if m_r, m_t, and m_u are scalars or arrays. When mc_lost_path is set and num_spheres > 0, an outer MC iteration loop refines the lost-light fractions before returning.

Returns:

  • a is the single scattering albedo of the slab

  • b is the optical thickness of the slab

  • g is the anisotropy of single scattering

invert_scalar_rt(hot_start=None, initial_simplex=None)[source]

Find a,b,g for a single experimental measurement.

This routine assumes that m_r, m_t, and m_u are scalars.

Parameters:
  • hot_start – optional (a, b, g) tuple to use as the optimizer starting point for two-parameter searches, bypassing the grid lookup. Pass the previous inversion result here when re-inverting after a lost-light update so the grid is not rebuilt and the previous solution seeds the optimizer.

  • initial_simplex – optional (N+1) × N numpy array passed directly to SciPy’s Nelder-Mead options['initial_simplex']. Only used for find_ab / find_ag / find_bg searches. When None the default SciPy simplex is used.

Returns:

  • a is the single scattering albedo of the slab

  • b is the optical thickness of the slab

  • g is the anisotropy of single scattering

measured_rt()[source]

Calculate measured reflection and transmission.

The direct incident power is \((1-f_u)P\). The reflected power will be \((1-f_u)R_{direct} P\). Since baffles ensure that the light cannot reach the detector, we must bounce the light off the sphere walls to use to above gain formulas. The contribution will then be

\[(1-f_u)R_{direct} (1-a_e) r_w P.\]

The measured power will be

\[P_d = a_d (1-a_e) r_w [(1-f_u) r_{direct} + f_u r_w] P ⋅ G(r_s)\]

Similarly the power falling on the detector measuring transmitted light is

\[P_d'= a_d' t_{direct} r_w' (1-a_e') P ⋅ G'(r_s)\]

when the empty port in the transmission sphere is closed, \(a_e'=0\).

The normalized sphere measurements are

\[M_R = r_{std}⋅\frac{R(r_{direct},r_s)-R(0,0)}{R(r_{std},r_{std})-R(0,0)}\]

and

\[M_T = t_{std}⋅\frac{T(t_{direct},r_s)-T(0,0)}{T(t_{std},r_{std})-T(0,0)}\]
Parameters:
  • ur1 – reflection for collimated incidence

  • ut1 – transmission for collimated incidence

  • uru – reflection for diffuse incidence

  • utu – transmission for diffuse incidence

Returns:

[float, float] – measured reflection and transmission

measured_rt_from_raw(ur1, ut1, uru, utu, include_lost=True, a=None, b=None, g=None, debug_sphere=True)[source]

Convert raw RT values into the measured M_R/M_T for this experiment.

measurement_distance(m_r, m_t)[source]

Return scaled L2 distance between calculated and measured M_R/M_T.

CWEB’s two-parameter searches always compare transmission and, unless albedo is fixed at zero, reflectance. Missing file columns therefore behave like zero-valued measurements once the search needs that axis.

measurement_distance_from_raw(ur1, ut1, uru, utu, include_lost=True, a=None, b=None, g=None, debug_sphere=True)[source]

Return corrected M_R/M_T and scaled L2 distance to the measurements.

point_at(index=None)[source]

Return a scalar experiment for one row of vector-valued input.

print_dot()[source]

Print a character for each datapoint during analysis.

reset_debug_search_reported()[source]

Reset the CWEB DEBUG_SEARCH final search marker.

useful_measurements()[source]

Count the number of useful measurements.

what_is_b()[source]

Find optical thickness using unscattered transmission.