<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_intra_event_std(self, C, mag, sa1180, vs30, vs30measured, rrup):
 """ Returns Phi as described at pages 1046 and 1047 """

        phi_al = self._get_phi_al_regional(C, mag, vs30measured, rrup)
        derAmp = self._get_derivative(C, sa1180, vs30)
        phi_amp = 0.4
        idx = phi_al < phi_amp
        if np.any(idx):
            # In the case of small magnitudes and long periods it is possible
            # for phi_al to take a value less than phi_amp, which would return
            # a complex value. According to the GMPE authors in this case
            # phi_amp should be reduced such that it is fractionally smaller
            # than phi_al
            phi_amp = 0.4 * np.ones_like(phi_al)
            phi_amp[idx] = 0.99 * phi_al[idx]
        phi_b = np.sqrt(phi_al**2 - phi_amp**2)
        phi = np.sqrt(phi_b**2 * (1 + derAmp)**2 + phi_amp**2)
        return phi