B
    à‹d¸  ã               @   s<   d Z ddlZddlZddlZddlmZ G dd„ deƒZdS )z³
Class for NRSur3dq8Remnant model for the remnant mass, spin and kick velocity
for nonprecessing BBH systems. This model was called surfinBH3dq8 in the paper.

Vijay Varma, 2019.
é    Né   )ÚNRFitsc               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚNRSur3dq8Remnantañ  
    Class for NRSur3dq8Remnant model for the remnant mass, spin and kick
    velocity for nonprecessing BBH systems. This model was called surfinBH3dq8
    in the paper.

    Paper: arxiv:1809.09125. The model is referred to as surfinBH3dq8 in the
    paper.

    Parameter ranges for usage: 

        q = [1, 9.1] 

        $\chi_{1z}, \chi_{2z}$ = [-0.91, 0.91] 

        OR 

        q = [1, 10.1] 

        $\chi_{1z}, \chi_{2z}$ = [-0.81, 0.81]

    Training parameter ranges:  

        q = [1, 8] 

        $\chi_{1z}, \chi_{2z}$ = [-0.81, 0.81]

    But extrapolates reasonably to the above mass ratios and spins. However,
    if a guarantee of accuracy is required, this model should be used within
    the training parameter range.
    c       	      C   s.   |dkrt dƒ‚|| }||d |d g}|S )zï No processing or spin evolution is required here, just returns the
        mass ratio, total mass and spins along the z-direction.

        See eval_fits.eval_nrfit() for the definitions of the arguments of
        this function.
        éÿÿÿÿz#This model only works for f_ref=-1.é   )Ú
ValueError)	ÚselfÚm1Úm2ZchiA_vecZchiB_vecZf_refÚextra_params_dictÚqÚ
fit_params© r   úr/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/lalsimulation/nrfits/NRSur3dq8Remnant.pyÚ_get_fit_params(   s
    z NRSur3dq8Remnant._get_fit_paramsc             C   s¸   |\}}}t  ¡ }|d r(t  |dd¡ |dkrDt |||d|¡}nj|dkrjt |||d|¡}	dd|	g}nD|dkr¢t |||d	|¡}
t |||d
|¡}|
|dg}ntd| ƒ‚t |¡S )zu Evaluates a particular fit for NRSur3dq8Remnant using the fit_params
        returned by _get_fit_params().
        Zunlimited_extrapolationr   Z	FinalMassÚmfZ	FinalSpinÚchifzr   Z
RecoilKickÚvfxÚvfyzVInvalid fit_type=%s. This model only allows 'FinalMass', 'FinalSpin' and 'RecoilKick'.)ÚlalZ
CreateDictZDictInsertUINT4ValueÚlalsimr   r   ÚnpZ
atleast_1d)r   r   Zfit_typer   r   ZchiAzZchiBzZ	LALParamsÚvalr   r   r   r   r   r   Ú	_eval_fitC   s     
zNRSur3dq8Remnant._eval_fitN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s   r   )	r   Únumpyr   Zlalsimulationr   r   Znrfitsr   r   r   r   r   r   Ú<module>   s
   