Ejemplo n.º 1
0
 def setUp(self,verbose=False):
     
     abss = AbsSpectrum()
     with energy_units("1/cm"):
         f = FrequencyAxis(10000.0,2000, 1.0)
         a = self._spectral_shape(f, [1.0, 11000.0, 100.0])
         abss.axis = f
         abss.data = a
     self.abss = abss
     self.axis = abss.axis
     
     #make a single-molecule system
     time = TimeAxis(0.0,1000,1.0)
     self.ta = time
     with energy_units("1/cm"):
         mol1 = Molecule(elenergies=[0.0, 12000.0])
         params = dict(ftype="OverdampedBrownian", reorg=20, cortime=100,
                       T=300)
         mol1.set_dipole(0,1,[0.0, 1.0, 0.0])
         cf = CorrelationFunction(time, params)
         mol1.set_transition_environment((0,1),cf)
         
         abs_calc = AbsSpectrumCalculator(time, system=mol1)
         abs_calc.bootstrap(rwa=12000)
         
     abs1 = abs_calc.calculate()
     
     self.abs1 = abs1
Ejemplo n.º 2
0
 def setUp(self,verbose=False):
     
     abss = AbsSpectrum()
     with energy_units("1/cm"):
         f = FrequencyAxis(10000.0,2000, 1.0)
         a = self._spectral_shape(f, [1.0, 11000.0, 100.0])
         abss.axis = f
         abss.data = a
     self.abss = abss
     self.axis = abss.axis
     
     #make a single-molecule system
     time = TimeAxis(0.0,1000,1.0)
     self.ta = time
     with energy_units("1/cm"):
         mol1 = Molecule(elenergies=[0.0, 12000.0])
         params = dict(ftype="OverdampedBrownian", reorg=20, cortime=100,
                       T=300)
         mol1.set_dipole(0,1,[0.0, 1.0, 0.0])
         cf = CorrelationFunction(time, params)
         mol1.set_transition_environment((0,1),cf)
         
         abs_calc = AbsSpectrumCalculator(time, system=mol1)
         abs_calc.bootstrap(rwa=12000)
         
     abs1 = abs_calc.calculate()
     
     self.abs1 = abs1
Ejemplo n.º 3
0
    def test_abs_spectrum_saveablity(self):
        """Testing if AbsSpectrum is saveble
        
        """
        abs1 = self.abs1

        drv = "core"
        bcs = False
        with h5py.File('tempfile.hdf5', driver=drv, backing_store=bcs) as f:

            abs1.save(f, test=True)

            abs2 = AbsSpectrum()
            abs2.load(f, test=True)

        numpy.testing.assert_array_equal(abs1.data, abs2.data)
Ejemplo n.º 4
0
    def test_abs_spectrum_saveablity(self):
        """Testing if AbsSpectrum is saveble
        
        """
        abs1 = self.abs1

        #drv = "core"
        #bcs = False

        with tempfile.TemporaryFile() as f:
            #with h5py.File('tempfile.hdf5',
            #               driver=drv,
            #               backing_store=bcs) as f:

            abs1.save(f)  #, test=True)
            f.seek(0)
            abs2 = AbsSpectrum()
            abs2 = abs2.load(f)  #, test=True)

        numpy.testing.assert_array_equal(abs1.data, abs2.data)
Ejemplo n.º 5
0
 def reset_tester():
     abss2 = AbsSpectrum()
     abss2.set_axis(copy.deepcopy(self.abss.axis))
     abss2.set_data(copy.deepcopy(self.abss.data))
     return abss2
Ejemplo n.º 6
0
 def _opt_spectral_shape(self, par):
     f = self.axis
     a = AbsSpectrum(axis=f,data=self._spectral_shape(f, par))
     return a
Ejemplo n.º 7
0
 def reset_tester():
     abss2 = AbsSpectrum()
     abss2.set_axis(copy.deepcopy(self.abss.axis))
     abss2.set_data(copy.deepcopy(self.abss.data))
     return abss2