Skip to content

Base

get_initial_intensity_thresh(config, nbp)

Gets absolute intensity threshold from config file. OMP will only be run on pixels with absolute intensity greater than this.

Parameters:

Name Type Description Default
config dict

omp section of config file.

required
nbp NotebookPage

call_spots NotebookPage

required

Returns:

Type Description
float

Either config['initial_intensity_thresh'] or nbp.abs_intensity_percentile[config['initial_intensity_thresh_percentile']].

Source code in coppafish/omp/base.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def get_initial_intensity_thresh(config: dict, nbp: NotebookPage) -> float:
    """
    Gets absolute intensity threshold from config file. OMP will only be run on
    pixels with absolute intensity greater than this.

    Args:
        config: `omp` section of config file.
        nbp: `call_spots` *NotebookPage*

    Returns:
        Either `config['initial_intensity_thresh']` or
            `nbp.abs_intensity_percentile[config['initial_intensity_thresh_percentile']]`.

    """
    initial_intensity_thresh = config['initial_intensity_thresh']
    if initial_intensity_thresh is None:
        config['initial_intensity_thresh'] = \
            round_any(nbp.abs_intensity_percentile[config['initial_intensity_thresh_percentile']],
                      config['initial_intensity_precision'])
    initial_intensity_thresh = \
        float(np.clip(config['initial_intensity_thresh'], config['initial_intensity_thresh_min'],
                      config['initial_intensity_thresh_max']))
    return initial_intensity_thresh