Use marked instead of markdown-js for Markdown parser of TiddlyWiki 5.
Originally fork from http://bjtools.tiddlyspot.com/
- support fenced code block
- support code highlighting
- Install the official Markdown and Hightlight.js plugin.
| from __future__ import division | |
| from scipy.stats import rv_continuous | |
| from numpy import log, exp, nan | |
| from numba import vectorize | |
| import numpy as np | |
| from matplotlib import pyplot as plt | |
| class rv_custom(rv_continuous): |
Use marked instead of markdown-js for Markdown parser of TiddlyWiki 5.
Originally fork from http://bjtools.tiddlyspot.com/
| code = r''' | |
| from __future__ import division, print_function | |
| import numpy as np | |
| from collections import OrderedDict | |
| from gala.potential.potential.cpotential import CPotentialBase | |
| from gala.potential.potential.cpotential cimport CPotentialWrapper | |
| from gala.potential.potential.cpotential cimport densityfunc, energyfunc, gradientfunc, hessianfunc |
| from selenium import webdriver | |
| from selenium.webdriver.support.ui import WebDriverWait | |
| import time | |
| from selenium.webdriver.common.action_chains import ActionChains | |
| from selenium.webdriver.common.keys import Keys | |
| class IfReady: | |
| key = None |
| if pyx_file is not None: | |
| pyx_mtime = os.path.getmtime(pyx_file) | |
| else: | |
| pyx_mtime = 0. # so ext_file always newer than pyx_file | |
| # need build: | |
| # force is True, ext_file non exists, or older than pyx_file | |
| # user should take care of deps by himself | |
| if (force or not os.path.isfile(ext_file) or | |
| os.path.getmtime(ext_file) < pyx_mtime): |
| if pyx_file is not None: | |
| pyx_mtime = os.path.getmtime(pyx_file) | |
| else: | |
| pyx_mtime = 0. # so ext_file always newer than pyx_file | |
| # need build: | |
| # force is True, ext_file non exists, or older than pyx_file | |
| # user should take care of deps by himself | |
| if (force or not os.path.isfile(ext_file) or | |
| os.path.getmtime(ext_file) < pyx_mtime): |
| # Do not modify the original value of range so we can check for `None` | |
| if range is None: | |
| if a.size == 0: | |
| # handle empty arrays. Can't determine range, so use 0-1. | |
| mn, mx = 0.0, 1.0 | |
| else: | |
| mn, mx = a.min() + 0.0, a.max() + 0.0 | |
| # add below | |
| if not np.all(np.isfinite([mn, mx])): | |
| b = a[np.isfinite(a)] |
| def compare_violin(x, y, bins, **kwargs): | |
| import numpy as np | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| nmax = int(kwargs.pop('nmax', 1e4)) | |
| nmin = int(kwargs.pop('nmax', 1)) | |
| kwargs.setdefault('showmedians', True) | |
| bins_mid = (bins[:-1] + bins[1:]) * 0.5 |
| def tripcolorshow(x, y, z=None, **kwargs): | |
| """ | |
| tripcolorshow(x, y, z) | |
| tri = Triangulation(x, y) | |
| tripcolorshow(tri, z) | |
| """ | |
| import matplotlib.tri as tri | |
| import matplotlib.pyplot as plt |
| import numpy as np | |
| from collections import namedtuple | |
| __all__ = ['query_radius_periodic'] | |
| def repeat_periodic(points, boxsize): | |
| """Repeat data to mock periodic boundaries. | |
| points (m, n) -> repeated_points (m, 3**n, n) |