Skip to content

Commit

Permalink
Adds button for PRISM-ing
Browse files Browse the repository at this point in the history
  • Loading branch information
luketpickering committed Apr 4, 2019
1 parent 9871c5b commit feaa8b2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 44 deletions.
49 changes: 17 additions & 32 deletions flux_hist.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,31 +102,10 @@ class OffAxis_flux_hist {
}

let targetvec = lalolib.array2vec(target.bincontent);

// (FluxMatrix_Solve.topRows(NBins).transpose() *
// FluxMatrix_Solve.topRows(NBins))
// .inverse() *
// FluxMatrix_Solve.topRows(NBins).transpose() *
// Target.topRows(NBins);

this.mat = lalolib.entrywisemul(this.mat,1E15);
targetvec = lalolib.entrywisemul(targetvec,1E15);

// let xtx = lalolib.xtx(this.mat);
// console.log("xtx: ", xtx);
// let xtxi = lalolib.inv(xtx);
// console.log("xtxi: ", xtxi);
// let xtxixt = lalolib.mul(xtxi, lalolib.transpose(this.mat));
// console.log("xtxixt: ", xtxixt);
// let result = lalolib.mul(xtxixt, target);
this.mat = lalolib.entrywisemul(this.mat, 1E15);
targetvec = lalolib.entrywisemul(targetvec, 1E15);
let result = lalolib.solve(this.mat, targetvec);
this.mat = lalolib.entrywisemul(this.mat,1E-15);

console.log("result: ", result);

// let result = lalolib.solve(this.mat, targetvec);

console.log(lalolib.mul(this.mat, result));
this.mat = lalolib.entrywisemul(this.mat, 1E-15);
return (lalolib.mul(this.mat, result));
}
};
Expand All @@ -136,8 +115,8 @@ class flux_plot {
constructor() { this.Hists = []; }

DrawAxes(el, axes_ranges, yScaleFactor = 1) {
this.width = 300;
this.height = 200;
this.width = 450;
this.height = 350;
this.margin = {top : 20, right : 20, bottom : 75, left : 95};
this.tot_width = this.width + this.margin.left + this.margin.right;
this.tot_height = this.height + this.margin.top + this.margin.bottom;
Expand Down Expand Up @@ -174,7 +153,7 @@ class flux_plot {

RenderLatexLabel(
this.svg.append("text").text("\\(E_{\\nu} \\textrm{(GeV)}\\)"),
this.svg, "25ex", "10ex", this.width * 0.6, this.height * 1.15, 1, 1);
this.svg, "25ex", "10ex", this.width * 0.75, this.height * 1.1, 1, 1);

this.svg.append("g")
.attr("class", "y_axis biglabel")
Expand All @@ -183,7 +162,7 @@ class flux_plot {
RenderLatexLabel(
this.svg.append("text").text(
"\\(\\Phi \\times{}10^{15} \\textrm{cm}^{-2}/\\textrm{POT}\\)"),
this.svg, "25ex", "10ex", -200, -65, 1, 1, -90);
this.svg, "25ex", "10ex", -225, -65, 1, 1, -90);
}

Draw(flux_h) {
Expand All @@ -196,9 +175,15 @@ class flux_plot {
.attr("d", this.lineGen(flux_h.GetPointList()))
.attr("class", lineclass));
}

ReDraw(flux_h) {
this.Hists[this.Hists.length - 1].remove();
this.Draw(flux_h);
Clear(n = 1) {
if (n <= 0) {
return;
}
if (n > this.Hists.length) {
n = this.Hists.length;
}
for (let i = this.Hists.length - n; i < this.Hists.length; ++i) {
this.Hists[i].remove();
}
}
};
25 changes: 13 additions & 12 deletions osc.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,7 @@
fp.Draw(FD_numode_numu_flux);
FD_numode_numu_flux_osc.Oscillate(pdg_from, pdg_to, baseline_km, op);
fp.Draw(FD_numode_numu_flux_osc);

console.log("ND Flux bins: ", ND_numuode_numu_flux.e_bins.length-1);
console.log("FD Flux bins: ", FD_numode_numu_flux_osc.e_bins.length-1);

let bfbinc = ND_numuode_numu_flux.flux_match(FD_numode_numu_flux_osc);

let bfflux = new flux_hist(DUNE_flux.FD.numode.numu.bins_e, bfbinc);
bfflux.line_class = "orange_line";
fp.Draw(bfflux);
Expand All @@ -197,7 +192,13 @@
FD_numode_numu_flux_osc = FD_numode_numu_flux.Copy();
FD_numode_numu_flux_osc.line_class = "blue_line";
FD_numode_numu_flux_osc.Oscillate(pdg_from, pdg_to, baseline_km, op);
fp.ReDraw(FD_numode_numu_flux_osc);
fp.Clear(2);
fp.Draw(FD_numode_numu_flux_osc);
let bfbinc = ND_numuode_numu_flux.flux_match(FD_numode_numu_flux_osc);
let bfflux = new flux_hist(DUNE_flux.FD.numode.numu.bins_e, bfbinc);
bfflux.line_class = "orange_line";
fp.Draw(bfflux);

};

let cc = document.getElementById("ConstraintControls");
Expand Down Expand Up @@ -331,7 +332,12 @@ <h5>Click/Drag to choose parameters</h5>
<div class="col-12" >
<button id="add_btn" type="button" class="btn btn-primary">Add</button>
<button id="clear_btn" type="button" class="btn btn-primary">Clear</button>
<button id="oscflux_btn" type="button" class="btn btn-primary">Osc. Flux</button>
<button id="oscflux_btn" type="button" class="btn btn-primary">Prism it!</button>
</div>
</div>
<div class="row">
<div class="col-8">
<div id="FluxHistPlot" ></div>
</div>
</div>
<div class="row">
Expand All @@ -347,11 +353,6 @@ <h5>Click/Drag to choose parameters</h5>
</table>
</div>
</div>
<div class="row">
<div class="col-8">
<div id="FluxHistPlot" ></div>
</div>
</div>
</div>
</body>
</html>

0 comments on commit feaa8b2

Please sign in to comment.