def pulse_drawer(samples, duration, dt=None, interp_method='<STR_LIT:None>',<EOL>filename=None, interactive=False,<EOL>dpi=<NUM_LIT>, nop=<NUM_LIT:1000>, size=(<NUM_LIT:6>, <NUM_LIT:5>)):
try:<EOL><INDENT>from matplotlib import pyplot as plt<EOL><DEDENT>except ImportError:<EOL><INDENT>raise ImportError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if dt:<EOL><INDENT>_dt = dt<EOL><DEDENT>else:<EOL><INDENT>_dt = <NUM_LIT:1><EOL><DEDENT>re_y = np.real(samples)<EOL>im_y = np.imag(samples)<EOL>image = plt.figure(figsize=size)<EOL>ax0 = image.add_subplot(<NUM_LIT>)<EOL>if interp_method == '<STR_LIT>':<EOL><INDENT>time = np.arange(<NUM_LIT:0>, duration + <NUM_LIT:1>) * _dt + <NUM_LIT:0.5> * _dt<EOL>cs_ry = CubicSpline(time[:-<NUM_LIT:1>], re_y)<EOL>cs_iy = CubicSpline(time[:-<NUM_LIT:1>], im_y)<EOL>_time = np.linspace(<NUM_LIT:0>, duration * _dt, nop)<EOL>_re_y = cs_ry(_time)<EOL>_im_y = cs_iy(_time)<EOL><DEDENT>elif interp_method == '<STR_LIT:None>':<EOL><INDENT>time = np.arange(<NUM_LIT:0>, duration + <NUM_LIT:1>) * _dt<EOL>_time = np.r_[time[<NUM_LIT:0>], np.repeat(time[<NUM_LIT:1>:-<NUM_LIT:1>], <NUM_LIT:2>), time[-<NUM_LIT:1>]]<EOL>_re_y = np.repeat(re_y, <NUM_LIT:2>)<EOL>_im_y = np.repeat(im_y, <NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>raise QiskitError('<STR_LIT>' % interp_method)<EOL><DEDENT>ax0.fill_between(x=_time, y1=_re_y, y2=np.zeros_like(_time),<EOL>facecolor='<STR_LIT>', alpha=<NUM_LIT>,<EOL>edgecolor='<STR_LIT>', linewidth=<NUM_LIT>,<EOL>label='<STR_LIT>')<EOL>ax0.fill_between(x=_time, y1=_im_y, y2=np.zeros_like(_time),<EOL>facecolor='<STR_LIT>', alpha=<NUM_LIT>,<EOL>edgecolor='<STR_LIT>', linewidth=<NUM_LIT>,<EOL>label='<STR_LIT>')<EOL>ax0.set_xlim(<NUM_LIT:0>, duration * _dt)<EOL>ax0.grid(b=True, linestyle='<STR_LIT:->')<EOL>ax0.legend(bbox_to_anchor=(<NUM_LIT:0.5>, <NUM_LIT>), loc='<STR_LIT>',<EOL>ncol=<NUM_LIT:2>, frameon=False, fontsize=<NUM_LIT>)<EOL>if filename:<EOL><INDENT>image.savefig(filename, dpi=dpi, bbox_inches='<STR_LIT>')<EOL><DEDENT>plt.close(image)<EOL>if image and interactive:<EOL><INDENT>plt.show(image)<EOL><DEDENT>return image<EOL>
Plot the interpolated envelope of pulse

    Args:
        samples (ndarray): Data points of complex pulse envelope.
        duration (int): Pulse length (number of points).
        dt (float): Time interval of samples.
        interp_method (str): Method of interpolation
            (set `None` for turn off the interpolation).
        filename (str): Name required to save pulse image.
        interactive (bool): When set true show the circuit in a new window
            (this depends on the matplotlib backend being used supporting this).
        dpi (int): Resolution of saved image.
        nop (int): Data points for interpolation.
        size (tuple): Size of figure.
    Returns:
        matplotlib.figure: A matplotlib figure object for the pulse envelope.
    Raises:
        ImportError: when the output methods requieres non-installed libraries.
        QiskitError: when invalid interpolation method is specified.