1&&\"string\"==typeof v&&!d.checkClone&&De.test(v))return e.each((function(i){var o=e.eq(i);y&&(t[0]=v.call(this,i,o.html())),Re(o,t,n,r)}));if(p&&(a=(i=xe(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=a),a||r)){for(u=(s=b.map(ve(i,\"script\"),Le)).length;f0&&ye(a,!u&&ve(e,\"script\")),s},cleanData:function(e){for(var t,n,r,i=b.event.special,o=0;void 0!==(n=e[o]);o++)if(X(n)){if(t=n[G.expando]){if(t.events)for(r in t.events)i[r]?b.event.remove(n,r):b.removeEvent(n,r,t.handle);n[G.expando]=void 0}n[Y.expando]&&(n[Y.expando]=void 0)}}}),b.fn.extend({detach:function(e){return Me(this,e,!0)},remove:function(e){return Me(this,e)},text:function(e){return B(this,(function(e){return void 0===e?b.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Re(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)}))},prepend:function(){return Re(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Re(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Re(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(b.cleanData(ve(e,!1)),e.textContent=\"\");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return b.clone(this,e,t)}))},html:function(e){return B(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if(\"string\"==typeof e&&!Ne.test(e)&&!ge[(de.exec(e)||[\"\",\"\"])[1].toLowerCase()]){e=b.htmlPrefilter(e);try{for(;n3,ne.removeChild(t)),s}}))}();var ze=[\"Webkit\",\"Moz\",\"ms\"],Ue=v.createElement(\"div\").style,Xe={};function Ve(e){var t=b.cssProps[e]||Xe[e];return t||(e in Ue?e:Xe[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),n=ze.length;n--;)if((e=ze[n]+t)in Ue)return e}(e)||e)}var Ge=/^(none|table(?!-c[ea]).+)/,Ye=/^--/,Qe={position:\"absolute\",visibility:\"hidden\",display:\"block\"},Je={letterSpacing:\"0\",fontWeight:\"400\"};function Ke(e,t,n){var r=ee.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||\"px\"):t}function Ze(e,t,n,r,i,o){var a=\"width\"===t?1:0,s=0,u=0;if(n===(r?\"border\":\"content\"))return 0;for(;a<4;a+=2)\"margin\"===n&&(u+=b.css(e,n+te[a],!0,i)),r?(\"content\"===n&&(u-=b.css(e,\"padding\"+te[a],!0,i)),\"margin\"!==n&&(u-=b.css(e,\"border\"+te[a]+\"Width\",!0,i))):(u+=b.css(e,\"padding\"+te[a],!0,i),\"padding\"!==n?u+=b.css(e,\"border\"+te[a]+\"Width\",!0,i):s+=b.css(e,\"border\"+te[a]+\"Width\",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function et(e,t,n){var r=We(e),i=(!d.boxSizingReliable()||n)&&\"border-box\"===b.css(e,\"boxSizing\",!1,r),o=i,a=$e(e,t,r),s=\"offset\"+t[0].toUpperCase()+t.slice(1);if(Ie.test(a)){if(!n)return a;a=\"auto\"}return(!d.boxSizingReliable()&&i||!d.reliableTrDimensions()&&k(e,\"tr\")||\"auto\"===a||!parseFloat(a)&&\"inline\"===b.css(e,\"display\",!1,r))&&e.getClientRects().length&&(i=\"border-box\"===b.css(e,\"boxSizing\",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ze(e,t,n||(i?\"border\":\"content\"),o,r,a)+\"px\"}function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=$e(e,\"opacity\");return\"\"===n?\"1\":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=U(t),u=Ye.test(t),l=e.style;if(u||(t=Ve(s)),a=b.cssHooks[t]||b.cssHooks[s],void 0===n)return a&&\"get\"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];\"string\"===(o=typeof n)&&(i=ee.exec(n))&&i[1]&&(n=ae(e,t,i),o=\"number\"),null!=n&&n==n&&(\"number\"!==o||u||(n+=i&&i[3]||(b.cssNumber[s]?\"\":\"px\")),d.clearCloneStyle||\"\"!==n||0!==t.indexOf(\"background\")||(l[t]=\"inherit\"),a&&\"set\"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=U(t);return Ye.test(t)||(t=Ve(s)),(a=b.cssHooks[t]||b.cssHooks[s])&&\"get\"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=$e(e,t,r)),\"normal\"===i&&t in Je&&(i=Je[t]),\"\"===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),b.each([\"height\",\"width\"],(function(e,t){b.cssHooks[t]={get:function(e,n,r){if(n)return!Ge.test(b.css(e,\"display\"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):Fe(e,Qe,(function(){return et(e,t,r)}))},set:function(e,n,r){var i,o=We(e),a=!d.scrollboxSize()&&\"absolute\"===o.position,s=(a||r)&&\"border-box\"===b.css(e,\"boxSizing\",!1,o),u=r?Ze(e,t,r,s,o):0;return s&&a&&(u-=Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,\"border\",!1,o)-.5)),u&&(i=ee.exec(n))&&\"px\"!==(i[3]||\"px\")&&(e.style[t]=n,n=b.css(e,t)),Ke(0,n,u)}}})),b.cssHooks.marginLeft=_e(d.reliableMarginLeft,(function(e,t){if(t)return(parseFloat($e(e,\"marginLeft\"))||e.getBoundingClientRect().left-Fe(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+\"px\"})),b.each({margin:\"\",padding:\"\",border:\"Width\"},(function(e,t){b.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o=\"string\"==typeof n?n.split(\" \"):[n];r<4;r++)i[e+te[r]+t]=o[r]||o[r-2]||o[0];return i}},\"margin\"!==e&&(b.cssHooks[e+t].set=Ke)})),b.fn.extend({css:function(e,t){return B(this,(function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=We(e),i=t.length;a1)}}),b.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||b.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?\"\":\"px\")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=b.css(e.elem,e.prop,\"\"))&&\"auto\"!==t?t:0},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):1!==e.elem.nodeType||!b.cssHooks[e.prop]&&null==e.elem.style[Ve(e.prop)]?e.elem[e.prop]=e.now:b.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:\"swing\"},b.fx=tt.prototype.init,b.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===v.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,b.fx.interval),b.fx.tick())}function st(){return e.setTimeout((function(){nt=void 0})),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i[\"margin\"+(n=te[r])]=i[\"padding\"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(ct.tweeners[t]||[]).concat(ct.tweeners[\"*\"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each((function(){b.removeAttr(this,e)}))}}),b.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?b.prop(e,t,n):(1===o&&b.isXMLDoc(e)||(i=b.attrHooks[t.toLowerCase()]||(b.expr.match.bool.test(t)?ft:void 0)),void 0!==n?null===n?void b.removeAttr(e,t):i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+\"\"),n):i&&\"get\"in i&&null!==(r=i.get(e,t))?r:null==(r=b.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!d.radioValue&&\"radio\"===t&&k(e,\"input\")){var n=e.value;return e.setAttribute(\"type\",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(O);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),ft={set:function(e,t,n){return!1===t?b.removeAttr(e,n):e.setAttribute(n,n),n}},b.each(b.expr.match.bool.source.match(/\\w+/g),(function(e,t){var n=pt[t]||b.find.attr;pt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=pt[a],pt[a]=i,i=null!=n(e,t,r)?a:null,pt[a]=o),i}}));var dt=/^(?:input|select|textarea|button)$/i,ht=/^(?:a|area)$/i;function gt(e){return(e.match(O)||[]).join(\" \")}function vt(e){return e.getAttribute&&e.getAttribute(\"class\")||\"\"}function yt(e){return Array.isArray(e)?e:\"string\"==typeof e&&e.match(O)||[]}b.fn.extend({prop:function(e,t){return B(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[b.propFix[e]||e]}))}}),b.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&b.isXMLDoc(e)||(t=b.propFix[t]||t,i=b.propHooks[t]),void 0!==n?i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&\"get\"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=b.find.attr(e,\"tabindex\");return t?parseInt(t,10):dt.test(e.nodeName)||ht.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:\"htmlFor\",class:\"className\"}}),d.optSelected||(b.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),b.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],(function(){b.propFix[this.toLowerCase()]=this})),b.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(h(e))return this.each((function(t){b(this).addClass(e.call(this,t,vt(this)))}));if((t=yt(e)).length)for(;n=this[u++];)if(i=vt(n),r=1===n.nodeType&&\" \"+gt(i)+\" \"){for(a=0;o=t[a++];)r.indexOf(\" \"+o+\" \")<0&&(r+=o+\" \");i!==(s=gt(r))&&n.setAttribute(\"class\",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(h(e))return this.each((function(t){b(this).removeClass(e.call(this,t,vt(this)))}));if(!arguments.length)return this.attr(\"class\",\"\");if((t=yt(e)).length)for(;n=this[u++];)if(i=vt(n),r=1===n.nodeType&&\" \"+gt(i)+\" \"){for(a=0;o=t[a++];)for(;r.indexOf(\" \"+o+\" \")>-1;)r=r.replace(\" \"+o+\" \",\" \");i!==(s=gt(r))&&n.setAttribute(\"class\",s)}return this},toggleClass:function(e,t){var n=typeof e,r=\"string\"===n||Array.isArray(e);return\"boolean\"==typeof t&&r?t?this.addClass(e):this.removeClass(e):h(e)?this.each((function(n){b(this).toggleClass(e.call(this,n,vt(this),t),t)})):this.each((function(){var t,i,o,a;if(r)for(i=0,o=b(this),a=yt(e);t=a[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&\"boolean\"!==n||((t=vt(this))&&G.set(this,\"__className__\",t),this.setAttribute&&this.setAttribute(\"class\",t||!1===e?\"\":G.get(this,\"__className__\")||\"\"))}))},hasClass:function(e){var t,n,r=0;for(t=\" \"+e+\" \";n=this[r++];)if(1===n.nodeType&&(\" \"+gt(vt(n))+\" \").indexOf(t)>-1)return!0;return!1}});var mt=/\\r/g;b.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=h(e),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,b(this).val()):e)?i=\"\":\"number\"==typeof i?i+=\"\":Array.isArray(i)&&(i=b.map(i,(function(e){return null==e?\"\":e+\"\"}))),(t=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()])&&\"set\"in t&&void 0!==t.set(this,i,\"value\")||(this.value=i))}))):i?(t=b.valHooks[i.type]||b.valHooks[i.nodeName.toLowerCase()])&&\"get\"in t&&void 0!==(n=t.get(i,\"value\"))?n:\"string\"==typeof(n=i.value)?n.replace(mt,\"\"):null==n?\"\":n:void 0}}),b.extend({valHooks:{option:{get:function(e){var t=b.find.attr(e,\"value\");return null!=t?t:gt(b.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a=\"select-one\"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),b.each([\"radio\",\"checkbox\"],(function(){b.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=b.inArray(b(e).val(),t)>-1}},d.checkOn||(b.valHooks[this].get=function(e){return null===e.getAttribute(\"value\")?\"on\":e.value})})),d.focusin=\"onfocusin\"in e;var xt=/^(?:focusinfocus|focusoutblur)$/,bt=function(e){e.stopPropagation()};b.extend(b.event,{trigger:function(t,n,r,i){var o,a,s,u,l,f,p,d,y=[r||v],m=c.call(t,\"type\")?t.type:t,x=c.call(t,\"namespace\")?t.namespace.split(\".\"):[];if(a=d=s=r=r||v,3!==r.nodeType&&8!==r.nodeType&&!xt.test(m+b.event.triggered)&&(m.indexOf(\".\")>-1&&(x=m.split(\".\"),m=x.shift(),x.sort()),l=m.indexOf(\":\")<0&&\"on\"+m,(t=t[b.expando]?t:new b.Event(m,\"object\"==typeof t&&t)).isTrigger=i?2:3,t.namespace=x.join(\".\"),t.rnamespace=t.namespace?new RegExp(\"(^|\\\\.)\"+x.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:b.makeArray(n,[t]),p=b.event.special[m]||{},i||!p.trigger||!1!==p.trigger.apply(r,n))){if(!i&&!p.noBubble&&!g(r)){for(u=p.delegateType||m,xt.test(u+m)||(a=a.parentNode);a;a=a.parentNode)y.push(a),s=a;s===(r.ownerDocument||v)&&y.push(s.defaultView||s.parentWindow||e)}for(o=0;(a=y[o++])&&!t.isPropagationStopped();)d=a,t.type=o>1?u:p.bindType||m,(f=(G.get(a,\"events\")||Object.create(null))[t.type]&&G.get(a,\"handle\"))&&f.apply(a,n),(f=l&&a[l])&&f.apply&&X(a)&&(t.result=f.apply(a,n),!1===t.result&&t.preventDefault());return t.type=m,i||t.isDefaultPrevented()||p._default&&!1!==p._default.apply(y.pop(),n)||!X(r)||l&&h(r[m])&&!g(r)&&((s=r[l])&&(r[l]=null),b.event.triggered=m,t.isPropagationStopped()&&d.addEventListener(m,bt),r[m](),t.isPropagationStopped()&&d.removeEventListener(m,bt),b.event.triggered=void 0,s&&(r[l]=s)),t.result}},simulate:function(e,t,n){var r=b.extend(new b.Event,n,{type:e,isSimulated:!0});b.event.trigger(r,null,t)}}),b.fn.extend({trigger:function(e,t){return this.each((function(){b.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return b.event.trigger(e,t,n,!0)}}),d.focusin||b.each({focus:\"focusin\",blur:\"focusout\"},(function(e,t){var n=function(e){b.event.simulate(t,e.target,b.event.fix(e))};b.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,i=G.access(r,t);i||r.addEventListener(e,n,!0),G.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=G.access(r,t)-1;i?G.access(r,t,i):(r.removeEventListener(e,n,!0),G.remove(r,t))}}}));var wt=e.location,Tt={guid:Date.now()},Ct=/\\?/;b.parseXML=function(t){var n;if(!t||\"string\"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,\"text/xml\")}catch(e){n=void 0}return n&&!n.getElementsByTagName(\"parsererror\").length||b.error(\"Invalid XML: \"+t),n};var Et=/\\[\\]$/,St=/\\r?\\n/g,kt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function Nt(e,t,n,r){var i;if(Array.isArray(t))b.each(t,(function(t,i){n||Et.test(e)?r(e,i):Nt(e+\"[\"+(\"object\"==typeof i&&null!=i?t:\"\")+\"]\",i,n,r)}));else if(n||\"object\"!==x(t))r(e,t);else for(i in t)Nt(e+\"[\"+i+\"]\",t[i],n,r)}b.param=function(e,t){var n,r=[],i=function(e,t){var n=h(t)?t():t;r[r.length]=encodeURIComponent(e)+\"=\"+encodeURIComponent(null==n?\"\":n)};if(null==e)return\"\";if(Array.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,(function(){i(this.name,this.value)}));else for(n in e)Nt(n,e[n],t,i);return r.join(\"&\")},b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=b.prop(this,\"elements\");return e?b.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!b(this).is(\":disabled\")&&At.test(this.nodeName)&&!kt.test(e)&&(this.checked||!pe.test(e))})).map((function(e,t){var n=b(this).val();return null==n?null:Array.isArray(n)?b.map(n,(function(e){return{name:t.name,value:e.replace(St,\"\\r\\n\")}})):{name:t.name,value:n.replace(St,\"\\r\\n\")}})).get()}});var Dt=/%20/g,jt=/#.*$/,qt=/([?&])_=[^&]*/,Lt=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Ht=/^(?:GET|HEAD)$/,Ot=/^\\/\\//,Pt={},Rt={},Mt=\"*/\".concat(\"*\"),It=v.createElement(\"a\");function Wt(e){return function(t,n){\"string\"!=typeof t&&(n=t,t=\"*\");var r,i=0,o=t.toLowerCase().match(O)||[];if(h(n))for(;r=o[i++];)\"+\"===r[0]?(r=r.slice(1)||\"*\",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Ft(e,t,n,r){var i={},o=e===Rt;function a(s){var u;return i[s]=!0,b.each(e[s]||[],(function(e,s){var l=s(t,n,r);return\"string\"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)})),u}return a(t.dataTypes[0])||!i[\"*\"]&&a(\"*\")}function Bt(e,t){var n,r,i=b.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&b.extend(!0,e,r),e}It.href=wt.href,b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:wt.href,type:\"GET\",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(wt.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":Mt,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Bt(Bt(e,b.ajaxSettings),t):Bt(b.ajaxSettings,e)},ajaxPrefilter:Wt(Pt),ajaxTransport:Wt(Rt),ajax:function(t,n){\"object\"==typeof t&&(n=t,t=void 0),n=n||{};var r,i,o,a,s,u,l,c,f,p,d=b.ajaxSetup({},n),h=d.context||d,g=d.context&&(h.nodeType||h.jquery)?b(h):b.event,y=b.Deferred(),m=b.Callbacks(\"once memory\"),x=d.statusCode||{},w={},T={},C=\"canceled\",E={readyState:0,getResponseHeader:function(e){var t;if(l){if(!a)for(a={};t=Lt.exec(o);)a[t[1].toLowerCase()+\" \"]=(a[t[1].toLowerCase()+\" \"]||[]).concat(t[2]);t=a[e.toLowerCase()+\" \"]}return null==t?null:t.join(\", \")},getAllResponseHeaders:function(){return l?o:null},setRequestHeader:function(e,t){return null==l&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,w[e]=t),this},overrideMimeType:function(e){return null==l&&(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(l)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return r&&r.abort(t),S(0,t),this}};if(y.promise(E),d.url=((t||d.url||wt.href)+\"\").replace(Ot,wt.protocol+\"//\"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=(d.dataType||\"*\").toLowerCase().match(O)||[\"\"],null==d.crossDomain){u=v.createElement(\"a\");try{u.href=d.url,u.href=u.href,d.crossDomain=It.protocol+\"//\"+It.host!=u.protocol+\"//\"+u.host}catch(e){d.crossDomain=!0}}if(d.data&&d.processData&&\"string\"!=typeof d.data&&(d.data=b.param(d.data,d.traditional)),Ft(Pt,d,n,E),l)return E;for(f in(c=b.event&&d.global)&&0==b.active++&&b.event.trigger(\"ajaxStart\"),d.type=d.type.toUpperCase(),d.hasContent=!Ht.test(d.type),i=d.url.replace(jt,\"\"),d.hasContent?d.data&&d.processData&&0===(d.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(d.data=d.data.replace(Dt,\"+\")):(p=d.url.slice(i.length),d.data&&(d.processData||\"string\"==typeof d.data)&&(i+=(Ct.test(i)?\"&\":\"?\")+d.data,delete d.data),!1===d.cache&&(i=i.replace(qt,\"$1\"),p=(Ct.test(i)?\"&\":\"?\")+\"_=\"+Tt.guid+++p),d.url=i+p),d.ifModified&&(b.lastModified[i]&&E.setRequestHeader(\"If-Modified-Since\",b.lastModified[i]),b.etag[i]&&E.setRequestHeader(\"If-None-Match\",b.etag[i])),(d.data&&d.hasContent&&!1!==d.contentType||n.contentType)&&E.setRequestHeader(\"Content-Type\",d.contentType),E.setRequestHeader(\"Accept\",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(\"*\"!==d.dataTypes[0]?\", \"+Mt+\"; q=0.01\":\"\"):d.accepts[\"*\"]),d.headers)E.setRequestHeader(f,d.headers[f]);if(d.beforeSend&&(!1===d.beforeSend.call(h,E,d)||l))return E.abort();if(C=\"abort\",m.add(d.complete),E.done(d.success),E.fail(d.error),r=Ft(Rt,d,n,E)){if(E.readyState=1,c&&g.trigger(\"ajaxSend\",[E,d]),l)return E;d.async&&d.timeout>0&&(s=e.setTimeout((function(){E.abort(\"timeout\")}),d.timeout));try{l=!1,r.send(w,S)}catch(e){if(l)throw e;S(-1,e)}}else S(-1,\"No Transport\");function S(t,n,a,u){var f,p,v,w,T,C=n;l||(l=!0,s&&e.clearTimeout(s),r=void 0,o=u||\"\",E.readyState=t>0?4:0,f=t>=200&&t<300||304===t,a&&(w=function(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;\"*\"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader(\"Content-Type\"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+\" \"+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(d,E,a)),!f&&b.inArray(\"script\",d.dataTypes)>-1&&(d.converters[\"text script\"]=function(){}),w=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];for(o=c.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if(\"*\"===o)o=u;else if(\"*\"!==u&&u!==o){if(!(a=l[u+\" \"+o]||l[\"* \"+o]))for(i in l)if((s=i.split(\" \"))[1]===o&&(a=l[u+\" \"+s[0]]||l[\"* \"+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:\"parsererror\",error:a?e:\"No conversion from \"+u+\" to \"+o}}}return{state:\"success\",data:t}}(d,w,E,f),f?(d.ifModified&&((T=E.getResponseHeader(\"Last-Modified\"))&&(b.lastModified[i]=T),(T=E.getResponseHeader(\"etag\"))&&(b.etag[i]=T)),204===t||\"HEAD\"===d.type?C=\"nocontent\":304===t?C=\"notmodified\":(C=w.state,p=w.data,f=!(v=w.error))):(v=C,!t&&C||(C=\"error\",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+\"\",f?y.resolveWith(h,[p,C,E]):y.rejectWith(h,[E,C,v]),E.statusCode(x),x=void 0,c&&g.trigger(f?\"ajaxSuccess\":\"ajaxError\",[E,d,f?p:v]),m.fireWith(h,[E,C]),c&&(g.trigger(\"ajaxComplete\",[E,d]),--b.active||b.event.trigger(\"ajaxStop\")))}return E},getJSON:function(e,t,n){return b.get(e,t,n,\"json\")},getScript:function(e,t){return b.get(e,void 0,t,\"script\")}}),b.each([\"get\",\"post\"],(function(e,t){b[t]=function(e,n,r,i){return h(n)&&(i=i||r,r=n,n=void 0),b.ajax(b.extend({url:e,type:t,dataType:i,data:n,success:r},b.isPlainObject(e)&&e))}})),b.ajaxPrefilter((function(e){var t;for(t in e.headers)\"content-type\"===t.toLowerCase()&&(e.contentType=e.headers[t]||\"\")})),b._evalUrl=function(e,t,n){return b.ajax({url:e,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,converters:{\"text script\":function(){}},dataFilter:function(e){b.globalEval(e,t,n)}})},b.fn.extend({wrapAll:function(e){var t;return this[0]&&(h(e)&&(e=e.call(this[0])),t=b(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return h(e)?this.each((function(t){b(this).wrapInner(e.call(this,t))})):this.each((function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=h(e);return this.each((function(n){b(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not(\"body\").each((function(){b(this).replaceWith(this.childNodes)})),this}}),b.expr.pseudos.hidden=function(e){return!b.expr.pseudos.visible(e)},b.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},b.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var $t={0:200,1223:204},_t=b.ajaxSettings.xhr();d.cors=!!_t&&\"withCredentials\"in _t,d.ajax=_t=!!_t,b.ajaxTransport((function(t){var n,r;if(d.cors||_t&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];for(a in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i[\"X-Requested-With\"]||(i[\"X-Requested-With\"]=\"XMLHttpRequest\"),i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,\"abort\"===e?s.abort():\"error\"===e?\"number\"!=typeof s.status?o(0,\"error\"):o(s.status,s.statusText):o($t[s.status]||s.status,s.statusText,\"text\"!==(s.responseType||\"text\")||\"string\"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n(\"error\"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout((function(){n&&r()}))},n=n(\"abort\");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}})),b.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),b.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter(\"script\",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type=\"GET\")})),b.ajaxTransport(\"script\",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=b(\""
],
"text/plain": [
"Row\n",
" [0] ParamFunction(function)\n",
" [1] Spacer(width=15)\n",
" [2] Column\n",
" [0] Spacer(height=30)\n",
" [1] IntSlider(end=55, name='frame', start=1, value=1)\n",
" [2] Spacer(height=15)\n",
" [3] Checkbox(name='overlay')"
]
},
"execution_count": 4,
"metadata": {
"application/vnd.holoviews_exec.v0+json": {
"id": "1002"
}
},
"output_type": "execute_result"
}
],
"source": [
"def dashboard():\n",
" ip_distance = 0.0645\n",
" dt = 15\n",
" frame_width = 200\n",
" frame_height = frame_width * ims[0].shape[0] // ims[1].shape[1]\n",
" bounds = [\n",
" 0,\n",
" 0,\n",
" ims[0].shape[1] * ip_distance,\n",
" ims[0].shape[0] * ip_distance,\n",
" ]\n",
" opts = dict(\n",
" xlabel=\"µm\",\n",
" ylabel=\"µm\",\n",
" frame_width=frame_width,\n",
" frame_height=frame_height,\n",
" )\n",
"\n",
" frame_slider = pn.widgets.IntSlider(name=\"frame\", start=1, end=55, value=1)\n",
" overlay_selector = pn.widgets.Checkbox(name=\"overlay\", value=False,)\n",
"\n",
" @pn.depends(frame_slider.param.value, overlay_selector.param.value)\n",
" def _show_bacillus(frame, overlay):\n",
" im = ims[frame - 1]\n",
" title = f\"t = {dt*(frame-1)} min\"\n",
"\n",
" if overlay:\n",
" im_rgb = make_overlay(im, ims_bw[frame - 1])\n",
" return hv.RGB(im_rgb, bounds=bounds).opts(title=title, **opts)\n",
" else:\n",
" return hv.Image(im, bounds=bounds).opts(\n",
" title=title, cmap=\"viridis\", **opts\n",
" )\n",
"\n",
" return pn.Row(\n",
" _show_bacillus,\n",
" pn.Spacer(width=15),\n",
" pn.Column(\n",
" pn.Spacer(height=30),\n",
" frame_slider,\n",
" pn.Spacer(height=15),\n",
" overlay_selector,\n",
" ),\n",
" )\n",
"\n",
"\n",
"dashboard()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**b)** For segmentation, we will take a similar approach as in [Lesson 37](l37_intro_to_image_processing.ipynb) to segment the image. We will simply threshold the image using Otsu's method. Since the dashboard is immediately above this cell, we can use it to look at this "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"ims_bw = [im > skimage.filters.threshold_otsu(im) for im in ims]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Looking again at the dashboard, this is pretty good. Certainly good enough for generating a growth curve."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**c)** See the dashboard above.\n",
"\n",
"The segmentation overshoots the bacteria. We might want to try to refine this a bit. We could do **adaptive thresholding**. We perform automatic thresholding on subimages throughout the image. We will take subimages to be 51 $\\times$ 51, since that would span the width of one bacterium, and then some, thereby avoiding the issue of thresholding within a single bacterium (and adaptive thresholding needs an odd image block size). Adaptive thresholding is achieved using `skimage.filters.threshold_local()`. Let's give it a shot."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# List of thresholded images\n",
"ims_bw = [im > skimage.filters.threshold_local(im, 51) for im in ims]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Checking out the dashboard again.... Whoa! It did a great job with the bacteria, but the background got really messed up. We could include pixels that are unity in both the adaptive and Otsu thresholding to take care of this. We then use `np.logical_and()` to do an element-by-element `AND` operation on the arrays."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"def thresh(im, block_size=51):\n",
" \"\"\"Combined adaptive and Otsu thresholding.\"\"\"\n",
" thresh_otsu = skimage.filters.threshold_otsu(im)\n",
" im_bw = im > thresh_otsu\n",
" return np.logical_and(im > skimage.filters.threshold_local(im, block_size), im_bw)\n",
"\n",
"# Threshold images\n",
"ims_bw = [thresh(im) for im in ims]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now looking at the dashboard, it is very nice!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**d)** To plot the growth curve, we can plot the total bacterial area on the $y$-axis (on a log scale), versus time on the $x$-axis. To get the total area, we need to compute the total number of \"bacterial\" pixels in a given image, multiplied by the pixel area, which is $(64.5\\text{ nm})^2 = 4160.25\\text{ nm}^2$. Also, according to the metadata, we have one frame every 15 minutes."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"(function(root) {\n",
" function embed_document(root) {\n",
" \n",
" var docs_json = {\"b97a645c-4c6c-4e96-9ac4-eac152a28895\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1143\"}],\"center\":[{\"id\":\"1146\"},{\"id\":\"1150\"}],\"left\":[{\"id\":\"1147\"}],\"plot_height\":250,\"plot_width\":400,\"renderers\":[{\"id\":\"1168\"}],\"title\":{\"id\":\"1171\"},\"toolbar\":{\"id\":\"1158\"},\"x_range\":{\"id\":\"1135\"},\"x_scale\":{\"id\":\"1139\"},\"y_range\":{\"id\":\"1137\"},\"y_scale\":{\"id\":\"1141\"}},\"id\":\"1134\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1154\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1177\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1166\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1155\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1174\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1157\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data_source\":{\"id\":\"1165\"},\"glyph\":{\"id\":\"1166\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1167\"},\"selection_glyph\":null,\"view\":{\"id\":\"1169\"}},\"id\":\"1168\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"time (hours)\",\"formatter\":{\"id\":\"1174\"},\"ticker\":{\"id\":\"1144\"}},\"id\":\"1143\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1165\"}},\"id\":\"1169\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1137\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1141\",\"type\":\"LogScale\"},{\"attributes\":{\"num_minor_ticks\":10},\"id\":\"1148\",\"type\":\"LogTicker\"},{\"attributes\":{},\"id\":\"1144\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1151\",\"type\":\"PanTool\"},{\"attributes\":{\"data\":{\"x\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADQPwAAAAAAAOA/AAAAAAAA6D8AAAAAAADwPwAAAAAAAPQ/AAAAAAAA+D8AAAAAAAD8PwAAAAAAAABAAAAAAAAAAkAAAAAAAAAEQAAAAAAAAAZAAAAAAAAACEAAAAAAAAAKQAAAAAAAAAxAAAAAAAAADkAAAAAAAAAQQAAAAAAAABFAAAAAAAAAEkAAAAAAAAATQAAAAAAAABRAAAAAAAAAFUAAAAAAAAAWQAAAAAAAABdAAAAAAAAAGEAAAAAAAAAZQAAAAAAAABpAAAAAAAAAG0AAAAAAAAAcQAAAAAAAAB1AAAAAAAAAHkAAAAAAAAAfQAAAAAAAACBAAAAAAACAIEAAAAAAAAAhQAAAAAAAgCFAAAAAAAAAIkAAAAAAAIAiQAAAAAAAACNAAAAAAACAI0AAAAAAAAAkQAAAAAAAgCRAAAAAAAAAJUAAAAAAAIAlQAAAAAAAACZAAAAAAACAJkAAAAAAAAAnQAAAAAAAgCdAAAAAAAAAKEAAAAAAAIAoQAAAAAAAAClAAAAAAACAKUAAAAAAAAAqQAAAAAAAgCpAAAAAAAAAK0A=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[55]},\"y\":{\"__ndarray__\":\"W3fzVIdMFkBu93KfHNkWQCuDaoMTnRdAmZoEb0jHGEBJSQ9Dq9MZQDmy8stgaBtAN/jCZKq0HEBWm/9XHUUeQHIZNzXQLCBAq3ZNSGssIUAriIGufX8hQF2I1R9h9iJAVU57Ss4TJEBJ1As+zRklQKBOeXQjRiZAEaYol8aHJ0CwNzEkJ8UoQMhaQ6m9JipAgsmNImt5K0CuSbclcsEsQHSV7q6zyy1AEyf3OxQJL0Cm07oNalcwQJm5wOWxUTFASghW1ctpMkCK5ZZWQ5gzQLml1ZC49zRAPLoRFhUUNkDI7gIlBWs3QMSUSKKXqzhAKa+V0F1BOkBO0vwxrQA8QEDbatYZoT1AfTuJCP9pP0D3WtB746hAQKlJ8Ia0zEFAGLFPAMX8QkDr/Ntlv2REQPDC1mzl30VA9ihcj8JmR0DswaT4eCRJQH9mEB/Yu0pA9mBSfHzSTEB9eJYgI7hOQP4PsFatLlBAwCMqVLcYUUB+/+bFieJRQLr0L0ml9lJA7KS+LK1nVEBYdOs1PYNVQCrIz0Zu4lZAet0iMNaOWEAL6lvmtBFaQOf9f5wwt1tAyol2FVKUXUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[55]}},\"selected\":{\"id\":\"1176\"},\"selection_policy\":{\"id\":\"1177\"}},\"id\":\"1165\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis\":{\"id\":\"1147\"},\"dimension\":1,\"ticker\":null},\"id\":\"1150\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1135\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1156\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1176\",\"type\":\"Selection\"},{\"attributes\":{\"axis_label\":\"bacterial area (\\u00b5m\\u00b2)\",\"formatter\":{\"id\":\"1172\"},\"ticker\":{\"id\":\"1148\"}},\"id\":\"1147\",\"type\":\"LogAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1167\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1139\",\"type\":\"LinearScale\"},{\"attributes\":{\"overlay\":{\"id\":\"1157\"}},\"id\":\"1153\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"axis\":{\"id\":\"1143\"},\"ticker\":null},\"id\":\"1146\",\"type\":\"Grid\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1171\",\"type\":\"Title\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1151\"},{\"id\":\"1152\"},{\"id\":\"1153\"},{\"id\":\"1154\"},{\"id\":\"1155\"},{\"id\":\"1156\"}]},\"id\":\"1158\",\"type\":\"Toolbar\"},{\"attributes\":{\"ticker\":null},\"id\":\"1172\",\"type\":\"LogTickFormatter\"},{\"attributes\":{},\"id\":\"1152\",\"type\":\"WheelZoomTool\"}],\"root_ids\":[\"1134\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.0\"}};\n",
" var render_items = [{\"docid\":\"b97a645c-4c6c-4e96-9ac4-eac152a28895\",\"root_ids\":[\"1134\"],\"roots\":{\"1134\":\"1b26ce6b-7e4c-455a-a26f-45f17a4560be\"}}];\n",
" root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
"\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" } else {\n",
" var attempts = 0;\n",
" var timer = setInterval(function(root) {\n",
" if (root.Bokeh !== undefined) {\n",
" clearInterval(timer);\n",
" embed_document(root);\n",
" } else {\n",
" attempts++;\n",
" if (attempts > 100) {\n",
" clearInterval(timer);\n",
" console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
" }\n",
" }\n",
" }, 10, root)\n",
" }\n",
"})(window);"
],
"application/vnd.bokehjs_exec.v0+json": ""
},
"metadata": {
"application/vnd.bokehjs_exec.v0+json": {
"id": "1134"
}
},
"output_type": "display_data"
}
],
"source": [
"# Compute pixel area\n",
"pixel_area = 0.0645**2\n",
"\n",
"# Get total bacterial area\n",
"bac_area = pixel_area * np.array([np.sum(im_bw) for im_bw in ims_bw])\n",
" \n",
"# Get time in units of hours\n",
"t = 0.25 * np.arange(len(ims_bw))\n",
"\n",
"# Plot the result\n",
"p = bokeh.plotting.figure(\n",
" height=250,\n",
" width=400,\n",
" y_axis_type='log',\n",
" x_axis_label='time (hours)',\n",
" y_axis_label='bacterial area (µm²)'\n",
")\n",
"\n",
"p.circle(\n",
" x=t,\n",
" y=bac_area\n",
")\n",
"\n",
"bokeh.io.show(p)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This looks pretty linear, suggesting that the bacteria are, indeed, performing exponential growth."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**e)** To perform the regression on the growth curve, we use `np.polyfit()` with the `x` values being time, and the `y` values being the natural log of the bacterial area. We fit with a first order polynomial, which is a line."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"m0 = 4.96 sq. µm\n",
" r = 0.23 1/hours\n",
"\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"(function(root) {\n",
" function embed_document(root) {\n",
" \n",
" var docs_json = {\"27dd90c4-642a-466e-a0db-63a08d0ffd06\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1143\"}],\"center\":[{\"id\":\"1146\"},{\"id\":\"1150\"}],\"left\":[{\"id\":\"1147\"}],\"plot_height\":250,\"plot_width\":400,\"renderers\":[{\"id\":\"1168\"},{\"id\":\"1236\"}],\"title\":{\"id\":\"1171\"},\"toolbar\":{\"id\":\"1158\"},\"x_range\":{\"id\":\"1135\"},\"x_scale\":{\"id\":\"1139\"},\"y_range\":{\"id\":\"1137\"},\"y_scale\":{\"id\":\"1141\"}},\"id\":\"1134\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1154\",\"type\":\"SaveTool\"},{\"attributes\":{\"line_color\":\"orange\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1234\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"1233\"},\"glyph\":{\"id\":\"1234\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1235\"},\"selection_glyph\":null,\"view\":{\"id\":\"1237\"}},\"id\":\"1236\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1177\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1166\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1155\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1174\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1157\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data_source\":{\"id\":\"1165\"},\"glyph\":{\"id\":\"1166\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1167\"},\"selection_glyph\":null,\"view\":{\"id\":\"1169\"}},\"id\":\"1168\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"time (hours)\",\"formatter\":{\"id\":\"1174\"},\"ticker\":{\"id\":\"1144\"}},\"id\":\"1143\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1165\"}},\"id\":\"1169\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1152\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1246\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1137\",\"type\":\"DataRange1d\"},{\"attributes\":{\"num_minor_ticks\":10},\"id\":\"1148\",\"type\":\"LogTicker\"},{\"attributes\":{},\"id\":\"1144\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data\":{\"x\":{\"__ndarray__\":\"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\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[200]},\"y\":{\"__ndarray__\":\"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\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[200]}},\"selected\":{\"id\":\"1246\"},\"selection_policy\":{\"id\":\"1247\"}},\"id\":\"1233\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data\":{\"x\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADQPwAAAAAAAOA/AAAAAAAA6D8AAAAAAADwPwAAAAAAAPQ/AAAAAAAA+D8AAAAAAAD8PwAAAAAAAABAAAAAAAAAAkAAAAAAAAAEQAAAAAAAAAZAAAAAAAAACEAAAAAAAAAKQAAAAAAAAAxAAAAAAAAADkAAAAAAAAAQQAAAAAAAABFAAAAAAAAAEkAAAAAAAAATQAAAAAAAABRAAAAAAAAAFUAAAAAAAAAWQAAAAAAAABdAAAAAAAAAGEAAAAAAAAAZQAAAAAAAABpAAAAAAAAAG0AAAAAAAAAcQAAAAAAAAB1AAAAAAAAAHkAAAAAAAAAfQAAAAAAAACBAAAAAAACAIEAAAAAAAAAhQAAAAAAAgCFAAAAAAAAAIkAAAAAAAIAiQAAAAAAAACNAAAAAAACAI0AAAAAAAAAkQAAAAAAAgCRAAAAAAAAAJUAAAAAAAIAlQAAAAAAAACZAAAAAAACAJkAAAAAAAAAnQAAAAAAAgCdAAAAAAAAAKEAAAAAAAIAoQAAAAAAAAClAAAAAAACAKUAAAAAAAAAqQAAAAAAAgCpAAAAAAAAAK0A=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[55]},\"y\":{\"__ndarray__\":\"W3fzVIdMFkBu93KfHNkWQCuDaoMTnRdAmZoEb0jHGEBJSQ9Dq9MZQDmy8stgaBtAN/jCZKq0HEBWm/9XHUUeQHIZNzXQLCBAq3ZNSGssIUAriIGufX8hQF2I1R9h9iJAVU57Ss4TJEBJ1As+zRklQKBOeXQjRiZAEaYol8aHJ0CwNzEkJ8UoQMhaQ6m9JipAgsmNImt5K0CuSbclcsEsQHSV7q6zyy1AEyf3OxQJL0Cm07oNalcwQJm5wOWxUTFASghW1ctpMkCK5ZZWQ5gzQLml1ZC49zRAPLoRFhUUNkDI7gIlBWs3QMSUSKKXqzhAKa+V0F1BOkBO0vwxrQA8QEDbatYZoT1AfTuJCP9pP0D3WtB746hAQKlJ8Ia0zEFAGLFPAMX8QkDr/Ntlv2REQPDC1mzl30VA9ihcj8JmR0DswaT4eCRJQH9mEB/Yu0pA9mBSfHzSTEB9eJYgI7hOQP4PsFatLlBAwCMqVLcYUUB+/+bFieJRQLr0L0ml9lJA7KS+LK1nVEBYdOs1PYNVQCrIz0Zu4lZAet0iMNaOWEAL6lvmtBFaQOf9f5wwt1tAyol2FVKUXUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[55]}},\"selected\":{\"id\":\"1176\"},\"selection_policy\":{\"id\":\"1177\"}},\"id\":\"1165\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1151\",\"type\":\"PanTool\"},{\"attributes\":{\"axis\":{\"id\":\"1147\"},\"dimension\":1,\"ticker\":null},\"id\":\"1150\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1247\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1135\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1156\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1176\",\"type\":\"Selection\"},{\"attributes\":{\"axis_label\":\"bacterial area (\\u00b5m\\u00b2)\",\"formatter\":{\"id\":\"1172\"},\"ticker\":{\"id\":\"1148\"}},\"id\":\"1147\",\"type\":\"LogAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1167\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1139\",\"type\":\"LinearScale\"},{\"attributes\":{\"overlay\":{\"id\":\"1157\"}},\"id\":\"1153\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"axis\":{\"id\":\"1143\"},\"ticker\":null},\"id\":\"1146\",\"type\":\"Grid\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1171\",\"type\":\"Title\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"orange\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1235\",\"type\":\"Line\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1151\"},{\"id\":\"1152\"},{\"id\":\"1153\"},{\"id\":\"1154\"},{\"id\":\"1155\"},{\"id\":\"1156\"}]},\"id\":\"1158\",\"type\":\"Toolbar\"},{\"attributes\":{\"ticker\":null},\"id\":\"1172\",\"type\":\"LogTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"1233\"}},\"id\":\"1237\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1141\",\"type\":\"LogScale\"}],\"root_ids\":[\"1134\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.0\"}};\n",
" var render_items = [{\"docid\":\"27dd90c4-642a-466e-a0db-63a08d0ffd06\",\"root_ids\":[\"1134\"],\"roots\":{\"1134\":\"1ee15bbb-7286-4e78-b696-fea0c888439e\"}}];\n",
" root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
"\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" } else {\n",
" var attempts = 0;\n",
" var timer = setInterval(function(root) {\n",
" if (root.Bokeh !== undefined) {\n",
" clearInterval(timer);\n",
" embed_document(root);\n",
" } else {\n",
" attempts++;\n",
" if (attempts > 100) {\n",
" clearInterval(timer);\n",
" console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
" }\n",
" }\n",
" }, 10, root)\n",
" }\n",
"})(window);"
],
"application/vnd.bokehjs_exec.v0+json": ""
},
"metadata": {
"application/vnd.bokehjs_exec.v0+json": {
"id": "1134"
}
},
"output_type": "display_data"
}
],
"source": [
"# Use polyfit to get slope and intercept\n",
"slope, intercept = np.polyfit(t, np.log(bac_area), 1)\n",
"\n",
"# Pull out and print parameters\n",
"print(\"\"\"\n",
"m0 = {0:.2f} sq. µm\n",
" r = {1:.2f} 1/hours\n",
"\"\"\".format(np.exp(intercept), slope))\n",
"\n",
"# Generate smooth curve\n",
"t_smooth = np.linspace(0, t.max(), 200)\n",
"y_smooth = np.exp(intercept + slope * t_smooth)\n",
"\n",
"# Add to the plot\n",
"p.line(\n",
" x=t_smooth,\n",
" y=y_smooth,\n",
" color='orange',\n",
" line_width=2,\n",
")\n",
"\n",
"bokeh.io.show(p)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There is some systematic error, it appears, with the data being consistently above the curve at short times and then below for intermediate times. This could be due to small changes in conditions over time, most likely delay in getting into exponential growth phase at short times."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Computing environment"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPython 3.7.7\n",
"IPython 7.15.0\n",
"\n",
"numpy 1.18.1\n",
"pandas 0.24.2\n",
"skimage 0.16.2\n",
"bokeh 2.1.0\n",
"bokeh_catplot 0.1.8\n",
"holoviews 1.13.2\n",
"panel 0.9.6\n",
"jupyterlab 2.1.4\n"
]
}
],
"source": [
"%load_ext watermark\n",
"%watermark -v -p numpy,pandas,skimage,bokeh,bokeh_catplot,holoviews,panel,jupyterlab"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}