pyerrors/docs/search.js

36 lines
450 KiB
JavaScript
Raw Normal View History

2021-11-07 20:53:18 +00:00
window.pdocSearch = (function(){
/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t
2021-12-23 15:43:56 +00:00
/** pdoc search index */const docs = {"version": "0.9.5", "fields": ["qualname", "fullname", "doc"], "ref": "fullname", "documentStore": {"docs": {"pyerrors": {"fullname": "pyerrors", "modulename": "pyerrors", "qualname": "", "type": "module", "doc": "<h1 id=\"what-is-pyerrors\">What is pyerrors?</h1>\n\n<p><code>pyerrors</code> is a python package for error computation and propagation of Markov chain Monte Carlo data.\nIt is based on the gamma method <a href=\"https://arxiv.org/abs/hep-lat/0306017\">arXiv:hep-lat/0306017</a>. Some of its features are:</p>\n\n<ul>\n<li>automatic differentiation for exact liner error propagation as suggested in <a href=\"https://arxiv.org/abs/1809.01289\">arXiv:1809.01289</a> (partly based on the <a href=\"https://github.com/HIPS/autograd\">autograd</a> package).</li>\n<li>treatment of slow modes in the simulation as suggested in <a href=\"https://arxiv.org/abs/1009.5228\">arXiv:1009.5228</a>.</li>\n<li>coherent error propagation for data from different Markov chains.</li>\n<li>non-linear fits with x- and y-errors and exact linear error propagation based on automatic differentiation as introduced in <a href=\"https://arxiv.org/abs/1809.01289\">arXiv:1809.01289</a>.</li>\n<li>real and complex matrix operations and their error propagation based on automatic differentiation (Matrix inverse, Cholesky decomposition, calculation of eigenvalues and eigenvectors, singular value decomposition...).</li>\n</ul>\n\n<p>There exist similar publicly available implementations of gamma method error analysis suites in <a href=\"https://gitlab.ift.uam-csic.es/alberto/aderrors\">Fortran</a>, <a href=\"https://gitlab.ift.uam-csic.es/alberto/aderrors.jl\">Julia</a> and <a href=\"https://github.com/mbruno46/pyobs\">Python</a>.</p>\n\n<h2 id=\"basic-example\">Basic example</h2>\n\n<div class=\"codehilite\"><pre><span></span><code><span class=\"kn\">import</span> <span class=\"nn\">numpy</span> <span class=\"k\">as</span> <span class=\"nn\">np</span>\n<span class=\"kn\">import</span> <span class=\"nn\">pyerrors</span> <span class=\"k\">as</span> <span class=\"nn\">pe</span>\n\n<span class=\"n\">my_obs</span> <span class=\"o\">=</span> <span class=\"n\">pe</span><span class=\"o\">.</span><span class=\"n\">Obs</span><span class=\"p\">([</span><span class=\"n\">samples</span><span class=\"p\">],</span> <span class=\"p\">[</span><span class=\"s1\">&#39;ensemble_name&#39;</span><span class=\"p\">])</span> <span class=\"c1\"># Initialize an Obs object</span>\n<span class=\"n\">my_new_obs</span> <span class=\"o\">=</span> <span class=\"mi\">2</span> <span class=\"o\">*</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">log</span><span class=\"p\">(</span><span class=\"n\">my_obs</span><span class=\"p\">)</span> <span class=\"o\">/</span> <span class=\"n\">my_obs</span> <span class=\"o\">**</span> <span class=\"mi\">2</span> <span class=\"c1\"># Construct derived Obs object</span>\n<span class=\"n\">my_new_obs</span><span class=\"o\">.</span><span class=\"n\">gamma_method</span><span class=\"p\">()</span> <span class=\"c1\"># Estimate the statistical error</span>\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">my_new_obs</span><span class=\"p\">)</span> <span class=\"c1\"># Print the result to stdout</span>\n<span class=\"o\">&gt;</span> <span class=\"mf\">0.31498</span><span class=\"p\">(</span><span class=\"mi\">72</span><span class=\"p\">)</span>\n</code></pre></div>\n\n<h1 id=\"the-obs-class\">The <code>Obs</code> class</h1>\n\n<p><code>pyerrors</code> introduces a new datatype, <code>Obs</code>, which simplifies error propagation and estimation for auto- and cross-correlated data.\nAn <code>Obs</code> object can be initialized with two arguments, the first is a list containing the samples for an Observable from a Monte Carlo chain.\nThe samples can either be provided as python list or as numpy array.\nThe second argument is a list containing the names of the respective Monte Carlo chains as strings. These stri
2021-11-07 20:53:18 +00:00
// mirrored in build-search-index.js (part 1)
// Also split on html tags. this is a cheap heuristic, but good enough.
elasticlunr.tokenizer.setSeperator(/[\s\-.;&]+|<[^>]*>/);
let searchIndex;
if (docs._isPrebuiltIndex) {
console.info("using precompiled search index");
searchIndex = elasticlunr.Index.load(docs);
} else {
console.time("building search index");
// mirrored in build-search-index.js (part 2)
searchIndex = elasticlunr(function () {
this.addField("qualname");
this.addField("fullname");
this.addField("doc");
this.setRef("fullname");
});
for (let doc of docs) {
searchIndex.addDoc(doc);
}
console.timeEnd("building search index");
}
return (term) => searchIndex.search(term, {
fields: {
qualname: {boost: 4},
fullname: {boost: 2},
doc: {boost: 1},
},
expand: true
});
})();