Skip to content

Commit aaf78a3

Browse files
committed
test: fix: add tests which test the bug, fix errors ran into with these tests
1 parent 7818be9 commit aaf78a3

10 files changed

Lines changed: 2683 additions & 2 deletions

pyopenms_viz/_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,9 @@ def _get_annotations(self, data: DataFrame, x: str, y: str):
10011001
"""Create annotations for each peak. Return lists of texts, x and y locations and colors."""
10021002

10031003
if self.annotation_color is None:
1004-
data["color"] = "black"
1004+
data["annotation_color"] = "black"
10051005
print(f"Annotation color: {self.annotation_color}")
1006-
annotation_color_column = "color" if self.annotation_color is None else self.annotation_color
1006+
annotation_color_column = "annotation_color" if self.annotation_color is None else self.annotation_color
10071007

10081008
ann_texts = []
10091009
top_n = self.annotate_top_n_peaks
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Bokeh Application</title>
6+
<style>
7+
html, body {
8+
box-sizing: border-box;
9+
display: flow-root;
10+
height: 100%;
11+
margin: 0;
12+
padding: 0;
13+
}
14+
</style>
15+
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-3.6.0.min.js"></script>
16+
<script type="text/javascript">
17+
Bokeh.set_log_level("info");
18+
</script>
19+
</head>
20+
<body>
21+
<div id="a8d0905b-5189-441f-80fe-36afd53b9cc5" data-root-id="p1321" style="display: contents;"></div>
22+
23+
<script type="application/json" id="c11cfcd7-e8f6-40e3-8e8a-0a4579270bf0">
24+
{"6fddd6cc-5f43-4823-9b16-961dc5ef9afc":{"version":"3.6.0","title":"Bokeh Application","roots":[{"type":"object","name":"Figure","id":"p1321","attributes":{"width":500,"height":500,"x_range":{"type":"object","name":"Range1d","id":"p1386","attributes":{"start":15991.1677936,"end":24003.608052000003}},"y_range":{"type":"object","name":"Range1d","id":"p1387","attributes":{"end":0.1226912}},"x_scale":{"type":"object","name":"LinearScale","id":"p1331"},"y_scale":{"type":"object","name":"LinearScale","id":"p1332"},"title":{"type":"object","name":"Title","id":"p1324","attributes":{"text":"Mass Spectrum","text_font_size":"18pt"}},"renderers":[{"type":"object","name":"GlyphRenderer","id":"p1365","attributes":{"data_source":{"type":"object","name":"ColumnDataSource","id":"p1356","attributes":{"selected":{"type":"object","name":"Selection","id":"p1357","attributes":{"indices":[],"line_indices":[]}},"selection_policy":{"type":"object","name":"UnionRenderers","id":"p1358"},"data":{"type":"map","entries":[["index",{"type":"ndarray","array":{"type":"bytes","data":"AAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAABAAAAAQAAAAEAAAABQAAAAUAAAAFAAAABgAAAAYAAAAGAAAABwAAAAcAAAAHAAAACAAAAAgAAAAIAAAACQAAAAkAAAAJAAAACgAAAAoAAAAKAAAACwAAAAsAAAALAAAADQAAAA0AAAANAAAADgAAAA4AAAAOAAAA"},"shape":[42],"dtype":"int32","order":"little"}],["mz",{"type":"ndarray","array":{"type":"bytes","data":"prVpbD2F00CmtWlsPYXTQKa1aWw9hdNAeJlho32F00B4mWGjfYXTQHiZYaN9hdNASn1Z2r2F00BKfVnavYXTQEp9Wdq9hdNAXi9NEf6F00BeL00R/oXTQF4vTRH+hdNAMBNFSD6G00AwE0VIPobTQDATRUg+htNAAfc8f36G00AB9zx/fobTQAH3PH9+htNA09o0tr6G00DT2jS2vobTQNPaNLa+htNApb4s7f6G00Clvizt/obTQKW+LO3+htNAd6IkJD+H00B3oiQkP4fTQHeiJCQ/h9NAi1QYW3+H00CLVBhbf4fTQItUGFt/h9NAXDgQkr+H00BcOBCSv4fTQFw4EJK/h9NALhwIyf+H00AuHAjJ/4fTQC4cCMn/h9NA0uP3NoCI00DS4/c2gIjTQNLj9zaAiNNApMfvbcCI00Ckx+9twIjTQKTH723AiNNA"},"shape":[42],"dtype":"float64","order":"little"}],["intensity",{"type":"ndarray","array":{"type":"bytes","data":"AAAAAAAAAACN7bWg98bgPgAAAAAAAAAAAAAAAAAAAADFrYIY6NoXPwAAAAAAAAAAAAAAAAAAAADpX5LKFHNAPwAAAAAAAAAAAAAAAAAAAADmV3OAYI5ePwAAAAAAAAAAAAAAAAAAAABn8PeL2ZJ1PwAAAAAAAAAAAAAAAAAAAABavcPt0LCIPwAAAAAAAAAAAAAAAAAAAABy/bs+c9aXPwAAAAAAAAAAAAAAAAAAAAC+amXCL/WjPwAAAAAAAAAAAAAAAAAAAAA/c9anHJOtPwAAAAAAAAAAAAAAAAAAAADz5nCt9rCzPwAAAAAAAAAAAAAAAAAAAAC3nEtxVdm3PwAAAAAAAAAAAAAAAAAAAADB5EaRtYa6PwAAAAAAAAAAAAAAAAAAAAC5izBFuTS6PwAAAAAAAAAAAAAAAAAAAAALRbqfU5C3PwAAAAAAAAAA"},"shape":[42],"dtype":"float64","order":"little"}],["color",{"type":"ndarray","array":["black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black"],"shape":[42],"dtype":"object","order":"little"}]]}}},"view":{"type":"object","name":"CDSView","id":"p1366","attributes":{"filter":{"type":"object","name":"AllIndices","id":"p1367"}}},"glyph":{"type":"object","name":"Line","id":"p1362","attributes":{"x":{"type":"field","field":"mz"},"y":{"type":"field","field":"intensity"}}},"nonselection_glyph":{"type":"object","name":"Line","id":"p1363","attributes":{"x":{"type":"field","field":"mz"},"y":{"type":"field","field":"intensity"},"line_alpha":0.1}},"muted_glyph":{"type":"object","name":"Line","id":"p1364","attributes":{"x":{"type":"field","field":"mz"},"y":{"type":"field","field":"intensity"},"line_alpha":0.2}}}},{"type":"object","name":"GlyphRenderer","id":"p1377","attributes":{"data_source":{"type":"object","name":"ColumnDataSource","id":"p1368","attributes":{"selected":{"type":"object","name":"Selection","id":"p1369","attributes":{"indices":[],"line_indices":[]}},"selection_policy":{"type":"object","name":"UnionRenderers","id":"p1370"},"data":{"type":"map","entries":[["index",{"type":"ndarray","array":{"type":"bytes","data":"DAAAAAwAAAAMAAAA"},"shape":[3],"dtype":"int32","order":"little"}],["mz",{"type":"ndarray","array":{"type":"bytes","data":"AAAAAECI00AAAAAAQIjTQAAAAABAiNNA"},"shape":[3],"dtype":"float64","order":"little"}],["intensity",{"type":"ndarray","array":{"type":"bytes","data":"AAAAAAAAAAB4KuCe50+7PwAAAAAAAAAA"},"shape":[3],"dtype":"float64","order":"little"}],["color",{"type":"ndarray","array":["red","red","red"],"shape":[3],"dtype":"object","order":"little"}]]}}},"view":{"type":"object","name":"CDSView","id":"p1378","attributes":{"filter":{"type":"object","name":"AllIndices","id":"p1379"}}},"glyph":{"type":"object","name":"Line","id":"p1374","attributes":{"x":{"type":"field","field":"mz"},"y":{"type":"field","field":"intensity"},"line_color":"red"}},"nonselection_glyph":{"type":"object","name":"Line","id":"p1375","attributes":{"x":{"type":"field","field":"mz"},"y":{"type":"field","field":"intensity"},"line_color":"red","line_alpha":0.1}},"muted_glyph":{"type":"object","name":"Line","id":"p1376","attributes":{"x":{"type":"field","field":"mz"},"y":{"type":"field","field":"intensity"},"line_color":"red","line_alpha":0.2}}}}],"toolbar":{"type":"object","name":"Toolbar","id":"p1330","attributes":{"tools":[{"type":"object","name":"PanTool","id":"p1343"},{"type":"object","name":"WheelZoomTool","id":"p1344","attributes":{"renderers":"auto"}},{"type":"object","name":"BoxZoomTool","id":"p1345","attributes":{"overlay":{"type":"object","name":"BoxAnnotation","id":"p1346","attributes":{"syncable":false,"line_color":"black","line_alpha":1.0,"line_width":2,"line_dash":[4,4],"fill_color":"lightgrey","fill_alpha":0.5,"level":"overlay","visible":false,"left":{"type":"number","value":"nan"},"right":{"type":"number","value":"nan"},"top":{"type":"number","value":"nan"},"bottom":{"type":"number","value":"nan"},"left_units":"canvas","right_units":"canvas","top_units":"canvas","bottom_units":"canvas","handles":{"type":"object","name":"BoxInteractionHandles","id":"p1352","attributes":{"all":{"type":"object","name":"AreaVisuals","id":"p1351","attributes":{"fill_color":"white","hover_fill_color":"lightgray"}}}}}}}},{"type":"object","name":"SaveTool","id":"p1353"},{"type":"object","name":"ResetTool","id":"p1354"},{"type":"object","name":"HelpTool","id":"p1355"},{"type":"object","name":"HoverTool","id":"p1383","attributes":{"renderers":"auto","tooltips":[["m/z","@mz"],["intensity","@intensity"]]}}]}},"toolbar_location":"above","left":[{"type":"object","name":"LinearAxis","id":"p1338","attributes":{"ticker":{"type":"object","name":"BasicTicker","id":"p1339","attributes":{"mantissas":[1,2,5]}},"formatter":{"type":"object","name":"BasicTickFormatter","id":"p1340"},"axis_label":"Intensity","axis_label_text_font_size":"16pt","major_label_policy":{"type":"object","name":"AllLabels","id":"p1341"},"major_label_text_font_size":"14pt"}}],"right":[{"type":"object","name":"Legend","id":"p1380","attributes":{"title":"Trace","click_policy":"mute","label_text_font_size":"10pt","items":[{"type":"object","name":"LegendItem","id":"p1381","attributes":{"label":{"type":"value","value":"black"},"renderers":[{"id":"p1365"}]}},{"type":"object","name":"LegendItem","id":"p1382","attributes":{"label":{"type":"value","value":"red"},"renderers":[{"id":"p1377"}]}}]}}],"below":[{"type":"object","name":"LinearAxis","id":"p1333","attributes":{"ticker":{"type":"object","name":"BasicTicker","id":"p1334","attributes":{"mantissas":[1,2,5]}},"formatter":{"type":"object","name":"BasicTickFormatter","id":"p1335"},"axis_label":"mass-to-charge","axis_label_text_font_size":"16pt","major_label_policy":{"type":"object","name":"AllLabels","id":"p1336"},"major_label_text_font_size":"14pt"}}],"center":[{"type":"object","name":"Grid","id":"p1337","attributes":{"axis":{"id":"p1333"}}},{"type":"object","name":"Grid","id":"p1342","attributes":{"dimension":1,"axis":{"id":"p1338"}}},{"type":"object","name":"Label","id":"p1384","attributes":{"text":"20001.0","text_color":"red","text_font_size":"13pt","x":20001.0,"y":0.106688,"x_offset":1}},{"type":"object","name":"Span","id":"p1385","attributes":{"location":0,"line_color":"#EEEEEE","line_width":2}}],"min_border":0}}]}}
25+
</script>
26+
<script type="text/javascript">
27+
(function() {
28+
const fn = function() {
29+
Bokeh.safely(function() {
30+
(function(root) {
31+
function embed_document(root) {
32+
const docs_json = document.getElementById('c11cfcd7-e8f6-40e3-8e8a-0a4579270bf0').textContent;
33+
const render_items = [{"docid":"6fddd6cc-5f43-4823-9b16-961dc5ef9afc","roots":{"p1321":"a8d0905b-5189-441f-80fe-36afd53b9cc5"},"root_ids":["p1321"]}];
34+
root.Bokeh.embed.embed_items(docs_json, render_items);
35+
}
36+
if (root.Bokeh !== undefined) {
37+
embed_document(root);
38+
} else {
39+
let attempts = 0;
40+
const timer = setInterval(function(root) {
41+
if (root.Bokeh !== undefined) {
42+
clearInterval(timer);
43+
embed_document(root);
44+
} else {
45+
attempts++;
46+
if (attempts > 100) {
47+
clearInterval(timer);
48+
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
49+
}
50+
}
51+
}, 10, root)
52+
}
53+
})(window);
54+
});
55+
};
56+
if (document.readyState != "loading") fn();
57+
else document.addEventListener("DOMContentLoaded", fn);
58+
})();
59+
</script>
60+
</body>
61+
</html>

0 commit comments

Comments
 (0)