[][src]Struct helixiser::wavefront::Wavefront

pub struct Wavefront {
    pub values: Array2<Complex64>,
    // some fields omitted
}

Fields

values: Array2<Complex64>

A wavefront is a 2D array of complex value where each point corresponds to a coordinate in 2D space. The array indices correspond to a point in space.

Implementations

impl Wavefront[src]

pub fn new(values: Array2<Complex64>) -> Self[src]

Instantiate a new Wavefront struct

pub fn rescale(&mut self, factor: f64)[src]

rescale the (complex) values of the wavefront by a (real) scalar value.

Examples

use assert_approx_eq::assert_approx_eq;
use helixiser::wavefront::Wavefront;
use num::traits::Pow;
use ndarray::arr2;
use num::complex::Complex64;
let mut my_wavefront = Wavefront::new( arr2(&[[Complex64::new(5., 1.),
                                          Complex64::new(0., 0.)],
                                         [Complex64::new(0., 0.),
                                          Complex64::new(4., 2.)]]));
// Rescale the wavefront
my_wavefront.rescale(10.5);

assert_eq!(my_wavefront.values, arr2(&[[Complex64::new(52.5, 10.5),
                                        Complex64::new(0., 0.)],
                                       [Complex64::new(0., 0.),
                                        Complex64::new(42., 21.)]]))

pub fn intensities(&self) -> Array2<f64>[src]

Convert the complex valued wavefront into (real valued) intensities.

Real values are obtained by squaring the norm of the complex values.

pub fn save_image(&self, path: &str)[src]

Save wavefront intensities as image using the image crate

Panics

This function uses the image::save_buffer function which can panic

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.