<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extractGlobalParameters(self, dna, bp, frames=None, paxis='Z', masked=False):
 """Extract the parameters for calculations .. currentmodule:: dnaMD Parameters dna : :class:`dnaMD.DNA` Input :class:`dnaMD.DNA` instance. bp : list List of two base-steps forming the DNA segment. For example: with ``bp=[5, 50]``, 5-50 base-step segment will be considered. frames : list List of two trajectory frames between which parameters will be extracted. It can be used to select portions of the trajectory. For example, with ``frames=[100, 1000]``, 100th to 1000th frame of the trajectory will be considered. paxis : str Axis parallel to global helical-axis(``'X'``, or ``'Y'`` or ``'Z'``). Only require when bending motions are included in the calculation. masked : bool ``Default=False``. To skip specific frames/snapshots. ``DNA.mask`` array should be set to use this functionality. This array contains boolean (either ``True`` or ``False``) value for each frame to mask the frames. Presently, mask array is automatically generated during :meth:`dnaMD.DNA.generate_smooth_axis` to skip those frames where 3D fitting curve was not successful within the given criteria. Returns ------- time : numpy.ndarray 1D numpy array of shape (nframes) containing time array : numpy.ndarray 2D numpy array of shape (parameters count, nframes) containing extracted parameters. """


        frames = self._validateFrames(frames)
        if frames[1] == -1:
            frames[1] = None

        if (len(bp) != 2):
            raise ValueError("bp should be a list containing first and last bp of a segment. See, documentation!!!")

        if bp[0] > bp[1]:
            raise ValueError("bp should be a list containing first and last bp of a segment. See, documentation!!!")

        time, clen = dna.time_vs_parameter('h-rise', bp=bp, merge=True, merge_method='sum', masked=masked)
        clen = np.asarray(clen) * 0.1  # conversion to nm

        time, htwist = dna.time_vs_parameter('h-twist', bp=bp, merge=True, merge_method='sum', masked=masked)
        htwist = np.deg2rad(htwist)  # Conversion to radian

        angleOne, angleTwo = None, None
        if self.esType=='BST':
            angleOne, angleTwo = dna.calculate_2D_angles_bw_tangents(paxis, bp, masked=masked)

            # Rarely there are nan during angle calculation, remove those nan
            nanInOne = np.isnan(angleOne[frames[0]:frames[1]])
            nanInTwo = np.isnan(angleTwo[frames[0]:frames[1]])
            notNan = ~(nanInOne + nanInTwo)
            notNanIdx = np.nonzero(notNan)

            array = np.array([angleOne[frames[0]:frames[1]][notNanIdx], angleTwo[frames[0]:frames[1]][notNanIdx],
                              clen[frames[0]:frames[1]][notNanIdx], htwist[frames[0]:frames[1]][notNanIdx]])
            time = (time[frames[0]:frames[1]])[notNanIdx]

        else:
            array = np.array([clen[frames[0]:frames[1]], htwist[frames[0]:frames[1]]])
            time = time[frames[0]:frames[1]]

        return time, array