pub fn transform(&self, first_x : f32, last_x : f32, npoints : i32) -> Spectrum { 
        assert!(first_x < last_x);
        // This molecule must be complete
        assert!(self.is_complete());
        // Can only have positive non-zero number of npoints
        assert!(npoints > 1);
        let mut spec = Spectrum::new(
            &self.name, &self.spectrum_type, &self.state, Xunits::cm, Yunits::Transmittance, first_x, last_x, npoints); 
        let delta_x: f32 = (last_x - first_x) / (npoints as f32);
        // Iterate curr_x from first_x to last_x by delta_x
        for i in 1..npoints + 1 {
            let curr_x : f32 = (first_x) + i as f32 * delta_x;
            let prev_x : f32 = curr_x - delta_x;
            spec.add_y(self.find_slice_average(prev_x, curr_x));
        }
        assert!(spec.is_complete());
        spec
    }
// Fit this spectrum into a different shaped spectrum
Fit this spectrum into a different shaped spectrum
Fit this spectrum into a different shaped spectrum
pub fn transform(&self, first_x : f32, last_x : f32, npoints : i32) -> Spectrum { 
        assert!(first_x < last_x);
        // This molecule must be complete
        assert!(self.is_complete());
        // Can only have positive non-zero number of npoints
        assert!(npoints > 1);
        let mut spec = Spectrum::new(
            &self.name, &self.spectrum_type, &self.state, Xunits::cm, Yunits::Transmittance, first_x, last_x, npoints); 
        let delta_x: f32 = (last_x - first_x) / (npoints as f32);
        // Iterate curr_x from first_x to last_x by delta_x
        for i in 1..npoints + 1 {
            let curr_x : f32 = (first_x) + i as f32 * delta_x;
            let prev_x : f32 = curr_x - delta_x;
            spec.add_y(self.find_slice_average(prev_x, curr_x));
        }
        assert!(spec.is_complete());
        spec
    }
pub fn transform ( & self , first_x : f32 , last_x : f32 , npoints : i32 ) -> Spectrum { assert ! ( first_x last_x ) ; // This molecule must be complete assert ! ( self is_complete ( ) ) ; // Can only have positive non-zero number of npoints assert ! ( npoints 1 ) ; let mut spec = Spectrum :: new ( & self . name , & self . spectrum_type , & self . state , Xunits :: cm , Yunits :: Transmittance , first_x , last_x , npoints ) ; let delta_x : f32 = ( last_x - first_x ) / ( npoints as f32 ) ; // Iterate curr_x from first_x to last_x by delta_x for i in 1 .. npoints + 1 { let curr_x : f32 = ( first_x ) + i as f32 * delta_x ; let prev_x : f32 = curr_x - delta_x ; spec . add_y ( self . find_slice_average ( prev_x , curr_x ) ) ; } assert ! ( spec is_complete ( ) ) ; spec }
Fit this spectrum into a different shaped spectrum
Fit this spectrum into a different shaped spectrum
&self
first_x
f32
last_x
f32
npoints
i32
&self
first_x
f32
last_x
f32
npoints
i32