0.697)return Math.exp(x)-1;if(a>1e-8){y=Math.exp(x)-1;}else{y=(x/2+1)*x;}
-y-=(1+y)*(jstat.log1p(y)-x);return y;}
-jstat.logBeta=function(a,b){var corr,p,q;p=q=a;if(bq)q=b;if(p<0){console.warn('Both arguements must be >= 0');return Number.NaN;}
-else if(p==0){return Number.POSITIVE_INFINITY;}
-else if(!jstat.isFinite(q)){return Number.NEGATIVE_INFINITY;}
-if(p>=10){corr=jstat.lgammacor(p)+jstat.lgammacor(q)-jstat.lgammacor(p+q);return Math.log(q)*-0.5+jstat.LN_SQRT_2PI+corr
-+(p-0.5)*Math.log(p/(p+q))+q*jstat.log1p(-p/(p+q));}
-else if(q>=10){corr=jstat.lgammacor(q)-jstat.lgammacor(p+q);return jstat.lgamma(p)+corr+p-p*Math.log(p+q)
-+(q-0.5)*jstat.log1p(-p/(p+q));}
-else
-return Math.log(jstat.gamma(p)*(jstat.gamma(q)/jstat.gamma(p+q)));}
-jstat.dbinom_raw=function(x,n,p,q,give_log){if(give_log==null)give_log=false;var lf,lc;if(p==0){if(x==0){return(give_log)?0.0:1.0;}else{return(give_log)?Number.NEGATIVE_INFINITY:0.0;}}
-if(q==0){if(x==n){return(give_log)?0.0:1.0;}else{return(give_log)?Number.NEGATIVE_INFINITY:0.0;}}
-if(x==0){if(n==0)return(give_log)?0.0:1.0;lc=(p<0.1)?-jstat.bd0(n,n*q)-n*p:n*Math.log(q);return(give_log)?lc:Math.exp(lc);}
-if(x==n){lc=(q<0.1)?-jstat.bd0(n,n*p)-n*q:n*Math.log(p);return(give_log)?lc:Math.exp(lc);}
-if(x<0||x>n)return(give_log)?Number.NEGATIVE_INFINITY:0.0;lc=jstat.stirlerr(n)-jstat.stirlerr(x)-jstat.stirlerr(n-x)-jstat.bd0(x,n*p)-jstat.bd0(n-x,n*q);lf=Math.log(jstat.TWO_PI)+Math.log(x)+jstat.log1p(-x/n);return(give_log)?lc-0.5*lf:Math.exp(lc-0.5*lf);}
-jstat.max=function(values){var max=Number.NEGATIVE_INFINITY;for(var i=0;imax){max=values[i];}}
-return max;}
-var Range=Class.extend({init:function(min,max,numPoints){this._minimum=parseFloat(min);this._maximum=parseFloat(max);this._numPoints=parseFloat(numPoints);},getMinimum:function(){return this._minimum;},getMaximum:function(){return this._maximum;},getNumPoints:function(){return this._numPoints;},getPoints:function(){var results=[];var x=this._minimum;var step=(this._maximum-this._minimum)/(this._numPoints-1);for(var i=0;ieps){xsq=x*x;xnum=a[4]*xsq;xden=xsq;for(i=0;i<3;++i){xnum=(xnum+a[i])*xsq;xden=(xden+b[i])*xsq;}}else{xnum=xden=0.0;}
-temp=x*(xnum+a[3])/(xden+b[3]);if(lower)cum=0.5+temp;if(upper)ccum=0.5-temp;if(log_p){if(lower)cum=Math.log(cum);if(upper)ccum=Math.log(ccum);}}else if(y<=jstat.SQRT_32){xnum=c[8]*y;xden=y;for(i=0;i<7;++i){xnum=(xnum+c[i])*y;xden=(xden+d[i])*y;}
-temp=(xnum+c[7])/(xden+d[7]);xsq=jstat.trunc(x*16)/16;del=(x-xsq)*(x+xsq);if(log_p){cum=(-xsq*xsq*0.5)+(-del*0.5)+Math.log(temp);if((lower&&x>0.)||(upper&&x<=0.))
-ccum=jstat.log1p(-Math.exp(-xsq*xsq*0.5)*Math.exp(-del*0.5)*temp);}
-else{cum=Math.exp(-xsq*xsq*0.5)*Math.exp(-del*0.5)*temp;ccum=1.0-cum;}
-if(x>0.0){temp=cum;if(lower){cum=ccum;}
-ccum=temp;}}
-else if((log_p&&y<1e170)||(lower&&-37.51930.)||(upper&&x<=0.))
-ccum=jstat.log1p(-Math.exp(-xsq*xsq*0.5)*Math.exp(-del*0.5)*temp);}
-else{cum=Math.exp(-xsq*xsq*0.5)*Math.exp(-del*0.5)*temp;ccum=1.0-cum;}
-if(x>0.0){temp=cum;if(lower){cum=ccum;}
-ccum=temp;}}else{if(x>0){cum=(log_p)?0.0:1.0;ccum=(log_p)?Number.NEGATIVE_INFINITY:0.0;}else{cum=(log_p)?Number.NEGATIVE_INFINITY:0.0;ccum=(log_p)?0.0:1.0;}}
-return[cum,ccum];}
-var p,cp;var mu=this._mean;var sigma=this._sigma;var R_DT_0,R_DT_1;if(lower_tail){if(log_p){R_DT_0=Number.NEGATIVE_INFINITY;R_DT_1=0.0;}else{R_DT_0=0.0;R_DT_1=1.0;}}else{if(log_p){R_DT_0=0.0;R_DT_1=Number.NEGATIVE_INFINITY;}else{R_DT_0=1.0;R_DT_1=0.0;}}
-if(!jstat.isFinite(x)&&mu==x)return Number.NaN;if(sigma<=0){if(sigma<0){console.warn("Sigma is less than 0");return Number.NaN;}
-return(x0){var nd=new NormalDistribution(meanlog,sdlog);return nd._cdf(Math.log(x),lower_tail,log_p);}
-if(lower_tail){return(log_p)?Number.NEGATIVE_INFINITY:0.0;}else{return(log_p)?0.0:1.0;}},getLocation:function(){return this._location;},getScale:function(){return this._scale;},getMean:function(){return Math.exp((this._location+this._scale)/2);},getVariance:function(){var ans=(Math.exp(this._scale)-1)*Math.exp(2*this._location+this._scale);return ans;}});var GammaDistribution=ContinuousDistribution.extend({init:function(shape,scale){this._super('Gamma');this._shape=parseFloat(shape);this._scale=parseFloat(scale);this._string="Gamma ("+this._shape.toFixed(2)+", "+this._scale.toFixed(2)+")";},_pdf:function(x,give_log){var pr;var shape=this._shape;var scale=this._scale;if(give_log==null){give_log=false;}
-if(shape<0||scale<=0){throw"Illegal argument in _pdf";}
-if(x<0){return(give_log)?Number.NEGATIVE_INFINITY:0.0;}
-if(shape==0){return(x==0)?Number.POSITIVE_INFINITY:(give_log)?Number.NEGATIVE_INFINITY:0.0;}
-if(x==0){if(shape<1)return Number.POSITIVE_INFINITY;if(shape>1)return(give_log)?Number.NEGATIVE_INFINITY:0.0;return(give_log)?-Math.log(scale):1/scale;}
-if(shape<1){pr=jstat.dopois_raw(shape,x/scale,give_log);return give_log?pr+Math.log(shape/x):pr*shape/x;}
-pr=jstat.dopois_raw(shape-1,x/scale,give_log);return give_log?pr-Math.log(scale):pr/scale;},_cdf:function(x,lower_tail,log_p){function USE_PNORM(){pn1=Math.sqrt(alph)*3.0*(Math.pow(x/alph,1.0/3.0)+1.0/(9.0*alph)-1.0);var norm_dist=new NormalDistribution(0.0,1.0);return norm_dist._cdf(pn1,lower_tail,log_p);}
-if(lower_tail==null)lower_tail=true;if(log_p==null)log_p=false;var alph=this._shape;var scale=this._scale;var xbig=1.0e+8;var xlarge=1.0e+37;var alphlimit=1e5;var pn1,pn2,pn3,pn4,pn5,pn6,arg,a,b,c,an,osum,sum,n,pearson;if(alph<=0.||scale<=0.){console.warn('Invalid gamma params in _cdf');return Number.NaN;}
-x/=scale;if(isNaN(x))return x;if(x<=0.0){if(lower_tail){return(log_p)?Number.NEGATIVE_INFINITY:0.0;}else{return(log_p)?0.0:1.0;}}
-if(alph>alphlimit){return USE_PNORM();}
-if(x>xbig*alph){if(x>jstat.DBL_MAX*alph){if(lower_tail){return(log_p)?0.0:1.0;}else{return(log_p)?Number.NEGATIVE_INFINITY:0.0;}}else{return USE_PNORM();}}
-if(x<=1.0||xjstat.DBL_EPSILON*sum);}else{pearson=0;arg=alph*Math.log(x)-x-jstat.lgamma(alph);a=1.-alph;b=a+x+1.;pn1=1.;pn2=x;pn3=x+1.;pn4=x*b;sum=pn3/pn4;for(n=1;;n++){a+=1.;b+=2.;an=a*n;pn5=b*pn3-an*pn1;pn6=b*pn4-an*pn2;if(Math.abs(pn6)>0.){osum=sum;sum=pn5/pn6;if(Math.abs(osum-sum)<=jstat.DBL_EPSILON*jstat.fmin2(1.0,sum))
-break;}
-pn1=pn3;pn2=pn4;pn3=pn5;pn4=pn6;if(Math.abs(pn5)>=xlarge){pn1/=xlarge;pn2/=xlarge;pn3/=xlarge;pn4/=xlarge;}}}
-arg+=Math.log(sum);lower_tail=(lower_tail==pearson);if(log_p&&lower_tail)
-return(arg);if(lower_tail){return Math.exp(arg);}else{if(log_p){return(arg>-Math.LN2)?Math.log(-jstat.expm1(arg)):jstat.log1p(-Math.exp(arg));}else{return-jstat.expm1(arg);}}},getShape:function(){return this._shape;},getScale:function(){return this._scale;},getMean:function(){return this._shape*this._scale;},getVariance:function(){return this._shape*Math.pow(this._scale,2);}});var BetaDistribution=ContinuousDistribution.extend({init:function(alpha,beta){this._super('Beta');this._alpha=parseFloat(alpha);this._beta=parseFloat(beta);this._string="Beta ("+this._alpha.toFixed(2)+", "+this._beta.toFixed(2)+")";},_pdf:function(x,give_log){if(give_log==null)give_log=false;var a=this._alpha;var b=this._beta;var lval;if(a<=0||b<=0){console.warn('Illegal arguments in _pdf');return Number.NaN;}
-if(x<0||x>1){return(give_log)?Number.NEGATIVE_INFINITY:0.0;}
-if(x==0){if(a>1){return(give_log)?Number.NEGATIVE_INFINITY:0.0;}
-if(a<1){return Number.POSITIVE_INFINITY;}
-return(give_log)?Math.log(b):b;}
-if(x==1){if(b>1){return(give_log)?Number.NEGATIVE_INFINITY:0.0;}
-if(b<1){return Number.POSITIVE_INFINITY;}
-return(give_log)?Math.log(a):a;}
-if(a<=2||b<=2){lval=(a-1)*Math.log(x)+(b-1)*jstat.log1p(-x)-jstat.logBeta(a,b);}else{lval=Math.log(a+b-1)+jstat.dbinom_raw(a-1,a+b-2,x,1-x,true);}
-return(give_log)?lval:Math.exp(lval);},_cdf:function(x,lower_tail,log_p){if(lower_tail==null)lower_tail=true;if(log_p==null)log_p=false;var pin=this._alpha;var qin=this._beta;if(pin<=0||qin<=0){console.warn('Invalid argument in _cdf');return Number.NaN;}
-if(x<=0){if(lower_tail){return(log_p)?Number.NEGATIVE_INFINITY:0.0;}else{return(log_p)?0.1:1.0;}}
-if(x>=1){if(lower_tail){return(log_p)?0.1:1.0;}else{return(log_p)?Number.NEGATIVE_INFINITY:0.0;}}
-return jstat.incompleteBeta(pin,qin,x);},getAlpha:function(){return this._alpha;},getBeta:function(){return this._beta;},getMean:function(){return this._alpha/(this._alpha+this._beta);},getVariance:function(){var ans=(this._alpha*this._beta)/(Math.pow(this._alpha+this._beta,2)*(this._alpha+this._beta+1));return ans;}});var StudentTDistribution=ContinuousDistribution.extend({init:function(degreesOfFreedom,mu){this._super('StudentT');this._dof=parseFloat(degreesOfFreedom);if(mu!=null){this._mu=parseFloat(mu);this._string="StudentT ("+this._dof.toFixed(2)+", "+this._mu.toFixed(2)+")";}else{this._mu=0.0;this._string="StudentT ("+this._dof.toFixed(2)+")";}},_pdf:function(x,give_log){if(give_log==null)give_log=false;if(this._mu==null){return this._dt(x,give_log);}else{var y=this._dnt(x,give_log);if(y>1){console.warn('x:'+x+', y: '+y);}
-return y;}},_cdf:function(x,lower_tail,give_log){if(lower_tail==null)lower_tail=true;if(give_log==null)give_log=false;if(this._mu==null){return this._pt(x,lower_tail,give_log);}else{return this._pnt(x,lower_tail,give_log);}},_dt:function(x,give_log){var t,u;var n=this._dof;if(n<=0){console.warn('Invalid parameters in _dt');return Number.NaN;}
-if(!jstat.isFinite(x)){return(give_log)?Number.NEGATIVE_INFINITY:0.0;}
-if(!jstat.isFinite(n)){var norm=new NormalDistribution(0.0,1.0);return norm.density(x,give_log);}
-t=-jstat.bd0(n/2.0,(n+1)/2.0)+jstat.stirlerr((n+1)/2.0)-jstat.stirlerr(n/2.0);if(x*x>0.2*n)
-u=Math.log(1+x*x/n)*n/2;else
-u=-jstat.bd0(n/2.0,(n+x*x)/2.0)+x*x/2.0;var p1=jstat.TWO_PI*(1+x*x/n);var p2=t-u;return(give_log)?-0.5*Math.log(p1)+p2:Math.exp(p2)/Math.sqrt(p1);},_dnt:function(x,give_log){if(give_log==null)give_log=false;var df=this._dof;var ncp=this._mu;var u;if(df<=0.0){console.warn("Illegal arguments _dnf");return Number.NaN;}
-if(ncp==0.0){return this._dt(x,give_log);}
-if(!jstat.isFinite(x)){if(give_log){return Number.NEGATIVE_INFINITY;}else{return 0.0;}}
-if(!isFinite(df)||df>1e8){var dist=new NormalDistribution(ncp,1.);return dist.density(x,give_log);}
-if(Math.abs(x)>Math.sqrt(df*jstat.DBL_EPSILON)){var newT=new StudentTDistribution(df+2,ncp);u=Math.log(df)-Math.log(Math.abs(x))+
-Math.log(Math.abs(newT._pnt(x*Math.sqrt((df+2)/df),true,false)-
-this._pnt(x,true,false)));}
-else{u=jstat.lgamma((df+1)/2)-jstat.lgamma(df/2)
--.5*(Math.log(Math.PI)+Math.log(df)+ncp*ncp);}
-return(give_log?u:Math.exp(u));},_pt:function(x,lower_tail,log_p){if(lower_tail==null)lower_tail=true;if(log_p==null)log_p=false;var val,nx;var n=this._dof;var DT_0,DT_1;if(lower_tail){if(log_p){DT_0=Number.NEGATIVE_INFINITY;DT_1=1.;}else{DT_0=0.;DT_1=1.;}}else{if(log_p){DT_0=0.;DT_1=Number.NEGATIVE_INFINITY;}else{DT_0=1.;DT_1=0.;}}
-if(n<=0.0){console.warn("Invalid T distribution _pt");return Number.NaN;}
-var norm=new NormalDistribution(0,1);if(!jstat.isFinite(x)){return(x<0)?DT_0:DT_1;}
-if(!jstat.isFinite(n)){return norm._cdf(x,lower_tail,log_p);}
-if(n>4e5){val=1./(4.*n);return norm._cdf(x*(1.-val)/sqrt(1.+x*x*2.*val),lower_tail,log_p);}
-nx=1+(x/n)*x;if(nx>1e100){var lval;lval=-0.5*n*(2*Math.log(Math.abs(x))-Math.log(n))
--jstat.logBeta(0.5*n,0.5)-Math.log(0.5*n);val=log_p?lval:Math.exp(lval);}else{if(n>x*x){var beta=new BetaDistribution(0.5,n/2.);return beta._cdf(x*x/(n+x*x),false,log_p);}else{beta=new BetaDistribution(n/2.,0.5);return beta._cdf(1./nx,true,log_p);}}
-if(x<=0.)
-lower_tail=!lower_tail;if(log_p){if(lower_tail)return jstat.log1p(-0.5*Math.exp(val));else return val-M_LN2;}
-else{val/=2.;if(lower_tail){return(0.5-val+0.5);}else{return val;}}},_pnt:function(t,lower_tail,log_p){var dof=this._dof;var ncp=this._mu;var DT_0,DT_1;if(lower_tail){if(log_p){DT_0=Number.NEGATIVE_INFINITY;DT_1=1.;}else{DT_0=0.;DT_1=1.;}}else{if(log_p){DT_0=0.;DT_1=Number.NEGATIVE_INFINITY;}else{DT_0=1.;DT_1=0.;}}
-var albeta,a,b,del,errbd,lambda,rxb,tt,x;var geven,godd,p,q,s,tnc,xeven,xodd;var it,negdel;var ITRMAX=1000;var ERRMAX=1.e-7;if(dof<=0.0){return Number.NaN;}else if(dof==0.0){return this._pt(t);}
-if(!jstat.isFinite(t)){return(t<0)?DT_0:DT_1;}
-if(t>=0.){negdel=false;tt=t;del=ncp;}else{if(ncp>=40&&(!log_p||!lower_tail)){return DT_0;}
-negdel=true;tt=-t;del=-ncp;}
-if(dof>4e5||del*del>2*Math.LN2*(-(jstat.DBL_MIN_EXP))){s=1./(4.*dof);var norm=new NormalDistribution(del,Math.sqrt(1.+tt*tt*2.*s));var result=norm._cdf(tt*(1.-s),lower_tail!=negdel,log_p);return result;}
-x=t*t;rxb=dof/(x+dof);x=x/(x+dof);if(x>0.){lambda=del*del;p=.5*Math.exp(-.5*lambda);if(p==0.){console.warn("underflow in _pnt");return DT_0;}
-q=jstat.SQRT_2dPI*p*del;s=.5-p;if(s<1e-7){s=-0.5*jstat.expm1(-0.5*lambda);}
-a=.5;b=.5*dof;rxb=Math.pow(rxb,b);albeta=jstat.LN_SQRT_PI+jstat.lgamma(b)-jstat.lgamma(.5+b);xodd=jstat.incompleteBeta(a,b,x);godd=2.*rxb*Math.exp(a*Math.log(x)-albeta);tnc=b*x;xeven=(tnc1)break;errbd=2.*s*(xodd-godd);if(Math.abs(errbd)1-1e-10&&lower_tail){console.warn("precision error _pnt");}
-var res=jstat.fmin2(tnc,1.);if(lower_tail){if(log_p){return Math.log(res);}else{return res;}}else{if(log_p){return jstat.log1p(-(res));}else{return(0.5-(res)+0.5);}}},getDegreesOfFreedom:function(){return this._dof;},getNonCentralityParameter:function(){return this._mu;},getMean:function(){if(this._dof>1){var ans=(1/2)*Math.log(this._dof/2)+jstat.lgamma((this._dof-1)/2)-jstat.lgamma(this._dof/2)
-return Math.exp(ans)*this._mu;}else{return Number.NaN;}},getVariance:function(){if(this._dof>2){var ans=this._dof*(1+this._mu*this._mu)/(this._dof-2)-(((this._mu*this._mu*this._dof)/2)*Math.pow(Math.exp(jstat.lgamma((this._dof-1)/2)-jstat.lgamma(this._dof/2)),2));return ans;}else{return Number.NaN;}}});var Plot=Class.extend({init:function(id,options){this._container='#'+String(id);this._plots=[];this._flotObj=null;this._locked=false;if(options!=null){this._options=options;}else{this._options={};}},getContainer:function(){return this._container;},getGraph:function(){return this._flotObj;},setData:function(data){this._plots=data;},clear:function(){this._plots=[];},showLegend:function(){this._options.legend={show:true}
-this.render();},hideLegend:function(){this._options.legend={show:false}
-this.render();},render:function(){this._flotObj=null;this._flotObj=$.plot($(this._container),this._plots,this._options);}});var DistributionPlot=Plot.extend({init:function(id,distribution,range,options){this._super(id,options);this._showPDF=true;this._showCDF=false;this._pdfValues=[];this._cdfValues=[];this._maxY=1;this._plotType='line';this._fill=false;this._distribution=distribution;if(range!=null&&Range.validate(range)){this._range=range;}else{this._range=this._distribution.getRange();}
-if(this._distribution!=null){this._maxY=this._generateValues();}else{this._options.xaxis={min:range.getMinimum(),max:range.getMaximum()}
-this._options.yaxis={max:1}}
-this.render();},setHover:function(bool){if(bool){if(this._options.grid==null){this._options.grid={hoverable:true,mouseActiveRadius:25}}else{this._options.grid.hoverable=true,this._options.grid.mouseActiveRadius=25}
-function showTooltip(x,y,contents,color){$(''+contents+'
').css({position:'absolute',display:'none',top:y+15,'font-size':'small',left:x+5,border:'1px solid '+color[1],color:color[2],padding:'5px','background-color':color[0],opacity:0.80}).appendTo("body").show();}
-var previousPoint=null;$(this._container).bind("plothover",function(event,pos,item){$("#x").text(pos.x.toFixed(2));$("#y").text(pos.y.toFixed(2));if(item){if(previousPoint!=item.datapoint){previousPoint=item.datapoint;$("#jstat_tooltip").remove();var x=jstat.toSigFig(item.datapoint[0],2),y=jstat.toSigFig(item.datapoint[1],2);var text=null;var color=item.series.color;if(item.series.label=='PDF'){text="P("+x+") = "+y;color=["#fee","#fdd","#C05F5F"];}else{text="F("+x+") = "+y;color=["#eef","#ddf","#4A4AC0"];}
-showTooltip(item.pageX,item.pageY,text,color);}}
-else{$("#jstat_tooltip").remove();previousPoint=null;}});$(this._container).bind("mouseleave",function(){if($('#jstat_tooltip').is(':visible')){$('#jstat_tooltip').remove();previousPoint=null;}});}else{if(this._options.grid==null){this._options.grid={hoverable:false}}else{this._options.grid.hoverable=false}
-$(this._container).unbind("plothover");}
-this.render();},setType:function(type){this._plotType=type;var lines={};var points={};if(this._plotType=='line'){lines.show=true;points.show=false;}else if(this._plotType=='points'){lines.show=false;points.show=true;}else if(this._plotType=='both'){lines.show=true;points.show=true;}
-if(this._options.series==null){this._options.series={lines:lines,points:points}}else{if(this._options.series.lines==null){this._options.series.lines=lines;}else{this._options.series.lines.show=lines.show;}
-if(this._options.series.points==null){this._options.series.points=points;}else{this._options.series.points.show=points.show;}}
-this.render();},setFill:function(bool){this._fill=bool;if(this._options.series==null){this._options.series={lines:{fill:bool}}}else{if(this._options.series.lines==null){this._options.series.lines={fill:bool}}else{this._options.series.lines.fill=bool;}}
-this.render();},clear:function(){this._super();this._distribution=null;this._pdfValues=[];this._cdfValues=[];this.render();},_generateValues:function(){this._cdfValues=[];this._pdfValues=[];var xs=this._range.getPoints();this._options.xaxis={min:xs[0],max:xs[xs.length-1]}
-var pdfs=this._distribution.density(this._range);var cdfs=this._distribution.cumulativeDensity(this._range);for(var i=0;i 1) {
- console.log('ERROR: Found more than one slider for the parameter "' + paramName + '".');
- console.log('sliderDiv.length = ', sliderDiv.length);
- } // else {
- // console.log('MESSAGE: Did not find a slider for the parameter "' + paramName + '".');
- // }
- }
-
- function createSlider(sliderDiv, paramName) {
- var paramObj;
-
- paramObj = state.getParamObj(paramName);
-
- // Check that the retrieval went OK.
- if (paramObj === undefined) {
- console.log('ERROR: Could not get a paramObj for parameter "' + paramName + '".');
-
- return;
- }
-
- // Create a jQuery UI slider from the slider DIV. We will set
- // starting parameters, and will also attach a handler to update
- // the 'state' on the 'slide' event.
- sliderDiv.slider({
- 'min': paramObj.min,
- 'max': paramObj.max,
- 'value': paramObj.value,
- 'step': paramObj.step
- });
-
- // Tell the parameter object stored in state that we have a slider
- // that is attached to it. Next time when the parameter changes, it
- // will also update the value of this slider.
- paramObj.sliderDiv = sliderDiv;
-
- // Atach callbacks to update the slider's parameter.
- paramObj.sliderDiv.on('slide', sliderOnSlide);
- paramObj.sliderDiv.on('slidechange', sliderOnChange);
-
- return;
-
- // Update the 'state' - i.e. set the value of the parameter this
- // slider is attached to to a new value.
- //
- // This will cause the plot to be redrawn each time after the user
- // drags the slider handle and releases it.
- function sliderOnSlide(event, ui) {
- // Last parameter passed to setParameterValue() will be 'true'
- // so that the function knows we are a slider, and it can
- // change the our value back in the case when the new value is
- // invalid for some reason.
- if (state.setParameterValue(paramName, ui.value, sliderDiv, true, 'slide') === undefined) {
- console.log('ERROR: Could not update the parameter named "' + paramName + '" with the value "' + ui.value + '".');
- }
- }
-
- function sliderOnChange(event, ui) {
- if (state.setParameterValue(paramName, ui.value, sliderDiv, true, 'change') === undefined) {
- console.log('ERROR: Could not update the parameter named "' + paramName + '" with the value "' + ui.value + '".');
- }
- }
- }
- }
-});
-
-// End of wrapper for RequireJS. As you can see, we are passing
-// namespaced Require JS variables to an anonymous function. Within
-// it, you can use the standard requirejs(), require(), and define()
-// functions as if they were in the global namespace.
-}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define)
diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js
deleted file mode 100644
index 2a4536a8f9..0000000000
--- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js
+++ /dev/null
@@ -1,395 +0,0 @@
-// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
-// define() functions from Require JS available inside the anonymous function.
-(function (requirejs, require, define) {
-
-define('State', [], function () {
- var stateInst;
-
- // Since there will be (can be) multiple GST on a page, and each will have
- // a separate state, we will create a factory constructor function. The
- // constructor will expect the ID of the DIV with the GST contents, and the
- // configuration object (parsed from a JSON string). It will return an
- // object containing methods to set and get the private state properties.
-
- stateInst = 0;
-
- // This module defines and returns a factory constructor.
- return State;
-
- function State(gstId, config) {
- var parameters, allParameterNames, allParameterValues,
- plotDiv, dynamicEl, dynamicElByElId;
-
- dynamicEl = [];
- dynamicElByElId = {};
-
- stateInst += 1;
- // console.log('MESSAGE: Creating state instance # ' + stateInst + '.');
-
- // Initially, there are no parameters to track. So, we will instantiate
- // an empty object.
- //
- // As we parse the JSON config object, we will add parameters as
- // named properties. For example
- //
- // parameters.a = {...};
- //
- // will be created for the parameter 'a'.
- parameters = {};
-
- // Check that the required parameters config object is available.
- if ($.isPlainObject(config.parameters) === false) {
- console.log('ERROR: Expected config.parameters to be an object. It is not.');
- console.log('config.parameters = ', config.parameters);
-
- return;
- }
-
- // If config.parameters.param is an array, pass it to the processor
- // element by element.
- if ($.isArray(config.parameters.param) === true) {
- (function (c1) {
- while (c1 < config.parameters.param.length) {
- processParameter(config.parameters.param[c1]);
- c1 += 1;
- }
- }(0));
- }
-
- // If config.parameters.param is an object, pass this object to the
- // processor directly.
- else if ($.isPlainObject(config.parameters.param) === true) {
- processParameter(config.parameters.param);
- }
-
- // If config.parameters.param is some other type, report an error and
- // do not continue.
- else {
- console.log('ERROR: config.parameters.param is of an unsupported type.');
- console.log('config.parameters.param = ', config.parameters.param);
-
- return;
- }
-
- // Instead of building these arrays every time when some component
- // requests them, we will create them in the beginning, and then update
- // each element individually when some parameter's value changes.
- //
- // Then we can just return the required array, instead of iterating
- // over all of the properties of the 'parameters' object, and
- // extracting their names/values one by one.
- allParameterNames = [];
- allParameterValues = [];
-
- // Populate 'allParameterNames', and 'allParameterValues' with data.
- generateHelperArrays();
-
- // The constructor will return an object with methods to operate on
- // it's private properties.
- return {
- 'getParameterValue': getParameterValue,
- 'setParameterValue': setParameterValue,
-
- 'getParamObj': getParamObj,
-
- 'getAllParameterNames': getAllParameterNames,
- 'getAllParameterValues': getAllParameterValues,
-
- 'bindUpdatePlotEvent': bindUpdatePlotEvent,
- 'addDynamicEl': addDynamicEl,
-
- // plde is an abbreviation for Plot Label Dynamic Elements.
- plde: []
- };
-
- function getAllParameterNames() {
- return allParameterNames;
- }
-
- function getAllParameterValues() {
- return allParameterValues;
- }
-
- function getParamObj(paramName) {
- if (parameters.hasOwnProperty(paramName) === false) {
- console.log('ERROR: Object parameters does not have a property named "' + paramName + '".');
-
- return;
- }
-
- return parameters[paramName];
- }
-
- function bindUpdatePlotEvent(newPlotDiv, callback) {
- plotDiv = newPlotDiv;
-
- plotDiv.bind('update_plot', callback);
- }
-
- function addDynamicEl(el, func, elId, updateOnEvent) {
- var newLength;
-
- newLength = dynamicEl.push({
- 'el': el,
- 'func': func,
- 'elId': elId,
- 'updateOnEvent': updateOnEvent
- });
-
- if (typeof dynamicElByElId[elId] !== 'undefined') {
- console.log(
- 'ERROR: Duplicate dynamic element ID "' + elId + '" found.'
- );
- } else {
- dynamicElByElId[elId] = dynamicEl[newLength - 1];
- }
- }
-
- function getParameterValue(paramName) {
-
- // If the name of the constant is not tracked by state, return an
- // 'undefined' value.
- if (parameters.hasOwnProperty(paramName) === false) {
- console.log('ERROR: Object parameters does not have a property named "' + paramName + '".');
-
- return;
- }
-
- return parameters[paramname].value;
- }
-
- // ####################################################################
- //
- // Function: setParameterValue(paramName, paramValue, element)
- // --------------------------------------------------
- //
- //
- // This function can be called from a callback, registered by a slider
- // or a text input, when specific events ('slide' or 'change') are
- // triggered.
- //
- // The 'paramName' is the name of the parameter in 'parameters' object
- // whose value must be updated to the new value of 'paramValue'.
- //
- // Before we update the value, we must check that:
- //
- // 1.) the parameter named as 'paramName' actually exists in the
- // 'parameters' object;
- // 2.) the value 'paramValue' is a valid floating-point number, and
- // it lies within the range specified by the 'min' and 'max'
- // properties of the stored parameter object.
- //
- // If 'paramName' and 'paramValue' turn out to be valid, we will update
- // the stored value in the parameter with the new value, and also
- // update all of the text inputs and the slider that correspond to this
- // parameter (if any), so that they reflect the new parameter's value.
- // Finally, the helper array 'allParameterValues' will also be updated
- // to reflect the change.
- //
- // If something went wrong (for example the new value is outside the
- // allowed range), then we will reset the 'element' to display the
- // original value.
- //
- // ####################################################################
- function setParameterValue(paramName, paramValue, element, slider, updateOnEvent) {
- var paramValueNum, c1;
-
- // If a parameter with the name specified by the 'paramName'
- // parameter is not tracked by state, do not do anything.
- if (parameters.hasOwnProperty(paramName) === false) {
- console.log('ERROR: Object parameters does not have a property named "' + paramName + '".');
-
- return;
- }
-
- // Try to convert the passed value to a valid floating-point
- // number.
- paramValueNum = parseFloat(paramValue);
-
- // We are interested only in valid float values. NaN, -INF,
- // +INF we will disregard.
- if (isFinite(paramValueNum) === false) {
- console.log('ERROR: New parameter value is not a floating-point number.');
- console.log('paramValue = ', paramValue);
-
- return;
- }
-
- if (paramValueNum < parameters[paramName].min) {
- paramValueNum = parameters[paramName].min;
- } else if (paramValueNum > parameters[paramName].max) {
- paramValueNum = parameters[paramName].max;
- }
-
- parameters[paramName].value = paramValueNum;
-
- // Update all text inputs with the new parameter's value.
- for (c1 = 0; c1 < parameters[paramName].inputDivs.length; c1 += 1) {
- parameters[paramName].inputDivs[c1].val(paramValueNum);
- }
-
- // Update the single slider with the new parameter's value.
- if ((slider === false) && (parameters[paramName].sliderDiv !== null)) {
- parameters[paramName].sliderDiv.slider('value', paramValueNum);
- }
-
- // Update the helper array with the new parameter's value.
- allParameterValues[parameters[paramName].helperArrayIndex] = paramValueNum;
-
- for (c1 = 0; c1 < dynamicEl.length; c1++) {
- if (
- ((updateOnEvent !== undefined) && (dynamicEl[c1].updateOnEvent === updateOnEvent)) ||
- (updateOnEvent === undefined)
- ) {
- // If we have a DOM element, call the function "paste" the answer into the DIV.
- if (dynamicEl[c1].el !== null) {
- dynamicEl[c1].el.html(dynamicEl[c1].func.apply(window, allParameterValues));
- }
- // If we DO NOT have an element, simply call the function. The function can then
- // manipulate all the DOM elements it wants, without the fear of them being overwritten
- // by us afterwards.
- else {
- dynamicEl[c1].func.apply(window, allParameterValues);
- }
- }
- }
-
- // If we have a plot DIV to work with, tell to update.
- if (plotDiv !== undefined) {
- plotDiv.trigger('update_plot');
- }
-
- return true;
- } // End-of: function setParameterValue
-
- // ####################################################################
- //
- // Function: processParameter(obj)
- // -------------------------------
- //
- //
- // This function will be run once for each instance of a GST when
- // parsing the JSON config object.
- //
- // 'newParamObj' must be empty from the start for each invocation of
- // this function, that's why we will declare it locally.
- //
- // We will parse the passed object 'obj' and populate the 'newParamObj'
- // object with required properties.
- //
- // Since there will be many properties that are of type floating-point
- // number, we will have a separate function for parsing them.
- //
- // processParameter() will fail right away if 'obj' does not have a
- // '@var' property which represents the name of the parameter we want
- // to process.
- //
- // If, after all of the properties have been processed, we reached the
- // end of the function successfully, the 'newParamObj' will be added to
- // the 'parameters' object (that is defined in the scope of State()
- // function) as a property named as the name of the parameter.
- //
- // If at least one of the properties from 'obj' does not get correctly
- // parsed, then the parameter represented by 'obj' will be disregarded.
- // It will not be available to user-defined plotting functions, and
- // things will most likely break. We will notify the user about this.
- //
- // ####################################################################
- function processParameter(obj) {
- var paramName, newParamObj;
-
- if (typeof obj['@var'] !== 'string') {
- console.log('ERROR: Expected obj["@var"] to be a string. It is not.');
- console.log('obj["@var"] = ', obj['@var']);
-
- return;
- }
-
- paramName = obj['@var'];
- newParamObj = {};
-
- if (
- (processFloat('@min', 'min') === false) ||
- (processFloat('@max', 'max') === false) ||
- (processFloat('@step', 'step') === false) ||
- (processFloat('@initial', 'value') === false)
- ) {
- console.log('ERROR: A required property is missing. Not creating parameter "' + paramName + '"');
-
- return;
- }
-
- // Pointers to text input and slider DIV elements that this
- // parameter will be attached to. Initially there are none. When we
- // will create text inputs and sliders, we will update these
- // properties.
- newParamObj.inputDivs = [];
- newParamObj.sliderDiv = null;
-
- // Everything went well, so save the new parameter object.
- parameters[paramName] = newParamObj;
-
- return;
-
- function processFloat(attrName, newAttrName) {
- var attrValue;
-
- if (typeof obj[attrName] !== 'string') {
- console.log('ERROR: Expected obj["' + attrName + '"] to be a string. It is not.');
- console.log('obj["' + attrName + '"] = ', obj[attrName]);
-
- return false;
- } else {
- attrValue = parseFloat(obj[attrName]);
-
- if (isFinite(attrValue) === false) {
- console.log('ERROR: Expected obj["' + attrName + '"] to be a valid floating-point number. It is not.');
- console.log('obj["' + attrName + '"] = ', obj[attrName]);
-
- return false;
- }
- }
-
- newParamObj[newAttrName] = attrValue;
-
- return true;
- } // End-of: function processFloat
- } // End-of: function processParameter
-
- // ####################################################################
- //
- // Function: generateHelperArrays()
- // -------------------------------
- //
- //
- // Populate 'allParameterNames' and 'allParameterValues' with data.
- // Link each parameter object with the corresponding helper array via
- // an index 'helperArrayIndex'. It will be the same for both of the
- // arrays.
- //
- // NOTE: It is important to remember to update these helper arrays
- // whenever a new parameter is added (or one is removed), or when a
- // parameter's value changes.
- //
- // ####################################################################
- function generateHelperArrays() {
- var paramName, c1;
-
- c1 = 0;
- for (paramName in parameters) {
- allParameterNames.push(paramName);
- allParameterValues.push(parameters[paramName].value);
-
- parameters[paramName].helperArrayIndex = c1;
-
- c1 += 1;
- }
- }
- } // End-of: function State
-});
-
-// End of wrapper for RequireJS. As you can see, we are passing
-// namespaced Require JS variables to an anonymous function. Within
-// it, you can use the standard requirejs(), require(), and define()
-// functions as if they were in the global namespace.
-}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define)
diff --git a/common/lib/xmodule/xmodule/tests/test_export.py b/common/lib/xmodule/xmodule/tests/test_export.py
index b9f361d4b0..b4da1df061 100644
--- a/common/lib/xmodule/xmodule/tests/test_export.py
+++ b/common/lib/xmodule/xmodule/tests/test_export.py
@@ -82,7 +82,6 @@ class RoundTripTestCase(unittest.TestCase):
"conditional_and_poll",
"conditional",
"self_assessment",
- "graphic_slider_tool",
"test_exam_registration",
"word_cloud",
"pure_xblock",
diff --git a/common/lib/xmodule/xmodule/tests/test_import.py b/common/lib/xmodule/xmodule/tests/test_import.py
index a061780477..54a7a662c1 100644
--- a/common/lib/xmodule/xmodule/tests/test_import.py
+++ b/common/lib/xmodule/xmodule/tests/test_import.py
@@ -614,22 +614,6 @@ class ImportTestCase(BaseCourseTestCase):
self.assertRaises(etree.XMLSyntaxError, system.process_xml, bad_xml)
- def test_graphicslidertool_import(self):
- '''
- Check to see if definition_from_xml in gst_module.py
- works properly. Pulls data from the graphic_slider_tool directory
- in the test data directory.
- '''
- modulestore = XMLModuleStore(DATA_DIR, source_dirs=['graphic_slider_tool'])
-
- sa_id = SlashSeparatedCourseKey("edX", "gst_test", "2012_Fall")
- location = sa_id.make_usage_key("graphical_slider_tool", "sample_gst")
- gst_sample = modulestore.get_item(location)
- render_string_from_sample_gst_xml = """
- \
-""".strip()
- self.assertIn(render_string_from_sample_gst_xml, gst_sample.data)
-
def test_word_cloud_import(self):
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['word_cloud'])
diff --git a/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py b/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py
index 214ce621db..e66b6ae5a2 100644
--- a/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py
+++ b/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py
@@ -32,7 +32,6 @@ from xmodule.annotatable_module import AnnotatableDescriptor
from xmodule.capa_module import CapaDescriptor
from xmodule.course_module import CourseDescriptor
from xmodule.discussion_module import DiscussionDescriptor
-from xmodule.gst_module import GraphicalSliderToolDescriptor
from xmodule.html_module import HtmlDescriptor
from xmodule.poll_module import PollDescriptor
from xmodule.word_cloud_module import WordCloudDescriptor
@@ -53,7 +52,6 @@ LEAF_XMODULES = {
AnnotatableDescriptor: [{}],
CapaDescriptor: [{}],
DiscussionDescriptor: [{}],
- GraphicalSliderToolDescriptor: [{}],
HtmlDescriptor: [{}],
PollDescriptor: [{'display_name': 'Poll Display Name'}],
WordCloudDescriptor: [{}],
@@ -75,10 +73,9 @@ CONTAINER_XMODULES = {
WrapperBlock: [{}],
}
-# These modules are editable in studio yet
+# These modules are not editable in studio yet
NOT_STUDIO_EDITABLE = (
CrowdsourceHinterDescriptor,
- GraphicalSliderToolDescriptor,
PollDescriptor
)
diff --git a/common/test/data/graphic_slider_tool/README.md b/common/test/data/graphic_slider_tool/README.md
deleted file mode 100644
index ec4f121ad8..0000000000
--- a/common/test/data/graphic_slider_tool/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-This is a very very simple course, useful for debugging graphical slider tool
-code.
diff --git a/common/test/data/graphic_slider_tool/course.xml b/common/test/data/graphic_slider_tool/course.xml
deleted file mode 120000
index 49041310f6..0000000000
--- a/common/test/data/graphic_slider_tool/course.xml
+++ /dev/null
@@ -1 +0,0 @@
-roots/2012_Fall.xml
\ No newline at end of file
diff --git a/common/test/data/graphic_slider_tool/course/2012_Fall.xml b/common/test/data/graphic_slider_tool/course/2012_Fall.xml
deleted file mode 100644
index 2983c85dd5..0000000000
--- a/common/test/data/graphic_slider_tool/course/2012_Fall.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/common/test/data/graphic_slider_tool/graphical_slider_tool/sample_gst.xml b/common/test/data/graphic_slider_tool/graphical_slider_tool/sample_gst.xml
deleted file mode 100644
index bd0360fde8..0000000000
--- a/common/test/data/graphic_slider_tool/graphical_slider_tool/sample_gst.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- return Math.sqrt(a * a - x * x);
- return -Math.sqrt(a * a - x * x);
-
-
-
-
-
- return -a;
-
-
- return a;
-
-
- 1000
- -30, 6, 30
- -30, 6, 30
-
-
-
-
diff --git a/common/test/data/graphic_slider_tool/policies/2012_Fall.json b/common/test/data/graphic_slider_tool/policies/2012_Fall.json
deleted file mode 100644
index 9058481dc8..0000000000
--- a/common/test/data/graphic_slider_tool/policies/2012_Fall.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "course/2012_Fall": {
- "graceperiod": "2 days 5 hours 59 minutes 59 seconds",
- "start": "2015-07-17T12:00",
- "display_name": "GST Test",
- "graded": "false"
- },
- "chapter/Overview": {
- "display_name": "Overview"
- },
- "graphical_slider_tool/sample_gst": {
- "display_name": "Sample GST"
- }
-}
diff --git a/common/test/data/graphic_slider_tool/roots/2012_Fall.xml b/common/test/data/graphic_slider_tool/roots/2012_Fall.xml
deleted file mode 100644
index 1dc86c4afc..0000000000
--- a/common/test/data/graphic_slider_tool/roots/2012_Fall.xml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/lms/djangoapps/courseware/features/gst.feature b/lms/djangoapps/courseware/features/gst.feature
deleted file mode 100644
index f397c54bbc..0000000000
--- a/lms/djangoapps/courseware/features/gst.feature
+++ /dev/null
@@ -1,10 +0,0 @@
-@shard_2
-Feature: LMS.Graphical Slider Tool Module
- As a student, I want to view a Graphical Slider Tool Component
-
- Scenario: The slider changes values on the page
- Given that I have a course with a Graphical Slider Tool
- When I view the Graphical Slider Tool
- Then the displayed value should be 0
- And I move the slider to the right
- Then the displayed value should be 10
\ No newline at end of file
diff --git a/lms/djangoapps/courseware/features/gst.py b/lms/djangoapps/courseware/features/gst.py
deleted file mode 100644
index f232f9dfad..0000000000
--- a/lms/djangoapps/courseware/features/gst.py
+++ /dev/null
@@ -1,76 +0,0 @@
-
-from lettuce import world, steps
-from nose.tools import assert_equals
-
-from common import i_am_registered_for_the_course, visit_scenario_item
-
-
-DEFAULT_DATA = """\
-
- Test of the graphical slider tool
-
-
-
-
-
-
-
-
-
-
-
-
- a
-
-
-"""
-
-
-@steps
-class GraphicalSliderToolSteps(object):
- COURSE_NUM = 'test_course'
-
- def setup_gst(self, step):
- r'that I have a course with a Graphical Slider Tool$'
-
- i_am_registered_for_the_course(step, self.COURSE_NUM)
-
- world.scenario_dict['GST'] = world.ItemFactory(
- parent_location=world.scenario_dict['SECTION'].location,
- category='graphical_slider_tool',
- display_name="Test GST",
- data=DEFAULT_DATA
- )
-
- def view_gst(self, step):
- r'I view the Graphical Slider Tool$'
- visit_scenario_item('GST')
- world.wait_for_js_variable_truthy('$(".xblock-student_view[data-type=GraphicalSliderTool]").data("initialized")')
- world.wait_for_ajax_complete()
-
- def check_value(self, step, value):
- r'the displayed value should be (?P\d+)$'
-
- assert_equals(world.css_text('.gst-value'), value)
-
- def move_slider(self, step):
- r'I move the slider to the right$'
-
- handle_selector = '.gst-input .ui-slider-handle'
- world.wait_for_visible(handle_selector)
- world.wait_for_visible('.gst-value #value-display')
-
- def try_move():
- handle = world.css_find(handle_selector).first
- slider = world.css_find('.gst-input .ui-slider').first
- (handle.action_chains
- .click_and_hold(handle._element)
- .move_by_offset(
- int(handle._element.location['x'] + 400),
- 0
- ).release().perform())
-
- world.retry_on_exception(try_move)
-
-
-GraphicalSliderToolSteps()
diff --git a/lms/templates/graphical_slider_tool.html b/lms/templates/graphical_slider_tool.html
deleted file mode 100644
index 93a6761784..0000000000
--- a/lms/templates/graphical_slider_tool.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- ${configuration_json}
-
-
-
- ${gst_html}
-
diff --git a/lms/templates/staff_problem_info.html b/lms/templates/staff_problem_info.html
index c422c9839c..9a7252584e 100644
--- a/lms/templates/staff_problem_info.html
+++ b/lms/templates/staff_problem_info.html
@@ -6,7 +6,7 @@ from django.template.defaultfilters import escapejs
## The JS for this is defined in xqa_interface.html
${block_content}
-%if location.category in ['problem','video','html','combinedopenended','graphical_slider_tool', 'library_content']:
+%if location.category in ['problem','video','html','combinedopenended','library_content']:
% if edit_link: