Fit Map Class

class empmap.fit_map.FullMap
add_fit_bounds(label, guess)

Add bounds to the fit.

Parameters:

label: str

The label for the map.

guess: array

The bounds for the fit.

add_fit_guess(label, guess)

Add an initial guess to the fit.

Parameters:

label: str

The label for the map.

guess: array

The initial guess for the fit.

add_fit_keyword(label, keyword, value)

Add a keyword to the fit.

Parameters:

label: str

The label for the map.

keyword: str

The keyword for the fit.

value: any

The value for the keyword.

add_map(label, order, xdata, ydata, **kwargs)

Add a map to the FullMap object.

Parameters:

label: str

The label for the map.

order: int

The order of the polynomial to fit the map to.

xdata: array

The xdata for the map.

ydata: array

The ydata for the map.

kwargs: dict

Additional keyword arguments to be passed to the Map object.

add_prebuilt_map(label, popt, **kwargs)

Add a prebuilt map to the FullMap object.

Parameters:

label: str

The label for the map.

popt: array

The optimal parameters for the map.

kwargs: dict

Additional keyword arguments to be passed to the Map object.

fit_map(label)

Fit a single map to its respective polynomial.

fit_maps()

Fit all maps to their respective polynomials.

report_latex_table()

Print a latex table of the fits to the console. Note - uses default parameters.

report_maps(display=False, histdisplay=False, **kwargs)

Report all maps in the FullMap object.

Parameters:

display: bool

Whether to display the maps.

kwargs: dict

Additional keyword arguments to be passed to the display_map function. This really supplies keyword arguments to plt.figure(), so dpi=x, figsize=(x,y) etc.

write_map_file(filename='empirical_map.in', pol_ratio=5.6, vibrational_lifetime=700)

Write the maps to a file.

Parameters:

filename: str

The name of the file to write the maps to.

class empmap.fit_map.Map(xdata, ydata, xlabel='E', ylabel='w')
add_bounds(bounds)

Add bounds to the fit.

Parameters:

bounds: array

The bounds for the fit.

add_fit_keyword(keyword, value)

Add a keyword to the fit.

Parameters:

keyword: str

The keyword for the fit.

value: any

The value for the keyword.

add_initial_guess(initial_guess)

Add an initial guess to the fit.

Parameters:

initial_guess: array

The initial guess for the fit.

classmethod build_from_map(popt, xdata=None, ydata=None, xlabel='E', ylabel='w')
calculate_fit_error()

Calculate the error between the data and the fit.

Returns:

error: array

The error between the data and the fit.

calculate_r_squared()

Calculate the R^2 value of the fit.

Returns:

r_squared: float

The R^2 value of the fit.

calculate_rmse()

Calculate the RMSE value of the fit.

Returns:

rmse: float

The RMSE value of the fit.

display_hist2d_map(xvals=None, **kwargs)

Display a 2D histogram of the data.

Parameters:

bins: tuple

The bins for the histogram.

cmap: str or Colormap

The colormap for the histogram.

display_map(xvals=None, **kwargs)

Display the data and the fit on a plot.

fit_to_poly(degree)

Fit the data to a polynomial of degree ‘degree’ and return the optimal parameters.

Parameters:

degree: int

The degree of the polynomial to fit the data to.

kwargs: dict

Additional keyword arguments to be passed to scipy.optimize.curve_fit.

Returns:

popt: array

The optimal parameters for the polynomial fit.

get_fit(xdata)

Return the fit for a given xdata.

Parameters:

xdata: array

The xdata for which to return the fit.

Returns:

fit: array

The fit for the given xdata.

remove_fit_keyword(keyword)

Remove a keyword from the fit.

Parameters:

keyword: str

The keyword to remove from the fit.

report_latex()

Print a report of the fit to the console in latex format.

report_latex_line(yunit='\\textrm{cm}^{-1}', xunit='\\textrm{a.u.}', xlabel='E', popt_fmt=None, r_fmt='{:.2f}', rmse_fmt='{:.2f}')

This is a function for reporting a line in a latex table associated with this map.

Parameters:

yunit: str

The unit for the y-axis.

xunit: str

The unit for the x-axis.

xlabel: str

The label for the x-axis.

popt_fmt: list

The format for the optimal parameters.

r_fmt: str

The format for the R value.

rmse_fmt: str

The format for the RMSE value.

Returns:

line: str

The latex line for the table.

report_map()

Print a report of the fit to the console.