<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def BA08_AB06(self, vs30, imt, pgar):
 """ Computes amplification factor similarly to what is done in the 2015 version of the Canada building code. An initial version of this code was kindly provided by Michal Kolaj - Geological Survey of Canada :param vs30: Can be either a scalar or a :class:`~numpy.ndarray` instance :param imt: The intensity measure type :param pgar: The value of hazard on rock (vs30=760). Can be either a scalar or a :class:`~numpy.ndarray` instance. Unit of measure is fractions of gravity acceleration. :return: A scalar or a :class:`~numpy.ndarray` instance with the amplification factor. """

        fa = np.ones_like(vs30)
        if np.isscalar(vs30):
            vs30 = np.array([vs30])
        if np.isscalar(pgar):
            pgar = np.array([pgar])
        #
        # Fixing vs30 for hard rock to 1999 m/s. Beyond this threshold the
        # motion will not be deamplified further
        vs = copy.copy(vs30)
        vs[vs >= 2000] = 1999.
        #
        # Computing motion on rock
        idx = np.where(vs30 > 760)
        if np.size(idx) > 0:
            """
            # This is the original implementation - Since this code is
            # experimental we keep it for possible further developments
            # For values of Vs30 greater than 760 a linear interpolation is
            # used between the gm factor at 2000 m/s and 760 m/s
            C2 = self.COEFFS_AB06r[imt]
            fa[idx] = 10**(np.interp(np.log10(vs[idx]),
                                     np.log10([760.0, 2000.0]),
                                     np.log10([1.0, C2['c']])))
            """
            C = self.COEFFS_BA08[imt]
            nl = BooreAtkinson2008()._get_site_amplification_non_linear(
                vs[idx], pgar[idx], C)
            lin = BooreAtkinson2008()._get_site_amplification_linear(
                vs[idx], C)
            tmp = np.exp(nl+lin)
            fa[idx] = tmp
        #
        # For values of Vs30 lower than 760 the amplification is computed
        # using the site term of Boore and Atkinson (2008)
        idx = np.where(vs < 760.)
        if np.size(idx) > 0:
            C = self.COEFFS_BA08[imt]
            nl = BooreAtkinson2008()._get_site_amplification_non_linear(
                vs[idx], pgar[idx], C)
            lin = BooreAtkinson2008()._get_site_amplification_linear(
                vs[idx], C)
            fa[idx] = np.exp(nl+lin)
        return fa