pub fn new(
        name : &str,
        spectrum_type : &str,
        state : &str,
        xunits : Xunits,
        yunits : Yunits,
        first_x : f32,
        last_x : f32,
        npoints : i32
        ) -> Spectrum {
        let (mut first_x, mut last_x) = (first_x, last_x);
        // Enforces that first_x is less than last_x
        if first_x > last_x {
            let temp = first_x;
            first_x = last_x;
            last_x = temp;
        }
        // Handles different xunit cases
        match xunits {
            Xunits::cm => {},
            Xunits::um => {
                let temp = first_x;
                first_x = 10000.0 / last_x;
                last_x = 10000.0 / temp;
            }
        }

        assert!(npoints > 1 );
        let delta_x : f32 = (last_x - first_x) / (npoints as f32 - 1.0);
        Spectrum {
            name : name.to_string(),
            spectrum_type : spectrum_type.to_string(),
            state : state.to_string(),
            yunits,
            delta_x,
            npoints,
            first_x,
            last_x,
            y_factor : 1.0,
            y_values : Vec::new()
        }
    }
// Instantiate a new Spectrum with empty y_values vector
Instantiate a new Spectrum with empty y_values vector
Instantiate a new Spectrum with empty y_values vector
pub fn new(
        name : &str,
        spectrum_type : &str,
        state : &str,
        xunits : Xunits,
        yunits : Yunits,
        first_x : f32,
        last_x : f32,
        npoints : i32
        ) -> Spectrum {
        let (mut first_x, mut last_x) = (first_x, last_x);
        // Enforces that first_x is less than last_x
        if first_x > last_x {
            let temp = first_x;
            first_x = last_x;
            last_x = temp;
        }
        // Handles different xunit cases
        match xunits {
            Xunits::cm => {},
            Xunits::um => {
                let temp = first_x;
                first_x = 10000.0 / last_x;
                last_x = 10000.0 / temp;
            }
        }
        assert!(npoints > 1 );
        let delta_x : f32 = (last_x - first_x) / (npoints as f32 - 1.0);
        Spectrum {
            name : name.to_string(),
            spectrum_type : spectrum_type.to_string(),
            state : state.to_string(),
            yunits,
            delta_x,
            npoints,
            first_x,
            last_x,
            y_factor : 1.0,
            y_values : Vec::new()
        }
    }
pub fn new ( name : & str , spectrum_type : & str , state : & str , xunits : Xunits , yunits : Yunits , first_x : f32 , last_x : f32 , npoints : i32 ) -> Spectrum { let ( mut first_x , mut last_x ) = ( first_x , last_x ) ; // Enforces that first_x is less than last_x if first_x > last_x { let temp = first_x ; first_x = last_x ; last_x = temp ; } // Handles different xunit cases match xunits { Xunits :: cm => { } , Xunits :: um => { let temp = first_x ; first_x = 10000.0 / last_x ; last_x = 10000.0 / temp ; } } assert ! ( npoints 1 ) ; let delta_x : f32 = ( last_x - first_x ) / ( npoints as f32 - 1.0 ) ; Spectrum { name : name . to_string ( ) , spectrum_type : spectrum_type . to_string ( ) , state : state . to_string ( ) , yunits , delta_x , npoints , first_x , last_x , y_factor : 1.0 , y_values : Vec :: new ( ) } }
Instantiate a new Spectrum with empty y_values vector
Instantiate a new Spectrum with empty y_values vector
name
&str
spectrum_type
&str
state
&str
xunits
Xunits
yunits
Yunits
first_x
f32
last_x
f32
npoints
i32
name
&str
spectrum_type
&str
state
&str
xunits
Xunits
yunits
Yunits
first_x
f32
last_x
f32
npoints
i32