Set the DTW object up.

def _setup_dtw(self):
        """
        Set the DTW object up.
        """
        # check if the DTW object has already been set up
        if self.dtw is not None:
            return

        # check we have the AudioFileMFCC objects
        if (self.real_wave_mfcc is None) or (self.real_wave_mfcc.middle_mfcc is None):
            self.log_exc(u"The real wave MFCCs are not initialized", None, True, DTWAlignerNotInitialized)
        if (self.synt_wave_mfcc is None) or (self.synt_wave_mfcc.middle_mfcc is None):
            self.log_exc(u"The synt wave MFCCs are not initialized", None, True, DTWAlignerNotInitialized)

        # setup
        algorithm = self.rconf[RuntimeConfiguration.DTW_ALGORITHM]
        delta = int(2 * self.rconf.dtw_margin / self.rconf[RuntimeConfiguration.MFCC_WINDOW_SHIFT])
        mfcc2_length = self.synt_wave_mfcc.middle_length
        self.log([u"Requested algorithm: '%s'", algorithm])
        self.log([u"delta = %d", delta])
        self.log([u"m = %d", mfcc2_length])
        # check if delta is >= length of synt wave
        if mfcc2_length <= delta:
            self.log(u"We have mfcc2_length <= delta")
            if (self.rconf[RuntimeConfiguration.C_EXTENSIONS]) and (gf.can_run_c_extension()):
                # the C code can be run: since it is still faster, do not run EXACT
                self.log(u"C extensions enabled and loaded: not selecting EXACT algorithm")
            else:
                self.log(u"Selecting EXACT algorithm")
                algorithm = DTWAlgorithm.EXACT

        # select mask here
        if self.rconf.mmn:
            self.log(u"Using masked MFCC")
            real_mfcc = self.real_wave_mfcc.masked_middle_mfcc
            synt_mfcc = self.synt_wave_mfcc.masked_middle_mfcc
        else:
            self.log(u"Using unmasked MFCC")
            real_mfcc = self.real_wave_mfcc.middle_mfcc
            synt_mfcc = self.synt_wave_mfcc.middle_mfcc
        n = real_mfcc.shape[1]
        m = synt_mfcc.shape[1]
        self.log([u"  Number of MFCC frames in real wave: %d", n])
        self.log([u"  Number of MFCC frames in synt wave: %d", m])
        if (n == 0) or (m == 0):
            self.log(u"Setting self.dtw to None")
            self.dtw = None
        else:
            # set the selected algorithm
            if algorithm == DTWAlgorithm.EXACT:
                self.log(u"Computing with EXACT algo")
                self.dtw = DTWExact(
                    m1=real_mfcc,
                    m2=synt_mfcc,
                    rconf=self.rconf,
                    logger=self.logger
                )
            else:
                self.log(u"Computing with STRIPE algo")
                self.dtw = DTWStripe(
                    m1=real_mfcc,
                    m2=synt_mfcc,
                    delta=delta,
                    rconf=self.rconf,
                    logger=self.logger
                )