2 Base class for Numerical Relativity fits such as remnant BH mass, spin, etc.
10 Base class to evaluate NR fits.
12 For each new fit, you need to do the following:
13 1. Add a new derived class for this class in a separate file and add the
14 new class to fits_collection in eval_fits.py.
15 2. override _get_fit_params() and _eval_fit() in the new derived class.
16 3. Add the new filename to Makefile.am
18 See NRSur7dq4Remnant.py for an example.
22 def _get_fit_params(self, m1, m2, chiA_vec, chiB_vec, f_ref,
24 """ Not all fits will require all of these parameters, this function
25 should be used to get the required params, and if necessary, process
26 them to get the parameters that are used to evaluate the actual fits.
28 For example: chiA_vec/chiB_vec are defined at f_ref, this function
29 could take these initial spins and evolve them to get the spins at
30 ISCO, which are then used to evaluate the fits.
32 See eval_fits.eval_nrfit() for the definitions of the arguments of
35 raise NotImplementedError(
"Please override me.")
39 def _eval_fit(self, fit_params, fit_type, extra_params_dict):
40 """ Evaluates a particular fit for a given model using the fit_params
41 returned by _get_fit_params().
43 raise NotImplementedError(
"Please override me.")
46 def __call__(self, m1, m2, chiA_vec, chiB_vec, f_ref, fit_types_list,
48 """ Evaluates all fits given in fit_types_list and returns them as
51 See eval_fits.eval_nrfit() for the definitions of the arguments of
57 fit_params = self.
_get_fit_params_get_fit_params(m1, m2, chiA_vec, chiB_vec,
58 f_ref, extra_params_dict)
71 for fit_type
in fit_types_list:
72 if fit_type
not in allowed_fit_types:
73 raise ValueError(
"Invalid fit_type=%s. "%fit_type \
74 +
"Should be one of ["+
", ".join(allowed_fit_types) +
"].")
75 return_dict[fit_type] = self.
_eval_fit_eval_fit(fit_params, fit_type,
Base class for Numerical Relativity fits such as remnant BH mass, spin, etc.
def _eval_fit(self, fit_params, fit_type, extra_params_dict)
def _get_fit_params(self, m1, m2, chiA_vec, chiB_vec, f_ref, extra_params_dict)
def __call__(self, m1, m2, chiA_vec, chiB_vec, f_ref, fit_types_list, extra_params_dict)
Evaluates all fits given in fit_types_list and returns them as a dictionary.