From 780243694fadda91506092f33cabcb29a089ffc7 Mon Sep 17 00:00:00 2001 From: foefl Date: Wed, 7 Jan 2026 07:39:18 +0100 Subject: [PATCH] change order of width and height, related to #24 --- src/dopt_sensor_anomalies/detection.c | 5978 +++++++++++++++--------- src/dopt_sensor_anomalies/detection.py | 2 +- tests/test_detection.py | 2 +- 3 files changed, 3666 insertions(+), 2316 deletions(-) diff --git a/src/dopt_sensor_anomalies/detection.c b/src/dopt_sensor_anomalies/detection.c index 05b7ab3..aa69626 100644 --- a/src/dopt_sensor_anomalies/detection.c +++ b/src/dopt_sensor_anomalies/detection.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.2.1 */ +/* Generated by Cython 3.2.4 */ /* BEGIN: Cython Metadata { @@ -34,8 +34,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x03080000 #error Cython requires Python 3.8+. #else -#define __PYX_ABI_VERSION "3_2_1" -#define CYTHON_HEX_VERSION 0x030201F0 +#define __PYX_ABI_VERSION "3_2_4" +#define CYTHON_HEX_VERSION 0x030204F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include @@ -1137,6 +1137,15 @@ static int __Pyx_init_co_variables(void) { #define CYTHON_WITHOUT_ASSERTIONS #endif +#ifdef CYTHON_FREETHREADING_COMPATIBLE +#if CYTHON_FREETHREADING_COMPATIBLE +#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED +#else +#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED +#endif +#else +#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED +#endif #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 #define __PYX_DEFAULT_STRING_ENCODING "" @@ -1520,10 +1529,12 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr; struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr; struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; +struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection; +struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr; struct __pyx_ctuple_double__and_double; typedef struct __pyx_ctuple_double__and_double __pyx_ctuple_double__and_double; -/* "dopt_sensor_anomalies/detection.py":35 +/* "dopt_sensor_anomalies/detection.py":36 * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], * ) -> tuple[float, float]: # <<<<<<<<<<<<<< @@ -1535,7 +1546,7 @@ struct __pyx_ctuple_double__and_double { double f1; }; -/* "dopt_sensor_anomalies/detection.py":55 +/* "dopt_sensor_anomalies/detection.py":56 * * * def measure_length( # <<<<<<<<<<<<<< @@ -1548,7 +1559,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_ }; -/* "dopt_sensor_anomalies/detection.py":84 +/* "dopt_sensor_anomalies/detection.py":85 * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< @@ -1566,7 +1577,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr }; -/* "dopt_sensor_anomalies/detection.py":112 +/* "dopt_sensor_anomalies/detection.py":114 * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -1581,7 +1592,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr }; -/* "dopt_sensor_anomalies/detection.py":143 +/* "dopt_sensor_anomalies/detection.py":168 * ) * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< @@ -1597,7 +1608,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr }; -/* "dopt_sensor_anomalies/detection.py":144 +/* "dopt_sensor_anomalies/detection.py":169 * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) # <<<<<<<<<<<<<< @@ -1613,7 +1624,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr }; -/* "dopt_sensor_anomalies/detection.py":145 +/* "dopt_sensor_anomalies/detection.py":170 * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< @@ -1629,7 +1640,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr }; -/* "dopt_sensor_anomalies/detection.py":146 +/* "dopt_sensor_anomalies/detection.py":171 * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) # <<<<<<<<<<<<<< @@ -1644,6 +1655,37 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr Py_ssize_t __pyx_t_1; }; + +/* "dopt_sensor_anomalies/detection.py":225 + * + * + * def anomaly_detection( # <<<<<<<<<<<<<< + * img_path: Path, + * detection_models: t.DetectionModels, +*/ +struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection { + PyObject_HEAD + PyObject *__pyx_v_export_data; +}; + + +/* "dopt_sensor_anomalies/detection.py":265 + * + * csv_data_sorted: tuple[tuple[str, ...]] = tuple( + * export_data[key] for key in const.EXPORT_DATA_SORTING # <<<<<<<<<<<<<< + * ) + * csv_data: tuple[str, ...] = tuple(flatten(csv_data_sorted)) +*/ +struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr { + PyObject_HEAD + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *__pyx_outer_scope; + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_key; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ @@ -2194,6 +2236,17 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2)) +#endif + +/* PyLongCompare.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + /* PyObjectFormat.proto */ #if CYTHON_USE_UNICODE_WRITER static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); @@ -2819,6 +2872,7 @@ int __pyx_module_is_main_dopt_sensor_anomalies__detection = 0; /* #### Code section: global_var ### */ static PyObject *__pyx_builtin_min; static PyObject *__pyx_builtin_max; +static PyObject *__pyx_builtin_reversed; static PyObject *__pyx_builtin_zip; static PyObject *__pyx_builtin_enumerate; /* #### Code section: string_decls ### */ @@ -2832,9 +2886,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9g static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_img_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y); /* proto */ -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, PyObject *__pyx_v_model); /* proto */ -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_img_path, PyObject *__pyx_v_detection_models, PyObject *__pyx_v_data_csv, PyObject *__pyx_v_sensor_images); /* proto */ -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_user_img_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y); /* proto */ +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, PyObject *__pyx_v_model, double __pyx_v_anomaly_threshold); /* proto */ +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_17anomaly_detection_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_img_path, PyObject *__pyx_v_detection_models, PyObject *__pyx_v_export_data, PyObject *__pyx_v_sensor_images, double __pyx_v_anomaly_threshold); /* proto */ +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_user_img_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y, double __pyx_v_anomaly_threshold); /* proto */ static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -2842,6 +2897,8 @@ static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_str static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ /* SmallCodeConfig */ @@ -2869,6 +2926,8 @@ typedef struct { PyObject *__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr; PyObject *__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr; PyObject *__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; + PyObject *__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection; + PyObject *__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr; PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length; PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr; PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr; @@ -2876,14 +2935,16 @@ typedef struct { PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr; PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr; PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; + PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection; + PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_slice[2]; PyObject *__pyx_tuple[7]; - PyObject *__pyx_codeobj_tab[12]; - PyObject *__pyx_string_tab[316]; - PyObject *__pyx_number_tab[16]; + PyObject *__pyx_codeobj_tab[13]; + PyObject *__pyx_string_tab[333]; + PyObject *__pyx_number_tab[17]; /* #### Code section: module_state_contents ### */ #if CYTHON_USE_FREELISTS @@ -2920,6 +2981,16 @@ int __pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_gene struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr *__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr[8]; int __pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; #endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection[8]; +int __pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr[8]; +int __pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr; +#endif /* CommonTypesMetaclass.module_state_decls */ PyTypeObject *__pyx_CommonTypesMetaclassType; @@ -2994,295 +3065,312 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_png __pyx_string_tab[24] #define __pyx_kp_u_src_dopt_sensor_anomalies_detect __pyx_string_tab[25] #define __pyx_kp_u_t_Box __pyx_string_tab[26] -#define __pyx_kp_u_t_CsvData __pyx_string_tab[27] -#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[28] +#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[27] +#define __pyx_kp_u_t_ExportData __pyx_string_tab[28] #define __pyx_kp_u_t_InferenceResult __pyx_string_tab[29] #define __pyx_kp_u_t_SensorImages __pyx_string_tab[30] #define __pyx_kp_u_tuple_float_float __pyx_string_tab[31] -#define __pyx_kp_u_tuple_t_CsvData_t_SensorImages __pyx_string_tab[32] -#define __pyx_n_u_ANOMALY_THRESHOLD __pyx_string_tab[33] -#define __pyx_n_u_Any __pyx_string_tab[34] -#define __pyx_n_u_BACKBONE __pyx_string_tab[35] -#define __pyx_n_u_Box __pyx_string_tab[36] -#define __pyx_n_u_CHAIN_APPROX_SIMPLE __pyx_string_tab[37] -#define __pyx_n_u_COLOR_BGR2GRAY __pyx_string_tab[38] -#define __pyx_n_u_COLOR_BGR2RGB __pyx_string_tab[39] -#define __pyx_n_u_Canny __pyx_string_tab[40] -#define __pyx_n_u_ContourCalculationError __pyx_string_tab[41] -#define __pyx_n_u_DETECTION_MODELS __pyx_string_tab[42] -#define __pyx_n_u_DataFrame __pyx_string_tab[43] -#define __pyx_n_u_Final __pyx_string_tab[44] -#define __pyx_n_u_HEATMAP_FILENAME_SUFFIX __pyx_string_tab[45] -#define __pyx_n_u_Image __pyx_string_tab[46] -#define __pyx_n_u_ImageNotReadError __pyx_string_tab[47] -#define __pyx_n_u_InferenceResult __pyx_string_tab[48] -#define __pyx_n_u_InvalidElectrodeCount __pyx_string_tab[49] -#define __pyx_n_u_LAYERS __pyx_string_tab[50] -#define __pyx_n_u_MODEL_FOLDER __pyx_string_tab[51] -#define __pyx_n_u_MORPH_CLOSE __pyx_string_tab[52] -#define __pyx_n_u_MORPH_RECT __pyx_string_tab[53] -#define __pyx_n_u_NDArray __pyx_string_tab[54] -#define __pyx_n_u_NUM_VALID_ELECTRODES __pyx_string_tab[55] -#define __pyx_n_u_None __pyx_string_tab[56] -#define __pyx_n_u_PIL __pyx_string_tab[57] -#define __pyx_n_u_Patchcore __pyx_string_tab[58] -#define __pyx_n_u_Path __pyx_string_tab[59] -#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[60] -#define __pyx_n_u_QUOTE_NONE __pyx_string_tab[61] -#define __pyx_n_u_RATIO __pyx_string_tab[62] -#define __pyx_n_u_RETR_TREE __pyx_string_tab[63] -#define __pyx_n_u_RGB __pyx_string_tab[64] -#define __pyx_n_u_SensorImages __pyx_string_tab[65] -#define __pyx_n_u_THRESHOLD_BW __pyx_string_tab[66] -#define __pyx_n_u_THRESH_BINARY __pyx_string_tab[67] -#define __pyx_n_u__8 __pyx_string_tab[68] -#define __pyx_n_u_accepted_boxes __pyx_string_tab[69] -#define __pyx_n_u_all __pyx_string_tab[70] -#define __pyx_n_u_alpha __pyx_string_tab[71] -#define __pyx_n_u_anomalib_models __pyx_string_tab[72] -#define __pyx_n_u_anomaly_detection __pyx_string_tab[73] -#define __pyx_n_u_anomaly_label __pyx_string_tab[74] -#define __pyx_n_u_anomaly_map __pyx_string_tab[75] -#define __pyx_n_u_anomaly_map_resized __pyx_string_tab[76] -#define __pyx_n_u_anomaly_score __pyx_string_tab[77] -#define __pyx_n_u_array __pyx_string_tab[78] -#define __pyx_n_u_astype __pyx_string_tab[79] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[80] -#define __pyx_n_u_ax __pyx_string_tab[81] -#define __pyx_n_u_axes __pyx_string_tab[82] -#define __pyx_n_u_axis __pyx_string_tab[83] -#define __pyx_n_u_backbone __pyx_string_tab[84] -#define __pyx_n_u_bbox_inches __pyx_string_tab[85] -#define __pyx_n_u_binary __pyx_string_tab[86] -#define __pyx_n_u_bl __pyx_string_tab[87] -#define __pyx_n_u_blbrX __pyx_string_tab[88] -#define __pyx_n_u_blbrY __pyx_string_tab[89] -#define __pyx_n_u_bool __pyx_string_tab[90] -#define __pyx_n_u_boundingRect __pyx_string_tab[91] -#define __pyx_n_u_box __pyx_string_tab[92] -#define __pyx_n_u_boxPoints __pyx_string_tab[93] -#define __pyx_n_u_box_1 __pyx_string_tab[94] -#define __pyx_n_u_box_2 __pyx_string_tab[95] -#define __pyx_n_u_br __pyx_string_tab[96] -#define __pyx_n_u_c __pyx_string_tab[97] -#define __pyx_n_u_c1 __pyx_string_tab[98] -#define __pyx_n_u_c2 __pyx_string_tab[99] -#define __pyx_n_u_cast __pyx_string_tab[100] -#define __pyx_n_u_category __pyx_string_tab[101] -#define __pyx_n_u_center_dist __pyx_string_tab[102] -#define __pyx_n_u_check_box_redundancy __pyx_string_tab[103] -#define __pyx_n_u_checkpoint __pyx_string_tab[104] -#define __pyx_n_u_class_getitem __pyx_string_tab[105] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[106] -#define __pyx_n_u_close __pyx_string_tab[107] -#define __pyx_n_u_closed __pyx_string_tab[108] -#define __pyx_n_u_cmap __pyx_string_tab[109] -#define __pyx_n_u_cnts __pyx_string_tab[110] -#define __pyx_n_u_const __pyx_string_tab[111] -#define __pyx_n_u_constants __pyx_string_tab[112] -#define __pyx_n_u_contours __pyx_string_tab[113] -#define __pyx_n_u_convert __pyx_string_tab[114] -#define __pyx_n_u_copy __pyx_string_tab[115] -#define __pyx_n_u_coreset_sampling_ratio __pyx_string_tab[116] -#define __pyx_n_u_cpu __pyx_string_tab[117] -#define __pyx_n_u_cropped __pyx_string_tab[118] -#define __pyx_n_u_cropped_sensor_left __pyx_string_tab[119] -#define __pyx_n_u_cropped_sensor_right __pyx_string_tab[120] -#define __pyx_n_u_csv_2 __pyx_string_tab[121] -#define __pyx_n_u_cuda __pyx_string_tab[122] -#define __pyx_n_u_cv2 __pyx_string_tab[123] -#define __pyx_n_u_cvtColor __pyx_string_tab[124] -#define __pyx_n_u_dA __pyx_string_tab[125] -#define __pyx_n_u_dB __pyx_string_tab[126] -#define __pyx_n_u_data_csv __pyx_string_tab[127] -#define __pyx_n_u_detection_models __pyx_string_tab[128] -#define __pyx_n_u_device __pyx_string_tab[129] -#define __pyx_n_u_df __pyx_string_tab[130] -#define __pyx_n_u_dimA __pyx_string_tab[131] -#define __pyx_n_u_dimB __pyx_string_tab[132] -#define __pyx_n_u_dist __pyx_string_tab[133] -#define __pyx_n_u_distance __pyx_string_tab[134] -#define __pyx_n_u_dopt_basics __pyx_string_tab[135] -#define __pyx_n_u_dopt_sensor_anomalies __pyx_string_tab[136] -#define __pyx_n_u_dopt_sensor_anomalies__find_path __pyx_string_tab[137] -#define __pyx_n_u_dopt_sensor_anomalies_detection __pyx_string_tab[138] -#define __pyx_n_u_dtype __pyx_string_tab[139] -#define __pyx_n_u_edged __pyx_string_tab[140] -#define __pyx_n_u_enter __pyx_string_tab[141] -#define __pyx_n_u_enumerate __pyx_string_tab[142] -#define __pyx_n_u_errors __pyx_string_tab[143] -#define __pyx_n_u_euclidean __pyx_string_tab[144] -#define __pyx_n_u_eval __pyx_string_tab[145] -#define __pyx_n_u_existing __pyx_string_tab[146] -#define __pyx_n_u_exists __pyx_string_tab[147] -#define __pyx_n_u_exit __pyx_string_tab[148] -#define __pyx_n_u_extend __pyx_string_tab[149] -#define __pyx_n_u_figsize __pyx_string_tab[150] -#define __pyx_n_u_file_path __pyx_string_tab[151] -#define __pyx_n_u_file_stem __pyx_string_tab[152] -#define __pyx_n_u_filtered_cnts __pyx_string_tab[153] -#define __pyx_n_u_filterwarnings __pyx_string_tab[154] -#define __pyx_n_u_findContours __pyx_string_tab[155] -#define __pyx_n_u_find_paths __pyx_string_tab[156] -#define __pyx_n_u_float __pyx_string_tab[157] -#define __pyx_n_u_float32 __pyx_string_tab[158] -#define __pyx_n_u_folder_path __pyx_string_tab[159] -#define __pyx_n_u_from_numpy __pyx_string_tab[160] -#define __pyx_n_u_fromarray __pyx_string_tab[161] -#define __pyx_n_u_func __pyx_string_tab[162] -#define __pyx_n_u_genexpr __pyx_string_tab[163] -#define __pyx_n_u_getStructuringElement __pyx_string_tab[164] -#define __pyx_n_u_get_detection_models __pyx_string_tab[165] -#define __pyx_n_u_get_model_folder __pyx_string_tab[166] -#define __pyx_n_u_grab_contours __pyx_string_tab[167] -#define __pyx_n_u_gray __pyx_string_tab[168] -#define __pyx_n_u_header __pyx_string_tab[169] -#define __pyx_n_u_hspace __pyx_string_tab[170] -#define __pyx_n_u_i __pyx_string_tab[171] -#define __pyx_n_u_ignore __pyx_string_tab[172] -#define __pyx_n_u_image __pyx_string_tab[173] -#define __pyx_n_u_image_np __pyx_string_tab[174] -#define __pyx_n_u_image_rgb __pyx_string_tab[175] -#define __pyx_n_u_img __pyx_string_tab[176] -#define __pyx_n_u_img_np __pyx_string_tab[177] -#define __pyx_n_u_img_path __pyx_string_tab[178] -#define __pyx_n_u_imread __pyx_string_tab[179] -#define __pyx_n_u_imshow __pyx_string_tab[180] -#define __pyx_n_u_imutils __pyx_string_tab[181] -#define __pyx_n_u_index __pyx_string_tab[182] -#define __pyx_n_u_infer_image __pyx_string_tab[183] -#define __pyx_n_u_input_tensor __pyx_string_tab[184] -#define __pyx_n_u_int32 __pyx_string_tab[185] -#define __pyx_n_u_is_available __pyx_string_tab[186] -#define __pyx_n_u_is_coroutine __pyx_string_tab[187] -#define __pyx_n_u_is_duplicate __pyx_string_tab[188] -#define __pyx_n_u_is_sorted __pyx_string_tab[189] -#define __pyx_n_u_item __pyx_string_tab[190] -#define __pyx_n_u_items __pyx_string_tab[191] -#define __pyx_n_u_jet __pyx_string_tab[192] -#define __pyx_n_u_kernel __pyx_string_tab[193] -#define __pyx_n_u_layers __pyx_string_tab[194] -#define __pyx_n_u_left __pyx_string_tab[195] -#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[196] -#define __pyx_n_u_linalg __pyx_string_tab[197] -#define __pyx_n_u_load __pyx_string_tab[198] -#define __pyx_n_u_load_state_dict __pyx_string_tab[199] -#define __pyx_n_u_main __pyx_string_tab[200] -#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[201] -#define __pyx_n_u_max __pyx_string_tab[202] -#define __pyx_n_u_measure_length __pyx_string_tab[203] -#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[204] -#define __pyx_n_u_message __pyx_string_tab[205] -#define __pyx_n_u_midpoint __pyx_string_tab[206] -#define __pyx_n_u_min __pyx_string_tab[207] -#define __pyx_n_u_minAreaRect __pyx_string_tab[208] -#define __pyx_n_u_mode __pyx_string_tab[209] -#define __pyx_n_u_model __pyx_string_tab[210] -#define __pyx_n_u_model_state_dict __pyx_string_tab[211] -#define __pyx_n_u_module __pyx_string_tab[212] -#define __pyx_n_u_morphologyEx __pyx_string_tab[213] -#define __pyx_n_u_name __pyx_string_tab[214] -#define __pyx_n_u_next __pyx_string_tab[215] -#define __pyx_n_u_no_grad __pyx_string_tab[216] -#define __pyx_n_u_norm __pyx_string_tab[217] -#define __pyx_n_u_np __pyx_string_tab[218] -#define __pyx_n_u_npt __pyx_string_tab[219] -#define __pyx_n_u_num_contours __pyx_string_tab[220] -#define __pyx_n_u_numpy __pyx_string_tab[221] -#define __pyx_n_u_numpy_typing __pyx_string_tab[222] -#define __pyx_n_u_off __pyx_string_tab[223] -#define __pyx_n_u_order_points __pyx_string_tab[224] -#define __pyx_n_u_orig __pyx_string_tab[225] -#define __pyx_n_u_output __pyx_string_tab[226] -#define __pyx_n_u_pad_inches __pyx_string_tab[227] -#define __pyx_n_u_pandas __pyx_string_tab[228] -#define __pyx_n_u_parent __pyx_string_tab[229] -#define __pyx_n_u_pathlib __pyx_string_tab[230] -#define __pyx_n_u_permute __pyx_string_tab[231] -#define __pyx_n_u_perspective __pyx_string_tab[232] -#define __pyx_n_u_pil_image __pyx_string_tab[233] -#define __pyx_n_u_pipeline __pyx_string_tab[234] -#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[235] -#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[236] -#define __pyx_n_u_plt __pyx_string_tab[237] -#define __pyx_n_u_pop __pyx_string_tab[238] -#define __pyx_n_u_pred_score __pyx_string_tab[239] -#define __pyx_n_u_pt_A __pyx_string_tab[240] -#define __pyx_n_u_pt_B __pyx_string_tab[241] -#define __pyx_n_u_pyplot __pyx_string_tab[242] -#define __pyx_n_u_qualname __pyx_string_tab[243] -#define __pyx_n_u_quoting __pyx_string_tab[244] -#define __pyx_n_u_rbox __pyx_string_tab[245] -#define __pyx_n_u_resize __pyx_string_tab[246] -#define __pyx_n_u_result __pyx_string_tab[247] -#define __pyx_n_u_result_pattern __pyx_string_tab[248] -#define __pyx_n_u_return __pyx_string_tab[249] -#define __pyx_n_u_right __pyx_string_tab[250] -#define __pyx_n_u_rightmost_x_third __pyx_string_tab[251] -#define __pyx_n_u_s1 __pyx_string_tab[252] -#define __pyx_n_u_s2 __pyx_string_tab[253] -#define __pyx_n_u_savefig __pyx_string_tab[254] -#define __pyx_n_u_scipy_spatial __pyx_string_tab[255] -#define __pyx_n_u_send __pyx_string_tab[256] -#define __pyx_n_u_sensor_images __pyx_string_tab[257] -#define __pyx_n_u_sep __pyx_string_tab[258] -#define __pyx_n_u_set_name __pyx_string_tab[259] -#define __pyx_n_u_setdefault __pyx_string_tab[260] -#define __pyx_n_u_shape __pyx_string_tab[261] -#define __pyx_n_u_side __pyx_string_tab[262] -#define __pyx_n_u_size_diff __pyx_string_tab[263] -#define __pyx_n_u_sort_contours __pyx_string_tab[264] -#define __pyx_n_u_squeeze __pyx_string_tab[265] -#define __pyx_n_u_stem __pyx_string_tab[266] -#define __pyx_n_u_str __pyx_string_tab[267] -#define __pyx_n_u_subplots __pyx_string_tab[268] -#define __pyx_n_u_subplots_adjust __pyx_string_tab[269] -#define __pyx_n_u_t __pyx_string_tab[270] -#define __pyx_n_u_test __pyx_string_tab[271] -#define __pyx_n_u_threshold __pyx_string_tab[272] -#define __pyx_n_u_throw __pyx_string_tab[273] -#define __pyx_n_u_tight __pyx_string_tab[274] -#define __pyx_n_u_tl __pyx_string_tab[275] -#define __pyx_n_u_tlblX __pyx_string_tab[276] -#define __pyx_n_u_tlblY __pyx_string_tab[277] -#define __pyx_n_u_tltrX __pyx_string_tab[278] -#define __pyx_n_u_tltrY __pyx_string_tab[279] -#define __pyx_n_u_to __pyx_string_tab[280] -#define __pyx_n_u_to_csv __pyx_string_tab[281] -#define __pyx_n_u_tolerance __pyx_string_tab[282] -#define __pyx_n_u_torch __pyx_string_tab[283] -#define __pyx_n_u_torch_device __pyx_string_tab[284] -#define __pyx_n_u_tr __pyx_string_tab[285] -#define __pyx_n_u_trbrX __pyx_string_tab[286] -#define __pyx_n_u_trbrY __pyx_string_tab[287] -#define __pyx_n_u_types __pyx_string_tab[288] -#define __pyx_n_u_typing __pyx_string_tab[289] -#define __pyx_n_u_uint8 __pyx_string_tab[290] -#define __pyx_n_u_unsqueeze __pyx_string_tab[291] -#define __pyx_n_u_user_img_path __pyx_string_tab[292] -#define __pyx_n_u_value __pyx_string_tab[293] -#define __pyx_n_u_values __pyx_string_tab[294] -#define __pyx_n_u_w __pyx_string_tab[295] -#define __pyx_n_u_warnings __pyx_string_tab[296] -#define __pyx_n_u_wrap_result __pyx_string_tab[297] -#define __pyx_n_u_wspace __pyx_string_tab[298] -#define __pyx_n_u_x1 __pyx_string_tab[299] -#define __pyx_n_u_x2 __pyx_string_tab[300] -#define __pyx_n_u_x_coords __pyx_string_tab[301] -#define __pyx_n_u_x_max __pyx_string_tab[302] -#define __pyx_n_u_x_middle __pyx_string_tab[303] -#define __pyx_n_u_x_min __pyx_string_tab[304] -#define __pyx_n_u_y_max __pyx_string_tab[305] -#define __pyx_n_u_y_min __pyx_string_tab[306] -#define __pyx_n_u_zip __pyx_string_tab[307] -#define __pyx_kp_b_iso88591_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX __pyx_string_tab[308] -#define __pyx_kp_b_iso88591_AQ_t9G1_q_5_ARRS_aq_nA_Q_a __pyx_string_tab[309] -#define __pyx_kp_b_iso88591_AT_Rt1D_AS_at2Q __pyx_string_tab[310] -#define __pyx_kp_b_iso88591_Cwas_1_vS_f_a_H_e1D_fE_q_2Q_7_q __pyx_string_tab[311] -#define __pyx_kp_b_iso88591_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9 __pyx_string_tab[312] -#define __pyx_kp_b_iso88591__6 __pyx_string_tab[313] -#define __pyx_kp_b_iso88591__7 __pyx_string_tab[314] -#define __pyx_kp_b_iso88591_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU __pyx_string_tab[315] +#define __pyx_kp_u_tuple_t_ExportData_t_SensorImage __pyx_string_tab[32] +#define __pyx_n_u_Any __pyx_string_tab[33] +#define __pyx_n_u_BACKBONE __pyx_string_tab[34] +#define __pyx_n_u_Box __pyx_string_tab[35] +#define __pyx_n_u_CHAIN_APPROX_SIMPLE __pyx_string_tab[36] +#define __pyx_n_u_COLOR_BGR2GRAY __pyx_string_tab[37] +#define __pyx_n_u_COLOR_BGR2RGB __pyx_string_tab[38] +#define __pyx_n_u_Canny __pyx_string_tab[39] +#define __pyx_n_u_ContourCalculationError __pyx_string_tab[40] +#define __pyx_n_u_DETECTION_MODELS __pyx_string_tab[41] +#define __pyx_n_u_DataFrame __pyx_string_tab[42] +#define __pyx_n_u_EXPORT_DATA_SORTING __pyx_string_tab[43] +#define __pyx_n_u_ExportData __pyx_string_tab[44] +#define __pyx_n_u_Final __pyx_string_tab[45] +#define __pyx_n_u_HEATMAP_FILENAME_SUFFIX __pyx_string_tab[46] +#define __pyx_n_u_Image __pyx_string_tab[47] +#define __pyx_n_u_ImageNotReadError __pyx_string_tab[48] +#define __pyx_n_u_InferenceResult __pyx_string_tab[49] +#define __pyx_n_u_InvalidElectrodeCount __pyx_string_tab[50] +#define __pyx_n_u_LAYERS __pyx_string_tab[51] +#define __pyx_n_u_M __pyx_string_tab[52] +#define __pyx_n_u_MODEL_FOLDER __pyx_string_tab[53] +#define __pyx_n_u_MORPH_CLOSE __pyx_string_tab[54] +#define __pyx_n_u_MORPH_RECT __pyx_string_tab[55] +#define __pyx_n_u_NDArray __pyx_string_tab[56] +#define __pyx_n_u_NUM_VALID_ELECTRODES __pyx_string_tab[57] +#define __pyx_n_u_None __pyx_string_tab[58] +#define __pyx_n_u_PIL __pyx_string_tab[59] +#define __pyx_n_u_Patchcore __pyx_string_tab[60] +#define __pyx_n_u_Path __pyx_string_tab[61] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[62] +#define __pyx_n_u_QUOTE_NONE __pyx_string_tab[63] +#define __pyx_n_u_RATIO __pyx_string_tab[64] +#define __pyx_n_u_RETR_TREE __pyx_string_tab[65] +#define __pyx_n_u_RGB __pyx_string_tab[66] +#define __pyx_n_u_SensorImages __pyx_string_tab[67] +#define __pyx_n_u_THRESHOLD_BW __pyx_string_tab[68] +#define __pyx_n_u_THRESH_BINARY __pyx_string_tab[69] +#define __pyx_n_u__8 __pyx_string_tab[70] +#define __pyx_n_u_accepted_boxes __pyx_string_tab[71] +#define __pyx_n_u_all __pyx_string_tab[72] +#define __pyx_n_u_alpha __pyx_string_tab[73] +#define __pyx_n_u_anomalib_models __pyx_string_tab[74] +#define __pyx_n_u_anomaly_detection __pyx_string_tab[75] +#define __pyx_n_u_anomaly_detection_locals_genexpr __pyx_string_tab[76] +#define __pyx_n_u_anomaly_label __pyx_string_tab[77] +#define __pyx_n_u_anomaly_map __pyx_string_tab[78] +#define __pyx_n_u_anomaly_map_resized __pyx_string_tab[79] +#define __pyx_n_u_anomaly_score __pyx_string_tab[80] +#define __pyx_n_u_anomaly_threshold __pyx_string_tab[81] +#define __pyx_n_u_array __pyx_string_tab[82] +#define __pyx_n_u_astype __pyx_string_tab[83] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[84] +#define __pyx_n_u_ax __pyx_string_tab[85] +#define __pyx_n_u_axes __pyx_string_tab[86] +#define __pyx_n_u_axis __pyx_string_tab[87] +#define __pyx_n_u_backbone __pyx_string_tab[88] +#define __pyx_n_u_bbox_inches __pyx_string_tab[89] +#define __pyx_n_u_binary __pyx_string_tab[90] +#define __pyx_n_u_binary_warped __pyx_string_tab[91] +#define __pyx_n_u_bl __pyx_string_tab[92] +#define __pyx_n_u_bool __pyx_string_tab[93] +#define __pyx_n_u_boundingRect __pyx_string_tab[94] +#define __pyx_n_u_box __pyx_string_tab[95] +#define __pyx_n_u_boxPoints __pyx_string_tab[96] +#define __pyx_n_u_box_1 __pyx_string_tab[97] +#define __pyx_n_u_box_2 __pyx_string_tab[98] +#define __pyx_n_u_br __pyx_string_tab[99] +#define __pyx_n_u_c __pyx_string_tab[100] +#define __pyx_n_u_c1 __pyx_string_tab[101] +#define __pyx_n_u_c2 __pyx_string_tab[102] +#define __pyx_n_u_cast __pyx_string_tab[103] +#define __pyx_n_u_category __pyx_string_tab[104] +#define __pyx_n_u_center_dist __pyx_string_tab[105] +#define __pyx_n_u_check_box_redundancy __pyx_string_tab[106] +#define __pyx_n_u_checkpoint __pyx_string_tab[107] +#define __pyx_n_u_class_getitem __pyx_string_tab[108] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[109] +#define __pyx_n_u_close __pyx_string_tab[110] +#define __pyx_n_u_closed __pyx_string_tab[111] +#define __pyx_n_u_cmap __pyx_string_tab[112] +#define __pyx_n_u_cnts __pyx_string_tab[113] +#define __pyx_n_u_const __pyx_string_tab[114] +#define __pyx_n_u_constants __pyx_string_tab[115] +#define __pyx_n_u_contours __pyx_string_tab[116] +#define __pyx_n_u_convert __pyx_string_tab[117] +#define __pyx_n_u_copy __pyx_string_tab[118] +#define __pyx_n_u_coreset_sampling_ratio __pyx_string_tab[119] +#define __pyx_n_u_cpu __pyx_string_tab[120] +#define __pyx_n_u_cropped __pyx_string_tab[121] +#define __pyx_n_u_cropped_sensor_left __pyx_string_tab[122] +#define __pyx_n_u_cropped_sensor_right __pyx_string_tab[123] +#define __pyx_n_u_csv_2 __pyx_string_tab[124] +#define __pyx_n_u_csv_data __pyx_string_tab[125] +#define __pyx_n_u_csv_data_sorted __pyx_string_tab[126] +#define __pyx_n_u_cuda __pyx_string_tab[127] +#define __pyx_n_u_cv2 __pyx_string_tab[128] +#define __pyx_n_u_cvtColor __pyx_string_tab[129] +#define __pyx_n_u_data_csv __pyx_string_tab[130] +#define __pyx_n_u_detection_models __pyx_string_tab[131] +#define __pyx_n_u_device __pyx_string_tab[132] +#define __pyx_n_u_df __pyx_string_tab[133] +#define __pyx_n_u_dimA __pyx_string_tab[134] +#define __pyx_n_u_dimB __pyx_string_tab[135] +#define __pyx_n_u_dist __pyx_string_tab[136] +#define __pyx_n_u_distance __pyx_string_tab[137] +#define __pyx_n_u_dopt_basics __pyx_string_tab[138] +#define __pyx_n_u_dopt_basics_datastructures __pyx_string_tab[139] +#define __pyx_n_u_dopt_sensor_anomalies __pyx_string_tab[140] +#define __pyx_n_u_dopt_sensor_anomalies__find_path __pyx_string_tab[141] +#define __pyx_n_u_dopt_sensor_anomalies_detection __pyx_string_tab[142] +#define __pyx_n_u_dst __pyx_string_tab[143] +#define __pyx_n_u_dtype __pyx_string_tab[144] +#define __pyx_n_u_edged __pyx_string_tab[145] +#define __pyx_n_u_enter __pyx_string_tab[146] +#define __pyx_n_u_enumerate __pyx_string_tab[147] +#define __pyx_n_u_errors __pyx_string_tab[148] +#define __pyx_n_u_eval __pyx_string_tab[149] +#define __pyx_n_u_existing __pyx_string_tab[150] +#define __pyx_n_u_exists __pyx_string_tab[151] +#define __pyx_n_u_exit __pyx_string_tab[152] +#define __pyx_n_u_export_data __pyx_string_tab[153] +#define __pyx_n_u_figsize __pyx_string_tab[154] +#define __pyx_n_u_file_path __pyx_string_tab[155] +#define __pyx_n_u_file_stem __pyx_string_tab[156] +#define __pyx_n_u_filtered_cnts __pyx_string_tab[157] +#define __pyx_n_u_filterwarnings __pyx_string_tab[158] +#define __pyx_n_u_findContours __pyx_string_tab[159] +#define __pyx_n_u_find_paths __pyx_string_tab[160] +#define __pyx_n_u_flatten __pyx_string_tab[161] +#define __pyx_n_u_float __pyx_string_tab[162] +#define __pyx_n_u_float32 __pyx_string_tab[163] +#define __pyx_n_u_folder_path __pyx_string_tab[164] +#define __pyx_n_u_from_numpy __pyx_string_tab[165] +#define __pyx_n_u_fromarray __pyx_string_tab[166] +#define __pyx_n_u_func __pyx_string_tab[167] +#define __pyx_n_u_genexpr __pyx_string_tab[168] +#define __pyx_n_u_getPerspectiveTransform __pyx_string_tab[169] +#define __pyx_n_u_getStructuringElement __pyx_string_tab[170] +#define __pyx_n_u_get_detection_models __pyx_string_tab[171] +#define __pyx_n_u_get_model_folder __pyx_string_tab[172] +#define __pyx_n_u_grab_contours __pyx_string_tab[173] +#define __pyx_n_u_gray __pyx_string_tab[174] +#define __pyx_n_u_gray_warped __pyx_string_tab[175] +#define __pyx_n_u_header __pyx_string_tab[176] +#define __pyx_n_u_heightA __pyx_string_tab[177] +#define __pyx_n_u_heightB __pyx_string_tab[178] +#define __pyx_n_u_hspace __pyx_string_tab[179] +#define __pyx_n_u_i __pyx_string_tab[180] +#define __pyx_n_u_ignore __pyx_string_tab[181] +#define __pyx_n_u_image __pyx_string_tab[182] +#define __pyx_n_u_image_np __pyx_string_tab[183] +#define __pyx_n_u_image_rgb __pyx_string_tab[184] +#define __pyx_n_u_img __pyx_string_tab[185] +#define __pyx_n_u_img_np __pyx_string_tab[186] +#define __pyx_n_u_img_path __pyx_string_tab[187] +#define __pyx_n_u_imread __pyx_string_tab[188] +#define __pyx_n_u_imshow __pyx_string_tab[189] +#define __pyx_n_u_imutils __pyx_string_tab[190] +#define __pyx_n_u_index __pyx_string_tab[191] +#define __pyx_n_u_infer_image __pyx_string_tab[192] +#define __pyx_n_u_input_tensor __pyx_string_tab[193] +#define __pyx_n_u_int32 __pyx_string_tab[194] +#define __pyx_n_u_is_available __pyx_string_tab[195] +#define __pyx_n_u_is_coroutine __pyx_string_tab[196] +#define __pyx_n_u_is_duplicate __pyx_string_tab[197] +#define __pyx_n_u_is_sorted __pyx_string_tab[198] +#define __pyx_n_u_item __pyx_string_tab[199] +#define __pyx_n_u_items __pyx_string_tab[200] +#define __pyx_n_u_jet __pyx_string_tab[201] +#define __pyx_n_u_kernel __pyx_string_tab[202] +#define __pyx_n_u_key __pyx_string_tab[203] +#define __pyx_n_u_layers __pyx_string_tab[204] +#define __pyx_n_u_left __pyx_string_tab[205] +#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[206] +#define __pyx_n_u_linalg __pyx_string_tab[207] +#define __pyx_n_u_load __pyx_string_tab[208] +#define __pyx_n_u_load_state_dict __pyx_string_tab[209] +#define __pyx_n_u_main __pyx_string_tab[210] +#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[211] +#define __pyx_n_u_max __pyx_string_tab[212] +#define __pyx_n_u_max_height __pyx_string_tab[213] +#define __pyx_n_u_max_width __pyx_string_tab[214] +#define __pyx_n_u_measure_length __pyx_string_tab[215] +#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[216] +#define __pyx_n_u_message __pyx_string_tab[217] +#define __pyx_n_u_midpoint __pyx_string_tab[218] +#define __pyx_n_u_min __pyx_string_tab[219] +#define __pyx_n_u_minAreaRect __pyx_string_tab[220] +#define __pyx_n_u_mode __pyx_string_tab[221] +#define __pyx_n_u_model __pyx_string_tab[222] +#define __pyx_n_u_model_state_dict __pyx_string_tab[223] +#define __pyx_n_u_module __pyx_string_tab[224] +#define __pyx_n_u_morphologyEx __pyx_string_tab[225] +#define __pyx_n_u_name __pyx_string_tab[226] +#define __pyx_n_u_next __pyx_string_tab[227] +#define __pyx_n_u_no_grad __pyx_string_tab[228] +#define __pyx_n_u_norm __pyx_string_tab[229] +#define __pyx_n_u_np __pyx_string_tab[230] +#define __pyx_n_u_npt __pyx_string_tab[231] +#define __pyx_n_u_num_contours __pyx_string_tab[232] +#define __pyx_n_u_numpy __pyx_string_tab[233] +#define __pyx_n_u_numpy_typing __pyx_string_tab[234] +#define __pyx_n_u_off __pyx_string_tab[235] +#define __pyx_n_u_offset __pyx_string_tab[236] +#define __pyx_n_u_order_points __pyx_string_tab[237] +#define __pyx_n_u_orig __pyx_string_tab[238] +#define __pyx_n_u_output __pyx_string_tab[239] +#define __pyx_n_u_pad_inches __pyx_string_tab[240] +#define __pyx_n_u_pandas __pyx_string_tab[241] +#define __pyx_n_u_parent __pyx_string_tab[242] +#define __pyx_n_u_pathlib __pyx_string_tab[243] +#define __pyx_n_u_permute __pyx_string_tab[244] +#define __pyx_n_u_perspective __pyx_string_tab[245] +#define __pyx_n_u_pil_image __pyx_string_tab[246] +#define __pyx_n_u_pipeline __pyx_string_tab[247] +#define __pyx_n_u_pixel_count __pyx_string_tab[248] +#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[249] +#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[250] +#define __pyx_n_u_plt __pyx_string_tab[251] +#define __pyx_n_u_pop __pyx_string_tab[252] +#define __pyx_n_u_pred_score __pyx_string_tab[253] +#define __pyx_n_u_pt_A __pyx_string_tab[254] +#define __pyx_n_u_pt_B __pyx_string_tab[255] +#define __pyx_n_u_pyplot __pyx_string_tab[256] +#define __pyx_n_u_qualname __pyx_string_tab[257] +#define __pyx_n_u_quoting __pyx_string_tab[258] +#define __pyx_n_u_rbox __pyx_string_tab[259] +#define __pyx_n_u_resize __pyx_string_tab[260] +#define __pyx_n_u_result __pyx_string_tab[261] +#define __pyx_n_u_result_pattern __pyx_string_tab[262] +#define __pyx_n_u_return __pyx_string_tab[263] +#define __pyx_n_u_reversed __pyx_string_tab[264] +#define __pyx_n_u_right __pyx_string_tab[265] +#define __pyx_n_u_rightmost_x_third __pyx_string_tab[266] +#define __pyx_n_u_s1 __pyx_string_tab[267] +#define __pyx_n_u_s2 __pyx_string_tab[268] +#define __pyx_n_u_savefig __pyx_string_tab[269] +#define __pyx_n_u_scipy_spatial __pyx_string_tab[270] +#define __pyx_n_u_send __pyx_string_tab[271] +#define __pyx_n_u_sensor_images __pyx_string_tab[272] +#define __pyx_n_u_sensor_sizes __pyx_string_tab[273] +#define __pyx_n_u_sensor_sizes_sorted __pyx_string_tab[274] +#define __pyx_n_u_sep __pyx_string_tab[275] +#define __pyx_n_u_set_name __pyx_string_tab[276] +#define __pyx_n_u_setdefault __pyx_string_tab[277] +#define __pyx_n_u_shape __pyx_string_tab[278] +#define __pyx_n_u_side __pyx_string_tab[279] +#define __pyx_n_u_size_diff __pyx_string_tab[280] +#define __pyx_n_u_sort_contours __pyx_string_tab[281] +#define __pyx_n_u_squeeze __pyx_string_tab[282] +#define __pyx_n_u_stem __pyx_string_tab[283] +#define __pyx_n_u_str __pyx_string_tab[284] +#define __pyx_n_u_subplots __pyx_string_tab[285] +#define __pyx_n_u_subplots_adjust __pyx_string_tab[286] +#define __pyx_n_u_sum __pyx_string_tab[287] +#define __pyx_n_u_t __pyx_string_tab[288] +#define __pyx_n_u_test __pyx_string_tab[289] +#define __pyx_n_u_threshold __pyx_string_tab[290] +#define __pyx_n_u_throw __pyx_string_tab[291] +#define __pyx_n_u_tight __pyx_string_tab[292] +#define __pyx_n_u_tl __pyx_string_tab[293] +#define __pyx_n_u_to __pyx_string_tab[294] +#define __pyx_n_u_to_csv __pyx_string_tab[295] +#define __pyx_n_u_tolerance __pyx_string_tab[296] +#define __pyx_n_u_torch __pyx_string_tab[297] +#define __pyx_n_u_torch_device __pyx_string_tab[298] +#define __pyx_n_u_tr __pyx_string_tab[299] +#define __pyx_n_u_types __pyx_string_tab[300] +#define __pyx_n_u_typing __pyx_string_tab[301] +#define __pyx_n_u_uint8 __pyx_string_tab[302] +#define __pyx_n_u_unsqueeze __pyx_string_tab[303] +#define __pyx_n_u_user_img_path __pyx_string_tab[304] +#define __pyx_n_u_value __pyx_string_tab[305] +#define __pyx_n_u_values __pyx_string_tab[306] +#define __pyx_n_u_w __pyx_string_tab[307] +#define __pyx_n_u_warnings __pyx_string_tab[308] +#define __pyx_n_u_warpPerspective __pyx_string_tab[309] +#define __pyx_n_u_warped __pyx_string_tab[310] +#define __pyx_n_u_widthA __pyx_string_tab[311] +#define __pyx_n_u_widthB __pyx_string_tab[312] +#define __pyx_n_u_wrap_result __pyx_string_tab[313] +#define __pyx_n_u_wspace __pyx_string_tab[314] +#define __pyx_n_u_x1 __pyx_string_tab[315] +#define __pyx_n_u_x2 __pyx_string_tab[316] +#define __pyx_n_u_x_coords __pyx_string_tab[317] +#define __pyx_n_u_x_max __pyx_string_tab[318] +#define __pyx_n_u_x_middle __pyx_string_tab[319] +#define __pyx_n_u_x_min __pyx_string_tab[320] +#define __pyx_n_u_y_max __pyx_string_tab[321] +#define __pyx_n_u_y_min __pyx_string_tab[322] +#define __pyx_n_u_zip __pyx_string_tab[323] +#define __pyx_kp_b_iso88591_1 __pyx_string_tab[324] +#define __pyx_kp_b_iso88591_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX __pyx_string_tab[325] +#define __pyx_kp_b_iso88591_AQ_t9G1_q_5_ARRS_aq_nA_Q_A_a __pyx_string_tab[326] +#define __pyx_kp_b_iso88591_AT_Rt1D_AS_at2Q __pyx_string_tab[327] +#define __pyx_kp_b_iso88591_Cwas_1_vS_f_a_H_e1D_fE_q_2Q_7_q __pyx_string_tab[328] +#define __pyx_kp_b_iso88591_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9 __pyx_string_tab[329] +#define __pyx_kp_b_iso88591__6 __pyx_string_tab[330] +#define __pyx_kp_b_iso88591__7 __pyx_string_tab[331] +#define __pyx_kp_b_iso88591_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU __pyx_string_tab[332] #define __pyx_float_0_5 __pyx_number_tab[0] #define __pyx_float_0_8 __pyx_number_tab[1] #define __pyx_float_2_0 __pyx_number_tab[2] @@ -3295,10 +3383,11 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_int_12 __pyx_number_tab[9] #define __pyx_int_20 __pyx_number_tab[10] #define __pyx_int_50 __pyx_number_tab[11] -#define __pyx_int_100 __pyx_number_tab[12] -#define __pyx_int_255 __pyx_number_tab[13] -#define __pyx_int_500 __pyx_number_tab[14] -#define __pyx_int_1500 __pyx_number_tab[15] +#define __pyx_int_80 __pyx_number_tab[12] +#define __pyx_int_100 __pyx_number_tab[13] +#define __pyx_int_255 __pyx_number_tab[14] +#define __pyx_int_500 __pyx_number_tab[15] +#define __pyx_int_1500 __pyx_number_tab[16] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { @@ -3327,11 +3416,15 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr); Py_CLEAR(clear_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); Py_CLEAR(clear_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection); + Py_CLEAR(clear_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection); + Py_CLEAR(clear_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr); for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } for (int i=0; i<7; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } - for (int i=0; i<12; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<316; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } - for (int i=0; i<16; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } + for (int i=0; i<13; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<333; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<17; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); @@ -3371,11 +3464,15 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr); Py_VISIT(traverse_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); Py_VISIT(traverse_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection); + Py_VISIT(traverse_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection); + Py_VISIT(traverse_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr); for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } for (int i=0; i<7; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } - for (int i=0; i<12; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<316; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } - for (int i=0; i<16; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } + for (int i=0; i<13; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<333; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<17; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); @@ -3392,7 +3489,7 @@ return 0; #endif /* #### Code section: module_code ### */ -/* "dopt_sensor_anomalies/detection.py":32 +/* "dopt_sensor_anomalies/detection.py":33 * * * def midpoint( # <<<<<<<<<<<<<< @@ -3440,39 +3537,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt_A,&__pyx_mstate_global->__pyx_n_u_pt_B,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 32, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 33, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 32, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 33, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 33, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "midpoint", 0) < (0)) __PYX_ERR(0, 32, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "midpoint", 0) < (0)) __PYX_ERR(0, 33, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, i); __PYX_ERR(0, 32, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, i); __PYX_ERR(0, 33, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 33, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 32, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 33, __pyx_L3_error) } __pyx_v_pt_A = values[0]; __pyx_v_pt_B = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 32, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 33, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3505,7 +3602,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU int __pyx_clineno = 0; __Pyx_RefNannySetupContext("midpoint", 0); - /* "dopt_sensor_anomalies/detection.py":36 + /* "dopt_sensor_anomalies/detection.py":37 * pt_B: npt.NDArray[np.floating], * ) -> tuple[float, float]: * return ((pt_A[0] + pt_B[0]) * 0.5, (pt_A[1] + pt_B[1]) * 0.5) # <<<<<<<<<<<<<< @@ -3513,41 +3610,41 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_A, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_A, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt_B, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt_B, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt_A, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt_A, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_B, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_B, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 37, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 37, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":32 + /* "dopt_sensor_anomalies/detection.py":33 * * * def midpoint( # <<<<<<<<<<<<<< @@ -3569,7 +3666,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":39 +/* "dopt_sensor_anomalies/detection.py":40 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -3618,40 +3715,40 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_box_1,&__pyx_mstate_global->__pyx_n_u_box_2,&__pyx_mstate_global->__pyx_n_u_tolerance,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 39, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 40, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 39, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 40, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 40, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 39, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 40, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "check_box_redundancy", 0) < (0)) __PYX_ERR(0, 39, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "check_box_redundancy", 0) < (0)) __PYX_ERR(0, 40, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, i); __PYX_ERR(0, 39, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, i); __PYX_ERR(0, 40, __pyx_L3_error) } } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 39, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 40, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 40, __pyx_L3_error) values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 39, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 40, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3659,14 +3756,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __pyx_v_box_1 = values[0]; __pyx_v_box_2 = values[1]; if (values[2]) { - __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error) + __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L3_error) } else { __pyx_v_tolerance = ((double)((double)5.0)); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 40, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3717,7 +3814,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan int __pyx_clineno = 0; __Pyx_RefNannySetupContext("check_box_redundancy", 0); - /* "dopt_sensor_anomalies/detection.py":44 + /* "dopt_sensor_anomalies/detection.py":45 * tolerance: float = 5.0, * ) -> bool: * c1, s1, _ = box_1 # <<<<<<<<<<<<<< @@ -3730,7 +3827,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 44, __pyx_L1_error) + __PYX_ERR(0, 45, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3742,26 +3839,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_v_box_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; @@ -3770,7 +3867,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_GOTREF(__pyx_t_2); index = 2; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 44, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -3778,7 +3875,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 44, __pyx_L1_error) + __PYX_ERR(0, 45, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_c1 = __pyx_t_1; @@ -3788,7 +3885,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_v__ = __pyx_t_3; __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":45 + /* "dopt_sensor_anomalies/detection.py":46 * ) -> bool: * c1, s1, _ = box_1 * c2, s2, _ = box_2 # <<<<<<<<<<<<<< @@ -3801,7 +3898,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 45, __pyx_L1_error) + __PYX_ERR(0, 46, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3813,26 +3910,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_INCREF(__pyx_t_1); } else { __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); } #else - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_v_box_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; @@ -3841,7 +3938,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_GOTREF(__pyx_t_2); index = 2; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L6_unpacking_done; @@ -3849,7 +3946,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 45, __pyx_L1_error) + __PYX_ERR(0, 46, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_v_c2 = __pyx_t_3; @@ -3859,33 +3956,33 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_DECREF_SET(__pyx_v__, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":46 + /* "dopt_sensor_anomalies/detection.py":47 * c1, s1, _ = box_1 * c2, s2, _ = box_2 * s1 = sorted(s1) # <<<<<<<<<<<<<< * s2 = sorted(s2) * */ - __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 46, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":47 + /* "dopt_sensor_anomalies/detection.py":48 * c2, s2, _ = box_2 * s1 = sorted(s1) * s2 = sorted(s2) # <<<<<<<<<<<<<< * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) */ - __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 47, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":49 + /* "dopt_sensor_anomalies/detection.py":50 * s2 = sorted(s2) * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) # <<<<<<<<<<<<<< @@ -3893,19 +3990,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __pyx_t_8; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -3925,13 +4022,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -3951,10 +4048,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 49, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } - __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -3965,7 +4062,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_t_12 = 1; @@ -3986,13 +4083,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_center_dist = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":50 + /* "dopt_sensor_anomalies/detection.py":51 * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) # <<<<<<<<<<<<<< @@ -4000,19 +4097,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * return bool(center_dist < tolerance and size_diff < tolerance) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_8 = __pyx_t_6; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4032,13 +4129,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); } __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4058,10 +4155,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 50, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } - __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -4072,7 +4169,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_12 = 1; @@ -4093,13 +4190,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_size_diff = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":52 + /* "dopt_sensor_anomalies/detection.py":53 * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) * * return bool(center_dist < tolerance and size_diff < tolerance) # <<<<<<<<<<<<<< @@ -4107,32 +4204,32 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_center_dist, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_center_dist, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_15) { } else { __pyx_t_14 = __pyx_t_15; goto __pyx_L7_bool_binop_done; } - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_size_diff, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_size_diff, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_t_15; __pyx_L7_bool_binop_done:; - __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_14))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_14))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":39 + /* "dopt_sensor_anomalies/detection.py":40 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -4168,7 +4265,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":55 +/* "dopt_sensor_anomalies/detection.py":56 * * * def measure_length( # <<<<<<<<<<<<<< @@ -4217,46 +4314,46 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_img_path,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_X,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 55, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 56, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 56, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 56, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "measure_length", 0) < (0)) __PYX_ERR(0, 55, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "measure_length", 0) < (0)) __PYX_ERR(0, 56, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, i); __PYX_ERR(0, 55, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, i); __PYX_ERR(0, 56, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 56, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 56, __pyx_L3_error) } __pyx_v_img_path = values[0]; - __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 57, __pyx_L3_error) - __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) + __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) + __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 55, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 56, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4278,7 +4375,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":84 +/* "dopt_sensor_anomalies/detection.py":85 * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< @@ -4298,7 +4395,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_ge if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 84, __pyx_L1_error) + __PYX_ERR(0, 85, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4306,7 +4403,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_ge __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4349,17 +4446,17 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 84, __pyx_L1_error) + __PYX_ERR(0, 85, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 84, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 85, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { @@ -4367,7 +4464,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4377,7 +4474,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4388,13 +4485,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g #endif ++__pyx_t_2; } - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 85, __pyx_L1_error) PyErr_Clear(); } break; @@ -4407,7 +4504,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 84, __pyx_L1_error) + __PYX_ERR(0, 85, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4417,22 +4514,22 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_INCREF(__pyx_t_6); } else { __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_6); } #else - __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); @@ -4440,7 +4537,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 85, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; @@ -4448,7 +4545,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 84, __pyx_L1_error) + __PYX_ERR(0, 85, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x1); @@ -4459,7 +4556,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_x2, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_x2, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_t_1); @@ -4478,7 +4575,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 85, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -4508,7 +4605,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":112 +/* "dopt_sensor_anomalies/detection.py":114 * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4528,7 +4625,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3g if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 112, __pyx_L1_error) + __PYX_ERR(0, 114, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4539,7 +4636,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4578,30 +4675,30 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 112, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 112, __pyx_L1_error) } + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 114, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 114, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 112, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 114, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_existing); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_existing, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_check_box_redundancy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_check_box_redundancy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_rbox)) { __Pyx_RaiseClosureNameError("rbox"); __PYX_ERR(0, 112, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_rbox)) { __Pyx_RaiseClosureNameError("rbox"); __PYX_ERR(0, 114, __pyx_L1_error) } __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { @@ -4619,14 +4716,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "dopt_sensor_anomalies/detection.py":111 + /* "dopt_sensor_anomalies/detection.py":113 * continue * * is_duplicate = any( # <<<<<<<<<<<<<< @@ -4635,7 +4732,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":112 + /* "dopt_sensor_anomalies/detection.py":114 * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4651,7 +4748,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*else*/ { - /* "dopt_sensor_anomalies/detection.py":111 + /* "dopt_sensor_anomalies/detection.py":113 * continue * * is_duplicate = any( # <<<<<<<<<<<<<< @@ -4660,7 +4757,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":112 + /* "dopt_sensor_anomalies/detection.py":114 * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4696,7 +4793,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":143 +/* "dopt_sensor_anomalies/detection.py":168 * ) * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< @@ -4716,7 +4813,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6g if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 143, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4724,7 +4821,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4766,34 +4863,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 143, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 143, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 168, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 168, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -4813,7 +4910,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -4832,7 +4929,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 168, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -4862,7 +4959,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":144 +/* "dopt_sensor_anomalies/detection.py":169 * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) # <<<<<<<<<<<<<< @@ -4882,7 +4979,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9g if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 144, __pyx_L1_error) + __PYX_ERR(0, 169, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4890,7 +4987,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4932,34 +5029,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 144, __pyx_L1_error) + __PYX_ERR(0, 169, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 144, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 169, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 144, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 169, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -4979,7 +5076,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -4998,7 +5095,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 144, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 169, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5028,7 +5125,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":145 +/* "dopt_sensor_anomalies/detection.py":170 * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< @@ -5048,7 +5145,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12 if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 145, __pyx_L1_error) + __PYX_ERR(0, 170, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5056,7 +5153,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12 __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5098,34 +5195,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 145, __pyx_L1_error) + __PYX_ERR(0, 170, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 145, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 170, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 170, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5145,7 +5242,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5164,7 +5261,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 170, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5194,7 +5291,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":146 +/* "dopt_sensor_anomalies/detection.py":171 * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) # <<<<<<<<<<<<<< @@ -5214,7 +5311,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15 if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 146, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5222,7 +5319,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15 __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5264,34 +5361,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 146, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 146, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 171, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 171, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5311,7 +5408,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5330,7 +5427,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 171, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5359,7 +5456,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":55 +/* "dopt_sensor_anomalies/detection.py":56 * * * def measure_length( # <<<<<<<<<<<<<< @@ -5369,7 +5466,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_img_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y) { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length *__pyx_cur_scope; - PyObject *__pyx_v_data_csv = 0; + PyObject *__pyx_v_sensor_sizes = 0; PyObject *__pyx_v_image = NULL; PyObject *__pyx_v_cropped = NULL; PyObject *__pyx_v_orig = NULL; @@ -5390,19 +5487,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_v_tr = NULL; PyObject *__pyx_v_br = NULL; PyObject *__pyx_v_bl = NULL; - PyObject *__pyx_v_tltrX = NULL; - PyObject *__pyx_v_tltrY = NULL; - PyObject *__pyx_v_blbrX = NULL; - PyObject *__pyx_v_blbrY = NULL; - PyObject *__pyx_v_tlblX = NULL; - PyObject *__pyx_v_tlblY = NULL; - PyObject *__pyx_v_trbrX = NULL; - PyObject *__pyx_v_trbrY = NULL; - PyObject *__pyx_v_dA = NULL; - PyObject *__pyx_v_dB = NULL; + PyObject *__pyx_v_widthA = NULL; + PyObject *__pyx_v_widthB = NULL; + PyObject *__pyx_v_max_width = NULL; + PyObject *__pyx_v_heightA = NULL; + PyObject *__pyx_v_heightB = NULL; + PyObject *__pyx_v_max_height = NULL; PyObject *__pyx_v_is_duplicate = NULL; - PyObject *__pyx_v_dimA = NULL; - PyObject *__pyx_v_dimB = NULL; + double __pyx_v_dimA; + double __pyx_v_dimB; + PyObject *__pyx_v_offset = NULL; + PyObject *__pyx_v_dst = NULL; + PyObject *__pyx_v_M = NULL; + PyObject *__pyx_v_warped = NULL; + PyObject *__pyx_v_gray_warped = NULL; + PyObject *__pyx_v_binary_warped = NULL; + PyObject *__pyx_v_pixel_count = NULL; Py_ssize_t __pyx_v_num_contours; PyObject *__pyx_v_x_min = NULL; PyObject *__pyx_v_x_max = NULL; @@ -5413,6 +5513,8 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_v_x_middle = NULL; PyObject *__pyx_v_cropped_sensor_left = NULL; PyObject *__pyx_v_cropped_sensor_right = NULL; + PyObject *__pyx_v_sensor_sizes_sorted = NULL; + PyObject *__pyx_v_export_data = NULL; PyObject *__pyx_7genexpr__pyx_v_c = NULL; PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator = 0; PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1 = 0; @@ -5439,10 +5541,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - PyObject *__pyx_t_20[4]; - long __pyx_t_21; + double __pyx_t_18; + PyObject *__pyx_t_19[4]; + long __pyx_t_20; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5451,37 +5552,37 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 55, __pyx_L1_error) + __PYX_ERR(0, 56, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - /* "dopt_sensor_anomalies/detection.py":60 + /* "dopt_sensor_anomalies/detection.py":61 * pixels_per_metric_Y: float, - * ) -> tuple[t.CsvData, t.SensorImages]: - * data_csv: list[str | int] = [] # <<<<<<<<<<<<<< + * ) -> tuple[t.ExportData, t.SensorImages]: + * sensor_sizes: list[tuple[str, ...]] = [] # <<<<<<<<<<<<<< * image = cv2.imread(str(img_path)) * if image is None: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_data_csv = ((PyObject*)__pyx_t_1); + __pyx_v_sensor_sizes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":61 - * ) -> tuple[t.CsvData, t.SensorImages]: - * data_csv: list[str | int] = [] + /* "dopt_sensor_anomalies/detection.py":62 + * ) -> tuple[t.ExportData, t.SensorImages]: + * sensor_sizes: list[tuple[str, ...]] = [] * image = cv2.imread(str(img_path)) # <<<<<<<<<<<<<< * if image is None: * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_imread); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_imread); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_img_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_img_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -5501,14 +5602,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":62 - * data_csv: list[str | int] = [] + /* "dopt_sensor_anomalies/detection.py":63 + * sensor_sizes: list[tuple[str, ...]] = [] * image = cv2.imread(str(img_path)) * if image is None: # <<<<<<<<<<<<<< * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") @@ -5517,7 +5618,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_6 = (__pyx_v_image == Py_None); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":63 + /* "dopt_sensor_anomalies/detection.py":64 * image = cv2.imread(str(img_path)) * if image is None: * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") # <<<<<<<<<<<<<< @@ -5525,18 +5626,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cropped = image[500:1500, 100 : image.shape[1] - 100] */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ImageNotReadError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ImageNotReadError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_img_path, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_img_path, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_Image_could_not_be_read_from; __pyx_t_7[1] = __pyx_t_3; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 63, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5557,15 +5658,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 63, __pyx_L1_error) + __PYX_ERR(0, 64, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":62 - * data_csv: list[str | int] = [] + /* "dopt_sensor_anomalies/detection.py":63 + * sensor_sizes: list[tuple[str, ...]] = [] * image = cv2.imread(str(img_path)) * if image is None: # <<<<<<<<<<<<<< * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") @@ -5573,39 +5674,39 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":65 + /* "dopt_sensor_anomalies/detection.py":66 * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * * cropped = image[500:1500, 100 : image.shape[1] - 100] # <<<<<<<<<<<<<< * orig = cropped.copy() * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyLong_SubtractObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_SubtractObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PySlice_New(__pyx_mstate_global->__pyx_int_100, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = PySlice_New(__pyx_mstate_global->__pyx_int_100, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[1]) != (0)) __PYX_ERR(0, 65, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[1]) != (0)) __PYX_ERR(0, 66, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 65, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 66, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_image, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_image, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cropped = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":66 + /* "dopt_sensor_anomalies/detection.py":67 * * cropped = image[500:1500, 100 : image.shape[1] - 100] * orig = cropped.copy() # <<<<<<<<<<<<<< @@ -5619,13 +5720,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_orig = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":68 + /* "dopt_sensor_anomalies/detection.py":69 * orig = cropped.copy() * * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) # <<<<<<<<<<<<<< @@ -5633,14 +5734,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2GRAY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2GRAY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -5661,13 +5762,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_gray = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":69 + /* "dopt_sensor_anomalies/detection.py":70 * * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) # <<<<<<<<<<<<<< @@ -5675,19 +5776,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_threshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_threshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESHOLD_BW); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESHOLD_BW); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESH_BINARY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESH_BINARY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5709,7 +5810,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -5718,7 +5819,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 69, __pyx_L1_error) + __PYX_ERR(0, 70, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5728,22 +5829,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_9); } else { __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); @@ -5751,7 +5852,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_9 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L5_unpacking_done; @@ -5759,7 +5860,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 69, __pyx_L1_error) + __PYX_ERR(0, 70, __pyx_L1_error) __pyx_L5_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -5767,7 +5868,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_v_binary = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":71 + /* "dopt_sensor_anomalies/detection.py":72 * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) # <<<<<<<<<<<<<< @@ -5775,14 +5876,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * edged = cv2.Canny(closed, 50, 100) */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_getStructuringElement); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_getStructuringElement); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MORPH_RECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MORPH_RECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -5803,13 +5904,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_kernel = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":72 + /* "dopt_sensor_anomalies/detection.py":73 * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) # <<<<<<<<<<<<<< @@ -5817,14 +5918,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_morphologyEx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_morphologyEx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MORPH_CLOSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MORPH_CLOSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -5845,13 +5946,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_closed = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":73 + /* "dopt_sensor_anomalies/detection.py":74 * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) # <<<<<<<<<<<<<< @@ -5859,9 +5960,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Canny); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Canny); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -5881,13 +5982,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_edged = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":75 + /* "dopt_sensor_anomalies/detection.py":76 * edged = cv2.Canny(closed, 50, 100) * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) # <<<<<<<<<<<<<< @@ -5895,9 +5996,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * if cnts is None: # pragma: no cover */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_findContours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_findContours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_4 = __pyx_v_edged; @@ -5907,17 +6008,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RETR_TREE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RETR_TREE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CHAIN_APPROX_SIMPLE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CHAIN_APPROX_SIMPLE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -5940,13 +6041,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_cnts = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":76 + /* "dopt_sensor_anomalies/detection.py":77 * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) # <<<<<<<<<<<<<< @@ -5954,9 +6055,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * raise errors.ContourCalculationError( */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_imutils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_imutils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_grab_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_grab_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_5 = 1; @@ -5976,13 +6077,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF_SET(__pyx_v_cnts, __pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":77 + /* "dopt_sensor_anomalies/detection.py":78 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # pragma: no cover # <<<<<<<<<<<<<< @@ -5992,7 +6093,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_6 = (__pyx_v_cnts == Py_None); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":78 + /* "dopt_sensor_anomalies/detection.py":79 * cnts = imutils.grab_contours(cnts) * if cnts is None: # pragma: no cover * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6000,9 +6101,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6022,14 +6123,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 78, __pyx_L1_error) + __PYX_ERR(0, 79, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":77 + /* "dopt_sensor_anomalies/detection.py":78 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # pragma: no cover # <<<<<<<<<<<<<< @@ -6038,7 +6139,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":82 + /* "dopt_sensor_anomalies/detection.py":83 * ) * * cnts, _ = contours.sort_contours(cnts) # <<<<<<<<<<<<<< @@ -6046,9 +6147,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sort_contours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sort_contours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6068,7 +6169,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -6077,7 +6178,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 82, __pyx_L1_error) + __PYX_ERR(0, 83, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6087,22 +6188,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_11); } else { __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_11); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); @@ -6110,7 +6211,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_11 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 82, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 83, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_unpacking_done; @@ -6118,7 +6219,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 82, __pyx_L1_error) + __PYX_ERR(0, 83, __pyx_L1_error) __pyx_L8_unpacking_done:; } __Pyx_DECREF_SET(__pyx_v_cnts, __pyx_t_1); @@ -6126,7 +6227,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF_SET(__pyx_v__, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":83 + /* "dopt_sensor_anomalies/detection.py":84 * * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] # <<<<<<<<<<<<<< @@ -6134,16 +6235,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * if not is_sorted: # pragma: no cover */ { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L11_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_v_cnts)) || PyTuple_CheckExact(__pyx_v_cnts)) { __pyx_t_11 = __pyx_v_cnts; __Pyx_INCREF(__pyx_t_11); __pyx_t_12 = 0; __pyx_t_13 = NULL; } else { - __pyx_t_12 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 83, __pyx_L11_error) + __pyx_t_12 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 83, __pyx_L11_error) + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 84, __pyx_L11_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6151,7 +6252,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 83, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6161,7 +6262,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 83, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6172,13 +6273,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L11_error) } else { __pyx_t_1 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 83, __pyx_L11_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 84, __pyx_L11_error) PyErr_Clear(); } break; @@ -6188,9 +6289,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_c, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_boundingRect); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L11_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_boundingRect); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6210,13 +6311,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L11_error) + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 83, __pyx_L11_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 84, __pyx_L11_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -6230,7 +6331,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_v_x_coords = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":84 + /* "dopt_sensor_anomalies/detection.py":85 * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< @@ -6238,13 +6339,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * raise errors.ContourCalculationError( */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = NULL; - __pyx_t_9 = __Pyx_PyList_GetSlice(__pyx_v_x_coords, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_GetSlice(__pyx_v_x_coords, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; { @@ -6252,10 +6353,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } - __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_genexpr(NULL, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_genexpr(NULL, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6276,24 +6377,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_is_sorted = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":85 + /* "dopt_sensor_anomalies/detection.py":86 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "Contour detection not valid: contours are not " */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_sorted); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_sorted); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 86, __pyx_L1_error) __pyx_t_14 = (!__pyx_t_6); if (unlikely(__pyx_t_14)) { - /* "dopt_sensor_anomalies/detection.py":86 + /* "dopt_sensor_anomalies/detection.py":87 * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # pragma: no cover * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6301,9 +6402,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * "properly sorted from left to right." */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6323,14 +6424,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 86, __pyx_L1_error) + __PYX_ERR(0, 87, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":85 + /* "dopt_sensor_anomalies/detection.py":86 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # pragma: no cover # <<<<<<<<<<<<<< @@ -6339,31 +6440,31 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":90 + /* "dopt_sensor_anomalies/detection.py":91 * "properly sorted from left to right." * ) * accepted_boxes: list[t.Box] = [] # <<<<<<<<<<<<<< * filtered_cnts: list[Any] = [] * */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_accepted_boxes = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":91 + /* "dopt_sensor_anomalies/detection.py":92 * ) * accepted_boxes: list[t.Box] = [] * filtered_cnts: list[Any] = [] # <<<<<<<<<<<<<< * * for c in cnts: */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_filtered_cnts = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":93 + /* "dopt_sensor_anomalies/detection.py":94 * filtered_cnts: list[Any] = [] * * for c in cnts: # <<<<<<<<<<<<<< @@ -6375,9 +6476,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_12 = 0; __pyx_t_13 = NULL; } else { - __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 94, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6385,7 +6486,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 94, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6395,7 +6496,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 94, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6406,13 +6507,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 94, __pyx_L1_error) } else { __pyx_t_11 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_11)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 94, __pyx_L1_error) PyErr_Clear(); } break; @@ -6422,7 +6523,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":94 + /* "dopt_sensor_anomalies/detection.py":95 * * for c in cnts: * rbox = cast(t.Box, cv2.minAreaRect(c)) # <<<<<<<<<<<<<< @@ -6430,17 +6531,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * box = np.array(box, dtype=np.int32) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Box); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Box); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_minAreaRect); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_minAreaRect); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_5 = 1; @@ -6460,7 +6561,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 94, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_5 = 1; @@ -6482,7 +6583,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 94, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rbox); @@ -6490,7 +6591,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":95 + /* "dopt_sensor_anomalies/detection.py":96 * for c in cnts: * rbox = cast(t.Box, cv2.minAreaRect(c)) * box = cv2.boxPoints(rbox) # <<<<<<<<<<<<<< @@ -6498,9 +6599,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_boxPoints); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_boxPoints); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6520,13 +6621,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 95, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_XDECREF_SET(__pyx_v_box, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":96 + /* "dopt_sensor_anomalies/detection.py":97 * rbox = cast(t.Box, cv2.minAreaRect(c)) * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) # <<<<<<<<<<<<<< @@ -6534,14 +6635,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6558,21 +6659,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_box}; - __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_1, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 96, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_1, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_DECREF_SET(__pyx_v_box, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":97 + /* "dopt_sensor_anomalies/detection.py":98 * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) # <<<<<<<<<<<<<< @@ -6580,26 +6681,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * (tl, tr, br, bl) = box */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_order_points); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_order_points); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6619,7 +6720,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); } __pyx_t_5 = 1; @@ -6641,18 +6742,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_DECREF_SET(__pyx_v_box, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":99 + /* "dopt_sensor_anomalies/detection.py":100 * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) * * (tl, tr, br, bl) = box # <<<<<<<<<<<<<< - * (tltrX, tltrY) = midpoint(tl, tr) - * (blbrX, blbrY) = midpoint(bl, br) + * + * widthA = np.linalg.norm(br - bl) */ if ((likely(PyTuple_CheckExact(__pyx_v_box))) || (PyList_CheckExact(__pyx_v_box))) { PyObject* sequence = __pyx_v_box; @@ -6660,7 +6761,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 99, __pyx_L1_error) + __PYX_ERR(0, 100, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6674,16 +6775,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_1); } else { __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_11); __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); } #else @@ -6691,7 +6792,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_11,&__pyx_t_9,&__pyx_t_16,&__pyx_t_1}; for (i=0; i < 4; i++) { - PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 99, __pyx_L1_error) + PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -6700,7 +6801,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT } else { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_11,&__pyx_t_9,&__pyx_t_16,&__pyx_t_1}; - __pyx_t_8 = PyObject_GetIter(__pyx_v_box); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_v_box); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); for (index=0; index < 4; index++) { @@ -6708,7 +6809,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 4) < (0)) __PYX_ERR(0, 99, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 4) < (0)) __PYX_ERR(0, 100, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L20_unpacking_done; @@ -6716,7 +6817,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 99, __pyx_L1_error) + __PYX_ERR(0, 100, __pyx_L1_error) __pyx_L20_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tl, __pyx_t_11); @@ -6728,520 +6829,246 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_bl, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":100 - * - * (tl, tr, br, bl) = box - * (tltrX, tltrY) = midpoint(tl, tr) # <<<<<<<<<<<<<< - * (blbrX, blbrY) = midpoint(bl, br) - * (tlblX, tlblY) = midpoint(tl, bl) -*/ - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9); - assert(__pyx_t_16); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); - __pyx_t_5 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_v_tl, __pyx_v_tr}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 100, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __Pyx_INCREF(__pyx_t_9); - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_16); - } else { - __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_16); - } - #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); - index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L22_unpacking_done; - __pyx_L21_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_L22_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_tltrX, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_tltrY, __pyx_t_16); - __pyx_t_16 = 0; - - /* "dopt_sensor_anomalies/detection.py":101 - * (tl, tr, br, bl) = box - * (tltrX, tltrY) = midpoint(tl, tr) - * (blbrX, blbrY) = midpoint(bl, br) # <<<<<<<<<<<<<< - * (tlblX, tlblY) = midpoint(tl, bl) - * (trbrX, trbrY) = midpoint(tr, br) -*/ - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9); - assert(__pyx_t_16); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); - __pyx_t_5 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_v_bl, __pyx_v_br}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 101, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __Pyx_INCREF(__pyx_t_9); - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_16); - } else { - __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_16); - } - #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); - index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L23_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L23_unpacking_failed; - __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 101, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L24_unpacking_done; - __pyx_L23_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 101, __pyx_L1_error) - __pyx_L24_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_blbrX, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_blbrY, __pyx_t_16); - __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":102 - * (tltrX, tltrY) = midpoint(tl, tr) - * (blbrX, blbrY) = midpoint(bl, br) - * (tlblX, tlblY) = midpoint(tl, bl) # <<<<<<<<<<<<<< - * (trbrX, trbrY) = midpoint(tr, br) + * (tl, tr, br, bl) = box * + * widthA = np.linalg.norm(br - bl) # <<<<<<<<<<<<<< + * widthB = np.linalg.norm(tr - tl) + * max_width = int(max(widthA, widthB)) */ - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9); - assert(__pyx_t_16); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); - __pyx_t_5 = 0; - } - #endif + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_16 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_16); + __pyx_t_9 = PyNumber_Subtract(__pyx_v_br, __pyx_v_bl); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = 0; { - PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_v_tl, __pyx_v_bl}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_norm, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 102, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __Pyx_INCREF(__pyx_t_9); - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_16); - } else { - __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_16); - } - #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); - index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L25_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L25_unpacking_failed; - __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L26_unpacking_done; - __pyx_L25_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_L26_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_tlblX, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_tlblY, __pyx_t_16); - __pyx_t_16 = 0; + __Pyx_XDECREF_SET(__pyx_v_widthA, __pyx_t_1); + __pyx_t_1 = 0; /* "dopt_sensor_anomalies/detection.py":103 - * (blbrX, blbrY) = midpoint(bl, br) - * (tlblX, tlblY) = midpoint(tl, bl) - * (trbrX, trbrY) = midpoint(tr, br) # <<<<<<<<<<<<<< * - * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) + * widthA = np.linalg.norm(br - bl) + * widthB = np.linalg.norm(tr - tl) # <<<<<<<<<<<<<< + * max_width = int(max(widthA, widthB)) + * */ - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9); - assert(__pyx_t_16); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); - __pyx_t_5 = 0; - } - #endif + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = __pyx_t_16; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_9 = PyNumber_Subtract(__pyx_v_tr, __pyx_v_tl); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = 0; { - PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_v_tr, __pyx_v_br}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_norm, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 103, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __Pyx_INCREF(__pyx_t_9); - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_16); - } else { - __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_16); - } - #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); - index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L27_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L27_unpacking_failed; - __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L28_unpacking_done; - __pyx_L27_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 103, __pyx_L1_error) - __pyx_L28_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_trbrX, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_trbrY, __pyx_t_16); - __pyx_t_16 = 0; + __Pyx_XDECREF_SET(__pyx_v_widthB, __pyx_t_1); + __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":105 - * (trbrX, trbrY) = midpoint(tr, br) - * - * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) # <<<<<<<<<<<<<< - * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) + /* "dopt_sensor_anomalies/detection.py":104 + * widthA = np.linalg.norm(br - bl) + * widthB = np.linalg.norm(tr - tl) + * max_width = int(max(widthA, widthB)) # <<<<<<<<<<<<<< * + * heightA = np.linalg.norm(tr - br) */ - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_tltrX); - __Pyx_GIVEREF(__pyx_v_tltrX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_tltrX) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_tltrY); - __Pyx_GIVEREF(__pyx_v_tltrY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_tltrY) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_blbrX); - __Pyx_GIVEREF(__pyx_v_blbrX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_blbrX) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_blbrY); - __Pyx_GIVEREF(__pyx_v_blbrY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_blbrY) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_11); - assert(__pyx_t_16); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_v_widthB); + __pyx_t_1 = __pyx_v_widthB; + __Pyx_INCREF(__pyx_v_widthA); + __pyx_t_16 = __pyx_v_widthA; + __pyx_t_11 = PyObject_RichCompare(__pyx_t_1, __pyx_t_16, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_14) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_9 = __pyx_t_1; + } else { __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); - __pyx_t_5 = 0; + __pyx_t_9 = __pyx_t_16; } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_t_9, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_dA, __pyx_t_1); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_max_width, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; /* "dopt_sensor_anomalies/detection.py":106 + * max_width = int(max(widthA, widthB)) * - * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) - * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) # <<<<<<<<<<<<<< - * - * if dA < 100 or dB < 100: + * heightA = np.linalg.norm(tr - br) # <<<<<<<<<<<<<< + * heightB = np.linalg.norm(tl - bl) + * max_height = int(max(heightA, heightB)) */ - __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_tlblX); - __Pyx_GIVEREF(__pyx_v_tlblX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_tlblX) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_tlblY); - __Pyx_GIVEREF(__pyx_v_tlblY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_tlblY) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(__pyx_v_trbrX); - __Pyx_GIVEREF(__pyx_v_trbrX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_trbrX) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_trbrY); - __Pyx_GIVEREF(__pyx_v_trbrY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_trbrY) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); - assert(__pyx_t_11); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); - __pyx_t_5 = 0; - } - #endif + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_9 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_16 = PyNumber_Subtract(__pyx_v_tr, __pyx_v_br); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_5 = 0; { - PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_16}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_16}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_norm, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF_SET(__pyx_v_dB, __pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_heightA, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dopt_sensor_anomalies/detection.py":107 + * + * heightA = np.linalg.norm(tr - br) + * heightB = np.linalg.norm(tl - bl) # <<<<<<<<<<<<<< + * max_height = int(max(heightA, heightB)) + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_11 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_16 = PyNumber_Subtract(__pyx_v_tl, __pyx_v_bl); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_16}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_norm, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_heightB, __pyx_t_1); __pyx_t_1 = 0; /* "dopt_sensor_anomalies/detection.py":108 - * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) + * heightA = np.linalg.norm(tr - br) + * heightB = np.linalg.norm(tl - bl) + * max_height = int(max(heightA, heightB)) # <<<<<<<<<<<<<< * - * if dA < 100 or dB < 100: # <<<<<<<<<<<<<< + * if max_width < 100 or max_height < 100: +*/ + __Pyx_INCREF(__pyx_v_heightB); + __pyx_t_1 = __pyx_v_heightB; + __Pyx_INCREF(__pyx_v_heightA); + __pyx_t_9 = __pyx_v_heightA; + __pyx_t_11 = PyObject_RichCompare(__pyx_t_1, __pyx_t_9, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_14) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_16 = __pyx_t_1; + } else { + __Pyx_INCREF(__pyx_t_9); + __pyx_t_16 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF_SET(__pyx_v_max_height, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dopt_sensor_anomalies/detection.py":110 + * max_height = int(max(heightA, heightB)) + * + * if max_width < 100 or max_height < 100: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dA, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_width, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_6) { } else { __pyx_t_14 = __pyx_t_6; - goto __pyx_L30_bool_binop_done; + goto __pyx_L22_bool_binop_done; } - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dB, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_height, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_t_6; - __pyx_L30_bool_binop_done:; + __pyx_L22_bool_binop_done:; if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":109 + /* "dopt_sensor_anomalies/detection.py":111 * - * if dA < 100 or dB < 100: + * if max_width < 100 or max_height < 100: * continue # <<<<<<<<<<<<<< * * is_duplicate = any( */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":108 - * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) + /* "dopt_sensor_anomalies/detection.py":110 + * max_height = int(max(heightA, heightB)) * - * if dA < 100 or dB < 100: # <<<<<<<<<<<<<< + * if max_width < 100 or max_height < 100: # <<<<<<<<<<<<<< * continue * */ } - /* "dopt_sensor_anomalies/detection.py":112 + /* "dopt_sensor_anomalies/detection.py":114 * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< * ) * if is_duplicate: */ - __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_accepted_boxes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_accepted_boxes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_is_duplicate, __pyx_t_9); - __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_is_duplicate, __pyx_t_16); + __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":114 + /* "dopt_sensor_anomalies/detection.py":116 * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) * if is_duplicate: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 116, __pyx_L1_error) if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":115 + /* "dopt_sensor_anomalies/detection.py":117 * ) * if is_duplicate: * continue # <<<<<<<<<<<<<< @@ -7250,7 +7077,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":114 + /* "dopt_sensor_anomalies/detection.py":116 * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) * if is_duplicate: # <<<<<<<<<<<<<< @@ -7259,115 +7086,577 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":117 + /* "dopt_sensor_anomalies/detection.py":119 * continue * * accepted_boxes.append(rbox) # <<<<<<<<<<<<<< * filtered_cnts.append(c) * */ - __pyx_t_9 = __pyx_cur_scope->__pyx_v_rbox; - __Pyx_INCREF(__pyx_t_9); - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_accepted_boxes, __pyx_t_9); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_16 = __pyx_cur_scope->__pyx_v_rbox; + __Pyx_INCREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_accepted_boxes, __pyx_t_16); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":118 + /* "dopt_sensor_anomalies/detection.py":120 * * accepted_boxes.append(rbox) * filtered_cnts.append(c) # <<<<<<<<<<<<<< * - * dimA = dA / pixels_per_metric_Y + * dimA = max_width / pixels_per_metric_Y */ - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_filtered_cnts, __pyx_v_c); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_filtered_cnts, __pyx_v_c); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 120, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":120 + /* "dopt_sensor_anomalies/detection.py":122 * filtered_cnts.append(c) * - * dimA = dA / pixels_per_metric_Y # <<<<<<<<<<<<<< - * dimB = dB / pixels_per_metric_X + * dimA = max_width / pixels_per_metric_Y # <<<<<<<<<<<<<< + * dimB = max_height / pixels_per_metric_X * */ - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_dimA, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dopt_sensor_anomalies/detection.py":121 - * - * dimA = dA / pixels_per_metric_Y - * dimB = dB / pixels_per_metric_X # <<<<<<<<<<<<<< - * - * data_csv.extend( -*/ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_v_dB, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_dimB, __pyx_t_9); - __pyx_t_9 = 0; - - /* "dopt_sensor_anomalies/detection.py":125 - * data_csv.extend( - * [ - * f"{dimB:.3f}".replace(".", ","), # <<<<<<<<<<<<<< - * f"{dimA:.3f}".replace(".", ","), - * f"{dimA * dimB:.1f}".replace(".", ","), -*/ - __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimB, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "dopt_sensor_anomalies/detection.py":126 - * [ - * f"{dimB:.3f}".replace(".", ","), - * f"{dimA:.3f}".replace(".", ","), # <<<<<<<<<<<<<< - * f"{dimA * dimB:.1f}".replace(".", ","), - * ] -*/ - __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimA, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_16 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "dopt_sensor_anomalies/detection.py":127 - * f"{dimB:.3f}".replace(".", ","), - * f"{dimA:.3f}".replace(".", ","), - * f"{dimA * dimB:.1f}".replace(".", ","), # <<<<<<<<<<<<<< - * ] - * ) -*/ - __pyx_t_9 = PyNumber_Multiply(__pyx_v_dimA, __pyx_v_dimB); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyUnicode_Replace(((PyObject*)__pyx_t_8), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_max_width, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_18 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_dimA = __pyx_t_18; /* "dopt_sensor_anomalies/detection.py":123 - * dimB = dB / pixels_per_metric_X * - * data_csv.extend( # <<<<<<<<<<<<<< - * [ - * f"{dimB:.3f}".replace(".", ","), + * dimA = max_width / pixels_per_metric_Y + * dimB = max_height / pixels_per_metric_X # <<<<<<<<<<<<<< + * + * offset = 20 */ - __pyx_t_17 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) - __pyx_t_18 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_16); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) - __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_data_csv, __pyx_t_9); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_v_max_height, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - (void)((__pyx_t_17 | (__pyx_t_18 | __pyx_t_19))); + __pyx_t_18 = __Pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_v_dimB = __pyx_t_18; - /* "dopt_sensor_anomalies/detection.py":93 + /* "dopt_sensor_anomalies/detection.py":125 + * dimB = max_height / pixels_per_metric_X + * + * offset = 20 # <<<<<<<<<<<<<< + * + * dst = np.array( +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_20); + __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_mstate_global->__pyx_int_20); + + /* "dopt_sensor_anomalies/detection.py":127 + * offset = 20 + * + * dst = np.array( # <<<<<<<<<<<<<< + * [ + * [offset, offset], +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "dopt_sensor_anomalies/detection.py":129 + * dst = np.array( + * [ + * [offset, offset], # <<<<<<<<<<<<<< + * [max_width - 1 + offset, offset], + * [max_width - 1 + offset, max_height - 1 + offset], +*/ + __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_offset) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_v_offset) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + + /* "dopt_sensor_anomalies/detection.py":130 + * [ + * [offset, offset], + * [max_width - 1 + offset, offset], # <<<<<<<<<<<<<< + * [max_width - 1 + offset, max_height - 1 + offset], + * [offset, max_height - 1 + offset], +*/ + __pyx_t_8 = __Pyx_PyLong_SubtractObjC(__pyx_v_max_width, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PyNumber_Add(__pyx_t_8, __pyx_v_offset); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_15); + if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_15) != (0)) __PYX_ERR(0, 130, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_offset) != (0)) __PYX_ERR(0, 130, __pyx_L1_error); + __pyx_t_15 = 0; + + /* "dopt_sensor_anomalies/detection.py":131 + * [offset, offset], + * [max_width - 1 + offset, offset], + * [max_width - 1 + offset, max_height - 1 + offset], # <<<<<<<<<<<<<< + * [offset, max_height - 1 + offset], + * ], +*/ + __pyx_t_15 = __Pyx_PyLong_SubtractObjC(__pyx_v_max_width, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = PyNumber_Add(__pyx_t_15, __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyLong_SubtractObjC(__pyx_v_max_height, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_4 = PyNumber_Add(__pyx_t_15, __pyx_v_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyList_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 131, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 131, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + + /* "dopt_sensor_anomalies/detection.py":132 + * [max_width - 1 + offset, offset], + * [max_width - 1 + offset, max_height - 1 + offset], + * [offset, max_height - 1 + offset], # <<<<<<<<<<<<<< + * ], + * dtype="float32", +*/ + __pyx_t_4 = __Pyx_PyLong_SubtractObjC(__pyx_v_max_height, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_offset) != (0)) __PYX_ERR(0, 132, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 132, __pyx_L1_error); + __pyx_t_3 = 0; + + /* "dopt_sensor_anomalies/detection.py":128 + * + * dst = np.array( + * [ # <<<<<<<<<<<<<< + * [offset, offset], + * [max_width - 1 + offset, offset], +*/ + __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_15); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_15) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_15 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_3}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_float32, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_16 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + } + __Pyx_XDECREF_SET(__pyx_v_dst, __pyx_t_16); + __pyx_t_16 = 0; + + /* "dopt_sensor_anomalies/detection.py":137 + * ) + * + * M = cv2.getPerspectiveTransform(box, dst) # <<<<<<<<<<<<<< + * warped = cv2.warpPerspective( + * orig, M, (max_width + 2 * offset, max_height + 2 * offset) +*/ + __pyx_t_11 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_getPerspectiveTransform); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_11); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_box, __pyx_v_dst}; + __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + } + __Pyx_XDECREF_SET(__pyx_v_M, __pyx_t_16); + __pyx_t_16 = 0; + + /* "dopt_sensor_anomalies/detection.py":138 + * + * M = cv2.getPerspectiveTransform(box, dst) + * warped = cv2.warpPerspective( # <<<<<<<<<<<<<< + * orig, M, (max_width + 2 * offset, max_height + 2 * offset) + * ) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_warpPerspective); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "dopt_sensor_anomalies/detection.py":139 + * M = cv2.getPerspectiveTransform(box, dst) + * warped = cv2.warpPerspective( + * orig, M, (max_width + 2 * offset, max_height + 2 * offset) # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_11 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_offset, 2, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyNumber_Add(__pyx_v_max_width, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_offset, 2, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_15 = PyNumber_Add(__pyx_v_max_height, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 139, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_15); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_15) != (0)) __PYX_ERR(0, 139, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_15 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_orig, __pyx_v_M, __pyx_t_11}; + __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + } + __Pyx_XDECREF_SET(__pyx_v_warped, __pyx_t_16); + __pyx_t_16 = 0; + + /* "dopt_sensor_anomalies/detection.py":142 + * ) + * + * gray_warped = cv2.cvtColor(warped, cv2.COLOR_BGR2GRAY) # <<<<<<<<<<<<<< + * _, binary_warped = cv2.threshold(gray_warped, 80, 255, cv2.THRESH_BINARY) + * pixel_count = np.sum(binary_warped == 0) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2GRAY); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_warped, __pyx_t_15}; + __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + } + __Pyx_XDECREF_SET(__pyx_v_gray_warped, __pyx_t_16); + __pyx_t_16 = 0; + + /* "dopt_sensor_anomalies/detection.py":143 + * + * gray_warped = cv2.cvtColor(warped, cv2.COLOR_BGR2GRAY) + * _, binary_warped = cv2.threshold(gray_warped, 80, 255, cv2.THRESH_BINARY) # <<<<<<<<<<<<<< + * pixel_count = np.sum(binary_warped == 0) + * +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_threshold); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_THRESH_BINARY); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_gray_warped, __pyx_mstate_global->__pyx_int_80, __pyx_mstate_global->__pyx_int_255, __pyx_t_11}; + __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + } + if ((likely(PyTuple_CheckExact(__pyx_t_16))) || (PyList_CheckExact(__pyx_t_16))) { + PyObject* sequence = __pyx_t_16; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 143, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); + index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_11 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_11)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L26_unpacking_done; + __pyx_L25_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_L26_unpacking_done:; + } + __Pyx_DECREF_SET(__pyx_v__, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_binary_warped, __pyx_t_11); + __pyx_t_11 = 0; + + /* "dopt_sensor_anomalies/detection.py":144 + * gray_warped = cv2.cvtColor(warped, cv2.COLOR_BGR2GRAY) + * _, binary_warped = cv2.threshold(gray_warped, 80, 255, cv2.THRESH_BINARY) + * pixel_count = np.sum(binary_warped == 0) # <<<<<<<<<<<<<< + * + * sensor_sizes.append( +*/ + __pyx_t_11 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyLong_EqObjC(__pyx_v_binary_warped, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_11); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_4}; + __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + } + __Pyx_XDECREF_SET(__pyx_v_pixel_count, __pyx_t_16); + __pyx_t_16 = 0; + + /* "dopt_sensor_anomalies/detection.py":148 + * sensor_sizes.append( + * ( + * f"{dimA:.3f}".replace(".", ","), # <<<<<<<<<<<<<< + * f"{dimB:.3f}".replace(".", ","), + * f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace( +*/ + __pyx_t_16 = PyFloat_FromDouble(__pyx_v_dimA); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_16, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = PyUnicode_Replace(((PyObject*)__pyx_t_3), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dopt_sensor_anomalies/detection.py":149 + * ( + * f"{dimA:.3f}".replace(".", ","), + * f"{dimB:.3f}".replace(".", ","), # <<<<<<<<<<<<<< + * f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace( + * ".", "," +*/ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dimB); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyUnicode_Replace(((PyObject*)__pyx_t_4), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dopt_sensor_anomalies/detection.py":150 + * f"{dimA:.3f}".replace(".", ","), + * f"{dimB:.3f}".replace(".", ","), + * f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace( # <<<<<<<<<<<<<< + * ".", "," + * ), +*/ + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_pixel_count, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_15, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyUnicode_Replace(((PyObject*)__pyx_t_4), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dopt_sensor_anomalies/detection.py":148 + * sensor_sizes.append( + * ( + * f"{dimA:.3f}".replace(".", ","), # <<<<<<<<<<<<<< + * f"{dimB:.3f}".replace(".", ","), + * f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace( +*/ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_16); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16) != (0)) __PYX_ERR(0, 148, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 148, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_15); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_15) != (0)) __PYX_ERR(0, 148, __pyx_L1_error); + __pyx_t_16 = 0; + __pyx_t_3 = 0; + __pyx_t_15 = 0; + + /* "dopt_sensor_anomalies/detection.py":146 + * pixel_count = np.sum(binary_warped == 0) + * + * sensor_sizes.append( # <<<<<<<<<<<<<< + * ( + * f"{dimA:.3f}".replace(".", ","), +*/ + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_sensor_sizes, __pyx_t_4); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dopt_sensor_anomalies/detection.py":94 * filtered_cnts: list[Any] = [] * * for c in cnts: # <<<<<<<<<<<<<< @@ -7378,7 +7667,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":131 + /* "dopt_sensor_anomalies/detection.py":156 * ) * * if not filtered_cnts: # pragma: no cover # <<<<<<<<<<<<<< @@ -7387,51 +7676,51 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); - if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 131, __pyx_L1_error) + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 156, __pyx_L1_error) __pyx_t_14 = (__pyx_temp != 0); } __pyx_t_6 = (!__pyx_t_14); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":132 + /* "dopt_sensor_anomalies/detection.py":157 * * if not filtered_cnts: # pragma: no cover * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< * "Contour detection not valid: no contours recognized" * ) */ - __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9); - assert(__pyx_t_1); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_1); + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Contour_detection_not_valid_no_c}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Contour_detection_not_valid_no_c}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 132, __pyx_L1_error) + __PYX_ERR(0, 157, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":131 + /* "dopt_sensor_anomalies/detection.py":156 * ) * * if not filtered_cnts: # pragma: no cover # <<<<<<<<<<<<<< @@ -7440,111 +7729,111 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":136 + /* "dopt_sensor_anomalies/detection.py":161 * ) * * num_contours = len(filtered_cnts) # <<<<<<<<<<<<<< * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover * raise errors.InvalidElectrodeCount( */ - __pyx_t_12 = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 161, __pyx_L1_error) __pyx_v_num_contours = __pyx_t_12; - /* "dopt_sensor_anomalies/detection.py":137 + /* "dopt_sensor_anomalies/detection.py":162 * * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " */ - __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":138 + /* "dopt_sensor_anomalies/detection.py":163 * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover * raise errors.InvalidElectrodeCount( # <<<<<<<<<<<<<< * f"Number of counted electrodes does not match the " * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" */ - __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InvalidElectrodeCount); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InvalidElectrodeCount); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":140 + /* "dopt_sensor_anomalies/detection.py":165 * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_num_contours, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_num_contours, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_Number_of_counted_electrodes_doe; - __pyx_t_20[1] = __pyx_t_2; - __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_expected; - __pyx_t_20[3] = __pyx_t_8; + __pyx_t_19[0] = __pyx_mstate_global->__pyx_kp_u_Number_of_counted_electrodes_doe; + __pyx_t_19[1] = __pyx_t_2; + __pyx_t_19[2] = __pyx_mstate_global->__pyx_kp_u_expected; + __pyx_t_19[3] = __pyx_t_16; - /* "dopt_sensor_anomalies/detection.py":139 + /* "dopt_sensor_anomalies/detection.py":164 * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " # <<<<<<<<<<<<<< * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" * ) */ - __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_20, 4, 72 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8)); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_19, 4, 72 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16)); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_16))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16); - assert(__pyx_t_1); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16); - __Pyx_INCREF(__pyx_t_1); + if (unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_16, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_15, __pyx__function); __pyx_t_5 = 0; } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_11}; - __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_11}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 163, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":137 + /* "dopt_sensor_anomalies/detection.py":162 * * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover # <<<<<<<<<<<<<< @@ -7553,209 +7842,209 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":143 + /* "dopt_sensor_anomalies/detection.py":168 * ) * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) */ - __pyx_t_21 = 0; - __pyx_t_16 = NULL; - __pyx_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_20 = 0; + __pyx_t_15 = NULL; + __pyx_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_t_11}; - __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_11}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_11 = __Pyx_PyLong_SubtractObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_SubtractObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_16 = __Pyx_PyLong_From_long(__pyx_t_21); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_16, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_15 = __Pyx_PyLong_From_long(__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_15, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_t_21); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyLong_From_long(__pyx_t_20); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; } else { __Pyx_INCREF(__pyx_t_11); - __pyx_t_9 = __pyx_t_11; + __pyx_t_3 = __pyx_t_11; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __pyx_t_9; + __pyx_t_11 = __pyx_t_3; __Pyx_INCREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_x_min = __pyx_t_11; __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":144 + /* "dopt_sensor_anomalies/detection.py":169 * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) # <<<<<<<<<<<<<< * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) */ - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_orig, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_orig, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_1 = NULL; - __pyx_t_16 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + __pyx_t_4 = NULL; + __pyx_t_15 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_16}; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_15}; __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } - __pyx_t_16 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + __pyx_t_15 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_9, __pyx_t_16, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_9); - __pyx_t_11 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_11 = __pyx_t_3; } else { - __Pyx_INCREF(__pyx_t_16); - __pyx_t_11 = __pyx_t_16; + __Pyx_INCREF(__pyx_t_15); + __pyx_t_11 = __pyx_t_15; } - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __pyx_t_11; - __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_v_x_max = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_x_max = __pyx_t_3; + __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":145 + /* "dopt_sensor_anomalies/detection.py":170 * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) * */ - __pyx_t_21 = 0; + __pyx_t_20 = 0; __pyx_t_11 = NULL; - __pyx_t_16 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + __pyx_t_15 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_16}; - __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_15}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_16 = __Pyx_PyLong_SubtractObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_11 = __Pyx_PyLong_From_long(__pyx_t_21); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyLong_SubtractObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_11 = __Pyx_PyLong_From_long(__pyx_t_20); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_11, __pyx_t_16, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_11, __pyx_t_15, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_t_21); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyLong_From_long(__pyx_t_20); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; } else { - __Pyx_INCREF(__pyx_t_16); - __pyx_t_9 = __pyx_t_16; + __Pyx_INCREF(__pyx_t_15); + __pyx_t_3 = __pyx_t_15; } - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = __pyx_t_9; - __Pyx_INCREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_y_min = __pyx_t_16; - __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_y_min = __pyx_t_15; + __pyx_t_15 = 0; - /* "dopt_sensor_anomalies/detection.py":146 + /* "dopt_sensor_anomalies/detection.py":171 * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) # <<<<<<<<<<<<<< * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) */ - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_orig, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_1 = NULL; - __pyx_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_orig, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_15, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_4 = NULL; + __pyx_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_11}; - __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_11}; + __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); } - __pyx_t_11 = __Pyx_PyLong_AddObjC(__pyx_t_16, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_AddObjC(__pyx_t_15, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_11, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_9); - __pyx_t_16 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_15 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_11); - __pyx_t_16 = __pyx_t_11; + __pyx_t_15 = __pyx_t_11; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __pyx_t_16; - __Pyx_INCREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_v_y_max = __pyx_t_9; - __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_15; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_v_y_max = __pyx_t_3; + __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":148 + /* "dopt_sensor_anomalies/detection.py":173 * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) # <<<<<<<<<<<<<< * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) */ - __pyx_t_16 = NULL; - __pyx_t_11 = __Pyx_PyObject_GetItem(__Pyx_PyList_GET_ITEM(__pyx_v_filtered_cnts, 2), __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_15 = NULL; + __pyx_t_11 = __Pyx_PyObject_GetItem(__Pyx_PyList_GET_ITEM(__pyx_v_filtered_cnts, 2), __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_t_11}; - __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_11}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __pyx_v_rightmost_x_third = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_rightmost_x_third = __pyx_t_3; + __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":149 + /* "dopt_sensor_anomalies/detection.py":174 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7763,143 +8052,281 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * */ __pyx_t_11 = NULL; - __pyx_t_16 = __Pyx_PyObject_GetItem(__Pyx_PyList_GET_ITEM(__pyx_v_filtered_cnts, 3), __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + __pyx_t_15 = __Pyx_PyObject_GetItem(__Pyx_PyList_GET_ITEM(__pyx_v_filtered_cnts, 3), __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_16}; - __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_15}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __pyx_v_leftmost_x_fourth = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_leftmost_x_fourth = __pyx_t_3; + __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":150 + /* "dopt_sensor_anomalies/detection.py":175 * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) # <<<<<<<<<<<<<< * * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] */ - __pyx_t_9 = PyNumber_Subtract(__pyx_v_leftmost_x_fourth, __pyx_v_rightmost_x_third); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_9, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyNumber_Add(__pyx_v_rightmost_x_third, __pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_x_middle = __pyx_t_16; - __pyx_t_16 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_v_leftmost_x_fourth, __pyx_v_rightmost_x_third); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Add(__pyx_v_rightmost_x_third, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_x_middle = __pyx_t_15; + __pyx_t_15 = 0; - /* "dopt_sensor_anomalies/detection.py":152 + /* "dopt_sensor_anomalies/detection.py":177 * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) * * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] # <<<<<<<<<<<<<< * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] * */ - __pyx_t_16 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_9 = PySlice_New(__pyx_v_x_min, __pyx_v_x_middle, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_15 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = PySlice_New(__pyx_v_x_min, __pyx_v_x_middle, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_16); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_16) != (0)) __PYX_ERR(0, 152, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 152, __pyx_L1_error); - __pyx_t_16 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_15); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15) != (0)) __PYX_ERR(0, 177, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 177, __pyx_L1_error); + __pyx_t_15 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_v_cropped_sensor_left = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_cropped_sensor_left = __pyx_t_3; + __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":153 + /* "dopt_sensor_anomalies/detection.py":178 * * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] # <<<<<<<<<<<<<< * - * return data_csv, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) + * sensor_sizes_sorted = cast( */ - __pyx_t_9 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = PySlice_New(__pyx_v_x_middle, __pyx_v_x_max, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_3 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = PySlice_New(__pyx_v_x_middle, __pyx_v_x_max, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 153, __pyx_L1_error); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 178, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_11); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 153, __pyx_L1_error); - __pyx_t_9 = 0; + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 178, __pyx_L1_error); + __pyx_t_3 = 0; __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_16); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_v_cropped_sensor_right = __pyx_t_11; __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":155 + /* "dopt_sensor_anomalies/detection.py":180 * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] * - * return data_csv, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) # <<<<<<<<<<<<<< - * - * + * sensor_sizes_sorted = cast( # <<<<<<<<<<<<<< + * tuple[str, ...], + * tuple(flatten(reversed(sensor_sizes))), # type: ignore */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_SensorImages); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_15 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "dopt_sensor_anomalies/detection.py":181 + * + * sensor_sizes_sorted = cast( + * tuple[str, ...], # <<<<<<<<<<<<<< + * tuple(flatten(reversed(sensor_sizes))), # type: ignore + * ) +*/ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF((PyObject *)(&PyUnicode_Type)); + __Pyx_GIVEREF((PyObject *)(&PyUnicode_Type)); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type))) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); + __Pyx_INCREF(Py_Ellipsis); + __Pyx_GIVEREF(Py_Ellipsis); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, Py_Ellipsis) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); + __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)(&PyTuple_Type)), __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dopt_sensor_anomalies/detection.py":182 + * sensor_sizes_sorted = cast( + * tuple[str, ...], + * tuple(flatten(reversed(sensor_sizes))), # type: ignore # <<<<<<<<<<<<<< + * ) + * export_data: t.ExportData = t.ExportData(sensor_sizes=sensor_sizes_sorted) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_flatten); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_sensor_sizes}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_reversed, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_1); - assert(__pyx_t_16); + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); __pyx_t_5 = 0; } #endif { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_16, NULL}; - __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_left, __pyx_v_cropped_sensor_left, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_right, __pyx_v_cropped_sensor_right, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) - __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 155, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_15); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_1}; + __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_data_csv); - __Pyx_GIVEREF(__pyx_v_data_csv); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 155, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_11); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 155, __pyx_L1_error); + __pyx_v_sensor_sizes_sorted = __pyx_t_11; __pyx_t_11 = 0; - __pyx_r = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + + /* "dopt_sensor_anomalies/detection.py":184 + * tuple(flatten(reversed(sensor_sizes))), # type: ignore + * ) + * export_data: t.ExportData = t.ExportData(sensor_sizes=sensor_sizes_sorted) # <<<<<<<<<<<<<< + * + * return export_data, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ExportData); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_16, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sensor_sizes, __pyx_v_sensor_sizes_sorted, __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_v_export_data = __pyx_t_11; + __pyx_t_11 = 0; + + /* "dopt_sensor_anomalies/detection.py":186 + * export_data: t.ExportData = t.ExportData(sensor_sizes=sensor_sizes_sorted) + * + * return export_data, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_16 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_SensorImages); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_16); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_16, NULL}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_left, __pyx_v_cropped_sensor_left, __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_right, __pyx_v_cropped_sensor_right, __pyx_t_1, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_export_data); + __Pyx_GIVEREF(__pyx_v_export_data); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_export_data) != (0)) __PYX_ERR(0, 186, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 186, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":55 + /* "dopt_sensor_anomalies/detection.py":56 * * * def measure_length( # <<<<<<<<<<<<<< @@ -7921,7 +8348,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_AddTraceback("dopt_sensor_anomalies.detection.measure_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_data_csv); + __Pyx_XDECREF(__pyx_v_sensor_sizes); __Pyx_XDECREF(__pyx_v_image); __Pyx_XDECREF(__pyx_v_cropped); __Pyx_XDECREF(__pyx_v_orig); @@ -7942,19 +8369,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_v_tr); __Pyx_XDECREF(__pyx_v_br); __Pyx_XDECREF(__pyx_v_bl); - __Pyx_XDECREF(__pyx_v_tltrX); - __Pyx_XDECREF(__pyx_v_tltrY); - __Pyx_XDECREF(__pyx_v_blbrX); - __Pyx_XDECREF(__pyx_v_blbrY); - __Pyx_XDECREF(__pyx_v_tlblX); - __Pyx_XDECREF(__pyx_v_tlblY); - __Pyx_XDECREF(__pyx_v_trbrX); - __Pyx_XDECREF(__pyx_v_trbrY); - __Pyx_XDECREF(__pyx_v_dA); - __Pyx_XDECREF(__pyx_v_dB); + __Pyx_XDECREF(__pyx_v_widthA); + __Pyx_XDECREF(__pyx_v_widthB); + __Pyx_XDECREF(__pyx_v_max_width); + __Pyx_XDECREF(__pyx_v_heightA); + __Pyx_XDECREF(__pyx_v_heightB); + __Pyx_XDECREF(__pyx_v_max_height); __Pyx_XDECREF(__pyx_v_is_duplicate); - __Pyx_XDECREF(__pyx_v_dimA); - __Pyx_XDECREF(__pyx_v_dimB); + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XDECREF(__pyx_v_dst); + __Pyx_XDECREF(__pyx_v_M); + __Pyx_XDECREF(__pyx_v_warped); + __Pyx_XDECREF(__pyx_v_gray_warped); + __Pyx_XDECREF(__pyx_v_binary_warped); + __Pyx_XDECREF(__pyx_v_pixel_count); __Pyx_XDECREF(__pyx_v_x_min); __Pyx_XDECREF(__pyx_v_x_max); __Pyx_XDECREF(__pyx_v_y_min); @@ -7964,6 +8392,8 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_v_x_middle); __Pyx_XDECREF(__pyx_v_cropped_sensor_left); __Pyx_XDECREF(__pyx_v_cropped_sensor_right); + __Pyx_XDECREF(__pyx_v_sensor_sizes_sorted); + __Pyx_XDECREF(__pyx_v_export_data); __Pyx_XDECREF(__pyx_7genexpr__pyx_v_c); __Pyx_XDECREF(__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator); __Pyx_XDECREF(__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1); @@ -7977,7 +8407,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":158 +/* "dopt_sensor_anomalies/detection.py":189 * * * def infer_image( # <<<<<<<<<<<<<< @@ -8003,11 +8433,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds ) { PyObject *__pyx_v_image = 0; PyObject *__pyx_v_model = 0; + double __pyx_v_anomaly_threshold; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8023,41 +8454,48 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_image,&__pyx_mstate_global->__pyx_n_u_model,0}; + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_image,&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_anomaly_threshold,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 158, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 189, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 189, __pyx_L3_error) + CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 158, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 189, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 158, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 189, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "infer_image", 0) < (0)) __PYX_ERR(0, 158, __pyx_L3_error) - for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, i); __PYX_ERR(0, 158, __pyx_L3_error) } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "infer_image", 0) < (0)) __PYX_ERR(0, 189, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("infer_image", 1, 3, 3, i); __PYX_ERR(0, 189, __pyx_L3_error) } } - } else if (unlikely(__pyx_nargs != 2)) { + } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 158, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 189, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 158, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 189, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 189, __pyx_L3_error) } __pyx_v_image = values[0]; __pyx_v_model = values[1]; + __pyx_v_anomaly_threshold = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_anomaly_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 158, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("infer_image", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 189, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8068,7 +8506,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(__pyx_self, __pyx_v_image, __pyx_v_model); + __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(__pyx_self, __pyx_v_image, __pyx_v_model, __pyx_v_anomaly_threshold); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -8078,7 +8516,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, PyObject *__pyx_v_model) { +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, PyObject *__pyx_v_model, double __pyx_v_anomaly_threshold) { PyObject *__pyx_v_torch_device = NULL; PyObject *__pyx_v_image_rgb = NULL; PyObject *__pyx_v_pil_image = NULL; @@ -8113,22 +8551,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON int __pyx_clineno = 0; __Pyx_RefNannySetupContext("infer_image", 0); - /* "dopt_sensor_anomalies/detection.py":162 - * model: Patchcore, + /* "dopt_sensor_anomalies/detection.py":194 + * anomaly_threshold: float, * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # <<<<<<<<<<<<<< * model.to(torch_device) * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_device); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_device); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_cuda); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_cuda); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __pyx_t_8; @@ -8139,10 +8577,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_available, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_10) { __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cuda); @@ -8169,13 +8607,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_torch_device = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":163 + /* "dopt_sensor_anomalies/detection.py":195 * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") * model.to(torch_device) # <<<<<<<<<<<<<< @@ -8189,12 +8627,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_torch_device}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":165 + /* "dopt_sensor_anomalies/detection.py":197 * model.to(torch_device) * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # <<<<<<<<<<<<<< @@ -8202,14 +8640,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * pil_image = pil_image.convert("RGB") */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2RGB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2RGB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -8230,13 +8668,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image_rgb = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":166 + /* "dopt_sensor_anomalies/detection.py":198 * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) # <<<<<<<<<<<<<< @@ -8244,9 +8682,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * image_np = np.array(pil_image).astype(np.float32) / 255.0 */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_fromarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_fromarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -8266,13 +8704,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_pil_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":167 + /* "dopt_sensor_anomalies/detection.py":199 * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) * pil_image = pil_image.convert("RGB") # <<<<<<<<<<<<<< @@ -8286,13 +8724,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RGB}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_convert, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF_SET(__pyx_v_pil_image, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":168 + /* "dopt_sensor_anomalies/detection.py":200 * pil_image = Image.fromarray(image_rgb) * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 # <<<<<<<<<<<<<< @@ -8300,9 +8738,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -8322,14 +8760,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = 0; @@ -8339,16 +8777,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_255_0, 255.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_255_0, 255.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_image_np = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":169 + /* "dopt_sensor_anomalies/detection.py":201 * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) # <<<<<<<<<<<<<< @@ -8356,9 +8794,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * input_tensor = input_tensor.unsqueeze(0) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_from_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_from_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -8378,19 +8816,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_permute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_permute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_input_tensor = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":171 + /* "dopt_sensor_anomalies/detection.py":203 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) * * input_tensor = input_tensor.unsqueeze(0) # <<<<<<<<<<<<<< @@ -8404,13 +8842,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_int_0}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unsqueeze, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF_SET(__pyx_v_input_tensor, __pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":172 + /* "dopt_sensor_anomalies/detection.py":204 * * input_tensor = input_tensor.unsqueeze(0) * input_tensor = input_tensor.to(torch_device) # <<<<<<<<<<<<<< @@ -8424,13 +8862,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_torch_device}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF_SET(__pyx_v_input_tensor, __pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":174 + /* "dopt_sensor_anomalies/detection.py":206 * input_tensor = input_tensor.to(torch_device) * * model.eval() # <<<<<<<<<<<<<< @@ -8444,12 +8882,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":175 + /* "dopt_sensor_anomalies/detection.py":207 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8458,9 +8896,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON */ /*with:*/ { __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_no_grad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_no_grad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; @@ -8480,13 +8918,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_4 = NULL; - __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS @@ -8505,7 +8943,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L3_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -8520,7 +8958,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGOTREF(__pyx_t_14); /*try:*/ { - /* "dopt_sensor_anomalies/detection.py":176 + /* "dopt_sensor_anomalies/detection.py":208 * model.eval() * with torch.no_grad(): * output = model(input_tensor) # <<<<<<<<<<<<<< @@ -8547,13 +8985,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L7_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_output = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":175 + /* "dopt_sensor_anomalies/detection.py":207 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8576,20 +9014,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /*except:*/ { __Pyx_AddTraceback("dopt_sensor_anomalies.detection.infer_image", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 175, __pyx_L9_except_error) + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 207, __pyx_L9_except_error) __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L9_except_error) + __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 175, __pyx_L9_except_error) + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 207, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (__pyx_t_10 < (0)) __PYX_ERR(0, 175, __pyx_L9_except_error) + if (__pyx_t_10 < (0)) __PYX_ERR(0, 207, __pyx_L9_except_error) __pyx_t_16 = (!__pyx_t_10); if (unlikely(__pyx_t_16)) { __Pyx_GIVEREF(__pyx_t_2); @@ -8597,7 +9035,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_5); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 175, __pyx_L9_except_error) + __PYX_ERR(0, 207, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8623,7 +9061,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON if (__pyx_t_11) { __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[4], NULL); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } @@ -8638,15 +9076,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_L16:; } - /* "dopt_sensor_anomalies/detection.py":178 + /* "dopt_sensor_anomalies/detection.py":210 * output = model(input_tensor) * * anomaly_score = output.pred_score.item() # <<<<<<<<<<<<<< - * anomaly_label = bool(1 if anomaly_score >= const.ANOMALY_THRESHOLD else 0) + * anomaly_label = bool(1 if anomaly_score >= anomaly_threshold else 0) * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 178, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_score); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 210, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_score); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); @@ -8656,28 +9094,25 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_item, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_score = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":179 + /* "dopt_sensor_anomalies/detection.py":211 * * anomaly_score = output.pred_score.item() - * anomaly_label = bool(1 if anomaly_score >= const.ANOMALY_THRESHOLD else 0) # <<<<<<<<<<<<<< + * anomaly_label = bool(1 if anomaly_score >= anomaly_threshold else 0) # <<<<<<<<<<<<<< * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_anomaly_threshold); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ANOMALY_THRESHOLD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_anomaly_score, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_anomaly_score, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_16) { __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); __pyx_t_5 = __pyx_mstate_global->__pyx_int_1; @@ -8685,19 +9120,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __pyx_t_5 = __pyx_mstate_global->__pyx_int_0; } - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_anomaly_label = (!(!__pyx_t_16)); - /* "dopt_sensor_anomalies/detection.py":180 + /* "dopt_sensor_anomalies/detection.py":212 * anomaly_score = output.pred_score.item() - * anomaly_label = bool(1 if anomaly_score >= const.ANOMALY_THRESHOLD else 0) + * anomaly_label = bool(1 if anomaly_score >= anomaly_threshold else 0) * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() # <<<<<<<<<<<<<< * * img_np = np.array(pil_image) */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 180, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_anomaly_map); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) + if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 212, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_anomaly_map); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); @@ -8707,7 +9142,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_squeeze, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_4 = __pyx_t_8; @@ -8715,141 +9150,39 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_9 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cpu, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cpu, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; { - PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_numpy, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_map = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":182 + /* "dopt_sensor_anomalies/detection.py":214 * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() * * img_np = np.array(pil_image) # <<<<<<<<<<<<<< * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) * */ - __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); - assert(__pyx_t_1); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); - __pyx_t_9 = 0; - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_pil_image}; - __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } - __pyx_v_img_np = __pyx_t_5; - __pyx_t_5 = 0; - - /* "dopt_sensor_anomalies/detection.py":183 - * - * img_np = np.array(pil_image) - * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) # <<<<<<<<<<<<<< - * - * return t.InferenceResult( -*/ - __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_resize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); - __pyx_t_4 = 0; - __pyx_t_6 = 0; - __pyx_t_9 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - assert(__pyx_t_8); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); - __pyx_t_9 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_anomaly_map, __pyx_t_1}; - __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } - __pyx_v_anomaly_map_resized = __pyx_t_5; - __pyx_t_5 = 0; - - /* "dopt_sensor_anomalies/detection.py":185 - * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) - * - * return t.InferenceResult( # <<<<<<<<<<<<<< - * img=img_np, - * anomaly_map_resized=anomaly_map_resized, -*/ - __Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_InferenceResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dopt_sensor_anomalies/detection.py":189 - * anomaly_map_resized=anomaly_map_resized, - * anomaly_score=anomaly_score, - * anomaly_label=anomaly_label, # <<<<<<<<<<<<<< - * ) - * -*/ - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_anomaly_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { @@ -8863,26 +9196,128 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON } #endif { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_2, NULL}; - __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_6, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_t_1, __pyx_t_6, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) - __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_pil_image}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_img_np = __pyx_t_5; + __pyx_t_5 = 0; + + /* "dopt_sensor_anomalies/detection.py":215 + * + * img_np = np.array(pil_image) + * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) # <<<<<<<<<<<<<< + * + * return t.InferenceResult( +*/ + __pyx_t_8 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_resize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 215, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 215, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_6 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_8); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_anomaly_map, __pyx_t_2}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_anomaly_map_resized = __pyx_t_5; + __pyx_t_5 = 0; + + /* "dopt_sensor_anomalies/detection.py":217 + * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) + * + * return t.InferenceResult( # <<<<<<<<<<<<<< + * img=img_np, + * anomaly_map_resized=anomaly_map_resized, +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InferenceResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dopt_sensor_anomalies/detection.py":221 + * anomaly_map_resized=anomaly_map_resized, + * anomaly_score=anomaly_score, + * anomaly_label=anomaly_label, # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_anomaly_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_1, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 217, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 217, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_6, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 217, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_t_2, __pyx_t_6, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":158 + /* "dopt_sensor_anomalies/detection.py":189 * * * def infer_image( # <<<<<<<<<<<<<< @@ -8918,7 +9353,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":193 +/* "dopt_sensor_anomalies/detection.py":225 * * * def anomaly_detection( # <<<<<<<<<<<<<< @@ -8944,13 +9379,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds ) { PyObject *__pyx_v_img_path = 0; PyObject *__pyx_v_detection_models = 0; - PyObject *__pyx_v_data_csv = 0; + PyObject *__pyx_v_export_data = 0; PyObject *__pyx_v_sensor_images = 0; + double __pyx_v_anomaly_threshold; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[4] = {0,0,0,0}; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8966,55 +9402,62 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_img_path,&__pyx_mstate_global->__pyx_n_u_detection_models,&__pyx_mstate_global->__pyx_n_u_data_csv,&__pyx_mstate_global->__pyx_n_u_sensor_images,0}; + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_img_path,&__pyx_mstate_global->__pyx_n_u_detection_models,&__pyx_mstate_global->__pyx_n_u_export_data,&__pyx_mstate_global->__pyx_n_u_sensor_images,&__pyx_mstate_global->__pyx_n_u_anomaly_threshold,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 193, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 225, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 225, __pyx_L3_error) + CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 225, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 225, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 225, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 225, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "anomaly_detection", 0) < (0)) __PYX_ERR(0, 193, __pyx_L3_error) - for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, i); __PYX_ERR(0, 193, __pyx_L3_error) } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "anomaly_detection", 0) < (0)) __PYX_ERR(0, 225, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 5; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 5, 5, i); __PYX_ERR(0, 225, __pyx_L3_error) } } - } else if (unlikely(__pyx_nargs != 4)) { + } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 225, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 225, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 225, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 193, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 225, __pyx_L3_error) + values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 225, __pyx_L3_error) } __pyx_v_img_path = values[0]; __pyx_v_detection_models = values[1]; - __pyx_v_data_csv = values[2]; + __pyx_v_export_data = values[2]; __pyx_v_sensor_images = values[3]; + __pyx_v_anomaly_threshold = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_anomaly_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 193, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 225, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9025,7 +9468,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(__pyx_self, __pyx_v_img_path, __pyx_v_detection_models, __pyx_v_data_csv, __pyx_v_sensor_images); + __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(__pyx_self, __pyx_v_img_path, __pyx_v_detection_models, __pyx_v_export_data, __pyx_v_sensor_images, __pyx_v_anomaly_threshold); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -9034,8 +9477,191 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_17anomaly_detection_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_img_path, PyObject *__pyx_v_detection_models, PyObject *__pyx_v_data_csv, PyObject *__pyx_v_sensor_images) { +/* "dopt_sensor_anomalies/detection.py":265 + * + * csv_data_sorted: tuple[tuple[str, ...]] = tuple( + * export_data[key] for key in const.EXPORT_DATA_SORTING # <<<<<<<<<<<<<< + * ) + * csv_data: tuple[str, ...] = tuple(flatten(csv_data_sorted)) +*/ + +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_17anomaly_detection_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *)__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr(__pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 265, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_17anomaly_detection_2generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_anomaly_detection_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("dopt_sensor_anomalies.detection.anomaly_detection.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_17anomaly_detection_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 265, __pyx_L1_error) + } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 265, __pyx_L1_error) } + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 265, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 265, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 265, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_export_data)) { __Pyx_RaiseClosureNameError("export_data"); __PYX_ERR(0, 265, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_export_data, __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 265, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + if (__Pyx_PyErr_Occurred()) { + __Pyx_Generator_Replace_StopIteration(0); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dopt_sensor_anomalies/detection.py":225 + * + * + * def anomaly_detection( # <<<<<<<<<<<<<< + * img_path: Path, + * detection_models: t.DetectionModels, +*/ + +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_img_path, PyObject *__pyx_v_detection_models, PyObject *__pyx_v_export_data, PyObject *__pyx_v_sensor_images, double __pyx_v_anomaly_threshold) { + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *__pyx_cur_scope; PyObject *__pyx_v_file_stem = NULL; PyObject *__pyx_v_folder_path = NULL; PyObject *__pyx_v_model = NULL; @@ -9047,7 +9673,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( PyObject *__pyx_v_checkpoint = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_ax = NULL; + PyObject *__pyx_v_csv_data_sorted = 0; + PyObject *__pyx_v_csv_data = 0; PyObject *__pyx_v_df = NULL; + PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_17anomaly_detection_2generator6 = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9069,32 +9698,43 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("anomaly_detection", 0); + __pyx_cur_scope = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *)__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection(__pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 225, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_export_data = __pyx_v_export_data; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_export_data); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_export_data); - /* "dopt_sensor_anomalies/detection.py":199 - * sensor_images: t.SensorImages, + /* "dopt_sensor_anomalies/detection.py":232 + * anomaly_threshold: float, * ) -> None: * file_stem = img_path.stem # <<<<<<<<<<<<<< * folder_path = img_path.parent * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_stem); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_stem); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_file_stem = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":200 + /* "dopt_sensor_anomalies/detection.py":233 * ) -> None: * file_stem = img_path.stem * folder_path = img_path.parent # <<<<<<<<<<<<<< * * model = Patchcore( */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_folder_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":202 + /* "dopt_sensor_anomalies/detection.py":235 * folder_path = img_path.parent * * model = Patchcore( # <<<<<<<<<<<<<< @@ -9102,29 +9742,29 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * ) */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "dopt_sensor_anomalies/detection.py":203 + /* "dopt_sensor_anomalies/detection.py":236 * * model = Patchcore( * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO # <<<<<<<<<<<<<< * ) * _, axes = plt.subplots(1, 2, figsize=(12, 6)) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_BACKBONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_BACKBONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LAYERS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LAYERS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RATIO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RATIO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = 1; @@ -9141,11 +9781,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, NULL}; - __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_backbone, __pyx_t_5, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_layers, __pyx_t_6, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_coreset_sampling_ratio, __pyx_t_7, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_backbone, __pyx_t_5, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 235, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_layers, __pyx_t_6, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 235, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_coreset_sampling_ratio, __pyx_t_7, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 235, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9153,28 +9793,28 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_model = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":205 + /* "dopt_sensor_anomalies/detection.py":238 * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO * ) * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< * * for i, (side, image) in enumerate(sensor_images.items()): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_subplots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_subplots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_figsize, __pyx_mstate_global->__pyx_tuple[6]) < (0)) __PYX_ERR(0, 205, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[5], __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_figsize, __pyx_mstate_global->__pyx_tuple[6]) < (0)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[5], __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9184,7 +9824,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 205, __pyx_L1_error) + __PYX_ERR(0, 238, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -9194,22 +9834,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); @@ -9217,7 +9857,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 205, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 238, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L4_unpacking_done; @@ -9225,7 +9865,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 205, __pyx_L1_error) + __PYX_ERR(0, 238, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -9233,7 +9873,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_v_axes = __pyx_t_3; __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":207 + /* "dopt_sensor_anomalies/detection.py":240 * _, axes = plt.subplots(1, 2, figsize=(12, 6)) * * for i, (side, image) in enumerate(sensor_images.items()): # <<<<<<<<<<<<<< @@ -9245,9 +9885,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_10 = 0; if (unlikely(__pyx_v_sensor_images == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 207, __pyx_L1_error) + __PYX_ERR(0, 240, __pyx_L1_error) } - __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_sensor_images, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_sensor_images, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_1; @@ -9255,7 +9895,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( while (1) { __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_10, &__pyx_t_1, &__pyx_t_7, NULL, __pyx_t_12); if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 207, __pyx_L1_error) + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_side, __pyx_t_1); @@ -9264,13 +9904,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":208 + /* "dopt_sensor_anomalies/detection.py":241 * * for i, (side, image) in enumerate(sensor_images.items()): * image = cast(npt.NDArray[np.uint8], image) # <<<<<<<<<<<<<< @@ -9278,19 +9918,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * model.load_state_dict(checkpoint["model_state_dict"]) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -9312,13 +9952,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF_SET(__pyx_v_image, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":209 + /* "dopt_sensor_anomalies/detection.py":242 * for i, (side, image) in enumerate(sensor_images.items()): * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) # <<<<<<<<<<<<<< @@ -9326,12 +9966,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * */ __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_detection_models, __pyx_v_side); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_detection_models, __pyx_v_side); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS @@ -9351,22 +9991,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_checkpoint, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":210 + /* "dopt_sensor_anomalies/detection.py":243 * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) * model.load_state_dict(checkpoint["model_state_dict"]) # <<<<<<<<<<<<<< * - * result = infer_image(image, model) + * result = infer_image(image, model, anomaly_threshold) */ __pyx_t_1 = __pyx_v_model; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 0; { @@ -9374,21 +10014,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load_state_dict, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":212 + /* "dopt_sensor_anomalies/detection.py":245 * model.load_state_dict(checkpoint["model_state_dict"]) * - * result = infer_image(image, model) # <<<<<<<<<<<<<< - * data_csv.extend([int(result.anomaly_label)]) - * + * result = infer_image(image, model, anomaly_threshold) # <<<<<<<<<<<<<< + * export_data[side] = ( + * f"{result.anomaly_score:.1f}".replace(".", ","), */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_anomaly_threshold); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_1))) { @@ -9402,131 +10044,160 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_image, __pyx_v_model}; - __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_image, __pyx_v_model, __pyx_t_6}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":213 - * - * result = infer_image(image, model) - * data_csv.extend([int(result.anomaly_label)]) # <<<<<<<<<<<<<< - * - * ax = axes[i] + /* "dopt_sensor_anomalies/detection.py":247 + * result = infer_image(image, model, anomaly_threshold) + * export_data[side] = ( + * f"{result.anomaly_score:.1f}".replace(".", ","), # <<<<<<<<<<<<<< + * str(int(result.anomaly_label)), + * ) */ - __pyx_t_1 = __pyx_v_data_csv; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 213, __pyx_L1_error); - __pyx_t_6 = 0; - __pyx_t_8 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; - __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_extend, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - } + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_score); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_Format(__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyUnicode_Replace(((PyObject*)__pyx_t_1), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":215 - * data_csv.extend([int(result.anomaly_label)]) + /* "dopt_sensor_anomalies/detection.py":248 + * export_data[side] = ( + * f"{result.anomaly_score:.1f}".replace(".", ","), + * str(int(result.anomaly_label)), # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dopt_sensor_anomalies/detection.py":247 + * result = infer_image(image, model, anomaly_threshold) + * export_data[side] = ( + * f"{result.anomaly_score:.1f}".replace(".", ","), # <<<<<<<<<<<<<< + * str(int(result.anomaly_label)), + * ) +*/ + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 247, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 247, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_1 = 0; + + /* "dopt_sensor_anomalies/detection.py":246 + * + * result = infer_image(image, model, anomaly_threshold) + * export_data[side] = ( # <<<<<<<<<<<<<< + * f"{result.anomaly_score:.1f}".replace(".", ","), + * str(int(result.anomaly_label)), +*/ + if (unlikely((PyObject_SetItem(__pyx_cur_scope->__pyx_v_export_data, __pyx_v_side, __pyx_t_6) < 0))) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dopt_sensor_anomalies/detection.py":251 + * ) * * ax = axes[i] # <<<<<<<<<<<<<< * ax.axis("off") * ax.imshow(image, alpha=0.8) */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XDECREF_SET(__pyx_v_ax, __pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_ax, __pyx_t_6); + __pyx_t_6 = 0; - /* "dopt_sensor_anomalies/detection.py":216 + /* "dopt_sensor_anomalies/detection.py":252 * * ax = axes[i] * ax.axis("off") # <<<<<<<<<<<<<< * ax.imshow(image, alpha=0.8) * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) */ - __pyx_t_5 = __pyx_v_ax; - __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __pyx_v_ax; + __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; { - PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_off}; - __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_axis, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_n_u_off}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_axis, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dopt_sensor_anomalies/detection.py":217 + /* "dopt_sensor_anomalies/detection.py":253 * ax = axes[i] * ax.axis("off") * ax.imshow(image, alpha=0.8) # <<<<<<<<<<<<<< * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) * */ - __pyx_t_5 = __pyx_v_ax; - __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __pyx_v_ax; + __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_image}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_8, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 217, __pyx_L1_error) - __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L1_error) + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_v_image}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_8, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dopt_sensor_anomalies/detection.py":218 + /* "dopt_sensor_anomalies/detection.py":254 * ax.axis("off") * ax.imshow(image, alpha=0.8) * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) # <<<<<<<<<<<<<< * * plt.subplots_adjust(wspace=0, hspace=0) */ - __pyx_t_1 = __pyx_v_ax; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __pyx_v_ax; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = 0; { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_t_5}; - __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cmap, __pyx_mstate_global->__pyx_n_u_jet, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_5, __pyx_t_6, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) - __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, __pyx_t_1}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cmap, __pyx_mstate_global->__pyx_n_u_jet, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_5, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":220 + /* "dopt_sensor_anomalies/detection.py":256 * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) * * plt.subplots_adjust(wspace=0, hspace=0) # <<<<<<<<<<<<<< @@ -9534,121 +10205,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_subplots_adjust); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); - assert(__pyx_t_3); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); - __pyx_t_8 = 0; - } - #endif - { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, NULL}; - __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_wspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 220, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 220, __pyx_L1_error) - __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dopt_sensor_anomalies/detection.py":221 - * - * plt.subplots_adjust(wspace=0, hspace=0) - * plt.savefig( # <<<<<<<<<<<<<< - * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), - * bbox_inches="tight", -*/ - __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_savefig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "dopt_sensor_anomalies/detection.py":222 - * plt.subplots_adjust(wspace=0, hspace=0) - * plt.savefig( - * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), # <<<<<<<<<<<<<< - * bbox_inches="tight", - * pad_inches=0, -*/ - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_subplots_adjust); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_HEATMAP_FILENAME_SUFFIX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15[0] = __pyx_t_7; - __pyx_t_15[1] = __pyx_t_5; - __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u_png; - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 4, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - assert(__pyx_t_6); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); - __pyx_t_8 = 0; - } - #endif - { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bbox_inches, __pyx_mstate_global->__pyx_n_u_tight, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 221, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pad_inches, __pyx_mstate_global->__pyx_int_0, __pyx_t_1, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dopt_sensor_anomalies/detection.py":226 - * pad_inches=0, - * ) - * plt.close() # <<<<<<<<<<<<<< - * - * df = DataFrame([data_csv]) -*/ - __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { @@ -9662,30 +10223,62 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_wspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 256, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":228 - * plt.close() + /* "dopt_sensor_anomalies/detection.py":257 * - * df = DataFrame([data_csv]) # <<<<<<<<<<<<<< - * df.to_csv( - * (folder_path / f"{file_stem}.csv"), + * plt.subplots_adjust(wspace=0, hspace=0) + * plt.savefig( # <<<<<<<<<<<<<< + * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), + * bbox_inches="tight", */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_savefig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dopt_sensor_anomalies/detection.py":258 + * plt.subplots_adjust(wspace=0, hspace=0) + * plt.savefig( + * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), # <<<<<<<<<<<<<< + * bbox_inches="tight", + * pad_inches=0, +*/ + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_data_csv); - __Pyx_GIVEREF(__pyx_v_data_csv); - if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 228, __pyx_L1_error); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_HEATMAP_FILENAME_SUFFIX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_15[0] = __pyx_t_6; + __pyx_t_15[1] = __pyx_t_1; + __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u_png; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 4, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { @@ -9699,76 +10292,219 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bbox_inches, __pyx_mstate_global->__pyx_n_u_tight, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pad_inches, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_v_df = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":229 + /* "dopt_sensor_anomalies/detection.py":262 + * pad_inches=0, + * ) + * plt.close() # <<<<<<<<<<<<<< * - * df = DataFrame([data_csv]) + * csv_data_sorted: tuple[tuple[str, ...]] = tuple( +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dopt_sensor_anomalies/detection.py":265 + * + * csv_data_sorted: tuple[tuple[str, ...]] = tuple( + * export_data[key] for key in const.EXPORT_DATA_SORTING # <<<<<<<<<<<<<< + * ) + * csv_data: tuple[str, ...] = tuple(flatten(csv_data_sorted)) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EXPORT_DATA_SORTING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_pf_21dopt_sensor_anomalies_9detection_17anomaly_detection_genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dopt_sensor_anomalies/detection.py":264 + * plt.close() + * + * csv_data_sorted: tuple[tuple[str, ...]] = tuple( # <<<<<<<<<<<<<< + * export_data[key] for key in const.EXPORT_DATA_SORTING + * ) +*/ + __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_csv_data_sorted = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dopt_sensor_anomalies/detection.py":267 + * export_data[key] for key in const.EXPORT_DATA_SORTING + * ) + * csv_data: tuple[str, ...] = tuple(flatten(csv_data_sorted)) # <<<<<<<<<<<<<< + * + * df = DataFrame([csv_data]) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_flatten); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_csv_data_sorted}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_csv_data = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "dopt_sensor_anomalies/detection.py":269 + * csv_data: tuple[str, ...] = tuple(flatten(csv_data_sorted)) + * + * df = DataFrame([csv_data]) # <<<<<<<<<<<<<< + * df.to_csv( + * (folder_path / f"{file_stem}.csv"), +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_csv_data); + __Pyx_GIVEREF(__pyx_v_csv_data); + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_csv_data) != (0)) __PYX_ERR(0, 269, __pyx_L1_error); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_df = __pyx_t_3; + __pyx_t_3 = 0; + + /* "dopt_sensor_anomalies/detection.py":270 + * + * df = DataFrame([csv_data]) * df.to_csv( # <<<<<<<<<<<<<< * (folder_path / f"{file_stem}.csv"), * mode="w", */ - __pyx_t_3 = __pyx_v_df; - __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __pyx_v_df; + __Pyx_INCREF(__pyx_t_4); - /* "dopt_sensor_anomalies/detection.py":230 - * df = DataFrame([data_csv]) + /* "dopt_sensor_anomalies/detection.py":271 + * df = DataFrame([csv_data]) * df.to_csv( * (folder_path / f"{file_stem}.csv"), # <<<<<<<<<<<<<< * mode="w", * index=False, */ - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_csv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_csv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":234 + /* "dopt_sensor_anomalies/detection.py":275 * index=False, * header=False, * quoting=csv.QUOTE_NONE, # <<<<<<<<<<<<<< * sep=";", * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = 0; { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_3, __pyx_t_1}; - __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_w, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_False, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_header, Py_False, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quoting, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 3) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sep, __pyx_mstate_global->__pyx_kp_u__4, __pyx_t_5, __pyx_callargs+2, 4) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) - __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_csv, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_w, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 270, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_False, __pyx_t_1, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 270, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_header, Py_False, __pyx_t_1, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 270, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quoting, __pyx_t_5, __pyx_t_1, __pyx_callargs+2, 3) < (0)) __PYX_ERR(0, 270, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sep, __pyx_mstate_global->__pyx_kp_u__4, __pyx_t_1, __pyx_callargs+2, 4) < (0)) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_csv, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":193 + /* "dopt_sensor_anomalies/detection.py":225 * * * def anomaly_detection( # <<<<<<<<<<<<<< @@ -9802,13 +10538,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_v_checkpoint); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_ax); + __Pyx_XDECREF(__pyx_v_csv_data_sorted); + __Pyx_XDECREF(__pyx_v_csv_data); __Pyx_XDECREF(__pyx_v_df); + __Pyx_XDECREF(__pyx_gb_21dopt_sensor_anomalies_9detection_17anomaly_detection_2generator6); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":239 +/* "dopt_sensor_anomalies/detection.py":280 * * * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< @@ -9835,11 +10575,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds PyObject *__pyx_v_user_img_path = 0; double __pyx_v_pixels_per_metric_X; double __pyx_v_pixels_per_metric_Y; + double __pyx_v_anomaly_threshold; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[3] = {0,0,0}; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9855,48 +10596,55 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_user_img_path,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_X,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y,0}; + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_user_img_path,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_X,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y,&__pyx_mstate_global->__pyx_n_u_anomaly_threshold,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 239, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 280, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { + case 4: + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 280, __pyx_L3_error) + CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 239, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 280, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 239, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 280, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 239, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 280, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipeline", 0) < (0)) __PYX_ERR(0, 239, __pyx_L3_error) - for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, i); __PYX_ERR(0, 239, __pyx_L3_error) } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipeline", 0) < (0)) __PYX_ERR(0, 280, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipeline", 1, 4, 4, i); __PYX_ERR(0, 280, __pyx_L3_error) } } - } else if (unlikely(__pyx_nargs != 3)) { + } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 239, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 280, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 239, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 280, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 239, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 280, __pyx_L3_error) + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 280, __pyx_L3_error) } __pyx_v_user_img_path = ((PyObject*)values[0]); - __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L3_error) + __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L3_error) + __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 284, __pyx_L3_error) + __pyx_v_anomaly_threshold = __Pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_anomaly_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("pipeline", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 280, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9907,8 +10655,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_img_path), (&PyUnicode_Type), 0, "user_img_path", 2))) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(__pyx_self, __pyx_v_user_img_path, __pyx_v_pixels_per_metric_X, __pyx_v_pixels_per_metric_Y); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_img_path), (&PyUnicode_Type), 0, "user_img_path", 2))) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(__pyx_self, __pyx_v_user_img_path, __pyx_v_pixels_per_metric_X, __pyx_v_pixels_per_metric_Y, __pyx_v_anomaly_threshold); /* function exit code */ goto __pyx_L0; @@ -9927,7 +10675,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_user_img_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y) { +static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_user_img_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y, double __pyx_v_anomaly_threshold) { PyObject *__pyx_v_file_path = NULL; PyObject *__pyx_v_MODEL_FOLDER = NULL; PyObject *__pyx_v_DETECTION_MODELS = NULL; @@ -9949,15 +10697,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pipeline", 0); - /* "dopt_sensor_anomalies/detection.py":245 - * pixels_per_metric_Y: float, + /* "dopt_sensor_anomalies/detection.py":287 + * anomaly_threshold: float, * ) -> None: * file_path = Path(user_img_path) # <<<<<<<<<<<<<< * if not file_path.exists(): * raise FileNotFoundError("The provided path seems not to exist") */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -9976,13 +10724,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_file_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":246 + /* "dopt_sensor_anomalies/detection.py":288 * ) -> None: * file_path = Path(user_img_path) * if not file_path.exists(): # <<<<<<<<<<<<<< @@ -9996,15 +10744,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":247 + /* "dopt_sensor_anomalies/detection.py":289 * file_path = Path(user_img_path) * if not file_path.exists(): * raise FileNotFoundError("The provided path seems not to exist") # <<<<<<<<<<<<<< @@ -10017,14 +10765,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_The_provided_path_seems_not_to_e}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_FileNotFoundError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 247, __pyx_L1_error) + __PYX_ERR(0, 289, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":246 + /* "dopt_sensor_anomalies/detection.py":288 * ) -> None: * file_path = Path(user_img_path) * if not file_path.exists(): # <<<<<<<<<<<<<< @@ -10033,16 +10781,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U */ } - /* "dopt_sensor_anomalies/detection.py":249 + /* "dopt_sensor_anomalies/detection.py":291 * raise FileNotFoundError("The provided path seems not to exist") * * MODEL_FOLDER: Final[Path] = dopt_sensor_anomalies._find_paths.get_model_folder() # <<<<<<<<<<<<<< * DETECTION_MODELS: Final[t.DetectionModels] = ( * dopt_sensor_anomalies._find_paths.get_detection_models(MODEL_FOLDER) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_7; @@ -10053,22 +10801,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_model_folder, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_MODEL_FOLDER = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":251 + /* "dopt_sensor_anomalies/detection.py":293 * MODEL_FOLDER: Final[Path] = dopt_sensor_anomalies._find_paths.get_model_folder() * DETECTION_MODELS: Final[t.DetectionModels] = ( * dopt_sensor_anomalies._find_paths.get_detection_models(MODEL_FOLDER) # <<<<<<<<<<<<<< * ) * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __pyx_t_2; @@ -10079,13 +10827,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_detection_models, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_DETECTION_MODELS = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":254 + /* "dopt_sensor_anomalies/detection.py":296 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10093,19 +10841,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * ) */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_measure_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_measure_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":255 + /* "dopt_sensor_anomalies/detection.py":297 * * data_csv, sensor_images = measure_length( * file_path, pixels_per_metric_X, pixels_per_metric_Y # <<<<<<<<<<<<<< * ) * anomaly_detection( */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10126,7 +10874,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -10135,7 +10883,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 254, __pyx_L1_error) + __PYX_ERR(0, 296, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -10145,22 +10893,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_INCREF(__pyx_t_8); } else { __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_8); } #else - __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); @@ -10168,7 +10916,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_GOTREF(__pyx_t_7); index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_8)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 296, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L5_unpacking_done; @@ -10176,11 +10924,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 254, __pyx_L1_error) + __PYX_ERR(0, 296, __pyx_L1_error) __pyx_L5_unpacking_done:; } - /* "dopt_sensor_anomalies/detection.py":254 + /* "dopt_sensor_anomalies/detection.py":296 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10192,7 +10940,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_v_sensor_images = __pyx_t_8; __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":257 + /* "dopt_sensor_anomalies/detection.py":299 * file_path, pixels_per_metric_X, pixels_per_metric_Y * ) * anomaly_detection( # <<<<<<<<<<<<<< @@ -10200,15 +10948,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * detection_models=DETECTION_MODELS, */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":261 - * detection_models=DETECTION_MODELS, - * data_csv=data_csv, - * sensor_images=sensor_images, # <<<<<<<<<<<<<< + /* "dopt_sensor_anomalies/detection.py":304 + * export_data=data_csv, + * sensor_images=sensor_images, + * anomaly_threshold=anomaly_threshold, # <<<<<<<<<<<<<< * ) */ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_anomaly_threshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { @@ -10222,23 +10972,25 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U } #endif { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_8, NULL}; - __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img_path, __pyx_v_file_path, __pyx_t_3, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_detection_models, __pyx_v_DETECTION_MODELS, __pyx_t_3, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data_csv, __pyx_v_data_csv, __pyx_t_3, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_v_sensor_images, __pyx_t_3, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) - __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img_path, __pyx_v_file_path, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_detection_models, __pyx_v_DETECTION_MODELS, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_export_data, __pyx_v_data_csv, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_v_sensor_images, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_threshold, __pyx_t_3, __pyx_t_2, __pyx_callargs+1, 4) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":239 + /* "dopt_sensor_anomalies/detection.py":280 * * * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< @@ -11444,6 +12196,346 @@ static PyTypeObject __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_st }; #endif +static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection[--__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection(PyObject *o) { + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *p = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_export_data); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection)))) + { + __pyx_mstate_global->__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection[__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection++] = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *p = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_export_data) { + e = (*v)(p->__pyx_v_export_data, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *p = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection *)o; + tmp = ((PyObject*)p->__pyx_v_export_data); + p->__pyx_v_export_data = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection}, + {Py_tp_clear, (void *)__pyx_tp_clear_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection}, + {Py_tp_new, (void *)__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection}, + {0, 0}, +}; +static PyType_Spec __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection_spec = { + "dopt_sensor_anomalies.detection.__pyx_scope_struct_7_anomaly_detection", + sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection_slots, +}; +#else + +static PyTypeObject __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection = { + PyVarObject_HEAD_INIT(0, 0) + "dopt_sensor_anomalies.detection.""__pyx_scope_struct_7_anomaly_detection", /*tp_name*/ + sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, /*tp_traverse*/ + __pyx_tp_clear_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr, sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr[--__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_key); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr, sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr[__pyx_mstate_global->__pyx_freecount_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_key) { + e = (*v)(p->__pyx_v_key, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr_spec = { + "dopt_sensor_anomalies.detection.__pyx_scope_struct_8_genexpr", + sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "dopt_sensor_anomalies.detection.""__pyx_scope_struct_8_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; @@ -11498,15 +12590,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length)) __PYX_ERR(0, 55, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length)) __PYX_ERR(0, 56, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length); @@ -11517,15 +12609,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 84, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 85, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 85, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 85, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr); @@ -11536,15 +12628,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 112, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 114, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 114, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 114, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr); @@ -11555,15 +12647,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 143, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 168, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 168, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 168, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr); @@ -11574,15 +12666,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 144, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 169, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 169, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 169, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr); @@ -11593,15 +12685,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 145, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 170, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 170, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 145, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 170, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr); @@ -11612,15 +12704,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 146, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 171, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); @@ -11630,6 +12722,44 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr->tp_getattro = PyObject_GenericGetAttr; } #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection)) __PYX_ERR(0, 225, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_7_anomaly_detection->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr)) __PYX_ERR(0, 265, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr) < (0)) __PYX_ERR(0, 265, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr) < (0)) __PYX_ERR(0, 265, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_8_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11671,7 +12801,7 @@ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_detection}, #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING - {Py_mod_gil, Py_MOD_GIL_USED}, + {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE}, #endif #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, @@ -12100,7 +13230,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import torch * from anomalib.models import Patchcore # <<<<<<<<<<<<<< * from dopt_basics import result_pattern - * from imutils import contours, perspective + * from dopt_basics.datastructures import flatten */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Patchcore}; @@ -12123,8 +13253,8 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import torch * from anomalib.models import Patchcore * from dopt_basics import result_pattern # <<<<<<<<<<<<<< + * from dopt_basics.datastructures import flatten * from imutils import contours, perspective - * from pandas import DataFrame */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_result_pattern}; @@ -12146,19 +13276,19 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); /* "dopt_sensor_anomalies/detection.py":14 * from anomalib.models import Patchcore * from dopt_basics import result_pattern - * from imutils import contours, perspective # <<<<<<<<<<<<<< + * from dopt_basics.datastructures import flatten # <<<<<<<<<<<<<< + * from imutils import contours, perspective * from pandas import DataFrame - * from PIL import Image */ { - PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contours,__pyx_mstate_global->__pyx_n_u_perspective}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_imutils, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_flatten}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_basics_datastructures, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { - PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contours,__pyx_mstate_global->__pyx_n_u_perspective}; - for (__pyx_t_3=0; __pyx_t_3 < 2; __pyx_t_3++) { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_flatten}; + __pyx_t_3 = 0; { __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) @@ -12169,20 +13299,20 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); /* "dopt_sensor_anomalies/detection.py":15 * from dopt_basics import result_pattern - * from imutils import contours, perspective - * from pandas import DataFrame # <<<<<<<<<<<<<< + * from dopt_basics.datastructures import flatten + * from imutils import contours, perspective # <<<<<<<<<<<<<< + * from pandas import DataFrame * from PIL import Image - * from scipy.spatial import distance as dist */ { - PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DataFrame}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pandas, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contours,__pyx_mstate_global->__pyx_n_u_perspective}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_imutils, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { - PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DataFrame}; - __pyx_t_3 = 0; { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contours,__pyx_mstate_global->__pyx_n_u_perspective}; + for (__pyx_t_3=0; __pyx_t_3 < 2; __pyx_t_3++) { __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) @@ -12192,20 +13322,20 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "dopt_sensor_anomalies/detection.py":16 + * from dopt_basics.datastructures import flatten * from imutils import contours, perspective - * from pandas import DataFrame - * from PIL import Image # <<<<<<<<<<<<<< + * from pandas import DataFrame # <<<<<<<<<<<<<< + * from PIL import Image * from scipy.spatial import distance as dist - * */ { - PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Image}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_PIL, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DataFrame}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pandas, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { - PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Image}; + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DataFrame}; __pyx_t_3 = 0; { __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -12216,6 +13346,30 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "dopt_sensor_anomalies/detection.py":17 + * from imutils import contours, perspective + * from pandas import DataFrame + * from PIL import Image # <<<<<<<<<<<<<< + * from scipy.spatial import distance as dist + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Image}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_PIL, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Image}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dopt_sensor_anomalies/detection.py":18 * from pandas import DataFrame * from PIL import Image * from scipy.spatial import distance as dist # <<<<<<<<<<<<<< @@ -12224,18 +13378,18 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_distance}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_scipy_spatial, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_scipy_spatial, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_distance}; __pyx_t_3 = 0; { - __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); switch (__pyx_t_3) { case 0: - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dist, __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dist, __pyx_t_4) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) break; default:; } @@ -12244,20 +13398,20 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":19 + /* "dopt_sensor_anomalies/detection.py":20 * from scipy.spatial import distance as dist * * import dopt_sensor_anomalies._find_paths # <<<<<<<<<<<<<< * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors */ - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies__find_path, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies__find_path, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":20 + /* "dopt_sensor_anomalies/detection.py":21 * * import dopt_sensor_anomalies._find_paths * from dopt_sensor_anomalies import constants as const # <<<<<<<<<<<<<< @@ -12266,18 +13420,18 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_constants}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_constants}; __pyx_t_3 = 0; { - __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); switch (__pyx_t_3) { case 0: - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_const, __pyx_t_4) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_const, __pyx_t_4) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) break; default:; } @@ -12286,7 +13440,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":21 + /* "dopt_sensor_anomalies/detection.py":22 * import dopt_sensor_anomalies._find_paths * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors # <<<<<<<<<<<<<< @@ -12295,22 +13449,22 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_errors}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_errors}; __pyx_t_3 = 0; { - __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":22 + /* "dopt_sensor_anomalies/detection.py":23 * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors * from dopt_sensor_anomalies import types as t # <<<<<<<<<<<<<< @@ -12319,18 +13473,18 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_types}; - __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_types}; __pyx_t_3 = 0; { - __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); switch (__pyx_t_3) { case 0: - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_t, __pyx_t_4) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_t, __pyx_t_4) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) break; default:; } @@ -12339,7 +13493,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":25 + /* "dopt_sensor_anomalies/detection.py":26 * * # Suppress the specific HuggingFace cache symlink warning * warnings.filterwarnings( # <<<<<<<<<<<<<< @@ -12347,13 +13501,13 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * message=".*huggingface_hub.*cache-system uses symlinks.*", */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_filterwarnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_filterwarnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dopt_sensor_anomalies/detection.py":28 + /* "dopt_sensor_anomalies/detection.py":29 * "ignore", * message=".*huggingface_hub.*cache-system uses symlinks.*", * category=UserWarning, # <<<<<<<<<<<<<< @@ -12363,68 +13517,68 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __pyx_t_8 = 1; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ignore}; - __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_message, __pyx_mstate_global->__pyx_kp_u_huggingface_hub_cache_system_us, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_category, ((PyObject *)(((PyTypeObject*)PyExc_UserWarning))), __pyx_t_6, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_message, __pyx_mstate_global->__pyx_kp_u_huggingface_hub_cache_system_us, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_category, ((PyObject *)(((PyTypeObject*)PyExc_UserWarning))), __pyx_t_6, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":32 + /* "dopt_sensor_anomalies/detection.py":33 * * * def midpoint( # <<<<<<<<<<<<<< * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pt_A, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pt_B, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_float_float) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_1midpoint, 0, __pyx_mstate_global->__pyx_n_u_midpoint, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 32, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pt_A, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pt_B, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_float_float) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_1midpoint, 0, __pyx_mstate_global->__pyx_n_u_midpoint, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_midpoint, __pyx_t_7) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_midpoint, __pyx_t_7) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":42 + /* "dopt_sensor_anomalies/detection.py":43 * box_1: t.Box, * box_2: t.Box, * tolerance: float = 5.0, # <<<<<<<<<<<<<< * ) -> bool: * c1, s1, _ = box_1 */ - __pyx_t_7 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_7 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":39 + /* "dopt_sensor_anomalies/detection.py":40 * * * def check_box_redundancy( # <<<<<<<<<<<<<< * box_1: t.Box, * box_2: t.Box, */ - __pyx_t_2 = PyTuple_Pack(1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_2 = PyTuple_Pack(1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_box_1, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_3check_box_redundancy, 0, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_box_1, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_3check_box_redundancy, 0, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); @@ -12433,79 +13587,81 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, __pyx_t_6) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, __pyx_t_6) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dopt_sensor_anomalies/detection.py":55 + /* "dopt_sensor_anomalies/detection.py":56 * * * def measure_length( # <<<<<<<<<<<<<< * img_path: Path, * pixels_per_metric_X: float, */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_t_CsvData_t_SensorImages) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_5measure_length, 0, __pyx_mstate_global->__pyx_n_u_measure_length, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_t_ExportData_t_SensorImage) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_5measure_length, 0, __pyx_mstate_global->__pyx_n_u_measure_length, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_measure_length, __pyx_t_7) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_measure_length, __pyx_t_7) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":158 + /* "dopt_sensor_anomalies/detection.py":189 * * * def infer_image( # <<<<<<<<<<<<<< * image: npt.NDArray[np.uint8], * model: Patchcore, */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_model, __pyx_mstate_global->__pyx_n_u_Patchcore) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_t_InferenceResult) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_7infer_image, 0, __pyx_mstate_global->__pyx_n_u_infer_image, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_model, __pyx_mstate_global->__pyx_n_u_Patchcore) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_threshold, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_t_InferenceResult) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_7infer_image, 0, __pyx_mstate_global->__pyx_n_u_infer_image, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_infer_image, __pyx_t_6) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_infer_image, __pyx_t_6) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dopt_sensor_anomalies/detection.py":193 + /* "dopt_sensor_anomalies/detection.py":225 * * * def anomaly_detection( # <<<<<<<<<<<<<< * img_path: Path, * detection_models: t.DetectionModels, */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_detection_models, __pyx_mstate_global->__pyx_kp_u_t_DetectionModels) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_data_csv, __pyx_mstate_global->__pyx_kp_u_t_CsvData) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_mstate_global->__pyx_kp_u_t_SensorImages) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_9anomaly_detection, 0, __pyx_mstate_global->__pyx_n_u_anomaly_detection, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_detection_models, __pyx_mstate_global->__pyx_kp_u_t_DetectionModels) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_data, __pyx_mstate_global->__pyx_kp_u_t_ExportData) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_mstate_global->__pyx_kp_u_t_SensorImages) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_anomaly_threshold, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_9anomaly_detection, 0, __pyx_mstate_global->__pyx_n_u_anomaly_detection, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_anomaly_detection, __pyx_t_7) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_anomaly_detection, __pyx_t_7) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":239 + /* "dopt_sensor_anomalies/detection.py":280 * * * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< @@ -12514,9 +13670,9 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __pyx_t_6 = NULL; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_wrap_result); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_wrap_result); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_8 = 1; @@ -12525,16 +13681,17 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_10 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_user_img_path, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_11pipeline, 0, __pyx_mstate_global->__pyx_n_u_pipeline, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_user_img_path, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_anomaly_threshold, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_11pipeline, 0, __pyx_mstate_global->__pyx_n_u_pipeline, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); @@ -12548,10 +13705,10 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pipeline, __pyx_t_7) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pipeline, __pyx_t_7) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "dopt_sensor_anomalies/detection.py":1 @@ -12605,10 +13762,11 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); - __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 143, __pyx_L1_error) - __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 144, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 84, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 240, __pyx_L1_error) /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; @@ -12628,86 +13786,86 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "dopt_sensor_anomalies/detection.py":143 + /* "dopt_sensor_anomalies/detection.py":168 * ) * * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) */ - __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); - __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); - /* "dopt_sensor_anomalies/detection.py":145 + /* "dopt_sensor_anomalies/detection.py":170 * x_min = max(min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20, 0) * x_max = min(max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20, orig.shape[1]) * y_min = max(min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20, 0) # <<<<<<<<<<<<<< * y_max = min(max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20, orig.shape[0]) * */ - __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); - /* "dopt_sensor_anomalies/detection.py":65 + /* "dopt_sensor_anomalies/detection.py":66 * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * * cropped = image[500:1500, 100 : image.shape[1] - 100] # <<<<<<<<<<<<<< * orig = cropped.copy() * */ - __pyx_mstate_global->__pyx_slice[1] = PySlice_New(__pyx_mstate_global->__pyx_int_500, __pyx_mstate_global->__pyx_int_1500, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_mstate_global->__pyx_slice[1] = PySlice_New(__pyx_mstate_global->__pyx_int_500, __pyx_mstate_global->__pyx_int_1500, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); - /* "dopt_sensor_anomalies/detection.py":71 + /* "dopt_sensor_anomalies/detection.py":72 * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) # <<<<<<<<<<<<<< * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) */ - __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_5, __pyx_mstate_global->__pyx_int_5); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_5, __pyx_mstate_global->__pyx_int_5); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); - /* "dopt_sensor_anomalies/detection.py":169 + /* "dopt_sensor_anomalies/detection.py":201 * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) # <<<<<<<<<<<<<< * * input_tensor = input_tensor.unsqueeze(0) */ - __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); - /* "dopt_sensor_anomalies/detection.py":175 + /* "dopt_sensor_anomalies/detection.py":207 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< * output = model(input_tensor) * */ - __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); - /* "dopt_sensor_anomalies/detection.py":205 + /* "dopt_sensor_anomalies/detection.py":238 * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO * ) * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< * * for i, (side, image) in enumerate(sensor_images.items()): */ - __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]); - __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); #if CYTHON_IMMORTAL_CONSTANTS @@ -12715,7 +13873,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { PyObject **table = __pyx_mstate->__pyx_tuple; for (Py_ssize_t i=0; i<7; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING - Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #if PY_VERSION_HEX < 0x030E0000 + if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) + #else + if (PyUnstable_Object_IsUniquelyReferenced(table[i])) + #endif + { + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + } #else Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif @@ -12727,7 +13892,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { PyObject **table = __pyx_mstate->__pyx_slice; for (Py_ssize_t i=0; i<2; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING - Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #if PY_VERSION_HEX < 0x030E0000 + if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) + #else + if (PyUnstable_Object_IsUniquelyReferenced(table[i])) + #endif + { + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + } #else Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif @@ -12745,31 +13917,31 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 10; } index[] = {{1},{3},{3},{81},{51},{31},{72},{179},{72},{36},{1},{1},{1},{1},{8},{4},{7},{6},{13},{2},{47},{9},{24},{21},{4},{38},{5},{9},{17},{17},{14},{19},{32},{17},{3},{8},{3},{19},{14},{13},{5},{23},{16},{9},{5},{23},{5},{17},{15},{21},{6},{12},{11},{10},{7},{20},{4},{3},{9},{4},{20},{10},{5},{9},{3},{12},{12},{13},{1},{14},{3},{5},{15},{17},{13},{11},{19},{13},{5},{6},{18},{2},{4},{4},{8},{11},{6},{2},{5},{5},{4},{12},{3},{9},{5},{5},{2},{1},{2},{2},{4},{8},{11},{20},{10},{17},{18},{5},{6},{4},{4},{5},{9},{8},{7},{4},{22},{3},{7},{19},{20},{3},{4},{3},{8},{2},{2},{8},{16},{6},{2},{4},{4},{4},{8},{11},{21},{33},{31},{5},{5},{9},{9},{6},{9},{4},{8},{6},{8},{6},{7},{9},{9},{13},{14},{12},{11},{5},{7},{11},{10},{9},{8},{7},{21},{20},{16},{13},{4},{6},{6},{1},{6},{5},{8},{9},{3},{6},{8},{6},{6},{7},{5},{11},{12},{5},{12},{13},{12},{9},{4},{5},{3},{6},{6},{4},{17},{6},{4},{15},{8},{17},{3},{14},{31},{7},{8},{3},{11},{4},{5},{16},{10},{12},{8},{4},{7},{4},{2},{3},{12},{5},{12},{3},{12},{4},{6},{10},{6},{6},{7},{7},{11},{9},{8},{19},{19},{3},{3},{10},{4},{4},{6},{12},{7},{4},{6},{6},{14},{6},{5},{17},{2},{2},{7},{13},{4},{13},{3},{12},{10},{5},{4},{9},{13},{7},{4},{3},{8},{15},{1},{8},{9},{5},{5},{2},{5},{5},{5},{5},{2},{6},{9},{5},{12},{2},{5},{5},{5},{6},{5},{9},{13},{5},{6},{1},{8},{11},{6},{2},{2},{8},{5},{8},{5},{5},{5},{3},{287},{118},{52},{898},{340},{2},{2},{139}}; - #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3094 bytes) */ -const char* const cstring = "BZh91AY&SY\255l\2310\000\001\240\177\377\377\377\377\377\377\377\377\377\277\377\377\377\277\377\377\362@@@@@@@@@@@@@\000@\000`\013=\357\245\347\3367}\203\246\361\353\336\255D\327\336\307\272w2\335\273\326H\365y\360\003\357\201\251\221\022h\21546\223M\243I\223\323M3D\233\323CL\232S\311\244<\2434\365M4yC@d\320m\023\032\215\000\331&\206\203D\023\021\221\220\021\251\247\251\351\0324\002\214\204\365=\251\2426\223A\200F@\311\221\221\200C\324\364\233I\262\002\006\032\236\204\320\021\032\025\037\243MF\243\324<\240\032\006@\0004h\000\000\000\000\000\000\320\320h\rL\t!\250\324\323\324\362\236\324\364\243d\311\030i\032h2\000\000\000\000\032\000\000\000\003#OSM\001\232\240SS)\241\345=F\233S#@\r\000h\000\006\200\000\320\000\320\320\332\206\200\000\000\000%\021=\"1\032d&$\006F\215\006\2151\000\320\000\000\000\000\000\000\000\000\003I#\001{GD\024?W\264\277jA\r\235E\350\r r:\243\244b\240\005\t\004\323\200\376\200\301\010\023\0201\002\023@\3204\002\000\031\374tEb\273\t`Ff\216\234\344\026)f\266&s 0\303>\022\244\342\242\212\202(\320$\t \005T\222\255ZsnNMJ*\323\205QJ\265&\204\347\235Sn\271)\241\325K\364\2519\262\374T.7S\242\212T\032\241\030\267\000J\356\317$O|J*\212(\300\344$\n\344\310P\0259\327nU\010\310\232\302J\215$WM\260\314\230\005\rx[\010E\023\010T\006\261B\244&\023\n(\245@)UB#u\273\"\360\322\025<\na\0074\004\264(\266\200\204.\365\346xH\330\212;\224\017\263\374y\337\215>\004\346\371S\346s\245\370\032P:4y\303\275K\313\2272TX\213\376\367\376p\214k2\200\336\321\233\301\221s\343\246\032\027\324$\241\030\272\255\002YL#S\252'\030P\331\353&\026U\020c\233\252\202B\304\337;\205g\202\274\031\261\232\342\205\021\001b\314\313A6\2673(Rlm\013b\235\360h\205;\246.A)\322,\032\377whz\030M\237\240rgX\262\200\005\211\203\270\207{\267G<\256k\303T\340\346\350\343\364\242\345\177\326\226\202\033\205\301\272\234\322\026\365\205\203@L\334\007\335\020\207\374\376\002\232^(\2058\224P\224\021\226{=,X@\202\244\266\332b\002\260e\314D\371r24*\315\317\311\337MK\026\002\204v\206\315\2006\355\375xnge\2458=}\322""\271\211\213\275\006I\242>0\304\000\262\200\310FR*.\027Vg\341f\303Q\255\006\320\227\032\t\223/\243\373\322]\324\"R\267Z\236\036\376_\354\266w\314\273{5\362\366!\\y\222\031y\\0\025\356\346_\344 \352G\313\327\357\033\352xx\322\361\273\307K\376~\024\036;\005J\362\031\270\275M$\003w\036>W\032-\257\022\377R\357\036\356]\274qv8\360\362\3326\016\343{\337\357xi#\310\\:s\275K\243\221\241w\343\340\321\264\016\036\\q\221b-5\362\025|<\225\2501*Q\365.\305g~\2467_\004F\277\232i\250\264@B\033&R|\272\2644m\022\346\310\356\034\331\234\003\006\262\301\337\226\335\364\212Yo\212V\016\213eU\0162\2621\241\255\002\3340\204\252g\220\024\261\003\002\202\272\345\212\205-\251\341f\353\205r\202b-H_\027OJ/\021\221r;\2764\321\002\226\342\021\257`\203\303\337\212\\\035<\376?\203\206 \324skq\r\301\267\212\330\357\024\273\017P\315W\244$\204\312\033l\351o]\001\202k\0068-\2140\270\300\206\300$\337\346T\207\326\211\322\216:\211\302\021\232I\234l5\362W\276\205|\312\323p\030\252+_\320\237\017\r[$\234\243\275\221C\313(1\235\000+\375\333H>\0361\264\271\034\306\317\2260\302W\003\256N\222\314\026\262\223\220\217\212U\220MA\2120@\226\320#\0042\227\0372QX\027\270i\006\256\2218\312\324@\010\230\242^Q\215\r\302\200\3075e\022i.Ln:\r#\013\206\313\232\362\263\344\244\tU\r\262\317\222\367=\310\241\027.\213;O\324i\032\022WT\255T\271w!S\352\247\274\226\366\240-yh\255\361\300\214q\227<6j\353\253\332\032\266J\026\327\211\034B\206\374Q\031\352\014eb\000\032J\361i\352T\026\t\241$\004\205\223\010]\030\367sL.a1\032Cb\347\207he\r15\214\227\026ll\206\243\346`\033x\325{;\372\343\270zi\220rL\373U\3404\3400\271\233\324\345\026\376\266o\260\032M\\A\0043\232\212*\273\221\223\260R\253;\202\253XV9\226\335\245I]\240\003Q\031\247bE*\346\230\254\235\257\222\030\303IPF`\211|\232\245u\232\206\255\315S\223\013\315\020\213\r\316\305\225\342\001\311\202\301qU<\244\014\372L4\240\324D/r\352\361\037E\226\213\260E03Am\255\353\235\3252.ef\020\303\240@\351\223\316H\223\037\177\026\030qh\336\335\340LA\033\372\3672g\323\031\353\341\210\325n\214V""\021\204\307\372\317\027\022BPu\367J\232\216\nQ\306\0177\027\000*-G>0\260\334LqJ\n\006\252a'\252\313\007\224_0\302\371\356\340=\260\271\273,\306[S\027N @\224*hW:\r\t\225\303#\211\016\342\t\"V\345W5+]n\246f\312b\337l\204E0gKZ-`h\332\272\366\252J\233:Iz\312\301\205\247\202\256\0239\001V6\210\241\232X\014\361\202\310\312r\3510\023\253K\301\265\224Fw\007\230\354\035)\320Dm\220\353\213v\205\251\206\342\357>2\225\375\030FuR\236\265QLiX\250\267r_\201h0\355\365P\002\370\313\2544\020\254\n\210\362\243\234\025fN\251\004\027)-\243+HQ~\r\364\251j\026/+\316@5L\255]\274\376c\010F\226\025\310\217\201\013\202\210\206\3458@E\213H\312Y\311k\344\344\357\250+\013\216K\246\3003&\022\300\203\336\014\301\035\327g\313\325\342\2211\214Z51\207aZ\224s\3573\235\264F\r\354Jt\212\212\2654\317\236\232\351R\316+Fa\n\246\266\3303\001\253\032\220D\032\216[\341tvYH]y\032\010\311\350\202\004\003\2532\311\310f\350\2114\331\226:C\265\034Q\241-,\0238f\006\034\264\222b\022\207\016\251\322/|\254\352+\225\341\032k\301\241\230\200\250\315\252*\014\266o@x6\024\024\200\220\230\004\034\215\245\007{1E)\274\nA;\353\310\225(R8r\020\320\202\314SB\261\013q\260D\252\006\215\226l\034-\300D\335\242\205\340u\335n\025\016A\027\254*\344\211\246\335\2754\262$I\302\022\t\004\240@\265\271\213U\303\205\030#\025\202\"2\230\2056\2352\220bG\324(\205\305\210X\027\234FIC\204\"\277\022%R\351\3050\333\207<\257\020\"\021\2105\021\231\244\222\223\"\010F\232\215\002*\256\031X\357\032\267\0145\n\025\322\202Y\247@\0012\270\027h\320w\350\032mn\003\262r\3263\250\372\240Q\004\r1\004%\262\004\3020&\001\013\201l\360\n\272\340L!a\233\014\\bC\204A\242m\014\246\030\350\026\006(\353\230\031M1\371fT\346\024\224\220x\344\npf\333\307\030r\340\276_\312*\230\252i\212U\330L\230\320X11$&5\010\0168j\342\252wZ\204O<\357\347\230\016?\017\243\201S\362\265*\271\027\003B\214\3003\001\000\321\304\370\245\363\010\314\304\2000E+\237t\277#\325l\016\273u\021\304q;\"i\350B\311b\344\264\327\270\325\3618r\362dd\264\204\256\277\026S3hl;8\357h,\206]\310\302\334Y\224\007\001\335\364ra\254\032_(\254\237\231tK\034\322\030bX\321\\\345\271X\245HH\304\204\036\374\"\000\032\265\206\270\270\014\204\311\201!6\352\034\300[\334<\206\220]\364\346\376'|\363\267\224h\t\010 Y\302\241\027\345rO2T\\\262\007\014\231\033\004.\244\340\031\226\177\020\222\251m\313sN\002J\002\240\022\316}\352\300yM\036\200-\003#h\024\266^\345\342\t52@\371\031\035\215\020\325D\006U\022c7>\213\230\233\276\264\3255\341d5\277\362\\$\377\\\r\233\\s\253\033\220+,\026\266b\273\225\356\343\207HY\024\202\246\320\236\353\212uKn\030%\257=\375\375\267F\213\312w}c8\273|t\266(\212E\252T\320(\210$\357\243u\372t\\\215I\324\200\365\225\337z\316\023\252\033\rO\243@\304\377h\"q!;\201\366\335\345:\005]\023\200i""\266\247\206\313O@\231\367W\3007\356\\\026\006|\271E\265bI\014\263D\255V\030\221h\023\375\333\\R\254]BS,0\271\277\232\215F\020\305\252\014i\366\253W\221g\371f\325a\334\217V4Z\265-#K\2326H\247\223\231O\263\326\303\307\340\377\007\206\275+\326\004<\277\005\356gN&FG\227\327\022n\240\2061er\tR\2618\300\355\311\2233X\r(T\336|m;\264 \202\r\322\263?\3309\327pa\013\317\315\331\370[,\\\250H\030\321@\207\347\2103\330\325rtu_\301\023b\350\357\3600\361\037]\\\226\207N\322\273+3\220`;\022*\2739\244H\311\303\352\214+\347y1i\033\306\224\253\033\335\030\304\272\302\353\026u*\305D\212\261D=j\310\301\345zX\021V\225\000\337\364\034#\r\361\210\314\224l\245\215\233\035+&\212\007\312I\214\221f\217\031\315\326x\005\222P\021?\374]\311\024\341BB\265\262d\300"; - PyObject *data = __Pyx_DecompressString(cstring, 3094, 2); + const struct { const unsigned int length: 11; } index[] = {{1},{3},{3},{81},{51},{31},{72},{179},{72},{36},{1},{1},{1},{1},{8},{4},{7},{6},{13},{2},{47},{9},{24},{21},{4},{38},{5},{17},{12},{17},{14},{19},{35},{3},{8},{3},{19},{14},{13},{5},{23},{16},{9},{19},{10},{5},{23},{5},{17},{15},{21},{6},{1},{12},{11},{10},{7},{20},{4},{3},{9},{4},{20},{10},{5},{9},{3},{12},{12},{13},{1},{14},{3},{5},{15},{17},{34},{13},{11},{19},{13},{17},{5},{6},{18},{2},{4},{4},{8},{11},{6},{13},{2},{4},{12},{3},{9},{5},{5},{2},{1},{2},{2},{4},{8},{11},{20},{10},{17},{18},{5},{6},{4},{4},{5},{9},{8},{7},{4},{22},{3},{7},{19},{20},{3},{8},{15},{4},{3},{8},{8},{16},{6},{2},{4},{4},{4},{8},{11},{26},{21},{33},{31},{3},{5},{5},{9},{9},{6},{4},{8},{6},{8},{11},{7},{9},{9},{13},{14},{12},{11},{7},{5},{7},{11},{10},{9},{8},{7},{23},{21},{20},{16},{13},{4},{11},{6},{7},{7},{6},{1},{6},{5},{8},{9},{3},{6},{8},{6},{6},{7},{5},{11},{12},{5},{12},{13},{12},{9},{4},{5},{3},{6},{3},{6},{4},{17},{6},{4},{15},{8},{17},{3},{10},{9},{14},{31},{7},{8},{3},{11},{4},{5},{16},{10},{12},{8},{4},{7},{4},{2},{3},{12},{5},{12},{3},{6},{12},{4},{6},{10},{6},{6},{7},{7},{11},{9},{8},{11},{19},{19},{3},{3},{10},{4},{4},{6},{12},{7},{4},{6},{6},{14},{6},{8},{5},{17},{2},{2},{7},{13},{4},{13},{12},{19},{3},{12},{10},{5},{4},{9},{13},{7},{4},{3},{8},{15},{3},{1},{8},{9},{5},{5},{2},{2},{6},{9},{5},{12},{2},{5},{6},{5},{9},{13},{5},{6},{1},{8},{15},{6},{6},{6},{11},{6},{2},{2},{8},{5},{8},{5},{5},{5},{3},{2},{288},{126},{52},{1141},{392},{2},{2},{139}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3387 bytes) */ +const char* const cstring = "BZh91AY&SY\000\302\362\277\000\001\335\377\377\377\377\377\377\377\377\377\377\277\377\377\377\277\377\377\372@@@@@@@@@@@@@\000@\000`\014_}\365\231\002\217\\>\000y\320\325O\310S)0\232\001\241\215M=\021\211\221\346\246\247\264\311\222x\215$\365?P#\321\2222z\215\006M\003F\231\224\0326Pi\240\320\200L@\023M\0012d\320\231C\021\352\217I\265\003\023 \000\000\000\000\r\003\324<\2204\310\rSD\323M=I\352a\030L\201\246\230A\202\r\0324\0001\000h\r\032b\006\206L\217SL \000\003M\002CQ\251\204\323M\032\"lI\345\036Sz\243A\241\240\000\000\000\000\000\000\000\032\000\000\224\365D$@\006\203C@\365\017SLCLjd\323@\320\000\r\000\000h\323\324\032\000\000\000\002T\002\236\224\315)\352\036M\032\237\252m#54`\320A\243\001\006\214\201\204\030F\000\023\023F\203FA\351\246\243ET`)\322\244$G\031N\247\"\024\306\271\2054\025\005=\314Z\205\306p\304\004a\243\021G\362\017\352\260\242)\010\260\212$\013\002\300\250\252 \241?\342Q)`\272B^\022fn\240\267'\374\0002&u\302\177\320\2008u\252f\306\001H\024\021\004b\026!E*\230V\2535ST4\3051l\014\350\326\260\027]d\224\004\312\345\022\200T\320\314\002\227S@\023\242RQe\266\221,\022!\235\004\224\014\\0r\201\211J\256\221@+H\211 \220!\010\266\000t\001!M\240a\202\225\212\360k\215\214R*\201Eq\022C\016\r\211>\215\264Vu\343!\315 f((\005\311\357\005j\311\300\331h\033\212,\3004\232+\224VAk\256q\2708\241\266\216\025\314HI\202Q\342Q\002\252\270B\020\210\014\021&\027 4\251Np\275\300_\024\224\234\022%\316\373\345z-\357D\3628O\207Mz\226\326\262WWB9\245V\303\347x\2655\310\220\"b_\336_\352le\0174\007(\261\355&)~W{\241\2058>\016sV\270\032\344\201L\253\004\313\237J\024\3547\006\201\274\352\304s\226]\340\3614*\236\335\345\3100\031))\021\307\034\327G\034\327\244D#\275.\215\\\026\326c\214t\261\rk\304b\260CuK\276\215\217.\025\332\331\374ic\221\266\342\267\213\360\250=\221O\257`\rz\205X\255G\036y\037\2110Y\r\2313\275a.?:/\312\246\263\371T\"r\010\212\023\327\323X\322\026\215\024\244\241\214u\007\037\"\030j{I2c\020\022$I\"%J%\017\007\274\322\315s\207$H\334""\211s \204S\307\213Hv!\034\326*\215\036\222Z\335\3301V0\007\230\220@\326 \355\356M`9\347\325N\3453R\236\342\201\023\250\321\253\342\275D\310,\203 \tt\007)7\223\272\335\343\024\216\032\005-@\253c\"\274B\352\372/O\255W&M\216c\343\270\\\006\036\034=\237\271\364yL\275n\216z\274U\337\336\354vr\316.\tu\\\345\374\306\363\255?\225c\372\035u\304Le1\227U2\343\320\207g\001R\376\013\2643K\302\003\317GV\217W\2450\315\300\360\324?\255\376C\333\352\215Z\203\365j\343\373:\361\032x\217j\200,\362{\233\365\003\334+o\237\317\213\033'\365\230f:\374\333\372\200\331\323\252\3135\017&\010\336\360\273\253\275r\303\224\261s0\337\323\261\256\341\312\301\303\310\326\313\001PT\272QJ\366*\311\302\261^\276\333\306\3363\016\024c\270\261\217\307\277z\205p\335\247\270\242i\026\353\366<\031\303\207\203\267\210\353-\340t\001\307\200\305\n\274b\r\0044\252\260\203I\347\014\347\017\007,o\362H{\23460\2439\021\233V\244\316+\264\013\005\330a/(\321Mb\375h\203\207!]B\241M*\200\235\021\361\371\231\322\320t\233\227\317}\005\254tt\341g1|\331\250]\231\006D\336\252\366f\203D6\340/c\030:%\177`5\263g\257\247v\306\301\327r\031\333P\343\334\244\342\253\370;;\241\2040\314\331u\373#\305G\247\335\335\235z\234\236\221\353\260\320\217\310h\206\251\020\010p\371-\220&\232G\225\014h\032\221\302\225\344#\005\246X\242\220\030\006\225b\200qNB\222B\266\262\334\352,`a\\(Z\345\020\212iM\374Kk83\200=\003\335\256\036\307F\010\001\207\205\213(\013\233\334\352 \223\010\024\262\0141\\^\343:!\334\311\214\327\213\257\300#'I\205\315m2\2000\024\031\215\374\366VT ?\233\217\020\354\377\212%\021,\251H_\036\351\266\345]\360\333\225\300F0u\224^\271R\206)\245\376\350%\276#\020\214\211_\035\023)gr8R\324\007\007\014\014W\003L\020@\n\330&\213\033yr\300:J\245\201(x\372\005\007\"r\r]\222\216\306:\271\243@e\014\\R\027{\2309W\355c\006\007*1\323\203r\3352\007,\006fy\271\252\322yN\261\352Y\210\307>9\310\360\243mR\033\377\2670\246\306?\027\003\nD\312\205-\346J\231\200\3476\334\203\233`\035\r\265\313v\255\233 \027B[y\206\027\352%\027%\326m\330*\351[\240l)""\221\231\000\034\037\262\030]\254k\327\253\\I\346\350\"\030\220CZ\2008\254(\225%)\251\225%S\000t-1b\013\214\025\0206\251\254\020\365\257A\034\3119\222\027\017BL\242\025;\323\203\2550\216\212\030\231\322\253$\206\212+%cfx\343\216<3\2159oJ\201\215\264\347\255m\271\217\307\203\006\021\334#\022i@{\314s\034\036\206h;\363A\001\275\357`\276i\"\250\003*5\243\373\204\274g[\357[E\241\315\305\360\321\232\347\206\244a/1\210NU\311\2406\242\22539\261\\\250\026\353J\334\214\006\003\212'\003U\210$\226H\033I\216\037\010\226@+MX=Le\260\245\257\261\245\275\366\n\3053wk\336/px\344\313k\345\330\323S\035\272\242n\362\274K>\007\235\231\200u\010\027{\341$Ghp3\3236\000e@\035\246\002\265\350d\202>+\202\236-n\205kH\352P;\313\337\036\215\003\200\3367\215#\307\333\364]3\252$\341\255}G\263,\342\320~\346\334#\333\303\316{\332\206(\342\321 \031\326;\371\020\220\025\021\355\215\200\2572\256\203B\014u\225\266\003\232\360\003sl\305m\265#\013\342\326\031\231\007~\333{p\330,\334`\037$\211\250\313\306\230\230\257\277cV\014\000\340\364C!\337\300\023\0147\300\312\205EUK\314\005 \371\t\216\273\003\030Y45<\342X\rn\200fb\031'0^\032\324\032c[\306\3278\360,\312O?{\252|k\233\373\254\240(TV\255\346~}6\322\266\035lM\301\027M\257\270n\001\354\032\320\002zv\346\236\025\364]He\273M\010\312I4\002e\013L\206\330#\266\355+\n\030$\030\316\366\232\006\263\261 \250\026:8\352\321C\020\005\\\024\224\017N\205\014\247}\315P\242\371\023!\242k\"J\326\274Q\206n\327i\017\\D@@\203\211\340\030;\016\320\20560\020\233\262\240\014\366\261\260,\267#\220P\020N6\001\010\252\353\266\234!E\225\003(\253a\200\330\021\2136\335\214\033f[C\3610\222\010\255\311t\222\026\306\334\340\234D\212@PH$\022\241C[S\016-\221!\206\005r\310\252\252\360\030\342Z\230Y=-\n@B\363@l\030\240\240>\244\000\227\235dV\307\274\014hg\312\234d#\205\002b\304\014!%\221\230\242\005f\331\202\243\024d\303\271\226\356,\226\216\233H\253\352T\202\254\344\002\254\300\027\250hy\263\214\271\260\206q\350\235\273Z\016\243\361L\253\000\215U\221\0138L\234\205\t@\246@\256 \214\331\320""\224\002\243X\337\003\t\020/f\031,\271$\220,\24008\212\225\"\036\245\t\030\321\031T\225\230i\020]\"F->\327\200\016AZ\265\213\005\006\207\210\326K2Q\256\256p\262\300@\314/;\2064\311\224\035\357]!d\202~<\305\235\213:\007\217\214=-U\276\360,\000\3561\201\352\240\260\340\320\242\001\323zP\204\300\03530u\351\233\340)a\261\353=:B^\010\311\207&33\0020\rr\240\302\247d\225H\006df,0\016\346WrRa\363k\345\002\233\021p\276\344Ay\030Y\261\254\rj^\025\217E\226\267\001B\254\327\007\253\321p\203Wu9\247\265\236\"\343\3146\366Y\357X\3601\220\262\373\034\014;\256\255\216\215\322,\306#\3410\023SZ~\251\201N\300\265\023B\211\010\014\262\361\337\316\030\020\364dYw\316\351\013\245!i\246,.\001\246\266\242\t\007\266CQLr\247W\007m\021\2577\234\272|\031\321\365UT{\032\007V\215\264\211\255\217g\002\332\321SP\2251)\004\244z\022\013\022,\206\201\0218\354\330\270\032ArA\222\301\215OQ\235\025\005e\230\211\003\326\235\323\246\302(\nq\326l\351\372\237KG\037f\357k'\303\000\207\212<\036Xt\242B\235\256\344YK]\270\224\243\275^\363qB\226\247)\036\244\332\261p\300\277.I\225\363KHe6\035\232dN\351\231\220j\215\373n\2506e \307\022TqNy\350\202Ie,\214e\356\274\363a}nK1\346O\022\356\376\357o\354\031e\320J-\312H\2247""\206\002\324?\351\022\037\313\364/o\233\353\336\252}}2\241\266\224\233\372\326\262\325-\271Lh,\022V\224j\\\220\272\321\350\255*a0\010\203\006S\001\261e\333\"c\n\375\314A\003\271\230\030\\\266\250\263\0031\323\301\022\362Z\234\257\243\\\210\214\330\336\216\244\267\342d7\275>\321\254\023\371]F\241\276\332\035\342v#\240\264J\n\033\246\036\241\237o\013`@a\340\372\221<:(>\362_M\202\t2\027(\361\376\340\017j\235$\301H\027\314G3\307\334\206\027\307\226\210\332\246a\005\234O<.\312\002\036\177\206p\205'\014/d\302\375Q\256\263\372\367\364B9\020{-9\253C2\322\004\tU\017h7\321\276\034\256\346h\203\372\207\312\254\004(\016\002\315\2035\370\320(\352\326p\2359\303Q\233\3443\255Z\310\273\r\315\234\327\341)m>\312\371m\2306Q\031\251\35556\2536\002>-\327\253\252\323\265\270\243PC\241\305\215i\255wD\346\222\232*\232\366a\314\210N\322\323\322\343\320\261\242&\312\225\026NVW\216!\220[\030\350\221S\023\036\247{\027\240$g\177\204\214ASZE;\224\343H\306\256\363\374\220#\255jL\224X=\231-\273\2501\006\030\231\372\301\227\323\227\304\006\016\213\014M\326\000\263\360!\231J\276\333\333b\350\020_\233\313\244\343\233\202<\273\365\305\312\333\023\375^\375\322\327\352\343\016\224a\205\220\006\036\314\216\270\232\303\327\216v;J\301Pz5\2373\270\311\277\323\323\207Az\372\233\3170\361JPH\036\273\273\314J\266b\246D\272\207\215\316\004\370!\354\245\225U\214\025\2072h\311HV\226G%\340R\"\034\202\035\324\257A\030\350\302f\016\r\240@\007\0373\201\266#\355\270xO-\325\366R\201J\203o\225U-3\264\271H\277\"\343\225jX\367DY\0265\226\262\2761\0234{A\016\026\317\374]\311\024\341B@\003\013\312\374"; + PyObject *data = __Pyx_DecompressString(cstring, 3387, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (3012 bytes) */ -const char* const cstring = "x\332\215V\313r\333F\026\035\331\224M\333\362C\321#\2663I ?3\036\207\031Jv\036\036')\210\242,N\364\244d[\232\304\323\005\002M\0226\010\200h\200\"]\225\252,\271\304\022K,\261\344\222K-\265\344\222K~B>a\316mH\262c;SS$\032\215F\367\355{\317=\3674\036\347\362\325\334B\265\340\330\276\023x\212\301}\256\373\246c+\266\343+-\3152\215G\212\236\276\024\212\346q9\356z\216\313=\253\243\010\307\363\271\241T=\247\241X\274\352+\276\243xf\255\356\347\376\247A\333yc\323\343\272S\263\315\327\334(5\264\032\307\213\3002\344\344\n\307K-\265\376H\371a\375\255E\373\034\236T\235\3006\024\323V\374:'\227Z\246\001_L\262\222S\nZ\272#-1\355\200+\232\255Y\035a\212\334\272\343s,\321|\245\320\361\353p\314\024\360\3222+\334\323|NA\371\236\251\373\334\243I\266\262Y\334\374\362\301\267\017\260\336\200;/\021\214PDP\321-M\010.\024\247\252T\002\323\362\311\215\216\313EN)U\225\216\023(6\2073\200\303\305\274\267\027\300Y[\021\334\227^\337\325l8\251\021>\014\313M\273vW1L\217\020kqZ\275\254Y\202\347\326\203\006\274\243\275\200\216M\210s\013s<\307\200A\303AC\24164_\257K\263\274\355\3425\246\001\357\200?JW)\337+;o\003\345j~\035\216\360F\272\032\233\361\266)\374\334\375\177\376\250\031\006\303\030\317\351\242e\230B\253X\234\333\324\336\177c\372{\245\246\347\356\325\203Z\r^W5\235\263zP\311\335\3235\275\316\277\024\035\341\363\206\022P\300\242\323\260L\373\225\310\3353Ej\305\260]?\267\276\244z\236\326\371\331vsU\313\001\004v\355\305;\343\201i\373\337\276\310\271vMx\372W\206\343\372\014\026\3009\246\331N\003T\342\342\253\023~\345\334\216\237[t\332\240\236h-i\0005\267t\374n\r@Y\010\255dWA\034[\347e.\002\313\367s\333\322\234$\236\360\003\327\342?K_\356+\362\366\"\035:\261x_\371\343\212\027\352\372\306\232\272\272\307vV\312\305\355\225\215\325%\325\356,\252\205\237\0267\326\213p\245\260\242\226\326\231\272\271Y\336\330e\333\245\265\315\325bacu\243\314\026\237\224\347\237\224\325\2757O\345'\213`\254\3359*\233\202f\351\201%yQ\364<\307[*\356\024\013;\245\215u\266\266\261T\\\335&o\226=\255\301\227M\320z\245\250\356\254""\251\233l\271\264Z\\W\327\212l\373\351\362riW:)\033P\276\214J\222\246\336\301\240d\313\232,\036\363\251@TYU\367\212\345m\271\025[FX\305\362\332Fys\205\025V7\266\213i\267\014\177\216R\265\376t\215=SWKK\254\210\000w\312X\266\275\356\330|\263\264\272I\224\324\035\217\243Sgl\263\323\306\265\204\352b\353\274\r\237\252[O7v\212l\035x\225U\304W.\356\224\331N\271X\004\036o#}\0020[|\236\366\331bi]-\3571M\327\271\013>\262\212\323\346B\263,\315r\353\332\021?*\271\206\314|\372\330a'd9\036\260\264\n\267\216\037\032\232\373V\227y\\\220*\035\017\t\nC\243x5A\225\256\211\216\255\233N\016\303N\000\366b\363\266F.\240\210*\232\376\252\002\004*p\212\2316*BT\220(\257S\261\360\363v\251\331\2538\216U!\t\003\363\313p\013s\361\337t@zA\353\362\324\314W<]\317\353\363:6\325!O5\307\353\350\034\022\3401\024&\300\345\372+\n\035\336\0320\245\331zG\216\271d\2061):\254\306}\023\345H\217\360\023\0161\337C\301\222\227\272\345\010.\033CG\320:\366\206b\30205Z\372$%\027\367\026\3670\356v\010\010\010\030\023Z\303\205\301\032\363\210\250\272\033\3508\026\\\030Jo\307\265J\347\302;C\362\210\200\266\350\201\241\351\255y\275\345\027\034\313\361\014\325X4\300lF\262s\234*\226\246\320\340-S\347F\3250\033*\256E\212\236.D\314\2452T4a\352\342\203\"\361\301\301\034\253\232\266\301H\005\377d\302\211\013\006\345\233\0335\004\300R\354q\013\032\362\274\340TS\202\007\200\326\340\232\315QMRF\201\213\274\013\314m\233>\265>\267\215\252Y#VUM\213\313\255e\207\264\022\035\030\306\016\224\202\364a_\363l\230\021\344\347\221.\210\267\234\226\022%\233\205\371\252c\031pKZ\304i\311\340\235\333\241\236$,c\325\300\326\031x`C\276=\320a\333\367\002\335\017<\230G\3457\020\024\006\331\273\230\323\230\354\261\324~\315\323*\354\230\020x\350\324!*\334\253\013\027l2\315\232\rb\310\343W6\314v\323\273W\253\230\215\032\376r\244&\2754\033t\264\233\rQw\366\315\006\352\307\022\010\014H\221:\261\324\210\355\006>\363eV@\346\205yS0\255\245\231\026\035!\014\017'\225\207\276\001\2456\251@\320O?J\210\361t\211\227\334\177\305=\233C\032:\334\023DG\272\032""\216\360Y\033\221\005\236_\267HFk\300\322\240\013\t\201%\024\030t\nR\200zA\353\273\226\343\223\244\270\035\3525\264v\003\032\020x\034\004\267k~\375\217O\271\307\226\243\343\354\376!w\004z\203\013\201\240\032\246!K\263a\332\370\253\000\201J\237@\226@\247h\377a{\307\010\020.\356\236[G\221\324:\3056c6\244\037-8e;\014\2310\000}\303vq~\"\363')\222,\220M.\375\270p\252UT\031\021E\252\014p\255\001A\300\354\"\350T\247 \201\206\206\026G\204O\211B\304\370\324C\2068n\302M\277L\\\323Js\344\232.'Mq\3156\370\3020\20558}>\261\335\367\207\366\\\313w\241\003\304r\251\246(:\025\327b\212(c\315@\263\322\310\232\201C\025\344A\331R\031\366\344a\225\266D \224\207\355q0\330\226Z\"\233\243\214\202\\\236!\362b^h-N\365\246\233\000\000!\371&}L\331\306Q\241\313\000\360I\3462Fj\226n\214\236\301\253\032v\021u\r\237s(j\332\036\311\250V\211W'\330\212f\300\371kN\245\213\357E|\337Q\010\342\370\3164\343e |\304\344c\n\332:\\G\372\014t\234}\237\274\365-\037\207\301.5{\350{\273\324\354\371\216\357\220\374\371\216\005y\201\266\371\216\247\327e\303R\t\364=\337\303\021B\315\236\374\342LS+\277\225\002\373\310-|xQ\200i\255\311\217@\331\210\375cM\331\367\322\023\016\201\356\313\362m\347\333\363mD\007~\2106\350\336Fc\032\006\304\014w\233N\304v\207z\257M\367\267\261\341\205\t\372\217\237\031f\246\302\207\321\331\250\031\237On'Ao\355\340\352\341\3440s\256;\325U\273[\243\314\225\360t\370]\244F\317\343B\334\034\342q<\3747&\217Q\367\\t5\236\214\347\206\231\313]/\234\r\233\321\371\370n2\231\334H\376\325\253\364\307R\313\027\342|\\Jv{[=\275?\325WG\030|\034\275\306\254\271\241\354\212x.\316\217\260\337LW\033\236\273\324\255\207\3320;\031\316\204Z\330\034e\246\303\345\350\357\361S\232<\035.Ec\321Ld'\205$\030'\034F\031e\240<""\354\3752P\313\203\362\36603>\314~\032\3752\370\333\017}\255\337\374\375\314_\306/\017.}\006\247a~j0\365E\202\00530\205\020'\207\331k\321\344QO\356:<\177\201\376\264%\234\352\356\204\223\341\315\260\034\372Q>Z\212O\305w\222L\242&\333\275S\275[=\255\347\367\347\373[Xs\351\362[\236*\224\230\211n\241\273\017\374D4\007O\341t\253\273\035\216\301\345nu0}'\326\006wW\016\307\016'G\231K]\036\346\001\353\231\250\032\027\223\331\244\331;\335\233\357!\316\013\335o\302\333\204\377\205\356B\327Db\317\305S\261J\246:\240\303\243hK.\370\274?\336\337>\030#\314\267\007W`8\026I\256\177\272\217=1\022^\304\264z\254'\237\365\232\251O\224\226zd\304s\251\335\006\302*\3063\261\221\334L~!n\244\373\346\342\261x\222\266\n\260\244y\344\365}\3407q\221\340\274\320\275\005\216\330H\353\026\361\256\t\177\276\307\212\217@\263B\354'\017{\222\231\247\302[\241\021\315\245\031\313\277g\344&\221\026\351\033e\262\335\361.\262q\271\353\003\t5|\026-DV2\227\310%zx\035.\252\324\255\204g\000h\020-\3077b9`\204s\341\002\242\321\"/\376$\371\251\367\353\201z\2605:w\021I\233\206\225\374\360\334qy\334\212\265\377\363a\224\245\345\327\243y\260\266\224<\357a\243w\006FY\002\256\002:\026\220\335\033\021\3053\312^G\240\312\034\275\313\313\347\331\260\006\350A\345\231\3609*wk\204\360Dx#T\207\307\235Q\366Jx6lb\366\360\243\251\360A\330\212v\343\255\230#\354\367\037\037F\247\242[\310\367\n\270\367\2647\367{\366/\343\331\017\202:\r@P\264\204\371\257\360/H\221\303\224{(_\3544!\251\247\036L\036\334>\220\225qEf\357\233\301\365\037\373\336\301\364\301I>OFv\016g\017\233(\330\367^\374\371\324Q\346jt\032Y[\223:\264\004B\203\215\037\030\272<\270<\007\322,\304\225\301\027\217\3727\006\2177\016=\251\013\327\021\254\026\265\342\347\311r\017$\371$z\200*?\023\327\222\275\236F\274}\004\0227@\266\"\225x\365@M+p\366cj!\032\251\\d\2431\022\247/\"P}\242[J\353}&|\025\177\234\214'{\203\257\327\016\237B,F@j\037,\273\206:]\210\364\370Zr+\321\210\222\231\356rx/*!\007\rH\027\324!\025\240\355(+\231\376\035\211\311L\3704\272\0355\007\312?zc=L\2718\270""\370)\262\3762\031K&G\330\355\023\251\331\3520\3154\224s\n\003\317 \265\222S\223\341\3340{\276{\033 \216Q\347.F\356F\263Q\363\370\341\316\340j.\341\275o\372w\250\300\317\016\316~\014#g\241\326\020x\312p\033\245yn\006\342\344E\223\321=T#itv\23286\025\346GRt\266H\326\257\241PPY\303\314\231\337j\250\264\2235sD\356-b\210F\264l\222\243\247\303\274\224\343h.\036;9\242(\323\022V\302e\t\356\276\351\\\226\356\247\267\021\360\276\005\376\355G\225\370l\034\200\254\345\244\205S\307\350\337\350/R\242\2104)\216\317\243\305\250F\016'\363\311\263^\276\267\324?\205I\313\007s\007y\312\360\003\230\233\300\224\227\220[y\220\375\027\312\265\227\r"; - PyObject *data = __Pyx_DecompressString(cstring, 3012, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (3322 bytes) */ +const char* const cstring = "x\332}VKw\333F\232m\331\224-[\262e=\375\232t\203\212\037\031\217\233\031Jv\234x\234\364\201(\312V\267\236\244\034\333\323q\352\024\201\"\t\033\004@<$2s\372\234,\271\304\022K,\261\344\222K.\275\344\222K\376\204\376\t}\277\202(+vz\316\001\n\205B\325W\337\343\336[x\226\313Wsk\325\202m\371v\340*\272\360\205\346\033\266\245X\266\257\034q\323\320\237*Z\372\321S\270+\344\270\343\332\216p\315\266\342\331\256/t\245\352\332\r\305\024U_\361m\3055ju?\367\377\032\264\354\2176]\241\3315\313\370E\350[\r^\023\370\020\230\272\234\\\021\370\310S\353O\225\037v\317,:\026\360\244j\007\226\256\030\226\342\327\005\271td\350\360\305 +9\245\300\323\035i\211a\005B\341\0267\333\236\341\345vm_`\t\367\225B\333\257\3031\303\203\227\246Q\021.\367\005\005\345\273\206\346\013\227&Y\312~q\377\317\217\276}\204\365:\334y\207`<\305\013*\232\311=Ox\212]U*\201a\372\344F\333\021^N\331\252*m;P,\001g\220\016\007\363\316.\200\263\226\342\t_z}\237[p\222S~\030\226\033V\355\276\242\033.e\354H\320\352Mnz\"\267\0334\340\035\355\205\354X\224qab\216k\3530\250\333h(\324\006\367\265\2724+Z\016>c\032\362\035\210\247\351*\345{\345\360l\242\034\356\327\341\210h\244\253\261\231h\031\236\237{\370?\177\341\272\3160&r\232w\244\033\036\257\230BX\324>\374h\372{\245\246\345\036\324\203Z\r^W\271&X=\250\344\036h\\\253\213?{m\317\027\r%\240\200\275v\3034\254\367^\356\201\341\245Vt\313\361s\273\033\252\353\362\366\337-'W5m\244\300\252\275\375d<0,\377\333\2679\307\252y\256\366\265n;>\203\005`\216q\313n\000J\302\373\372\024_9\247\355\347\326\355\226\237\333\030\017\355 ?&\"*\266\034\340t\203#\321\271-\253\n\354X\232(\t/0}?W\226\026%\366\336\246Cgm1\337\005\363\311Q\315\264=!\033]C\"4\354\r\351\205ajx\372&\265\033\317#\341b\334iSr\240\204\314\343\r\007\006k\314%\360kN\240\341|Ah'\2171\351\351\200\371dH\2365\020)\\L\007\370\307O\226\036LZ\240s\355hU;\362\013\266i\273\362\013I\332\270\304,\305\202.\216\014M\350U\335h\250\270\327)!t#\tB\252N\205{\206\346\235\351\346\310\024\316\211@\363\003\304\360\273\322\364\273\2039V5,\235\221\366\376\233\t\247\316\351p\202 \"\364\032\002fi\255\360\010\032\362\240\022D]O\200\253R\266\221>\371\3640\245e\370\324\222\"\310lT\215\032\241\262j\230B\356,;$\320\350\300(\254S\271\322\027\200\312\202-\217\334<\321%\357\214\317U\350\223/,\251\215\262Y[\255\002\321\360L\032\306I\315\340\240\323\246\236\2049c\325\300\322\030;\341\020\020\264/\\\317IO\270Cp\312\253\332n\003\303\345\223lbsHO\003\341b\220}Z*\032\223=\226n[sy\205\215\241\205\2276\335'\314\250C\340\204[\027\204\0215}\254\327=\007\2005\214\232\005\354\311_\005\3310\313I\237n\255b4j\270\344HMFe4\3507\304h\200\273\307F\003,5=\344\003Y""&\335d\251\021\313\t|\346\313Z\202/k\253\206\307\370\0217L:\356\030^N\371\215\276\216#\305 \016\242\237\342\224HE\267\367N\370\357\205k\t\363\275h\233\274\215L\021\350\351n\330\236\317Z\210:p\375\272I\032_C\372u\272QJ\030\003\215\241\241\020!\260\022\255\357\230\266Or\347\264\251\327\340-\\,\315\002\365\216\r\335\2577\240?\300/\230e\325>}\373L\376\032\302\363\020j\303\320\245&4\014\013\227\212\324\220\346PMd]\322\342\374\306#[\017\220\004<]\007\352g\327\332\305\026c\026\3161\264\220|\313f(\232\216\2024,\007\177\000\300\317iE%\226d\223K\177\217\354j\025\027D\003l&\320I\221C\316k\310.J\340 \033\251RB\225u\216\026\007\233OED*\360\313\212\352\t\347#\376\034\303L\353\347\030\216 Is\214\026\274\227\277K\262\3531\314f\rA\177\204\354\365\347Co\034\323w\240H\304!\251\365`\264\212{=\315:c\315\200\233i\250\315\300&\222\272\320\330\364\220p\345i\233\266\2043\220\317r\005\030\200\026\n\t!\225\352&\233\223\352\003\213\256\356\345\275U\217\037\tb\265f 3\210\3227\350?\021\222\221\252\211\214\311;y\241\275~\323?\001\235'\034\306H~S\377\320\323E\225\303\031\257\316\361#\213\177D\232\215\"\"\337\244$\343\232x\315@\010\230!\274\372.\376l)Ro\374d\\\177\027@\206\202\006\242\3671\213}<\367\320\261\217}\212\3077}\333\267I\213}\333\204\234AhQQ\255.\033\226\352\261\357\312\037\352\264\356\362W0\260N\366\306\177%\005\231\322S\376\343\312\306;\036\253\027\t\300\031\235I\365@B^\225\355\372\261\233\036\326\010\367XJB+\337Zm!F\340\312k\201?-4\206\256C\\\361\264\350po\265\251\367\213\341\204\371_'\206\3233t]\2771\234\2740\314,\204\217\243\213Q3\276\234\334M\202\356N\377\306\207\271a\346Rg\241\243v\016F\231k\341\371\360\273H\215^\305\205\2709\304\353d\370\277\230\234\232\013\227B\0366G\231\305p3\372\257\370%M^\0147\242\211h)\262\222\302\340\353\315>\037f\346\303{\321L\374\"YO\364\356Jw\263\227\035e\256tJ""\235\243\360\00062\267\242/\341\264\032\377\334\375\246\267\334k\3663\375\315\017\367\006\373\007\203\203\322(3\335\311\017f\376#R\207S3\0354\262\267L;\243\371ub\264\2608\274y\213\256\223\024]\0133\241\032\036\0143\027\177\365;\337\205\317\243\374p\352\352\340\352\237(\021\243\2142P\036w\177\032\250\245A\251<\314L\016\247\276\210~\032\374\347\017=\336k\376\363\302\037&g\007W\377\010\257\261\303\302`\341\253\004\013\226`\n1\316\r\247nFh\026\303\361\356\267\242,\252sy\232.\332\027\316u\016\303\271\360\313\260\024\372Q>\332\210\317\305\367\222L\242&\345\356\271\356\235.\357\372\275\325\336\001\326\\\235=\361\230\226=\240|\315t\n\235cd\321\213\262p\027\236\037u\312\341\004\374\356T\007\213\367b>\270\377\342\303\304\207\271Q\346jG\204y$\367BT\215\213\311r\322\354\236\357\256v\021\354t\347Ix\227\2520\335Y\353\030(\357\245x!V\311T\033\240x\032\035\310\005\177\352M\366\312\375\t\312}yp\r\206c/\311\365\316\367\260'F\302+\230V\217\265\344\217\335f\352\023\225\247\036\351q6\265\333@X\305x)\326\223/\223\237\010!\351\276\271x\"\236\243\255\002,i\236x\375\020I\234\271B9\235\356\334\001R,\224\367\200\320\327\204?\337c\305<\300V\210\375\344qW\342\363\\x'\324\243lZ\266\374gF\276$\350\242\206\243\314Tg\262\203\222\314v|dB\r\177\214\326\"3\311&r\211\026\336\202\213*u+\341\005$4\2106\343\225X\016\350a6\\C4y\275\335]\007\301\317\365\262\351\344\333\360\255\222\234K\262\243\231\3710\213\314\"\001\205\301\354\375\270\231L&2\344\205\301\342\035d\014\237\357\204\357\200\341\025\254\250'\357{\363@oI\262\344\322\365P\213nB\013\276M\326\0228<=\230\276\215\320\336%\023\311\027]\275w""\267\347\365\263D\222J\224A ?\323\244\021R\007&\216\256a\323\360Qx\024\275\216\017b\201L\314/|\372\372,r\007\331\307\335\322\340\311_I\003^\017^\277\031.\202{\377\274\374\207\311\251\337\305\306\"\352\n\005\"\350\374C\026H=\231B\334B\226f$\203\324\376\\\377n_\262\374\232\004\341\223\301\255\277\364\334\376b\377\024\226\247#\207\037\226?4\241?\237}\370\367SG\231\033\321y\200oG\212\352\006x\tR\375\316\320\354`6\013\354\257\305\225\301WO{+\203g{\037\\)s\267\242;\300\346Q\374*\331\354\002\353\267\243G\300\335\205\270\226\274\351\362\223\257\303\251+\235\003R\200\264S\223\354\344D\n\005\260\273\r\251y\333\223T\375\036\352\373\005\330\035\014\036\252\375\345~3\025\235\345\353\303\271\371!\364\362T)\247\242\t\222\346\257\"\254\232\351l\245R\267\024\276\217\257\003\ro\006\337\354|x\t\235\034!\261\307\340\326M\250\323Z\244\3057\223;\250(\210\230\351l\206\017\242-\324\256\001\341\206:\246\332[\216\246$\277\277#\035]\n_\022\203\006\312\177w'\272\230rep\345\013\340\234\3002G\200\276-\317\253\347\304\337\005\"\364p\346j\207Cx~\216\277Int\347\272w\241E3i\316\3638`$d\257J\241\005\306.w\356\342\313\004u\356c\344~\264\0345\307/\367\0067r\211\350>\351\335#\301\2738\270x\035\252x\021g\030\216=\202J\013Rui\t\264t\243\271\350\001\324\211N\256T\337\341\310H\2120\252J6\362H\032\345x\022\221\326\222\003\n\376R\347&\220L\376f.\374Z\203 \235\232\312\312\342\020\00291\267IY9O%\303\001\021e\343\211\323#\235\220$\353@\211\334@\024\037;\2632\252\3641\312\020\023yx\034U\342\213q\200\"\227\222#\034\321zo\245\267\336\253\222\212\215\017\275W\321zT\2438\222\325\344\307n\276\273\001\336\257\3646\373\331~\236P\361\010\346f0\345\035N%y\352\377\013\356\316zr"; + PyObject *data = __Pyx_DecompressString(cstring, 3322, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #else /* compression: none (4961 bytes) */ -const char* const bytes = "<.1f.3fContour detection not valid: contours are not properly sorted from left to right.Contour detection not valid: no contours recognizedImage could not be read from: >No contours were found in the provided image. Can not continue analysis.Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Number of counted electrodes does not match the expected value: count = The provided path seems not to exist.,;?add_note.csvdisableenable, expected = gc.*huggingface_hub.*cache-system uses symlinks.*isenablednpt.NDArray[np.floating]npt.NDArray[np.uint8].pngsrc/dopt_sensor_anomalies/detection.pyt.Boxt.CsvDatat.DetectionModelst.InferenceResultt.SensorImagestuple[float, float]tuple[t.CsvData, t.SensorImages]ANOMALY_THRESHOLDAnyBACKBONEBoxCHAIN_APPROX_SIMPLECOLOR_BGR2GRAYCOLOR_BGR2RGBCannyContourCalculationErrorDETECTION_MODELSDataFrameFinalHEATMAP_FILENAME_SUFFIXImageImageNotReadErrorInferenceResultInvalidElectrodeCountLAYERSMODEL_FOLDERMORPH_CLOSEMORPH_RECTNDArrayNUM_VALID_ELECTRODESNonePILPatchcorePath__Pyx_PyDict_NextRefQUOTE_NONERATIORETR_TREERGBSensorImagesTHRESHOLD_BWTHRESH_BINARY_accepted_boxesallalphaanomalib.modelsanomaly_detectionanomaly_labelanomaly_mapanomaly_map_resizedanomaly_scorearrayastypeasyncio.coroutinesaxaxesaxisbackbonebbox_inchesbinaryblblbrXblbrYboolboundingRectboxboxPointsbox_1box_2brcc1c2castcategorycenter_distcheck_box_redundancycheckpoint__class_getitem__cline_in_tracebackcloseclosedcmapcntsconstconstantscontoursconvertcopycoreset_sampling_ratiocpucroppedcropped_sensor_leftcropped_sensor_rightcsvcudacv2cvtColordAdBdata_csvdetection_modelsdevicedfdimAdimBdistdistancedopt_basicsdopt_sensor_anomaliesdopt_sensor_anomalies._find_pathsdopt_sensor_anomalies.detectiondtypeedged__enter__enumerateerrorseuclideanevalexistingexists__exit__extendfigsizefile_pathfile_stemfiltered_cntsfilterwarningsfindContours_find_pathsfloatfloat32folder_pat""hfrom_numpyfromarray__func__genexprgetStructuringElementget_detection_modelsget_model_foldergrab_contoursgrayheaderhspaceiignoreimageimage_npimage_rgbimgimg_npimg_pathimreadimshowimutilsindexinfer_imageinput_tensorint32is_available_is_coroutineis_duplicateis_sorteditemitemsjetkernellayersleftleftmost_x_fourthlinalgloadload_state_dict__main__matplotlib.pyplotmaxmeasure_lengthmeasure_length..genexprmessagemidpointminminAreaRectmodemodelmodel_state_dict__module__morphologyEx__name__nextno_gradnormnpnptnum_contoursnumpynumpy.typingofforder_pointsorigoutputpad_inchespandasparentpathlibpermuteperspectivepil_imagepipelinepixels_per_metric_Xpixels_per_metric_Ypltpoppred_scorept_Apt_Bpyplot__qualname__quotingrboxresizeresultresult_patternreturnrightrightmost_x_thirds1s2savefigscipy.spatialsendsensor_imagessep__set_name__setdefaultshapesidesize_diffsort_contourssqueezestemstrsubplotssubplots_adjustt__test__thresholdthrowtighttltlblXtlblYtltrXtltrYtoto_csvtolerancetorchtorch_devicetrtrbrXtrbrYtypestypinguint8unsqueezeuser_img_pathvaluevalueswwarningswrap_resultwspacex1x2x_coordsx_maxx_middlex_miny_maxy_minzip\200\001\330\013\014\330\013\014\330\005\006\330\004\023\2205\230\007\230q\240\n\250%\250u\260M\300\030\310\021\330\004\t\210\023\210A\210Q\340\004\020\220\003\2209\230A\230W\240C\240q\330\004\020\220\005\220Z\230q\240\001\330\004\020\220\t\230\030\240\021\240!\330\004\017\210r\220\026\220q\230\n\240'\250\021\250\"\250J\260b\270\001\330\004\023\2205\230\013\2401\240I\250X\260Q\260c\270\023\270A\340\004\023\220<\230z\250\021\250!\330\004\023\220<\230s\240!\2401\340\004\t\210\025\210a\330\t\016\210h\220a\330\010\021\220\025\220a\220q\340\004\024\220F\230+\240U\250!\330\004\024\220D\230\001\230\025\230n\250C\250u\3204L\310A\330\004\022\220&\230\014\240H\250B\250d\260\"\260F\270!\340\004\r\210R\210v\220Q\220a\330\004\032\230#\230W\240A\240^\2606\270\026\270q\300\004\300F\310&\320PQ\320QR\340\004\013\2101\320\014\034\230A\330\010\014\210A\330\010\034\230A\330\010\026""\220a\330\010\026\220a\200\001\340\023\024\330\031\032\330\031\032\330\005\006\330\004\020\220\004\220A\220Q\330\004\007\200t\2109\220G\2301\330\010\016\320\016\037\230q\240\001\340\004 \320 5\260\\\320AR\320RS\330\004\005\330\010\035\230\\\320)>\270a\270q\360\006\000\005\017\320\016\036\230n\250A\330\010\023\320\023(\250\001\340\004\025\220Q\330\010\021\220\021\330\010\031\230\021\330\010\021\220\021\330\010\026\220a\200\001\330\n\013\330\n\013\330\005\006\330\004\014\210A\210T\220\021\220#\220R\220t\2301\230D\240\002\240&\250\004\250A\250S\260\002\260$\260a\260t\2702\270Q\200\001\330\016\017\330\031\032\330\031\032\330\005\006\330\004 \240\001\330\004\014\210C\210w\220a\220s\230!\2301\330\004\007\200v\210S\220\001\330\010\016\210f\320\024&\240a\320'H\310\001\310\021\340\004\016\210e\2201\220D\230\006\230f\240E\250\026\250q\260\003\2602\260Q\330\004\013\2107\220%\220q\340\004\013\2103\210i\220q\230\t\240\023\240A\330\004\007\200y\220\003\220:\230Q\230f\240E\250\037\270\005\270S\300\001\340\004\r\210S\320\020&\240a\240s\250.\270\003\2701\330\004\r\210S\220\r\230Q\230h\240c\250\036\260q\330\004\014\210C\210v\220Q\220h\230d\240!\340\004\013\2103\210m\2301\230E\240\025\240d\250#\250\\\270\023\270A\330\004\013\2107\220.\240\001\240\021\330\004\007\200u\210C\210q\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\013\210$\210h\220n\240A\240Q\330\004\017\210q\220\003\220=\240\001\240\022\2401\240C\240t\2505\260\001\330\004\020\220\002\220$\220d\230!\330\004\007\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005#\240!\330\004\037\230q\340\004\010\210\005\210Q\330\010\017\210t\2201\220A\220V\2303\230l\250!\2501\330\010\016\210c\220\032\2301\230A\330\010\016\210b\220\006\220a\220u\230F\240\"\240A\330\010\016\210d\220!\2203\220h\230a\230r\240\033\250K\260}\300A\300Q\340\t\r\210T\220\024\220V\2301\330\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021""\240$\240a\340\010\r\210T\220\032\2302\230W\240I\250W\260A\330\010\r\210T\220\032\2302\230W\240I\250W\260A\340\010\013\2103\210b\220\004\220C\220s\230\"\230A\330\014\r\340\010\032\230!\330 !\340\010\013\2101\330\014\r\340\010\026\220g\230Q\230a\330\010\025\220W\230A\230Q\340\010\017\210s\220\"\220A\330\010\017\210s\220\"\220A\340\010\020\220\007\220q\330\014\r\330\022\023\2204\220v\230X\240Q\240e\2501\330\022\023\2204\220v\230X\240Q\240e\2501\330\022\023\2205\230\002\230$\230f\240H\250A\250U\260!\360\010\000\005\010\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\024\2203\220a\220q\330\004\007\200}\220C\220u\230A\330\010\016\210f\320\024*\250!\330\014\r\330\014&\240a\320'A\300\021\300%\300q\360\006\000\005\020\210q\220\003\2207\320\032?\270r\300\024\300Q\330\004\017\210q\220\003\2207\320\032?\270r\300\024\300T\310\026\310q\320PQ\330\004\017\210q\220\003\2207\320\032?\270r\300\024\300Q\330\004\017\210q\220\003\2207\320\032?\270r\300\024\300T\310\026\310q\320PQ\340\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\017\320\017!\240\022\2403\240b\320(:\270\"\320\270f\300A\200\001\330\016\017\330\026\027\330\016\017\330\023\024\330\005\006\330\004\020\220\010\230\001\330\004\022\220(\230!\340\004\014\210I\220Q\330\010\021\220\025\220k\240\027\250\005\250Y\3206M\310U\320RS\340\004\007\200w\210c\220\031\230!\2303\230c\240\031\250$\250a\340\004\010\210\004\210F\220*\230I\240Q\240m\2606\270\021\330\010\020\220\004\220A\220S\230\010\240\001\240\022\2409\250A\330\010\025\220U\230%\230q\320 0\260\001\260\021\330\010\r\320\r\035\230Q\230j\250\001\250\021\340\010\021\220\033\230A\230W\240A\330\010\020\220\007\220q\230\001\230\023\230A\230V\2401\340\010\r\210T\220\021\220!\330\010\n\210%\210q\220\001\330\010\n\210'\220\021\220'\230\026\230q\330""\010\n\210'\220\021\220&\320\030.\250e\2607\270&\300\001\340\004\007\320\007\027\220q\230\007\230s\240'\250\021\330\004\007\200x\210q\330\t\025\220R\220r\230\021\230*\240A\240U\250!\330\010\024\220A\330\010\023\2201\340\004\007\200v\210Q\340\004\t\210\031\220!\2201\220A\330\004\006\200g\210Q\330\t\025\220R\220r\230\021\230!\330\010\r\210Q\330\010\016\210a\330\010\017\210q\330\010\020\220\003\2201\330\010\014\210A\230!\240\001\200\001\330\013\014\330\013\014\330\004\017\210q\330\005\006\330\004\010\210\004\210D\220\001\330\004\010\210\004\210D\220\001\330\004\017\210q\220\001\330\004\017\210q\220\001\340\004\022\220$\220a\220w\230b\240\007\240u\250A\250R\250v\260Q\260d\270\"\270B\270f\300A\300Q\330\004\020\220\004\220A\220W\230B\230g\240U\250!\2502\250V\2601\260D\270\002\270\"\270F\300!\3001\340\004\013\2104\210q\220\014\230B\230j\250\004\250J\260b\270\001"; + #else /* compression: none (5523 bytes) */ +const char* const bytes = "<.1f.3fContour detection not valid: contours are not properly sorted from left to right.Contour detection not valid: no contours recognizedImage could not be read from: >No contours were found in the provided image. Can not continue analysis.Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Number of counted electrodes does not match the expected value: count = The provided path seems not to exist.,;?add_note.csvdisableenable, expected = gc.*huggingface_hub.*cache-system uses symlinks.*isenablednpt.NDArray[np.floating]npt.NDArray[np.uint8].pngsrc/dopt_sensor_anomalies/detection.pyt.Boxt.DetectionModelst.ExportDatat.InferenceResultt.SensorImagestuple[float, float]tuple[t.ExportData, t.SensorImages]AnyBACKBONEBoxCHAIN_APPROX_SIMPLECOLOR_BGR2GRAYCOLOR_BGR2RGBCannyContourCalculationErrorDETECTION_MODELSDataFrameEXPORT_DATA_SORTINGExportDataFinalHEATMAP_FILENAME_SUFFIXImageImageNotReadErrorInferenceResultInvalidElectrodeCountLAYERSMMODEL_FOLDERMORPH_CLOSEMORPH_RECTNDArrayNUM_VALID_ELECTRODESNonePILPatchcorePath__Pyx_PyDict_NextRefQUOTE_NONERATIORETR_TREERGBSensorImagesTHRESHOLD_BWTHRESH_BINARY_accepted_boxesallalphaanomalib.modelsanomaly_detectionanomaly_detection..genexpranomaly_labelanomaly_mapanomaly_map_resizedanomaly_scoreanomaly_thresholdarrayastypeasyncio.coroutinesaxaxesaxisbackbonebbox_inchesbinarybinary_warpedblboolboundingRectboxboxPointsbox_1box_2brcc1c2castcategorycenter_distcheck_box_redundancycheckpoint__class_getitem__cline_in_tracebackcloseclosedcmapcntsconstconstantscontoursconvertcopycoreset_sampling_ratiocpucroppedcropped_sensor_leftcropped_sensor_rightcsvcsv_datacsv_data_sortedcudacv2cvtColordata_csvdetection_modelsdevicedfdimAdimBdistdistancedopt_basicsdopt_basics.datastructuresdopt_sensor_anomaliesdopt_sensor_anomalies._find_pathsdopt_sensor_anomalies.detectiondstdtypeedged__enter__enumerateerrorsevalexistingexist""s__exit__export_datafigsizefile_pathfile_stemfiltered_cntsfilterwarningsfindContours_find_pathsflattenfloatfloat32folder_pathfrom_numpyfromarray__func__genexprgetPerspectiveTransformgetStructuringElementget_detection_modelsget_model_foldergrab_contoursgraygray_warpedheaderheightAheightBhspaceiignoreimageimage_npimage_rgbimgimg_npimg_pathimreadimshowimutilsindexinfer_imageinput_tensorint32is_available_is_coroutineis_duplicateis_sorteditemitemsjetkernelkeylayersleftleftmost_x_fourthlinalgloadload_state_dict__main__matplotlib.pyplotmaxmax_heightmax_widthmeasure_lengthmeasure_length..genexprmessagemidpointminminAreaRectmodemodelmodel_state_dict__module__morphologyEx__name__nextno_gradnormnpnptnum_contoursnumpynumpy.typingoffoffsetorder_pointsorigoutputpad_inchespandasparentpathlibpermuteperspectivepil_imagepipelinepixel_countpixels_per_metric_Xpixels_per_metric_Ypltpoppred_scorept_Apt_Bpyplot__qualname__quotingrboxresizeresultresult_patternreturnreversedrightrightmost_x_thirds1s2savefigscipy.spatialsendsensor_imagessensor_sizessensor_sizes_sortedsep__set_name__setdefaultshapesidesize_diffsort_contourssqueezestemstrsubplotssubplots_adjustsumt__test__thresholdthrowtighttltoto_csvtolerancetorchtorch_devicetrtypestypinguint8unsqueezeuser_img_pathvaluevalueswwarningswarpPerspectivewarpedwidthAwidthBwrap_resultwspacex1x2x_coordsx_maxx_middlex_miny_maxy_minzip\2201\200\001\330\013\014\330\013\014\330\027\030\330\005\006\330\004\023\2205\230\007\230q\240\n\250%\250u\260M\300\030\310\021\330\004\t\210\023\210A\210Q\340\004\020\220\003\2209\230A\230W\240C\240q\330\004\020\220\005\220Z\230q\240\001\330\004\020\220\t\230\030\240\021\240!\330\004\017\210r\220\026\220q\230\n\240'\250\021\250\"\250J\260b\270\001\330\004\023\2205\230\013\2401\240I\250X\260Q\260c\270\023\270A\340\004\023\220<\230z\250\021\250!\330\004\023\220<\230s\240!\2401\340\004\t\210\025\210a\330\t\016\210h\220a\330\010\021\220\025\220a\220q\340\004\024\220F\230+\240U\250!\330\004\024\220D\230\001\230\025""\230n\250C\320/F\300a\330\004\022\220&\230\014\240H\250B\250d\260\"\260F\270!\340\004\r\210R\210v\220Q\220a\330\004\032\230#\230W\240A\240^\2606\270\026\270q\300\004\300F\310&\320PQ\320QR\340\004\013\2101\320\014\034\230A\330\010\014\210A\330\010\034\230A\330\010\026\220a\330\010\026\220a\200\001\340\023\024\330\031\032\330\031\032\330\027\030\330\005\006\330\004\020\220\004\220A\220Q\330\004\007\200t\2109\220G\2301\330\010\016\320\016\037\230q\240\001\340\004 \320 5\260\\\320AR\320RS\330\004\005\330\010\035\230\\\320)>\270a\270q\360\006\000\005\017\320\016\036\230n\250A\330\010\023\320\023(\250\001\340\004\025\220Q\330\010\021\220\021\330\010\031\230\021\330\010\024\220A\330\010\026\220a\330\010\032\230!\200\001\330\n\013\330\n\013\330\005\006\330\004\014\210A\210T\220\021\220#\220R\220t\2301\230D\240\002\240&\250\004\250A\250S\260\002\260$\260a\260t\2702\270Q\200\001\330\016\017\330\031\032\330\031\032\330\005\006\330\004*\250!\330\004\014\210C\210w\220a\220s\230!\2301\330\004\007\200v\210S\220\001\330\010\016\210f\320\024&\240a\320'H\310\001\310\021\340\004\016\210e\2201\220D\230\006\230f\240E\250\026\250q\260\003\2602\260Q\330\004\013\2107\220%\220q\340\004\013\2103\210i\220q\230\t\240\023\240A\330\004\007\200y\220\003\220:\230Q\230f\240E\250\037\270\005\270S\300\001\340\004\r\210S\320\020&\240a\240s\250.\270\003\2701\330\004\r\210S\220\r\230Q\230h\240c\250\036\260q\330\004\014\210C\210v\220Q\220h\230d\240!\340\004\013\2103\210m\2301\230E\240\025\240d\250#\250\\\270\023\270A\330\004\013\2107\220.\240\001\240\021\330\004\007\200u\210C\210q\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\013\210$\210h\220n\240A\240Q\330\004\017\210q\220\003\220=\240\001\240\022\2401\240C\240t\2505\260\001\330\004\020\220\002\220$\220d\230!\330\004\007\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005#\240!\330\004\037\230q\340\004\010\210\005\210Q\330\010\017\210t\2201\220A\220V\2303\230l\250!\2501\330\010\016\210c\220\032\2301\230A\330\010\016\210b\220""\006\220a\220u\230F\240\"\240A\330\010\016\210d\220!\2203\220h\230a\230r\240\033\250K\260}\300A\300Q\340\t\r\210T\220\024\220V\2301\340\010\021\220\022\2207\230%\230q\240\003\2402\240Q\330\010\021\220\022\2207\230%\230q\240\003\2402\240Q\330\010\024\220C\220u\230H\240A\340\010\022\220\"\220G\2305\240\001\240\023\240B\240a\330\010\022\220\"\220G\2305\240\001\240\023\240B\240a\330\010\025\220S\230\005\230Y\240a\340\010\013\210:\220R\220t\2303\230k\250\022\2501\330\014\r\340\010\032\230!\330 !\340\010\013\2101\330\014\r\340\010\026\220g\230Q\230a\330\010\025\220W\230A\230Q\340\010\017\210z\230\022\2301\330\010\017\210{\230\"\230A\340\010\021\220\021\340\010\016\210b\220\006\220a\330\014\r\330\020\021\220\030\230\021\330\020\021\220\032\2302\230R\230r\240\030\250\021\330\020\021\220\032\2302\230R\230r\240\030\250\033\260B\260b\270\002\270!\330\020\021\220\030\230\033\240B\240b\250\002\250!\340\014\022\220!\360\006\000\t\r\210C\320\017'\240q\250\005\250Q\330\010\021\220\023\320\024$\240A\330\014\022\220$\220j\240\002\240\"\240B\240h\250k\270\022\2702\270R\270q\360\006\000\t\027\220c\230\031\240!\2408\2503\250a\330\010\013\320\013\033\2303\230j\250\001\250\035\260d\270%\270s\300!\330\010\026\220b\230\004\230A\230^\2503\250a\340\010\024\220G\2301\340\020\022\220!\2204\220v\230X\240Q\240e\2501\330\022\023\2204\220v\230X\240Q\240e\2501\330\022\023\220<\230r\320!5\260R\3207J\310&\320PX\320XY\330\024\031\230\021\360\n\000\005\010\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\024\2203\220a\220q\330\004\007\200}\220C\220u\230A\330\010\016\210f\320\024*\250!\330\014\r\330\014&\240a\320'A\300\021\300%\300q\360\006\000\005\020\210q\220\003\2207\320\032?\270r\300\024\300Q\330\004\017\210q\220\003\2207\320\032?\270r\300\024\300T\310\026\310q\320PQ\330\004\017\210q\220\003\2207\320\032?\270r\300\024\300Q\330\004\017\210q\220\003\2207\320\032?\270r\300\024\300T\310\026\310q\320PQ\340\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\030\230\003\2301""\230M\250\021\250\"\250D\260\003\2601\330\004\017\320\017!\240\022\2403\240b\320(:\270\"\320__pyx_string_tab; Py_ssize_t pos = 0; - for (int i = 0; i < 308; i++) { + for (int i = 0; i < 324; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 33) PyUnicode_InternInPlace(&string); @@ -12780,7 +13952,7 @@ const char* const bytes = "<.1f.3fContour detection not valid: contours are not stringtab[i] = string; pos += bytes_length; } - for (int i = 308; i < 316; i++) { + for (int i = 324; i < 333; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -12791,17 +13963,24 @@ const char* const bytes = "<.1f.3fContour detection not valid: contours are not } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 316; i++) { + for (Py_ssize_t i = 0; i < 333; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 308; - for (Py_ssize_t i=0; i<8; ++i) { + PyObject **table = stringtab + 324; + for (Py_ssize_t i=0; i<9; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING - Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #if PY_VERSION_HEX < 0x030E0000 + if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) + #else + if (PyUnstable_Object_IsUniquelyReferenced(table[i])) + #endif + { + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + } #else Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif @@ -12819,19 +13998,26 @@ const char* const bytes = "<.1f.3fContour detection not valid: contours are not } { PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 4; - int8_t const cint_constants_1[] = {0,1,2,5,6,12,20,50,100}; + int8_t const cint_constants_1[] = {0,1,2,5,6,12,20,50,80,100}; int16_t const cint_constants_2[] = {255,500,1500}; - for (int i = 0; i < 12; i++) { - numbertab[i] = PyLong_FromLong((i < 9 ? cint_constants_1[i - 0] : cint_constants_2[i - 9])); + for (int i = 0; i < 13; i++) { + numbertab[i] = PyLong_FromLong((i < 10 ? cint_constants_1[i - 0] : cint_constants_2[i - 10])); if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = __pyx_mstate->__pyx_number_tab; - for (Py_ssize_t i=0; i<16; ++i) { + for (Py_ssize_t i=0; i<17; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING - Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #if PY_VERSION_HEX < 0x030E0000 + if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) + #else + if (PyUnstable_Object_IsUniquelyReferenced(table[i])) + #endif + { + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + } #else Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif @@ -12849,7 +14035,7 @@ typedef struct { unsigned int num_kwonly_args : 1; unsigned int nlocals : 6; unsigned int flags : 10; - unsigned int first_line : 8; + unsigned int first_line : 9; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( @@ -12866,64 +14052,69 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 84}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 85}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x1, __pyx_mstate->__pyx_n_u_x2}; __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 112}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 114}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_existing}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 143}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 168}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 144}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 169}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 145}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 170}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 146}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 171}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 32}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 265}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 33}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt_A, __pyx_mstate->__pyx_n_u_pt_B}; - __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_midpoint, __pyx_mstate->__pyx_kp_b_iso88591_AT_Rt1D_AS_at2Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_midpoint, __pyx_mstate->__pyx_kp_b_iso88591_AT_Rt1D_AS_at2Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 39}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 40}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_box_1, __pyx_mstate->__pyx_n_u_box_2, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_c1, __pyx_mstate->__pyx_n_u_s1, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_c2, __pyx_mstate->__pyx_n_u_s2, __pyx_mstate->__pyx_n_u_center_dist, __pyx_mstate->__pyx_n_u_size_diff}; - __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_check_box_redundancy, __pyx_mstate->__pyx_kp_b_iso88591_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_check_box_redundancy, __pyx_mstate->__pyx_kp_b_iso88591_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 56, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 55}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_cropped, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_gray, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_binary, __pyx_mstate->__pyx_n_u_kernel, __pyx_mstate->__pyx_n_u_closed, __pyx_mstate->__pyx_n_u_edged, __pyx_mstate->__pyx_n_u_cnts, __pyx_mstate->__pyx_n_u_x_coords, __pyx_mstate->__pyx_n_u_is_sorted, __pyx_mstate->__pyx_n_u_accepted_boxes, __pyx_mstate->__pyx_n_u_filtered_cnts, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_rbox, __pyx_mstate->__pyx_n_u_box, __pyx_mstate->__pyx_n_u_tl, __pyx_mstate->__pyx_n_u_tr, __pyx_mstate->__pyx_n_u_br, __pyx_mstate->__pyx_n_u_bl, __pyx_mstate->__pyx_n_u_tltrX, __pyx_mstate->__pyx_n_u_tltrY, __pyx_mstate->__pyx_n_u_blbrX, __pyx_mstate->__pyx_n_u_blbrY, __pyx_mstate->__pyx_n_u_tlblX, __pyx_mstate->__pyx_n_u_tlblY, __pyx_mstate->__pyx_n_u_trbrX, __pyx_mstate->__pyx_n_u_trbrY, __pyx_mstate->__pyx_n_u_dA, __pyx_mstate->__pyx_n_u_dB, __pyx_mstate->__pyx_n_u_is_duplicate, __pyx_mstate->__pyx_n_u_dimA, __pyx_mstate->__pyx_n_u_dimB, __pyx_mstate->__pyx_n_u_num_contours, __pyx_mstate->__pyx_n_u_x_min, __pyx_mstate->__pyx_n_u_x_max, __pyx_mstate->__pyx_n_u_y_min, __pyx_mstate->__pyx_n_u_y_max, __pyx_mstate->__pyx_n_u_rightmost_x_third, __pyx_mstate->__pyx_n_u_leftmost_x_fourth, __pyx_mstate->__pyx_n_u_x_middle, __pyx_mstate->__pyx_n_u_cropped_sensor_left, __pyx_mstate->__pyx_n_u_cropped_sensor_right, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; - __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_measure_length, __pyx_mstate->__pyx_kp_b_iso88591_Cwas_1_vS_f_a_H_e1D_fE_q_2Q_7_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 61, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 56}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_sensor_sizes, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_cropped, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_gray, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_binary, __pyx_mstate->__pyx_n_u_kernel, __pyx_mstate->__pyx_n_u_closed, __pyx_mstate->__pyx_n_u_edged, __pyx_mstate->__pyx_n_u_cnts, __pyx_mstate->__pyx_n_u_x_coords, __pyx_mstate->__pyx_n_u_is_sorted, __pyx_mstate->__pyx_n_u_accepted_boxes, __pyx_mstate->__pyx_n_u_filtered_cnts, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_rbox, __pyx_mstate->__pyx_n_u_box, __pyx_mstate->__pyx_n_u_tl, __pyx_mstate->__pyx_n_u_tr, __pyx_mstate->__pyx_n_u_br, __pyx_mstate->__pyx_n_u_bl, __pyx_mstate->__pyx_n_u_widthA, __pyx_mstate->__pyx_n_u_widthB, __pyx_mstate->__pyx_n_u_max_width, __pyx_mstate->__pyx_n_u_heightA, __pyx_mstate->__pyx_n_u_heightB, __pyx_mstate->__pyx_n_u_max_height, __pyx_mstate->__pyx_n_u_is_duplicate, __pyx_mstate->__pyx_n_u_dimA, __pyx_mstate->__pyx_n_u_dimB, __pyx_mstate->__pyx_n_u_offset, __pyx_mstate->__pyx_n_u_dst, __pyx_mstate->__pyx_n_u_M, __pyx_mstate->__pyx_n_u_warped, __pyx_mstate->__pyx_n_u_gray_warped, __pyx_mstate->__pyx_n_u_binary_warped, __pyx_mstate->__pyx_n_u_pixel_count, __pyx_mstate->__pyx_n_u_num_contours, __pyx_mstate->__pyx_n_u_x_min, __pyx_mstate->__pyx_n_u_x_max, __pyx_mstate->__pyx_n_u_y_min, __pyx_mstate->__pyx_n_u_y_max, __pyx_mstate->__pyx_n_u_rightmost_x_third, __pyx_mstate->__pyx_n_u_leftmost_x_fourth, __pyx_mstate->__pyx_n_u_x_middle, __pyx_mstate->__pyx_n_u_cropped_sensor_left, __pyx_mstate->__pyx_n_u_cropped_sensor_right, __pyx_mstate->__pyx_n_u_sensor_sizes_sorted, __pyx_mstate->__pyx_n_u_export_data, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_measure_length, __pyx_mstate->__pyx_kp_b_iso88591_Cwas_1_vS_f_a_H_e1D_fE_q_2Q_7_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 158}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_torch_device, __pyx_mstate->__pyx_n_u_image_rgb, __pyx_mstate->__pyx_n_u_pil_image, __pyx_mstate->__pyx_n_u_image_np, __pyx_mstate->__pyx_n_u_input_tensor, __pyx_mstate->__pyx_n_u_output, __pyx_mstate->__pyx_n_u_anomaly_score, __pyx_mstate->__pyx_n_u_anomaly_label, __pyx_mstate->__pyx_n_u_anomaly_map, __pyx_mstate->__pyx_n_u_img_np, __pyx_mstate->__pyx_n_u_anomaly_map_resized}; - __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_infer_image, __pyx_mstate->__pyx_kp_b_iso88591_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 189}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_anomaly_threshold, __pyx_mstate->__pyx_n_u_torch_device, __pyx_mstate->__pyx_n_u_image_rgb, __pyx_mstate->__pyx_n_u_pil_image, __pyx_mstate->__pyx_n_u_image_np, __pyx_mstate->__pyx_n_u_input_tensor, __pyx_mstate->__pyx_n_u_output, __pyx_mstate->__pyx_n_u_anomaly_score, __pyx_mstate->__pyx_n_u_anomaly_label, __pyx_mstate->__pyx_n_u_anomaly_map, __pyx_mstate->__pyx_n_u_img_np, __pyx_mstate->__pyx_n_u_anomaly_map_resized}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_infer_image, __pyx_mstate->__pyx_kp_b_iso88591_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 193}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_detection_models, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images, __pyx_mstate->__pyx_n_u_file_stem, __pyx_mstate->__pyx_n_u_folder_path, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_axes, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_side, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_checkpoint, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_df}; - __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_anomaly_detection, __pyx_mstate->__pyx_kp_b_iso88591_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 225}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_detection_models, __pyx_mstate->__pyx_n_u_export_data, __pyx_mstate->__pyx_n_u_sensor_images, __pyx_mstate->__pyx_n_u_anomaly_threshold, __pyx_mstate->__pyx_n_u_file_stem, __pyx_mstate->__pyx_n_u_folder_path, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_axes, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_side, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_checkpoint, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_csv_data_sorted, __pyx_mstate->__pyx_n_u_csv_data, __pyx_mstate->__pyx_n_u_df, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_anomaly_detection, __pyx_mstate->__pyx_kp_b_iso88591_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 239}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_user_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_file_path, __pyx_mstate->__pyx_n_u_MODEL_FOLDER, __pyx_mstate->__pyx_n_u_DETECTION_MODELS, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images}; - __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_pipeline, __pyx_mstate->__pyx_kp_b_iso88591_AQ_t9G1_q_5_ARRS_aq_nA_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 280}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_user_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_anomaly_threshold, __pyx_mstate->__pyx_n_u_file_path, __pyx_mstate->__pyx_n_u_MODEL_FOLDER, __pyx_mstate->__pyx_n_u_DETECTION_MODELS, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_pipeline, __pyx_mstate->__pyx_kp_b_iso88591_AQ_t9G1_q_5_ARRS_aq_nA_Q_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; @@ -14953,6 +16144,165 @@ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyO } #endif +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + const long a = intval; + long b; + const PY_LONG_LONG lla = intval; + PY_LONG_LONG llb; + if (unlikely(__Pyx_PyLong_IsZero(op2))) { + return __Pyx_NewRef(op2); + } + const int is_positive = __Pyx_PyLong_IsPos(op2); + const digit* digits = __Pyx_PyLong_Digits(op2); + const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2); + if (likely(size == 1)) { + b = (long) digits[0]; + if (!is_positive) b *= -1; + } else { + switch (size) { + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) b *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) llb *= -1; + goto calculate_long_long; + } + break; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) b *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) llb *= -1; + goto calculate_long_long; + } + break; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) b *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) llb *= -1; + goto calculate_long_long; + } + break; + } + return PyLong_Type.tp_as_number->nb_multiply(op1, op2); + } + calculate_long: + CYTHON_UNUSED_VAR(a); + CYTHON_UNUSED_VAR(b); + llb = b; + goto calculate_long_long; + calculate_long_long: + { + PY_LONG_LONG llx; + llx = lla * llb; + return PyLong_FromLongLong(llx); + } + +} +#endif +static PyObject* __Pyx_Float___Pyx_PyLong_MultiplyCObj(PyObject *float_val, long intval, int zerodivision_check) { + CYTHON_UNUSED_VAR(zerodivision_check); + const long a = intval; + double b = __Pyx_PyFloat_AS_DOUBLE(float_val); + double result; + + result = ((double)a) * (double)b; + return PyFloat_FromDouble(result); +} +static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(zerodivision_check); + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op2))) { + return __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op2)) { + return __Pyx_Float___Pyx_PyLong_MultiplyCObj(op2, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(op1, op2, inplace); +} +#endif + +/* PyLongCompare */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + Py_RETURN_TRUE; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + if (__Pyx_PyLong_IsZero(op1) == 1) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + Py_RETURN_FALSE; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + Py_RETURN_FALSE; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + return ( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + /* PyObjectFormat */ #if CYTHON_USE_UNICODE_WRITER static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { @@ -16565,13 +17915,13 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { /* dict_setdefault (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { PyObject* value; -#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 +#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4) + PyDict_SetDefaultRef(d, key, default_value, &value); +#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 PyObject *args[] = {d, key, default_value}; value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #elif CYTHON_COMPILING_IN_LIMITED_API value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); -#elif PY_VERSION_HEX >= 0x030d0000 - PyDict_SetDefaultRef(d, key, default_value, &value); #else value = PyDict_SetDefault(d, key, default_value); if (unlikely(!value)) return NULL; @@ -20346,14 +21696,14 @@ done: /* DecompressString */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { - PyObject *module, *decompress, *compressed_bytes, *decompressed; + PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed; const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; PyObject *methodname = PyUnicode_FromString("decompress"); if (unlikely(!methodname)) return NULL; #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 if (algo == 3) { PyObject *fromlist = Py_BuildValue("[O]", methodname); - if (unlikely(!fromlist)) return NULL; + if (unlikely(!fromlist)) goto bad; module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); Py_DECREF(fromlist); } else diff --git a/src/dopt_sensor_anomalies/detection.py b/src/dopt_sensor_anomalies/detection.py index af82a8b..f0cd963 100644 --- a/src/dopt_sensor_anomalies/detection.py +++ b/src/dopt_sensor_anomalies/detection.py @@ -145,8 +145,8 @@ def measure_length( sensor_sizes.append( ( - f"{dimB:.3f}".replace(".", ","), f"{dimA:.3f}".replace(".", ","), + f"{dimB:.3f}".replace(".", ","), f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace( ".", "," ), diff --git a/tests/test_detection.py b/tests/test_detection.py index b91f8d5..07f2dd2 100644 --- a/tests/test_detection.py +++ b/tests/test_detection.py @@ -69,7 +69,7 @@ def test_measure_length(single_img_path): ) assert len(data["sensor_sizes"]) == 18 assert isinstance(data["sensor_sizes"][0], str) - assert float(data["sensor_sizes"][0].replace(",", ".")) == pytest.approx(1266.932) + assert float(data["sensor_sizes"][0].replace(",", ".")) == pytest.approx(1207.171) img_left = imgs["left"] assert 235 < img_left.shape[0] < 260 assert 910 < img_left.shape[1] < 960