# Path: upho/irreps/irreps.py
# def extract_degeneracy_from_ir_label(ir_label):
#     if ir_label[0] == 'E':
#         degeneracy = 2
#     elif ir_label[0] == 'T':
#         degeneracy = 3
#     else:
#         degeneracy = 1
#     return degeneracy


import h5py
import numpy as np
from scipy.optimize import curve_fit
from upho.analysis.functions import FittingFunctionFactory
from upho.irreps.irreps import extract_degeneracy_from_ir_label

__author__ = 'Yuji Ikeda'


class SFFitter:
    def __init__(self, filename='sf.hdf5', name='gaussian'):
        self._name = name

        with h5py.File(filename, 'r') as f:
            self._band_data = f
            self._run()

    def _run(self):
        band_data = self._band_data

        npaths, npoints = band_data['paths'].shape[:2]
        frequencies = band_data['frequencies']
        frequencies = np.array(frequencies)
        self._is_squared = np.array(band_data['is_squared'])


# Path: upho/irreps/irreps.py
# def extract_degeneracy_from_ir_label(ir_label):
#     if ir_label[0] == 'E':
#         degeneracy = 2
#     elif ir_label[0] == 'T':
#         degeneracy = 3
#     else:
#         degeneracy = 1
#     return degeneracy


# Path: upho/phonon/sf_fitter.py
import h5py
import numpy as np
from scipy.optimize import curve_fit
from upho.analysis.functions import FittingFunctionFactory
from upho.irreps.irreps import extract_degeneracy_from_ir_label


__author__ = 'Yuji Ikeda'


class SFFitter:
    def __init__(self, filename='sf.hdf5', name='gaussian'):
        self._name = name

        with h5py.File(filename, 'r') as f:
            self._band_data = f
            self._run()

    def _run(self):
        band_data = self._band_data

        npaths, npoints = band_data['paths'].shape[:2]
        frequencies = band_data['frequencies']
        frequencies = np.array(frequencies)
        self._is_squared = np.array(band_data['is_squared'])


        filename_sf = 'sf_fit.hdf5'