Skip to content

Commit 74fc3f6

Browse files
save before parsing is added
1 parent dfae173 commit 74fc3f6

8 files changed

Lines changed: 522 additions & 359 deletions

File tree

js/events/load_composite_button.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $(function() {
1919
$("#metadata-table").metadata_table("add_row", [id]);
2020
$("#settings-table").settings_table("add_row", [id]);
2121
};
22+
console.log(prefixes)
2223

2324
$("#settings-table").settings_table("plot_all_composites", {xmin: xmin, xmax: xmax, ymax: ymax}, allow_shrink=true);
2425
$("#main-plot").main_plot("update_legend")

js/parse_composite.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ let parse_multiple_composite = function(text, prefix) {
129129
if (col0 === "" || col0 === "NAME") {
130130
// If the x domain is defined, save the composite
131131
if (save_comp) {
132+
console.log(id)
132133
composites[id] = {xmin: xmin, xmax: xmax, sense: sense, anti: anti}
133134
};
134135
save_comp = false;
@@ -142,6 +143,7 @@ let parse_multiple_composite = function(text, prefix) {
142143
}
143144
} else if (col0.startsWith(prefix)){
144145
id = col0.slice(prefix.length).split("_")[0];
146+
console.log(id)
145147
save_comp = true;
146148
if (col0.toLowerCase().includes("sense")) {
147149
sense = fields.slice(1).map(parseFloat)
@@ -160,6 +162,6 @@ let parse_multiple_composite = function(text, prefix) {
160162
if (save_comp) {
161163
composites[id] = {xmin: xmin, xmax: xmax, sense: sense, anti: anti}
162164
};
163-
165+
console.log(composites)
164166
return composites
165167
}

js/widgets/main_plot.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ $(function() {
171171
d3.select("#main-plot-div").on("mousemove", function(e) {
172172
$("#main-plot").main_plot("move_tooltip", e)
173173
});
174-
main_plot.on("mouseleave", function() {
175-
// $("#main-plot").main_plot("hide_tooltip")
174+
d3.select("#main-plot-div").on("mouseleave", function() {
175+
$("#main-plot").main_plot("hide_tooltip")
176176
});
177177

178178
this.enable_tooltip = true;
@@ -315,6 +315,8 @@ $(function() {
315315

316316
plot_composite: function(xmin, xmax, sense, anti, scale, color, secondary_color, i, opacity, smoothing, bp_shift, hide, hide_sense=false, hide_anti=false, baseline=0) {
317317
// Set composite visibility
318+
console.log("xmin:" + xmin)
319+
console.log("xmax:" + xmax)
318320
let composite = this._elements.composites[i]
319321
.classed("plotted", !hide)
320322
.style("display", hide ? "none" : null),
@@ -345,6 +347,7 @@ $(function() {
345347
scaled_occupancy = smoothed_occupancy.filter((_, j) => new_xdomain[j] >= this.xmin && new_xdomain[j] <= this.xmax)
346348
.map(d => ((value = d * scale + baseline) > 0)? value: 0);
347349

350+
console.log(truncated_xdomain)
348351
// Set fill color
349352
composite.select(".composite-gradient-top")
350353
.selectAll("stop")
@@ -737,8 +740,10 @@ $(function() {
737740
if (color_trace) {
738741
this._elements.composite_group.selectAll(".composite .color-line-top")
739742
.style("display", null);
740-
this._elements.composite_group.selectAll(".composite .color-line-bottom")
741-
.style("display", null);
743+
if (!this.combined){
744+
this._elements.composite_group.selectAll(".composite .color-line-bottom")
745+
.style("display", null);
746+
}
742747
this._elements.composite_group.selectAll(".composite .white-line")
743748
.style("display", "none");
744749
this._elements.composite_group.selectAll(".composite .black-line")
@@ -820,12 +825,13 @@ $(function() {
820825
.style("left", ev.clientX - (w - 80) / 1.4)
821826
} else {
822827
this._elements.tooltip.style("display", "none")
828+
d3.selectAll("#composite-plot-tooltip").remove();
823829
}
824830
}
825831
},
826832

827833
hide_tooltip: function() {
828-
this._elements.tooltip.style("display", "none")
834+
d3.selectAll("#composite-plot-tooltip").remove();
829835
},
830836

831837
download_as_svg: function() {
10 Bytes
Binary file not shown.

python/composite.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@ def __str__(self):
1717
return "Sense: " + str(self.sense) + "\nAnti: " + str(self.anti) + "\nXMin: " + str(self.xmin) + "\nXMax: " + str(self.xmax) + "\nID:" + str(self.id)
1818

1919
class CompositeGroup:
20-
def __init__(self):
20+
def __init__(self, scale=1, color=None, secondary_color=None, i=None, opacity=None, smoothing=None, bp_shift=None, hide_sense=False, hide_anti=False, baseline=0, name=None):
2121
self.xmin = 0
2222
self.xmax = 0
2323
self.sense = []
2424
self.anti = []
25+
self.scale = scale
26+
self.color = color
27+
self.secondary_color = secondary_color if secondary_color is not None else color
28+
self.opacity = opacity
29+
self.smoothing = smoothing
30+
self.bp_shift = bp_shift
31+
self.hide_anti = hide_anti
32+
self.baseline = baseline
33+
self.hide_sense = hide_sense
2534
self.individual_composites = {}
2635
self.files_loaded = len(self.individual_composites)
36+
self.name = name
2737

2838
def loadComposite(self,composite: Composite):
2939
# If no files, initialize sense and anti arrays; otherwise, pad sense and anti arrays to new xdomain

0 commit comments

Comments
 (0)