Skip to main content

Detector

Struct Detector 

Source
pub struct Detector { /* private fields */ }
Expand description

Spherical detector that collects escaping photons and bins them by direction.

Uses CIE photometric coordinates:

  • C-angle: azimuth (0-360), C0 = +X, C90 = +Y
  • Gamma: from nadir (0-180), gamma=0 = -Z (down), gamma=180 = +Z (up)

Implementations§

Source§

impl Detector

Source

pub fn new(c_resolution_deg: f64, g_resolution_deg: f64) -> Self

Create a new detector with the given angular resolution.

Source

pub fn record(&mut self, direction: &Vector3<f64>, energy: f64)

Record an escaping photon by its world-space direction and energy.

Source

pub fn to_candela(&self, source_flux_lm: f64) -> Vec<Vec<f64>>

Convert accumulated bins to candela values.

cd = (energy_in_bin / solid_angle_of_bin) * (source_flux / total_energy)

Source

pub fn total_flux(&self, source_flux_lm: f64) -> f64

Total detected flux in lumens (for energy conservation validation).

Source

pub fn total_energy(&self) -> f64

Total accumulated energy.

Source

pub fn num_c(&self) -> usize

Number of C bins.

Source

pub fn num_g(&self) -> usize

Number of gamma bins.

Source

pub fn c_resolution_deg(&self) -> f64

C resolution in degrees.

Source

pub fn g_resolution_deg(&self) -> f64

Gamma resolution in degrees.

Source

pub fn bins(&self) -> &Vec<Vec<f64>>

Access raw bins (energy).

Source

pub fn counts(&self) -> &Vec<Vec<u64>>

Access raw counts.

Source

pub fn merge(&mut self, other: &Detector)

Merge another detector’s data into this one (for parallel accumulation).

Source

pub fn candela_at(&self, c_deg: f64, g_deg: f64, source_flux_lm: f64) -> f64

Sample the candela value at a specific (C, gamma) angle pair.

Uses bilinear interpolation from the fine-resolution bins. This allows extracting cd values at the source LDT’s exact (non-uniform) C-plane angles.

Source

pub fn resample(&self, c_step_deg: f64, g_step_deg: f64) -> Detector

Resample to a coarser resolution for export.

Trait Implementations§

Source§

impl Clone for Detector

Source§

fn clone(&self) -> Detector

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Detector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V