def load_data_from_online(self, url, meta_data={}):

        id_ = ID.new_ID()
        new_orbital = OrbitalData.init_from_online(url,
                                                   ID=id_,
                                                   meta_data=meta_data)

        self.orbitals.append(new_orbital)

        return new_orbital
Example #2
0
    def test_file_initialization(self):
        ID = 1
        data = OrbitalData.init_from_file(
            __directory__ / '../example/data/' / '5A_MO_73.cube', ID)

        self.assertEqual(data.name, '5A_MO_73')
        self.assertEqual(data.ID, ID)
        self.assertEqual(data.meta_data, {
            'origin': 'Cube file generated by NWChem',
            'alias': 'pentacene_MO_73'
        })
Example #3
0
    def test_default_initialization(self):
        name = 'Test'
        ID = 1
        meta_data = {'origin': 'selfmade'}
        with open(__directory__ / '../example/data/5A_MO_73.cube', 'r') as f:
            file = f.read()

        data = OrbitalData(file, ID, name=name, meta_data=meta_data)

        self.assertEqual(data.name, name)
        self.assertEqual(data.ID, ID)
        self.assertEqual(data.meta_data, meta_data)
Example #4
0
    def test_online_initialization(self):
        ID = 1
        data = OrbitalData.init_from_online(
            'http://143.50.77.12/' + 'OrganicMolecule/B3LYP/5A/' +
            'charge0mult1/5A_MO_73', ID)

        self.assertEqual(data.name, '5A_MO_73')
        self.assertEqual(data.ID, ID)
        self.assertEqual(data.meta_data, {
            'origin': 'Cube file generated by NWChem',
            'alias': 'pentacene_MO_73'
        })
Example #5
0
    def load_data_from_path(self, path, ID=None):
        if ID is None:
            id_ = IDD.new_ID()

        else:
            id_ = ID
            IDD.update(id_)

        new_orbital = OrbitalData.init_from_file(path, ID=id_)
        self.orbitals.append([new_orbital, 'path', path, None, id_])

        return new_orbital
Example #6
0
    def load_data_from_online(self, url, meta_data={}, ID=None):
        if ID is None:
            id_ = IDD.new_ID()

        else:
            id_ = ID
            IDD.update(id_)

        new_orbital = OrbitalData.init_from_online(url,
                                                   ID=id_,
                                                   meta_data=meta_data)

        self.orbitals.append([new_orbital, 'url', url, meta_data, id_])

        return new_orbital
Example #7
0
    def setUpClass(cls):

        file_path = os.path.dirname(os.path.realpath(__file__))
        input_path = file_path + '/../../example/data/'

        sliced_path = input_path + 'example5_6584.hdf5'
        cls.sliced_data = SlicedData.init_from_hdf5(sliced_path)

        orbital_paths = [
            'PTCDA_C.cube', 'PTCDA_D.cube', 'PTCDA_E.cube', 'PTCDA_F.cube'
        ]
        cls.orbitals = [
            OrbitalData.init_from_file(input_path + path, ID)
            for ID, path in enumerate(orbital_paths)
        ]

        cls.expected = np.loadtxt(file_path + '/output/weights_PTCDA')
        cls.background_expected = np.loadtxt(file_path +
                                             '/output/background_expected')
Example #8
0
from kmap.library.orbitaldata import OrbitalData
from kmap.model.lmfit_model import LMFitModel

# Path to data folder; replace with your own; use '/' instead of '+'
# when concatenating with strings
data_path = Path(__file__).parent / Path('../data/')

# Load experimental data as SlicedData object
exp_data = SlicedData.init_from_hdf5(data_path / 'example5_6584.hdf5')

# Load orbitals for fitting as OrbitalData objects
orbital_paths = [
    'PTCDA_C.cube', 'PTCDA_D.cube', 'PTCDA_E.cube', 'PTCDA_F.cube'
]
orbitals = [
    OrbitalData.init_from_file(data_path / path, ID)
    for ID, path in enumerate(orbital_paths)
]

# Initialize fit as LMFitModel object
lmfit = LMFitModel(exp_data, orbitals)

# Set common range and delta-k-grid for exp. and sim. kmaps
range_, dk = [-3.0, 3.0], 0.04
lmfit.set_axis_by_step_size(range_, dk)
lmfit.set_polarization('toroid', 'p')
lmfit.set_background_equation('c')

# Set parameters not intended for fitting to desired value
lmfit.edit_parameter('E_kin', value=27.2, vary=False)
lmfit.edit_parameter('alpha', value=40, vary=False)
Example #9
0
# kMap.py Imports
from kmap.library.sliceddata import SlicedData
from kmap.library.orbitaldata import OrbitalData
from kmap.model.lmfit_model import LMFitModel

# Path to data folder; replace with your own; use '/' instead of '+'
# when concatenating with strings
data_path = Path(__file__).parent / Path('../data/')

# Load experimental data as SlicedData object
exp_data = SlicedData.init_from_hdf5(data_path / 'example4_3271.hdf5')

# Load orbital for fitting as OrbitalData objects
orbital_paths = ['pentacene_HOMO.cube']
orbitals = [OrbitalData.init_from_file(
            data_path / path, ID) for ID, path in enumerate(orbital_paths)]

# Initialize fit as LMFitModel object
lmfit = LMFitModel(exp_data, orbitals)

# Set common range and delta-k-grid for exp. and sim. kmaps
range_, dk = [-3.0, 3.0], 0.04
lmfit.set_axis_by_step_size(range_, dk)
lmfit.set_polarization('toroid', 'p')
lmfit.set_symmetrization('2-fold')

# Set parameters not intended for fitting to desired value
lmfit.edit_parameter('E_kin', value=28, vary=False)
lmfit.edit_parameter('alpha', value=40, vary=False)
lmfit.set_background_equation('c')
    def load_data_from_path(self, path):
        id_ = ID.new_ID()
        new_orbital = OrbitalData.init_from_file(path, ID=id_)
        self.orbitals.append([new_orbital, 'path', path, None, id_])

        return new_orbital