Errors
ColorInvalidWarning
Source code in coppafish/utils/errors.py
172 173 174 175 176 177 178 179 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 |
|
__init__(colors, nbp_basic, invalid_value, round_no=None, channel_no=None, code_no=None)
Warning raised because spot_colors
contains a invalid_value
where it should not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors |
np.ndarray
|
|
required |
nbp_basic |
NotebookPage
|
basic_info NotebookPage |
required |
invalid_value |
float
|
This is the value that colors should only be in rounds/channels not used. Likely to be np.nan if colors is float or -nbp_basic.tile_pixel_value_shift if integer. |
required |
round_no |
Optional[int]
|
round to flag error for. |
None
|
channel_no |
Optional[int]
|
channel to flag error for. |
None
|
code_no |
Optional[int]
|
Spot or gene index to flag error for. |
None
|
Source code in coppafish/utils/errors.py
173 174 175 176 177 178 179 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 |
|
EmptyListError
Bases: Exception
Source code in coppafish/utils/errors.py
36 37 38 39 40 41 42 43 44 45 |
|
__init__(var_name)
Error raised because the variable indicated by var_name
contains no data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var_name |
str
|
Name of list or numpy array |
required |
Source code in coppafish/utils/errors.py
37 38 39 40 41 42 43 44 45 |
|
NoFileError
Bases: Exception
Source code in coppafish/utils/errors.py
24 25 26 27 28 29 30 31 32 33 |
|
__init__(file_path)
Error raised because file_path
does not exist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Path to file of interest. |
required |
Source code in coppafish/utils/errors.py
25 26 27 28 29 30 31 32 33 |
|
OutOfBoundsError
Bases: Exception
Source code in coppafish/utils/errors.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
__init__(var_name, oob_val, min_allowed, max_allowed)
Error raised because oob_val
is outside expected range between
min_allowed
and max_allowed
inclusive.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var_name |
str
|
Name of variable testing. |
required |
oob_val |
float
|
Value in array that is not in expected range. |
required |
min_allowed |
float
|
Smallest allowed value i.e. |
required |
max_allowed |
float
|
Largest allowed value i.e. |
required |
Source code in coppafish/utils/errors.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
ShapeError
Bases: Exception
Source code in coppafish/utils/errors.py
66 67 68 69 70 71 72 73 74 75 76 77 |
|
__init__(var_name, var_shape, expected_shape)
Error raised because variable indicated by var_name
has wrong shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var_name |
str
|
Name of numpy array. |
required |
var_shape |
tuple
|
Shape of numpy array. |
required |
expected_shape |
tuple
|
Expected shape of numpy array. |
required |
Source code in coppafish/utils/errors.py
67 68 69 70 71 72 73 74 75 76 77 |
|
TiffError
Bases: Exception
Source code in coppafish/utils/errors.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
__init__(scale_tiff, scale_nbp, shift_tiff, shift_nbp)
Error raised because parameters used to produce tiff files are different to those in the current notebook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_tiff |
float
|
Scale factor applied to tiff. Found from tiff description. |
required |
scale_nbp |
float
|
Scale factor applied to tiff. Found from |
required |
shift_tiff |
int
|
Shift applied to tiff to ensure pixel values positive. Found from tiff description. |
required |
shift_nbp |
int
|
Shift applied to tiff to ensure pixel values positive.
Found from |
required |
Source code in coppafish/utils/errors.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
check_color_nan(colors, nbp_basic)
colors
should only contain the invalid_value
in rounds/channels not in use_rounds/channels.
This raises an error if this is not the case or if a round/channel not in use_rounds/channels
contains a value other than invalid_value
.
invalid_value = -nbp_basic.tile_pixel_value_shift - 1
if colors is integer i.e. the non-normalised colors,
usually spot_colors.
invalid_value = -np.nan
if colors is float i.e. the normalised colors or most likely the bled_codes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors |
np.ndarray
|
|
required |
nbp_basic |
NotebookPage
|
basic_info NotebookPage |
required |
Source code in coppafish/utils/errors.py
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 130 131 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 |
|
check_shape(array, expected_shape)
Checks to see if array
has the shape indicated by expected_shape
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array |
np.ndarray
|
Array to check the shape of. |
required |
expected_shape |
Union[list, tuple, np.ndarray]
|
|
required |
Returns:
Type | Description |
---|---|
bool
|
|
Source code in coppafish/utils/errors.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|