def METHOD_NAME(self):
    import matplotlib as _mpl
    _mpl.use('Agg')
    import numpy as np
    from brian2 import prefs
    from brian2.utils.filetools import ensure_directory_of_file
    prefs.codegen.target = self.codegen_target
    prefs.core.default_float_dtype = self.dtype
    # Move to the file's directory for the run, so that it can do relative
    # imports and load files (e.g. figure style files)
    curdir = os.getcwd()
    os.chdir(os.path.dirname(self.filename))
    sys.path.append(os.path.dirname(self.filename))
    try:
        runpy.run_path(self.filename, run_name='__main__')
        if self.codegen_target == 'cython' and self.dtype == np.float64:
            for fignum in _mpl.pyplot.get_fignums():
                fname = os.path.relpath(self.filename, self.example_dir)
                fname = fname.replace('/', '.').replace('\\\\', '.')
                fname = fname.replace('.py', '.%d.png' % fignum)
                fname = os.path.abspath(os.path.join(self.example_dir,
                                                     '../docs_sphinx/resources/examples_images/',
                                                     fname))
                ensure_directory_of_file(fname)
                _mpl.pyplot.figure(fignum).savefig(fname)
    finally:
        _mpl.pyplot.close('all')
        os.chdir(curdir)
        sys.path.remove(os.path.dirname(self.filename))
        device.reinit()
        set_device('runtime')