{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "*Examples are given here in abbreviated form. We invite you to look over our other examples which explain these calculations in greater detail, as well as read the freud documentation to better understand these examples*" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function(global) {\n", " function now() {\n", " return new Date();\n", " }\n", "\n", " var force = true;\n", "\n", " if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n", " window._bokeh_onload_callbacks = [];\n", " window._bokeh_is_loading = undefined;\n", " }\n", "\n", "\n", " \n", " if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n", " window._bokeh_timeout = Date.now() + 5000;\n", " window._bokeh_failed_load = false;\n", " }\n", "\n", " var NB_LOAD_WARNING = {'data': {'text/html':\n", " \"\\n\"+\n", " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", " \"
\\n\"+\n", " \"\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"
\\n\"+\n",
" \"i;e=0<=i?++r:--r)(l[e]<=a&&a<=l[e+1]||l[e+1]<=a&&a<=l[e])&&(n[\"0d\"].glyph=this.model,n[\"0d\"].get_view=function(){return this}.bind(this),n[\"0d\"].flag=!0,n[\"0d\"].indices.push(e));return n},e.prototype.get_interpolation_hit=function(t,e){var r,o,i,n,a,l,u,c,_,p,h,d,f,m,y,g,v,b,w;return r=[e.vx,e.vy],p=r[0],h=r[1],o=[this._x[t],this._y[t],this._x[t+1],this._y[t+1]],m=o[0],b=o[1],y=o[2],w=o[3],\"point\"===e.type?(i=this.renderer.yscale.v_invert([h-1,h+1]),g=i[0],v=i[1],n=this.renderer.xscale.v_invert([p-1,p+1]),d=n[0],f=n[1]):\"v\"===e.direction?(a=this.renderer.yscale.v_invert([h,h]),g=a[0],v=a[1],l=[m,y],d=l[0],f=l[1]):(u=this.renderer.xscale.v_invert([p,p]),d=u[0],f=u[1],c=[b,w],g=c[0],v=c[1]),_=s.check_2_segments_intersect(d,g,f,v,m,b,y,w),[_.x,_.y]},e.prototype.draw_legend_for_index=function(t,e,r,o,i,n){return this._generic_line_legend(t,e,r,o,i,n)},e}(n.XYGlyphView),r.Line=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.default_view=r.LineView,e.prototype.type=\"Line\",e.mixins([\"line\"]),e}(n.XYGlyph)},{\"./xy_glyph\":\"models/glyphs/xy_glyph\",\"core/hittest\":\"core/hittest\"}],\"models/glyphs/multi_line\":[function(t,e,r){\"use strict\";Object.defineProperty(r,\"__esModule\",{value:!0});var o=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty,n=t(\"core/util/spatial\"),s=t(\"core/hittest\"),a=t(\"core/util/array\"),l=t(\"core/util/types\"),u=t(\"./glyph\");r.MultiLineView=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype._index_data=function(){var t,e,r,o,i,s,u,c;for(r=[],t=e=0,o=this._xs.length;0<=o?e d&&(l=d),b.push(e[l])):b.push(e[d]);return b},e}(c.ColorMapper)},{\"./color_mapper\":\"models/mappers/color_mapper\",\"core/properties\":\"core/properties\",\"core/util/array\":\"core/util/array\",\"core/util/color\":\"core/util/color\"}],\"models/markers/index\":[function(t,e,r){\"use strict\";Object.defineProperty(r,\"__esModule\",{value:!0});var o,i,n,s,a,l,u,c,_,p,h,d,f,m,y,g,v,b,w=function(t,e){function r(){this.constructor=t}for(var o in e)x.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},x={}.hasOwnProperty,k=t(\"./marker\");o=Math.sqrt(3),l=function(t,e){return t.moveTo(-e,e),t.lineTo(e,-e),t.moveTo(-e,-e),t.lineTo(e,e)},n=function(t,e){return t.moveTo(0,e),t.lineTo(0,-e),t.moveTo(-e,0),t.lineTo(e,0)},s=function(t,e){return t.moveTo(0,e),t.lineTo(e/1.5,0),t.lineTo(0,-e),t.lineTo(-e/1.5,0),t.closePath()},a=function(t,e){var r,i;return i=e*o,r=i/3,t.moveTo(-e,r),t.lineTo(e,r),t.lineTo(0,r-i),t.closePath()},u=function(t,e,r,o,i,s,a){var u;u=.65*i,n(t,i),l(t,u),s.doit&&(s.set_vectorize(t,e),t.stroke())},c=function(t,e,r,o,i,s,a){t.arc(0,0,i,0,2*Math.PI,!1),a.doit&&(a.set_vectorize(t,e),t.fill()),s.doit&&(s.set_vectorize(t,e),n(t,i),t.stroke())},_=function(t,e,r,o,i,n,s){t.arc(0,0,i,0,2*Math.PI,!1),s.doit&&(s.set_vectorize(t,e),t.fill()),n.doit&&(n.set_vectorize(t,e),l(t,i),t.stroke())},p=function(t,e,r,o,i,s,a){n(t,i),s.doit&&(s.set_vectorize(t,e),t.stroke());\n",
" },h=function(t,e,r,o,i,n,a){s(t,i),a.doit&&(a.set_vectorize(t,e),t.fill()),n.doit&&(n.set_vectorize(t,e),t.stroke())},d=function(t,e,r,o,i,a,l){s(t,i),l.doit&&(l.set_vectorize(t,e),t.fill()),a.doit&&(a.set_vectorize(t,e),n(t,i),t.stroke())},f=function(t,e,r,o,i,n,s){t.rotate(Math.PI),a(t,i),t.rotate(-Math.PI),s.doit&&(s.set_vectorize(t,e),t.fill()),n.doit&&(n.set_vectorize(t,e),t.stroke())},m=function(t,e,r,o,i,n,s){var a;a=2*i,t.rect(-i,-i,a,a),s.doit&&(s.set_vectorize(t,e),t.fill()),n.doit&&(n.set_vectorize(t,e),t.stroke())},y=function(t,e,r,o,i,s,a){var l;l=2*i,t.rect(-i,-i,l,l),a.doit&&(a.set_vectorize(t,e),t.fill()),s.doit&&(s.set_vectorize(t,e),n(t,i),t.stroke())},g=function(t,e,r,o,i,n,s){var a;a=2*i,t.rect(-i,-i,a,a),s.doit&&(s.set_vectorize(t,e),t.fill()),n.doit&&(n.set_vectorize(t,e),l(t,i),t.stroke())},v=function(t,e,r,o,i,n,s){a(t,i),s.doit&&(s.set_vectorize(t,e),t.fill()),n.doit&&(n.set_vectorize(t,e),t.stroke())},b=function(t,e,r,o,i,n,s){l(t,i),n.doit&&(n.set_vectorize(t,e),t.stroke())},i=function(t,e){var r,o;return o=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return w(r,t),r.prototype._render_one=e,r}(k.MarkerView),r=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return w(r,e),r.prototype.default_view=o,r.prototype.type=t,r}(k.Marker)},r.Asterisk=i(\"Asterisk\",u),r.CircleCross=i(\"CircleCross\",c),r.CircleX=i(\"CircleX\",_),r.Cross=i(\"Cross\",p),r.Diamond=i(\"Diamond\",h),r.DiamondCross=i(\"DiamondCross\",d),r.InvertedTriangle=i(\"InvertedTriangle\",f),r.Square=i(\"Square\",m),r.SquareCross=i(\"SquareCross\",y),r.SquareX=i(\"SquareX\",g),r.Triangle=i(\"Triangle\",v),r.X=i(\"X\",b)},{\"./marker\":\"models/markers/marker\"}],\"models/markers/marker\":[function(t,e,r){\"use strict\";Object.defineProperty(r,\"__esModule\",{value:!0});var o=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty,n=t(\"../glyphs/xy_glyph\"),s=t(\"core/hittest\"),a=t(\"core/properties\");r.MarkerView=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.draw_legend_for_index=function(t,e,r,o,i,n){var s,a,l,u,c,_;return l=[n],c={},c[n]=(e+r)/2,_={},_[n]=(o+i)/2,u={},u[n]=.4*Math.min(Math.abs(r-e),Math.abs(i-o)),s={},s[n]=this._angle[n],a={sx:c,sy:_,_size:u,_angle:s},this._render(t,l,a)},e.prototype._render=function(t,e,r){var o,i,n,s,a,l,u,c,_;for(c=r.sx,_=r.sy,i=r._size,o=r._angle,u=[],s=0,a=e.length;se;0<=e?t++:t--)c.push(t);return c}.apply(this),r=[],o=n=0,l=e.length;0<=l?n 1&&s.logger.warn(\"Bokeh does not support Polygons with holes in, only exterior ring used.\"),n=t.coordinates[0],O=[],u=_=0,h=n.length;__;o=0<=_?++i:--i)for(r[o]=[],u=a.copy(t[o]);u.length>0;)n=a.findLastIndex(u,function(t){return l.isStrictNaN(t)}),n>=0?c=u.splice(n):(c=u,u=[]),e=function(){var t,e,r;for(r=[],t=0,e=c.length;t0&&a>o&&(c=(o-l)/(a-l)),c=Math.max(0,Math.min(1,c))),c},e.prototype.update_range=function(t,e,r){var o,i,n,s,a,l,u;if(this.pause(),null==t){n=this.frame.x_ranges;for(o in n)u=n[o],u.reset();s=this.frame.y_ranges;for(o in s)u=s[o],u.reset();this.update_dataranges()}else{i=[],a=this.frame.x_ranges;for(o in a)u=a[o],i.push([u,t.xrs[o]]);l=this.frame.y_ranges;for(o in l)u=l[o],i.push([u,t.yrs[o]]);r&&this._update_ranges_together(i),this._update_ranges_individually(i,e,r)}return this.unpause()},e.prototype.reset_range=function(){return this.update_range(null)},e.prototype.build_levels=function(){var t,e,r,o,i,n,s,a,l,u,c;for(l=this.model.plot.all_renderers,a=Object.keys(this.renderer_views),s=h.build_views(this.renderer_views,l,this.view_options()),u=j.difference(a,function(){var t,e,r;for(r=[],t=0,e=l.length;t\\s*\\(/gm,\"{anonymous}()@\"):\"Unknown Stack Trace\",n=e.console&&(e.console.warn||e.console.log);return n&&n.call(e.console,i,o),t.apply(this,arguments)}}function c(t,e,r){var o,i=e.prototype;o=t.prototype=Object.create(i),o.constructor=t,o._super=i,r&&ht(o,r)}function _(t,e){return function(){return t.apply(e,arguments)}}function p(t,e){return typeof t==mt?t.apply(e?e[0]||n:n,e):t}function h(t,e){return t===n?e:t}function d(t,e,r){l(g(e),function(e){t.addEventListener(e,r,!1)})}function f(t,e,r){l(g(e),function(e){t.removeEventListener(e,r,!1)})}function m(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function y(t,e){return t.indexOf(e)>-1}function g(t){return t.trim().split(/\\s+/g)}function v(t,e,r){if(t.indexOf&&!r)return t.indexOf(e);for(var o=0;o