@@ -19,7 +19,6 @@ interactively zoomed-in if you execute the code in a notebook
1919 import holoviews.operation.datashader as hd
2020 from holoviews.plotting.util import process_cmap
2121 from holoviews import opts, dim
22- import sys
2322
2423 hv.extension(" bokeh" )
2524
@@ -29,9 +28,16 @@ interactively zoomed-in if you execute the code in a notebook
2928 loadopts.setMSLevels([1 ])
3029 loadopts.setSkipXMLChecks(True )
3130 loadopts.setIntensity32Bit(True )
32- loadopts.setIntensityRange(oms.DRange1(oms.DPosition1(5000 ), oms.DPosition1(sys.maxsize)))
3331 loader.setOptions(loadopts)
3432 loader.load(" ../../../src/data/BSA1.mzML" , exp)
33+
34+ # Filter out low-intensity peaks using ThresholdMower
35+ threshold_filter = oms.ThresholdMower()
36+ params = threshold_filter.getDefaults()
37+ params.setValue(b " threshold" , 5000.0 )
38+ threshold_filter.setParameters(params)
39+ threshold_filter.filterPeakMap(exp)
40+
3541 exp.updateRanges()
3642 expandcols = [" RT" , " mz" , " inty" ]
3743 spectraarrs2d = exp.get2DPeakDataLong(
@@ -77,12 +83,12 @@ interactively zoomed-in if you execute the code in a notebook
7783 .opts(active_tools = [" box_zoom" ], tools = [" hover" ], hooks = [new_bounds_hook])
7884 )
7985
80- hd.dynspread(raster, threshold=0.7, how="add", shape="square").opts(
81- width=800,
82- height=800,
83- xlabel="Retention time (s)",
84- ylabel="mass/charge (Da)",
85- )
86+ hd.dynspread(raster, threshold = 0.7 , how = " add" , shape = " square" ).opts(
87+ width = 800 ,
88+ height = 800 ,
89+ xlabel = " Retention time (s)" ,
90+ ylabel = " mass/charge (Da)" ,
91+ )
8692
8793
8894 Result:
0 commit comments