B
    à‹dJ  ã               @   s   d Z G dd„ deƒZdS )zb
Base class for Numerical Relativity fits such as remnant BH mass, spin, etc.

Vijay Varma, 2019.
c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚNRFitsa•  
    Base class to evaluate NR fits.

    For each new fit, you need to do the following:
        1. Add a new derived class for this class in a separate file and add the
            new class to fits_collection in eval_fits.py.
        2. override _get_fit_params() and _eval_fit() in the new derived class.
        3. Add the new filename to Makefile.am

    See NRSur7dq4Remnant.py for an example.
    c             C   s   t dƒ‚tS )a   Not all fits will require all of these parameters, this function
        should be used to get the required params, and if necessary, process
        them to get the parameters that are used to evaluate the actual fits.

        For example: chiA_vec/chiB_vec are defined at f_ref, this function
        could take these initial spins and evolve them to get the spins at
        ISCO, which are then used to evaluate the fits.

        See eval_fits.eval_nrfit() for the definitions of the arguments of
        this function.
        zPlease override me.)ÚNotImplementedErrorÚ
fit_params)ÚselfÚm1Úm2ÚchiA_vecÚchiB_vecÚf_refÚextra_params_dict© r   úh/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/lalsimulation/nrfits/nrfits.pyÚ_get_fit_params   s    zNRFits._get_fit_paramsc             C   s   t dƒ‚dS )zr Evaluates a particular fit for a given model using the fit_params
        returned by _get_fit_params().
        zPlease override me.N)r   )r   r   Úfit_typer
   r   r   r   Ú	_eval_fit'   s    zNRFits._eval_fitc             C   sn   |   ||||||¡}ddddg}	i }
xD|D ]<}||	krTtd| d d |	¡ d ƒ‚|  |||¡|
|< q*W |
S )	zÍ Evaluates all fits given in fit_types_list and returns them as
            a dictionary.

            See eval_fits.eval_nrfit() for the definitions of the arguments of
            this function.
        Z	FinalMassZ	FinalSpinZ
RecoilKickZPeakLuminosityzInvalid fit_type=%s. zShould be one of [z, z].)r   Ú
ValueErrorÚjoinr   )r   r   r   r   r   r	   Zfit_types_listr
   r   Zallowed_fit_typesZreturn_dictr   r   r   r   Ú__call__.   s    
zNRFits.__call__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s   r   N)r   Úobjectr   r   r   r   r   Ú<module>   s   