Base
color_normalisation(hist_values, hist_counts, thresh_intensities, thresh_probs, method)
This finds the normalisations for each round, r
, and channel, c
, such that if norm_spot_color[r,c] =
spot_color[r,c] / norm_factor[r,c]
, the probability of norm_spot_color
being larger than thresh_intensities[i]
is less than thresh_probs[i]
for every i
.
Where the probability is based on all pixels from all tiles in that round and channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hist_values |
np.ndarray
|
|
required |
hist_counts |
np.ndarray
|
|
required |
thresh_intensities |
Union[float, List[float], np.ndarray]
|
|
required |
thresh_probs |
Union[float, List[float], np.ndarray]
|
|
required |
method |
str
|
Must be one of the following:
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/call_spots/base.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
get_bled_codes(gene_codes, bleed_matrix)
This gets bled_codes
such that the spot_color of a gene g
in round r
is expected to be a constant
multiple of bled_codes[g, r]
.
This function should be run with full bleed_matrix with any rounds/channels/dyes outside those using set to nan.
Otherwise, will get confusion with dye indices in gene_codes
being outside size of bleed_matrix
.
Note
All bled_codes returned with an L2 norm of 1 when summed over all rounds and channels with any nan values assumed to be 0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gene_codes |
np.ndarray
|
|
required |
bleed_matrix |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/call_spots/base.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
get_gene_efficiency(spot_colors, spot_gene_no, gene_codes, bleed_matrix, min_spots, max_gene_efficiency=np.inf, min_gene_efficiency=0, min_gene_efficiency_factor=1)
gene_efficiency[g,r]
gives the expected intensity of gene g
in round r
compared to that expected
by the bleed_matrix
. It is computed based on the average of all spot_colors
assigned to that gene.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spot_colors |
np.ndarray
|
|
required |
spot_gene_no |
np.ndarray
|
|
required |
gene_codes |
np.ndarray
|
|
required |
bleed_matrix |
np.ndarray
|
|
required |
min_spots |
int
|
If number of spots assigned to a gene less than or equal to this, |
required |
max_gene_efficiency |
float
|
Maximum allowed gene efficiency, i.e. any one round can be at most this times more important than the median round for every gene. Typical = 6. |
np.inf
|
min_gene_efficiency |
float
|
At most |
0
|
min_gene_efficiency_factor |
float
|
At most |
1
|
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/call_spots/base.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
get_non_duplicate(tile_origin, use_tiles, tile_centre, spot_local_yxz, spot_tile)
Find duplicate spots as those detected on a tile which is not tile centre they are closest to.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile_origin |
np.ndarray
|
|
required |
use_tiles |
List
|
|
required |
tile_centre |
np.ndarray
|
|
required |
spot_local_yxz |
np.ndarray
|
|
required |
spot_tile |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/call_spots/base.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|