This repo contains the python code implementing two machine learning based background removal algorithms:
- KDTree based background estimation
- Radial feature extraction
Included files are:
PYmodule/: the code implementing the background removal algorithmsscript/: the code generating the data to be processed by the background removal algorithms (numpy array)demo.ipynb: demonstration of the data processing workflowplot.ipynb: figures for data illustration without need for interactive widget support
This code needs Python version 3.12.
Required modules can be installed with the following conda environment file.
conda create -n environment.yml
- Open
script/1-gen_sim_peak.ipynband follow the cells to generate simulated file. - Use
demo.ipynbto perform the example material analysis.
- Generating the
npyfiles takes about 10min - Background removal with KD Tree methods takes ~ 1h
- Use
plot.ipynbto visualize the results.
- relevant methods of KDTree background removal:
-
apply_mask(): set Data elements that are masked to 0
-
build: calls node.create_children, assign splitted Data region to node,
-
estimate(): calls node.estimate: set node.data (assigned elements) to mean
-
random_select_subtract(data3d): set data3d to subtracted results
-
constant_subtract(data3d)
-
load
-
save
- relevant data of tree:
- tree.tensor/node.data
- tree.mask
‣潣灭敲獳搭瑡