From a9f9ffc5e774e6a0f7d8de0588f6bda2d1d41037 Mon Sep 17 00:00:00 2001 From: foefl Date: Thu, 23 Oct 2025 10:25:30 +0200 Subject: [PATCH] add full pipeline including tests --- src/dopt_sensor_anomalies/detection.c | 3363 ++++++++++++----------- src/dopt_sensor_anomalies/detection.py | 25 +- src/dopt_sensor_anomalies/detection.pyi | 31 +- tests/test_detection.py | 101 +- 4 files changed, 1834 insertions(+), 1686 deletions(-) diff --git a/src/dopt_sensor_anomalies/detection.c b/src/dopt_sensor_anomalies/detection.c index 2e0bf13..3a2666b 100644 --- a/src/dopt_sensor_anomalies/detection.c +++ b/src/dopt_sensor_anomalies/detection.c @@ -1523,7 +1523,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr struct __pyx_ctuple_double__and_double; typedef struct __pyx_ctuple_double__and_double __pyx_ctuple_double__and_double; -/* "dopt_sensor_anomalies/detection.py":37 +/* "dopt_sensor_anomalies/detection.py":41 * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], * ) -> tuple[float, float]: # <<<<<<<<<<<<<< @@ -1535,11 +1535,11 @@ struct __pyx_ctuple_double__and_double { double f1; }; -/* "dopt_sensor_anomalies/detection.py":61 +/* "dopt_sensor_anomalies/detection.py":65 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * pixels_per_metric_X: float, */ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length { @@ -1548,7 +1548,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_ }; -/* "dopt_sensor_anomalies/detection.py":93 +/* "dopt_sensor_anomalies/detection.py":97 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< @@ -1566,7 +1566,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr }; -/* "dopt_sensor_anomalies/detection.py":133 +/* "dopt_sensor_anomalies/detection.py":137 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -1581,7 +1581,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr }; -/* "dopt_sensor_anomalies/detection.py":168 +/* "dopt_sensor_anomalies/detection.py":172 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -1597,7 +1597,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr }; -/* "dopt_sensor_anomalies/detection.py":169 +/* "dopt_sensor_anomalies/detection.py":173 * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -1613,7 +1613,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr }; -/* "dopt_sensor_anomalies/detection.py":170 +/* "dopt_sensor_anomalies/detection.py":174 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -1629,7 +1629,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr }; -/* "dopt_sensor_anomalies/detection.py":171 +/* "dopt_sensor_anomalies/detection.py":175 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -2720,6 +2720,7 @@ int __pyx_module_is_main_dopt_sensor_anomalies__detection = 0; /* Implementation of "dopt_sensor_anomalies.detection" */ /* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_UserWarning; static PyObject *__pyx_builtin_min; static PyObject *__pyx_builtin_max; static PyObject *__pyx_builtin_zip; @@ -2751,7 +2752,6 @@ static const char __pyx_k_dB[] = "dB"; static const char __pyx_k_df[] = "df"; static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_np[] = "np"; -static const char __pyx_k_os[] = "os"; static const char __pyx_k_s1[] = "s1"; static const char __pyx_k_s2[] = "s2"; static const char __pyx_k_tl[] = "tl"; @@ -2806,7 +2806,6 @@ static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_next[] = "next"; static const char __pyx_k_norm[] = "norm"; static const char __pyx_k_orig[] = "orig"; -static const char __pyx_k_path[] = "path"; static const char __pyx_k_pt_A[] = "pt_A"; static const char __pyx_k_pt_B[] = "pt_B"; static const char __pyx_k_rbox[] = "rbox"; @@ -2868,6 +2867,7 @@ static const char __pyx_k_exists[] = "exists"; static const char __pyx_k_extend[] = "extend"; static const char __pyx_k_header[] = "header"; static const char __pyx_k_hspace[] = "hspace"; +static const char __pyx_k_ignore[] = "ignore"; static const char __pyx_k_img_np[] = "img_np"; static const char __pyx_k_imread[] = "imread"; static const char __pyx_k_imshow[] = "imshow"; @@ -2893,6 +2893,7 @@ static const char __pyx_k_figsize[] = "figsize"; static const char __pyx_k_float32[] = "float32"; static const char __pyx_k_genexpr[] = "genexpr"; static const char __pyx_k_imutils[] = "imutils"; +static const char __pyx_k_message[] = "message"; static const char __pyx_k_no_grad[] = "no_grad"; static const char __pyx_k_pathlib[] = "pathlib"; static const char __pyx_k_permute[] = "permute"; @@ -2902,6 +2903,7 @@ static const char __pyx_k_squeeze[] = "squeeze"; static const char __pyx_k_BACKBONE[] = "BACKBONE"; static const char __pyx_k_add_note[] = "add_note"; static const char __pyx_k_backbone[] = "backbone"; +static const char __pyx_k_category[] = "category"; static const char __pyx_k_contours[] = "contours"; static const char __pyx_k_cvtColor[] = "cvtColor"; static const char __pyx_k_data_csv[] = "data_csv"; @@ -2909,13 +2911,13 @@ static const char __pyx_k_distance[] = "distance"; static const char __pyx_k_existing[] = "existing"; static const char __pyx_k_expected[] = ", expected = "; static const char __pyx_k_image_np[] = "image_np"; +static const char __pyx_k_img_path[] = "img_path"; static const char __pyx_k_midpoint[] = "midpoint"; static const char __pyx_k_pipeline[] = "pipeline"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_set_name[] = "__set_name__"; static const char __pyx_k_subplots[] = "subplots"; -static const char __pyx_k_to_dtype[] = "to_dtype"; -static const char __pyx_k_to_image[] = "to_image"; +static const char __pyx_k_warnings[] = "warnings"; static const char __pyx_k_x_coords[] = "x_coords"; static const char __pyx_k_x_middle[] = "x_middle"; static const char __pyx_k_DataFrame[] = "DataFrame"; @@ -2947,13 +2949,16 @@ static const char __pyx_k_pad_inches[] = "pad_inches"; static const char __pyx_k_pred_label[] = "pred_label"; static const char __pyx_k_pred_score[] = "pred_score"; static const char __pyx_k_MORPH_CLOSE[] = "MORPH_CLOSE"; +static const char __pyx_k_UserWarning[] = "UserWarning"; static const char __pyx_k_anomaly_map[] = "anomaly_map"; static const char __pyx_k_bbox_inches[] = "bbox_inches"; static const char __pyx_k_center_dist[] = "center_dist"; +static const char __pyx_k_dopt_basics[] = "dopt_basics"; static const char __pyx_k_folder_path[] = "folder_path"; static const char __pyx_k_infer_image[] = "infer_image"; static const char __pyx_k_minAreaRect[] = "minAreaRect"; static const char __pyx_k_perspective[] = "perspective"; +static const char __pyx_k_wrap_result[] = "wrap_result"; static const char __pyx_k_MODEL_FOLDER[] = "MODEL_FOLDER"; static const char __pyx_k_SensorImages[] = "SensorImages"; static const char __pyx_k_THRESHOLD_BW[] = "THRESHOLD_BW"; @@ -2979,11 +2984,13 @@ static const char __pyx_k_grab_contours[] = "grab_contours"; static const char __pyx_k_scipy_spatial[] = "scipy.spatial"; static const char __pyx_k_sensor_images[] = "sensor_images"; static const char __pyx_k_sort_contours[] = "sort_contours"; +static const char __pyx_k_user_img_path[] = "user_img_path"; static const char __pyx_k_COLOR_BGR2GRAY[] = "COLOR_BGR2GRAY"; static const char __pyx_k_accepted_boxes[] = "accepted_boxes"; +static const char __pyx_k_filterwarnings[] = "filterwarnings"; static const char __pyx_k_measure_length[] = "measure_length"; +static const char __pyx_k_result_pattern[] = "result_pattern"; static const char __pyx_k_t_SensorImages[] = "t.SensorImages"; -static const char __pyx_k_user_file_path[] = "user_file_path"; static const char __pyx_k_AT_Rt1D_AS_at2Q[] = "\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"; static const char __pyx_k_InferenceResult[] = "InferenceResult"; static const char __pyx_k_anomalib_models[] = "anomalib.models"; @@ -3021,25 +3028,25 @@ static const char __pyx_k_coreset_sampling_ratio[] = "coreset_sampling_ratio"; static const char __pyx_k_ContourCalculationError[] = "ContourCalculationError"; static const char __pyx_k_HEATMAP_FILENAME_SUFFIX[] = "HEATMAP_FILENAME_SUFFIX"; static const char __pyx_k_npt_NDArray_np_floating[] = "npt.NDArray[np.floating]"; -static const char __pyx_k_AQ_t9G1_q_5_ARRS_aq_nA_Q_a[] = "\200\001\330\024\025\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\022\220!\330\010\031\230\021\330\010\021\220\021\330\010\026\220a"; +static const char __pyx_k_AQ_t9G1_q_5_ARRS_aq_nA_Q_a[] = "\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"; static const char __pyx_k_Image_could_not_be_read_from[] = "Image could not be read from: >"; static const char __pyx_k_measure_length_locals_genexpr[] = "measure_length..genexpr"; static const char __pyx_k_tuple_t_CsvData_t_SensorImages[] = "tuple[t.CsvData, t.SensorImages]"; -static const char __pyx_k_1_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS[] = "\200\001\330\017\020\330\026\027\330\016\017\330\023\024\330\005\006\330\004\020\220\t\230\021\330\004\022\220)\2301\360\006\000\005\r\210I\220Q\330\010\021\220\025\220k\240\027\250\005\250Y\3206M\310U\320RS\360\014\000\005\010\200w\210c\220\031\230!\2303\230c\240\031\250$\250a\360\006\000\005\t\210\004\210F\220*\230I\240Q\240m\2606\270\021\340\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\024\230[\250\005\250Q\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\024\230Q\330\010\r\210Q\330\010\016\210a\330\010\017\210q\330\010\020\220\003\2201\330\010\014\210A"; static const char __pyx_k_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX[] = "\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\220F\230+\240U\250!\330\004\022\220&\230\014\240H\250B\250d\260\"\260F\270!\360\006\000\005\016\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"; -static const char __pyx_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7[] = "\200\001\330\017\020\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\240r\320)L\310A\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\360\006\000\005\020\210q\220\003\220=\240\001\240\022\2401\240C\240t\2505\260\001\340\004\020\220\002\220$\220d\230!\330\004\007\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\010\000\005#\240!\330\004\037\230q\360\006\000\005\t\210\005\210Q\340\010\017\210t\2201\220A\220V\2303\230l\250!\2501\360\006\000\t\017\210c\220\032\2301\230A\330\010\016\210b\220\006\220a\220u\230F\240\"\240A\340\010\016\210d\220!\2203\220h\230a\230r\240\033\250K\260}\300A\300Q\360\006\000\n\016\210T\220\024\220V\2301\340\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\340\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\360\006\000\t\016\210T\220\032\2302\230W\240I\250W\260A\330\010\r\210T\220\032\2302\230W\240I\250W\260A\360\006\000\t\014\2103\210b\220\004\220C\220s\230\"\230A\330\014\r\360\006\000\t\033\230!\330 !\340\010\013\2101\330\014\r\360\006\000\t\027\220g\230Q\230a\330\010\025\220W\230A\230Q\360\006\000\t\020\210s\220\"\220A\330\010\017\210s\220\"\220A\340\010\020\220\007\220q\330\014\r\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220e\2302\230W\240H\250A\250U\260!\360\010\000\005\010\200t\2101\330\010\016""\210f\320\024,\250A\330\014\r\360\010\000\005\024\2203\220a\220q\330\004\007\200}\220C\220u\230A\330\010\016\210f\320\024*\250!\330\014\016\210a\330\016*\320*E\300U\310!\360\010\000\005\r\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\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"; +static const char __pyx_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7[] = "\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\240r\320)L\310A\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\360\006\000\005\020\210q\220\003\220=\240\001\240\022\2401\240C\240t\2505\260\001\340\004\020\220\002\220$\220d\230!\330\004\007\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\010\000\005#\240!\330\004\037\230q\360\006\000\005\t\210\005\210Q\340\010\017\210t\2201\220A\220V\2303\230l\250!\2501\360\006\000\t\017\210c\220\032\2301\230A\330\010\016\210b\220\006\220a\220u\230F\240\"\240A\340\010\016\210d\220!\2203\220h\230a\230r\240\033\250K\260}\300A\300Q\360\006\000\n\016\210T\220\024\220V\2301\340\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\340\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\360\006\000\t\016\210T\220\032\2302\230W\240I\250W\260A\330\010\r\210T\220\032\2302\230W\240I\250W\260A\360\006\000\t\014\2103\210b\220\004\220C\220s\230\"\230A\330\014\r\360\006\000\t\033\230!\330 !\340\010\013\2101\330\014\r\360\006\000\t\027\220g\230Q\230a\330\010\025\220W\230A\230Q\360\006\000\t\020\210s\220\"\220A\330\010\017\210s\220\"\220A\340\010\020\220\007\220q\330\014\r\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220e\2302\230W\240H\250A\250U\260!\360\010\000\005\010\200t\2101\330\010\016""\210f\320\024,\250A\330\014\r\360\010\000\005\024\2203\220a\220q\330\004\007\200}\220C\220u\230A\330\010\016\210f\320\024*\250!\330\014\016\210a\330\016*\320*E\300U\310!\360\010\000\005\r\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\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"; +static const char __pyx_k_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9[] = "\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!\360\006\000\005\r\210I\220Q\330\010\021\220\025\220k\240\027\250\005\250Y\3206M\310U\320RS\360\006\000\005\010\200w\210c\220\031\230!\2303\230c\240\031\250$\250a\340\004\010\210\004\210F\220*\230I\240Q\240m\2606\270\021\340\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\024\230[\250\005\250Q\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\024\230Q\330\010\r\210Q\330\010\016\210a\330\010\017\210q\330\010\020\220\003\2201\330\010\014\210A"; static const char __pyx_k_dopt_sensor_anomalies_detection[] = "dopt_sensor_anomalies.detection"; +static const char __pyx_k_huggingface_hub_cache_system_us[] = ".*huggingface_hub.*cache-system uses symlinks.*"; static const char __pyx_k_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU[] = "\200\001\330\013\014\330\013\014\330\004\017\210q\330\005\006\340\004\010\210\004\210D\220\001\330\004\010\210\004\210D\220\001\360\006\000\005\020\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"; static const char __pyx_k_C_Users_demon_Documents_EKF_Anal[] = "C:\\Users\\demon\\Documents\\EKF\\Analyse_fuer_Florian\\bild2.bmp"; static const char __pyx_k_Contour_detection_not_valid_cont[] = "Contour detection not valid: contours are not properly sorted from left to right."; static const char __pyx_k_Contour_detection_not_valid_no_c[] = "Contour detection not valid: no contours recognized"; static const char __pyx_k_No_contours_were_found_in_the_pr[] = "No contours were found in the provided image. Can not continue analysis."; static const char __pyx_k_Note_that_Cython_is_deliberately[] = "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."; -static const char __pyx_k_Number_of_counted_electroedes_do[] = "Number of counted electroedes does not match the expected value: count = "; +static const char __pyx_k_Number_of_counted_electrodes_doe[] = "Number of counted electrodes does not match the expected value: count = "; static const char __pyx_k_The_provided_path_seems_not_to_e[] = "The provided path seems not to exist"; static const char __pyx_k_dopt_sensor_anomalies__find_path[] = "dopt_sensor_anomalies._find_paths"; static const char __pyx_k_src_dopt_sensor_anomalies_detect[] = "src/dopt_sensor_anomalies/detection.py"; -static const char __pyx_k_torchvision_transforms_v2_functi[] = "torchvision.transforms.v2.functional"; /* #### Code section: decls ### */ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt_A, PyObject *__pyx_v_pt_B); /* proto */ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundancy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_box_1, PyObject *__pyx_v_box_2, double __pyx_v_tolerance); /* proto */ @@ -3049,10 +3056,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6g static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ 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_file_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y); /* 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_file_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_file_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y); /* 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_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*/ @@ -3116,7 +3123,7 @@ typedef struct { PyObject *__pyx_slice[2]; PyObject *__pyx_tuple[10]; PyObject *__pyx_codeobj_tab[12]; - PyObject *__pyx_string_tab[305]; + PyObject *__pyx_string_tab[311]; PyObject *__pyx_float_0_5; PyObject *__pyx_float_0_8; PyObject *__pyx_float_2_0; @@ -3244,7 +3251,7 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_No_contours_were_found_in_the_pr __pyx_string_tab[30] #define __pyx_n_u_None __pyx_string_tab[31] #define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[32] -#define __pyx_kp_u_Number_of_counted_electroedes_do __pyx_string_tab[33] +#define __pyx_kp_u_Number_of_counted_electrodes_doe __pyx_string_tab[33] #define __pyx_n_u_PIL __pyx_string_tab[34] #define __pyx_n_u_Patchcore __pyx_string_tab[35] #define __pyx_n_u_Path __pyx_string_tab[36] @@ -3256,266 +3263,272 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_n_u_THRESHOLD_BW __pyx_string_tab[42] #define __pyx_n_u_THRESH_BINARY __pyx_string_tab[43] #define __pyx_kp_u_The_provided_path_seems_not_to_e __pyx_string_tab[44] -#define __pyx_kp_u__2 __pyx_string_tab[45] -#define __pyx_kp_u__3 __pyx_string_tab[46] -#define __pyx_kp_u__4 __pyx_string_tab[47] -#define __pyx_kp_u__5 __pyx_string_tab[48] -#define __pyx_n_u__8 __pyx_string_tab[49] -#define __pyx_n_u_accepted_boxes __pyx_string_tab[50] -#define __pyx_kp_u_add_note __pyx_string_tab[51] -#define __pyx_n_u_all __pyx_string_tab[52] -#define __pyx_n_u_alpha __pyx_string_tab[53] -#define __pyx_n_u_anomalib_models __pyx_string_tab[54] -#define __pyx_n_u_anomaly_detection __pyx_string_tab[55] -#define __pyx_n_u_anomaly_label __pyx_string_tab[56] -#define __pyx_n_u_anomaly_map __pyx_string_tab[57] -#define __pyx_n_u_anomaly_map_resized __pyx_string_tab[58] -#define __pyx_n_u_anomaly_score __pyx_string_tab[59] -#define __pyx_n_u_array __pyx_string_tab[60] -#define __pyx_n_u_astype __pyx_string_tab[61] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[62] -#define __pyx_n_u_ax __pyx_string_tab[63] -#define __pyx_n_u_axes __pyx_string_tab[64] -#define __pyx_n_u_axis __pyx_string_tab[65] -#define __pyx_n_u_backbone __pyx_string_tab[66] -#define __pyx_n_u_bbox_inches __pyx_string_tab[67] -#define __pyx_n_u_binary __pyx_string_tab[68] -#define __pyx_n_u_bl __pyx_string_tab[69] -#define __pyx_n_u_blbrX __pyx_string_tab[70] -#define __pyx_n_u_blbrY __pyx_string_tab[71] -#define __pyx_n_u_bool __pyx_string_tab[72] -#define __pyx_n_u_boundingRect __pyx_string_tab[73] -#define __pyx_n_u_box __pyx_string_tab[74] -#define __pyx_n_u_boxPoints __pyx_string_tab[75] -#define __pyx_n_u_box_1 __pyx_string_tab[76] -#define __pyx_n_u_box_2 __pyx_string_tab[77] -#define __pyx_n_u_br __pyx_string_tab[78] -#define __pyx_n_u_c __pyx_string_tab[79] -#define __pyx_n_u_c1 __pyx_string_tab[80] -#define __pyx_n_u_c2 __pyx_string_tab[81] -#define __pyx_n_u_cast __pyx_string_tab[82] -#define __pyx_n_u_center_dist __pyx_string_tab[83] -#define __pyx_n_u_check_box_redundancy __pyx_string_tab[84] -#define __pyx_n_u_checkpoint __pyx_string_tab[85] -#define __pyx_n_u_class_getitem __pyx_string_tab[86] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[87] -#define __pyx_n_u_close __pyx_string_tab[88] -#define __pyx_n_u_closed __pyx_string_tab[89] -#define __pyx_n_u_cmap __pyx_string_tab[90] -#define __pyx_n_u_cnts __pyx_string_tab[91] -#define __pyx_n_u_const __pyx_string_tab[92] -#define __pyx_n_u_constants __pyx_string_tab[93] -#define __pyx_n_u_contours __pyx_string_tab[94] -#define __pyx_n_u_convert __pyx_string_tab[95] -#define __pyx_n_u_copy __pyx_string_tab[96] -#define __pyx_n_u_coreset_sampling_ratio __pyx_string_tab[97] -#define __pyx_n_u_cpu __pyx_string_tab[98] -#define __pyx_n_u_cropped __pyx_string_tab[99] -#define __pyx_n_u_cropped_sensor_left __pyx_string_tab[100] -#define __pyx_n_u_cropped_sensor_right __pyx_string_tab[101] -#define __pyx_kp_u_csv __pyx_string_tab[102] -#define __pyx_n_u_csv_2 __pyx_string_tab[103] -#define __pyx_n_u_cuda __pyx_string_tab[104] -#define __pyx_n_u_cv2 __pyx_string_tab[105] -#define __pyx_n_u_cvtColor __pyx_string_tab[106] -#define __pyx_n_u_dA __pyx_string_tab[107] -#define __pyx_n_u_dB __pyx_string_tab[108] -#define __pyx_n_u_data_csv __pyx_string_tab[109] -#define __pyx_n_u_detection_models __pyx_string_tab[110] -#define __pyx_n_u_device __pyx_string_tab[111] -#define __pyx_n_u_df __pyx_string_tab[112] -#define __pyx_n_u_dimA __pyx_string_tab[113] -#define __pyx_n_u_dimB __pyx_string_tab[114] -#define __pyx_kp_u_disable __pyx_string_tab[115] -#define __pyx_n_u_dist __pyx_string_tab[116] -#define __pyx_n_u_distance __pyx_string_tab[117] -#define __pyx_n_u_dopt_sensor_anomalies __pyx_string_tab[118] -#define __pyx_n_u_dopt_sensor_anomalies__find_path __pyx_string_tab[119] -#define __pyx_n_u_dopt_sensor_anomalies_detection __pyx_string_tab[120] -#define __pyx_n_u_dtype __pyx_string_tab[121] -#define __pyx_n_u_edged __pyx_string_tab[122] -#define __pyx_kp_u_enable __pyx_string_tab[123] -#define __pyx_n_u_enter __pyx_string_tab[124] -#define __pyx_n_u_enumerate __pyx_string_tab[125] -#define __pyx_n_u_errors __pyx_string_tab[126] -#define __pyx_n_u_euclidean __pyx_string_tab[127] -#define __pyx_n_u_eval __pyx_string_tab[128] -#define __pyx_n_u_existing __pyx_string_tab[129] -#define __pyx_n_u_exists __pyx_string_tab[130] -#define __pyx_n_u_exit __pyx_string_tab[131] -#define __pyx_kp_u_expected __pyx_string_tab[132] -#define __pyx_n_u_extend __pyx_string_tab[133] -#define __pyx_n_u_figsize __pyx_string_tab[134] -#define __pyx_n_u_file_path __pyx_string_tab[135] -#define __pyx_n_u_file_stem __pyx_string_tab[136] -#define __pyx_n_u_filtered_cnts __pyx_string_tab[137] -#define __pyx_n_u_findContours __pyx_string_tab[138] -#define __pyx_n_u_find_paths __pyx_string_tab[139] -#define __pyx_n_u_float __pyx_string_tab[140] -#define __pyx_n_u_float32 __pyx_string_tab[141] -#define __pyx_n_u_folder_path __pyx_string_tab[142] -#define __pyx_n_u_from_numpy __pyx_string_tab[143] -#define __pyx_n_u_fromarray __pyx_string_tab[144] -#define __pyx_n_u_func __pyx_string_tab[145] -#define __pyx_kp_u_gc __pyx_string_tab[146] -#define __pyx_n_u_genexpr __pyx_string_tab[147] -#define __pyx_n_u_getStructuringElement __pyx_string_tab[148] -#define __pyx_n_u_get_detection_models __pyx_string_tab[149] -#define __pyx_n_u_get_model_folder __pyx_string_tab[150] -#define __pyx_n_u_grab_contours __pyx_string_tab[151] -#define __pyx_n_u_gray __pyx_string_tab[152] -#define __pyx_n_u_header __pyx_string_tab[153] -#define __pyx_n_u_hspace __pyx_string_tab[154] -#define __pyx_n_u_i __pyx_string_tab[155] -#define __pyx_n_u_image __pyx_string_tab[156] -#define __pyx_n_u_image_np __pyx_string_tab[157] -#define __pyx_n_u_image_rgb __pyx_string_tab[158] -#define __pyx_n_u_img __pyx_string_tab[159] -#define __pyx_n_u_img_np __pyx_string_tab[160] -#define __pyx_n_u_imread __pyx_string_tab[161] -#define __pyx_n_u_imshow __pyx_string_tab[162] -#define __pyx_n_u_imutils __pyx_string_tab[163] -#define __pyx_n_u_index __pyx_string_tab[164] -#define __pyx_n_u_infer_image __pyx_string_tab[165] -#define __pyx_n_u_initializing __pyx_string_tab[166] -#define __pyx_n_u_input_tensor __pyx_string_tab[167] -#define __pyx_n_u_int32 __pyx_string_tab[168] -#define __pyx_n_u_is_available __pyx_string_tab[169] -#define __pyx_n_u_is_coroutine __pyx_string_tab[170] -#define __pyx_n_u_is_duplicate __pyx_string_tab[171] -#define __pyx_n_u_is_sorted __pyx_string_tab[172] -#define __pyx_kp_u_isenabled __pyx_string_tab[173] -#define __pyx_n_u_item __pyx_string_tab[174] -#define __pyx_n_u_items __pyx_string_tab[175] -#define __pyx_n_u_jet __pyx_string_tab[176] -#define __pyx_n_u_kernel __pyx_string_tab[177] -#define __pyx_n_u_layers __pyx_string_tab[178] -#define __pyx_n_u_left __pyx_string_tab[179] -#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[180] -#define __pyx_n_u_linalg __pyx_string_tab[181] -#define __pyx_n_u_load __pyx_string_tab[182] -#define __pyx_n_u_load_state_dict __pyx_string_tab[183] -#define __pyx_n_u_main __pyx_string_tab[184] -#define __pyx_n_u_matplotlib __pyx_string_tab[185] -#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[186] -#define __pyx_n_u_max __pyx_string_tab[187] -#define __pyx_n_u_measure_length __pyx_string_tab[188] -#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[189] -#define __pyx_n_u_midpoint __pyx_string_tab[190] -#define __pyx_n_u_min __pyx_string_tab[191] -#define __pyx_n_u_minAreaRect __pyx_string_tab[192] -#define __pyx_n_u_mode __pyx_string_tab[193] -#define __pyx_n_u_model __pyx_string_tab[194] -#define __pyx_n_u_model_state_dict __pyx_string_tab[195] -#define __pyx_n_u_module __pyx_string_tab[196] -#define __pyx_n_u_morphologyEx __pyx_string_tab[197] -#define __pyx_n_u_name __pyx_string_tab[198] -#define __pyx_n_u_next __pyx_string_tab[199] -#define __pyx_n_u_no_grad __pyx_string_tab[200] -#define __pyx_n_u_norm __pyx_string_tab[201] -#define __pyx_n_u_np __pyx_string_tab[202] -#define __pyx_n_u_npt __pyx_string_tab[203] -#define __pyx_kp_u_npt_NDArray_np_floating __pyx_string_tab[204] -#define __pyx_kp_u_npt_NDArray_np_uint8 __pyx_string_tab[205] -#define __pyx_n_u_num_contours __pyx_string_tab[206] -#define __pyx_n_u_numpy __pyx_string_tab[207] -#define __pyx_n_u_numpy_typing __pyx_string_tab[208] -#define __pyx_n_u_off __pyx_string_tab[209] -#define __pyx_n_u_order_points __pyx_string_tab[210] -#define __pyx_n_u_orig __pyx_string_tab[211] -#define __pyx_n_u_os __pyx_string_tab[212] -#define __pyx_n_u_output __pyx_string_tab[213] -#define __pyx_n_u_pad_inches __pyx_string_tab[214] -#define __pyx_n_u_pandas __pyx_string_tab[215] -#define __pyx_n_u_parent __pyx_string_tab[216] -#define __pyx_n_u_path __pyx_string_tab[217] -#define __pyx_n_u_pathlib __pyx_string_tab[218] -#define __pyx_n_u_permute __pyx_string_tab[219] -#define __pyx_n_u_perspective __pyx_string_tab[220] -#define __pyx_n_u_pil_image __pyx_string_tab[221] -#define __pyx_n_u_pipeline __pyx_string_tab[222] -#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[223] -#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[224] -#define __pyx_n_u_plt __pyx_string_tab[225] -#define __pyx_kp_u_png __pyx_string_tab[226] -#define __pyx_n_u_pop __pyx_string_tab[227] -#define __pyx_n_u_pred_label __pyx_string_tab[228] -#define __pyx_n_u_pred_score __pyx_string_tab[229] -#define __pyx_n_u_pt_A __pyx_string_tab[230] -#define __pyx_n_u_pt_B __pyx_string_tab[231] -#define __pyx_n_u_pyplot __pyx_string_tab[232] -#define __pyx_n_u_qualname __pyx_string_tab[233] -#define __pyx_n_u_quoting __pyx_string_tab[234] -#define __pyx_n_u_rbox __pyx_string_tab[235] -#define __pyx_n_u_resize __pyx_string_tab[236] -#define __pyx_n_u_result __pyx_string_tab[237] -#define __pyx_n_u_return __pyx_string_tab[238] -#define __pyx_n_u_right __pyx_string_tab[239] -#define __pyx_n_u_rightmost_x_third __pyx_string_tab[240] -#define __pyx_n_u_s1 __pyx_string_tab[241] -#define __pyx_n_u_s2 __pyx_string_tab[242] -#define __pyx_n_u_savefig __pyx_string_tab[243] -#define __pyx_n_u_scipy_spatial __pyx_string_tab[244] -#define __pyx_n_u_send __pyx_string_tab[245] -#define __pyx_n_u_sensor_images __pyx_string_tab[246] -#define __pyx_n_u_sep __pyx_string_tab[247] -#define __pyx_n_u_set_name __pyx_string_tab[248] -#define __pyx_n_u_shape __pyx_string_tab[249] -#define __pyx_n_u_side __pyx_string_tab[250] -#define __pyx_n_u_size_diff __pyx_string_tab[251] -#define __pyx_n_u_sort_contours __pyx_string_tab[252] -#define __pyx_n_u_spec __pyx_string_tab[253] -#define __pyx_n_u_squeeze __pyx_string_tab[254] -#define __pyx_kp_u_src_dopt_sensor_anomalies_detect __pyx_string_tab[255] -#define __pyx_n_u_stem __pyx_string_tab[256] -#define __pyx_n_u_str __pyx_string_tab[257] -#define __pyx_n_u_subplots __pyx_string_tab[258] -#define __pyx_n_u_subplots_adjust __pyx_string_tab[259] -#define __pyx_n_u_t __pyx_string_tab[260] -#define __pyx_kp_u_t_Box __pyx_string_tab[261] -#define __pyx_kp_u_t_CsvData __pyx_string_tab[262] -#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[263] -#define __pyx_kp_u_t_InferenceResult __pyx_string_tab[264] -#define __pyx_kp_u_t_SensorImages __pyx_string_tab[265] -#define __pyx_n_u_test __pyx_string_tab[266] -#define __pyx_n_u_threshold __pyx_string_tab[267] -#define __pyx_n_u_throw __pyx_string_tab[268] -#define __pyx_n_u_tight __pyx_string_tab[269] -#define __pyx_n_u_tl __pyx_string_tab[270] -#define __pyx_n_u_tlblX __pyx_string_tab[271] -#define __pyx_n_u_tlblY __pyx_string_tab[272] -#define __pyx_n_u_tltrX __pyx_string_tab[273] -#define __pyx_n_u_tltrY __pyx_string_tab[274] -#define __pyx_n_u_to __pyx_string_tab[275] -#define __pyx_n_u_to_csv __pyx_string_tab[276] -#define __pyx_n_u_to_dtype __pyx_string_tab[277] -#define __pyx_n_u_to_image __pyx_string_tab[278] -#define __pyx_n_u_tolerance __pyx_string_tab[279] -#define __pyx_n_u_torch __pyx_string_tab[280] -#define __pyx_n_u_torch_device __pyx_string_tab[281] -#define __pyx_n_u_torchvision_transforms_v2_functi __pyx_string_tab[282] -#define __pyx_n_u_tr __pyx_string_tab[283] -#define __pyx_n_u_trbrX __pyx_string_tab[284] -#define __pyx_n_u_trbrY __pyx_string_tab[285] -#define __pyx_kp_u_tuple_float_float __pyx_string_tab[286] -#define __pyx_kp_u_tuple_t_CsvData_t_SensorImages __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_file_path __pyx_string_tab[292] -#define __pyx_n_u_value __pyx_string_tab[293] -#define __pyx_n_u_w __pyx_string_tab[294] -#define __pyx_n_u_wspace __pyx_string_tab[295] -#define __pyx_n_u_x1 __pyx_string_tab[296] -#define __pyx_n_u_x2 __pyx_string_tab[297] -#define __pyx_n_u_x_coords __pyx_string_tab[298] -#define __pyx_n_u_x_max __pyx_string_tab[299] -#define __pyx_n_u_x_middle __pyx_string_tab[300] -#define __pyx_n_u_x_min __pyx_string_tab[301] -#define __pyx_n_u_y_max __pyx_string_tab[302] -#define __pyx_n_u_y_min __pyx_string_tab[303] -#define __pyx_n_u_zip __pyx_string_tab[304] +#define __pyx_n_u_UserWarning __pyx_string_tab[45] +#define __pyx_kp_u__2 __pyx_string_tab[46] +#define __pyx_kp_u__3 __pyx_string_tab[47] +#define __pyx_kp_u__4 __pyx_string_tab[48] +#define __pyx_kp_u__5 __pyx_string_tab[49] +#define __pyx_n_u__8 __pyx_string_tab[50] +#define __pyx_n_u_accepted_boxes __pyx_string_tab[51] +#define __pyx_kp_u_add_note __pyx_string_tab[52] +#define __pyx_n_u_all __pyx_string_tab[53] +#define __pyx_n_u_alpha __pyx_string_tab[54] +#define __pyx_n_u_anomalib_models __pyx_string_tab[55] +#define __pyx_n_u_anomaly_detection __pyx_string_tab[56] +#define __pyx_n_u_anomaly_label __pyx_string_tab[57] +#define __pyx_n_u_anomaly_map __pyx_string_tab[58] +#define __pyx_n_u_anomaly_map_resized __pyx_string_tab[59] +#define __pyx_n_u_anomaly_score __pyx_string_tab[60] +#define __pyx_n_u_array __pyx_string_tab[61] +#define __pyx_n_u_astype __pyx_string_tab[62] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[63] +#define __pyx_n_u_ax __pyx_string_tab[64] +#define __pyx_n_u_axes __pyx_string_tab[65] +#define __pyx_n_u_axis __pyx_string_tab[66] +#define __pyx_n_u_backbone __pyx_string_tab[67] +#define __pyx_n_u_bbox_inches __pyx_string_tab[68] +#define __pyx_n_u_binary __pyx_string_tab[69] +#define __pyx_n_u_bl __pyx_string_tab[70] +#define __pyx_n_u_blbrX __pyx_string_tab[71] +#define __pyx_n_u_blbrY __pyx_string_tab[72] +#define __pyx_n_u_bool __pyx_string_tab[73] +#define __pyx_n_u_boundingRect __pyx_string_tab[74] +#define __pyx_n_u_box __pyx_string_tab[75] +#define __pyx_n_u_boxPoints __pyx_string_tab[76] +#define __pyx_n_u_box_1 __pyx_string_tab[77] +#define __pyx_n_u_box_2 __pyx_string_tab[78] +#define __pyx_n_u_br __pyx_string_tab[79] +#define __pyx_n_u_c __pyx_string_tab[80] +#define __pyx_n_u_c1 __pyx_string_tab[81] +#define __pyx_n_u_c2 __pyx_string_tab[82] +#define __pyx_n_u_cast __pyx_string_tab[83] +#define __pyx_n_u_category __pyx_string_tab[84] +#define __pyx_n_u_center_dist __pyx_string_tab[85] +#define __pyx_n_u_check_box_redundancy __pyx_string_tab[86] +#define __pyx_n_u_checkpoint __pyx_string_tab[87] +#define __pyx_n_u_class_getitem __pyx_string_tab[88] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[89] +#define __pyx_n_u_close __pyx_string_tab[90] +#define __pyx_n_u_closed __pyx_string_tab[91] +#define __pyx_n_u_cmap __pyx_string_tab[92] +#define __pyx_n_u_cnts __pyx_string_tab[93] +#define __pyx_n_u_const __pyx_string_tab[94] +#define __pyx_n_u_constants __pyx_string_tab[95] +#define __pyx_n_u_contours __pyx_string_tab[96] +#define __pyx_n_u_convert __pyx_string_tab[97] +#define __pyx_n_u_copy __pyx_string_tab[98] +#define __pyx_n_u_coreset_sampling_ratio __pyx_string_tab[99] +#define __pyx_n_u_cpu __pyx_string_tab[100] +#define __pyx_n_u_cropped __pyx_string_tab[101] +#define __pyx_n_u_cropped_sensor_left __pyx_string_tab[102] +#define __pyx_n_u_cropped_sensor_right __pyx_string_tab[103] +#define __pyx_kp_u_csv __pyx_string_tab[104] +#define __pyx_n_u_csv_2 __pyx_string_tab[105] +#define __pyx_n_u_cuda __pyx_string_tab[106] +#define __pyx_n_u_cv2 __pyx_string_tab[107] +#define __pyx_n_u_cvtColor __pyx_string_tab[108] +#define __pyx_n_u_dA __pyx_string_tab[109] +#define __pyx_n_u_dB __pyx_string_tab[110] +#define __pyx_n_u_data_csv __pyx_string_tab[111] +#define __pyx_n_u_detection_models __pyx_string_tab[112] +#define __pyx_n_u_device __pyx_string_tab[113] +#define __pyx_n_u_df __pyx_string_tab[114] +#define __pyx_n_u_dimA __pyx_string_tab[115] +#define __pyx_n_u_dimB __pyx_string_tab[116] +#define __pyx_kp_u_disable __pyx_string_tab[117] +#define __pyx_n_u_dist __pyx_string_tab[118] +#define __pyx_n_u_distance __pyx_string_tab[119] +#define __pyx_n_u_dopt_basics __pyx_string_tab[120] +#define __pyx_n_u_dopt_sensor_anomalies __pyx_string_tab[121] +#define __pyx_n_u_dopt_sensor_anomalies__find_path __pyx_string_tab[122] +#define __pyx_n_u_dopt_sensor_anomalies_detection __pyx_string_tab[123] +#define __pyx_n_u_dtype __pyx_string_tab[124] +#define __pyx_n_u_edged __pyx_string_tab[125] +#define __pyx_kp_u_enable __pyx_string_tab[126] +#define __pyx_n_u_enter __pyx_string_tab[127] +#define __pyx_n_u_enumerate __pyx_string_tab[128] +#define __pyx_n_u_errors __pyx_string_tab[129] +#define __pyx_n_u_euclidean __pyx_string_tab[130] +#define __pyx_n_u_eval __pyx_string_tab[131] +#define __pyx_n_u_existing __pyx_string_tab[132] +#define __pyx_n_u_exists __pyx_string_tab[133] +#define __pyx_n_u_exit __pyx_string_tab[134] +#define __pyx_kp_u_expected __pyx_string_tab[135] +#define __pyx_n_u_extend __pyx_string_tab[136] +#define __pyx_n_u_figsize __pyx_string_tab[137] +#define __pyx_n_u_file_path __pyx_string_tab[138] +#define __pyx_n_u_file_stem __pyx_string_tab[139] +#define __pyx_n_u_filtered_cnts __pyx_string_tab[140] +#define __pyx_n_u_filterwarnings __pyx_string_tab[141] +#define __pyx_n_u_findContours __pyx_string_tab[142] +#define __pyx_n_u_find_paths __pyx_string_tab[143] +#define __pyx_n_u_float __pyx_string_tab[144] +#define __pyx_n_u_float32 __pyx_string_tab[145] +#define __pyx_n_u_folder_path __pyx_string_tab[146] +#define __pyx_n_u_from_numpy __pyx_string_tab[147] +#define __pyx_n_u_fromarray __pyx_string_tab[148] +#define __pyx_n_u_func __pyx_string_tab[149] +#define __pyx_kp_u_gc __pyx_string_tab[150] +#define __pyx_n_u_genexpr __pyx_string_tab[151] +#define __pyx_n_u_getStructuringElement __pyx_string_tab[152] +#define __pyx_n_u_get_detection_models __pyx_string_tab[153] +#define __pyx_n_u_get_model_folder __pyx_string_tab[154] +#define __pyx_n_u_grab_contours __pyx_string_tab[155] +#define __pyx_n_u_gray __pyx_string_tab[156] +#define __pyx_n_u_header __pyx_string_tab[157] +#define __pyx_n_u_hspace __pyx_string_tab[158] +#define __pyx_kp_u_huggingface_hub_cache_system_us __pyx_string_tab[159] +#define __pyx_n_u_i __pyx_string_tab[160] +#define __pyx_n_u_ignore __pyx_string_tab[161] +#define __pyx_n_u_image __pyx_string_tab[162] +#define __pyx_n_u_image_np __pyx_string_tab[163] +#define __pyx_n_u_image_rgb __pyx_string_tab[164] +#define __pyx_n_u_img __pyx_string_tab[165] +#define __pyx_n_u_img_np __pyx_string_tab[166] +#define __pyx_n_u_img_path __pyx_string_tab[167] +#define __pyx_n_u_imread __pyx_string_tab[168] +#define __pyx_n_u_imshow __pyx_string_tab[169] +#define __pyx_n_u_imutils __pyx_string_tab[170] +#define __pyx_n_u_index __pyx_string_tab[171] +#define __pyx_n_u_infer_image __pyx_string_tab[172] +#define __pyx_n_u_initializing __pyx_string_tab[173] +#define __pyx_n_u_input_tensor __pyx_string_tab[174] +#define __pyx_n_u_int32 __pyx_string_tab[175] +#define __pyx_n_u_is_available __pyx_string_tab[176] +#define __pyx_n_u_is_coroutine __pyx_string_tab[177] +#define __pyx_n_u_is_duplicate __pyx_string_tab[178] +#define __pyx_n_u_is_sorted __pyx_string_tab[179] +#define __pyx_kp_u_isenabled __pyx_string_tab[180] +#define __pyx_n_u_item __pyx_string_tab[181] +#define __pyx_n_u_items __pyx_string_tab[182] +#define __pyx_n_u_jet __pyx_string_tab[183] +#define __pyx_n_u_kernel __pyx_string_tab[184] +#define __pyx_n_u_layers __pyx_string_tab[185] +#define __pyx_n_u_left __pyx_string_tab[186] +#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[187] +#define __pyx_n_u_linalg __pyx_string_tab[188] +#define __pyx_n_u_load __pyx_string_tab[189] +#define __pyx_n_u_load_state_dict __pyx_string_tab[190] +#define __pyx_n_u_main __pyx_string_tab[191] +#define __pyx_n_u_matplotlib __pyx_string_tab[192] +#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[193] +#define __pyx_n_u_max __pyx_string_tab[194] +#define __pyx_n_u_measure_length __pyx_string_tab[195] +#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[196] +#define __pyx_n_u_message __pyx_string_tab[197] +#define __pyx_n_u_midpoint __pyx_string_tab[198] +#define __pyx_n_u_min __pyx_string_tab[199] +#define __pyx_n_u_minAreaRect __pyx_string_tab[200] +#define __pyx_n_u_mode __pyx_string_tab[201] +#define __pyx_n_u_model __pyx_string_tab[202] +#define __pyx_n_u_model_state_dict __pyx_string_tab[203] +#define __pyx_n_u_module __pyx_string_tab[204] +#define __pyx_n_u_morphologyEx __pyx_string_tab[205] +#define __pyx_n_u_name __pyx_string_tab[206] +#define __pyx_n_u_next __pyx_string_tab[207] +#define __pyx_n_u_no_grad __pyx_string_tab[208] +#define __pyx_n_u_norm __pyx_string_tab[209] +#define __pyx_n_u_np __pyx_string_tab[210] +#define __pyx_n_u_npt __pyx_string_tab[211] +#define __pyx_kp_u_npt_NDArray_np_floating __pyx_string_tab[212] +#define __pyx_kp_u_npt_NDArray_np_uint8 __pyx_string_tab[213] +#define __pyx_n_u_num_contours __pyx_string_tab[214] +#define __pyx_n_u_numpy __pyx_string_tab[215] +#define __pyx_n_u_numpy_typing __pyx_string_tab[216] +#define __pyx_n_u_off __pyx_string_tab[217] +#define __pyx_n_u_order_points __pyx_string_tab[218] +#define __pyx_n_u_orig __pyx_string_tab[219] +#define __pyx_n_u_output __pyx_string_tab[220] +#define __pyx_n_u_pad_inches __pyx_string_tab[221] +#define __pyx_n_u_pandas __pyx_string_tab[222] +#define __pyx_n_u_parent __pyx_string_tab[223] +#define __pyx_n_u_pathlib __pyx_string_tab[224] +#define __pyx_n_u_permute __pyx_string_tab[225] +#define __pyx_n_u_perspective __pyx_string_tab[226] +#define __pyx_n_u_pil_image __pyx_string_tab[227] +#define __pyx_n_u_pipeline __pyx_string_tab[228] +#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[229] +#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[230] +#define __pyx_n_u_plt __pyx_string_tab[231] +#define __pyx_kp_u_png __pyx_string_tab[232] +#define __pyx_n_u_pop __pyx_string_tab[233] +#define __pyx_n_u_pred_label __pyx_string_tab[234] +#define __pyx_n_u_pred_score __pyx_string_tab[235] +#define __pyx_n_u_pt_A __pyx_string_tab[236] +#define __pyx_n_u_pt_B __pyx_string_tab[237] +#define __pyx_n_u_pyplot __pyx_string_tab[238] +#define __pyx_n_u_qualname __pyx_string_tab[239] +#define __pyx_n_u_quoting __pyx_string_tab[240] +#define __pyx_n_u_rbox __pyx_string_tab[241] +#define __pyx_n_u_resize __pyx_string_tab[242] +#define __pyx_n_u_result __pyx_string_tab[243] +#define __pyx_n_u_result_pattern __pyx_string_tab[244] +#define __pyx_n_u_return __pyx_string_tab[245] +#define __pyx_n_u_right __pyx_string_tab[246] +#define __pyx_n_u_rightmost_x_third __pyx_string_tab[247] +#define __pyx_n_u_s1 __pyx_string_tab[248] +#define __pyx_n_u_s2 __pyx_string_tab[249] +#define __pyx_n_u_savefig __pyx_string_tab[250] +#define __pyx_n_u_scipy_spatial __pyx_string_tab[251] +#define __pyx_n_u_send __pyx_string_tab[252] +#define __pyx_n_u_sensor_images __pyx_string_tab[253] +#define __pyx_n_u_sep __pyx_string_tab[254] +#define __pyx_n_u_set_name __pyx_string_tab[255] +#define __pyx_n_u_shape __pyx_string_tab[256] +#define __pyx_n_u_side __pyx_string_tab[257] +#define __pyx_n_u_size_diff __pyx_string_tab[258] +#define __pyx_n_u_sort_contours __pyx_string_tab[259] +#define __pyx_n_u_spec __pyx_string_tab[260] +#define __pyx_n_u_squeeze __pyx_string_tab[261] +#define __pyx_kp_u_src_dopt_sensor_anomalies_detect __pyx_string_tab[262] +#define __pyx_n_u_stem __pyx_string_tab[263] +#define __pyx_n_u_str __pyx_string_tab[264] +#define __pyx_n_u_subplots __pyx_string_tab[265] +#define __pyx_n_u_subplots_adjust __pyx_string_tab[266] +#define __pyx_n_u_t __pyx_string_tab[267] +#define __pyx_kp_u_t_Box __pyx_string_tab[268] +#define __pyx_kp_u_t_CsvData __pyx_string_tab[269] +#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[270] +#define __pyx_kp_u_t_InferenceResult __pyx_string_tab[271] +#define __pyx_kp_u_t_SensorImages __pyx_string_tab[272] +#define __pyx_n_u_test __pyx_string_tab[273] +#define __pyx_n_u_threshold __pyx_string_tab[274] +#define __pyx_n_u_throw __pyx_string_tab[275] +#define __pyx_n_u_tight __pyx_string_tab[276] +#define __pyx_n_u_tl __pyx_string_tab[277] +#define __pyx_n_u_tlblX __pyx_string_tab[278] +#define __pyx_n_u_tlblY __pyx_string_tab[279] +#define __pyx_n_u_tltrX __pyx_string_tab[280] +#define __pyx_n_u_tltrY __pyx_string_tab[281] +#define __pyx_n_u_to __pyx_string_tab[282] +#define __pyx_n_u_to_csv __pyx_string_tab[283] +#define __pyx_n_u_tolerance __pyx_string_tab[284] +#define __pyx_n_u_torch __pyx_string_tab[285] +#define __pyx_n_u_torch_device __pyx_string_tab[286] +#define __pyx_n_u_tr __pyx_string_tab[287] +#define __pyx_n_u_trbrX __pyx_string_tab[288] +#define __pyx_n_u_trbrY __pyx_string_tab[289] +#define __pyx_kp_u_tuple_float_float __pyx_string_tab[290] +#define __pyx_kp_u_tuple_t_CsvData_t_SensorImages __pyx_string_tab[291] +#define __pyx_n_u_types __pyx_string_tab[292] +#define __pyx_n_u_typing __pyx_string_tab[293] +#define __pyx_n_u_uint8 __pyx_string_tab[294] +#define __pyx_n_u_unsqueeze __pyx_string_tab[295] +#define __pyx_n_u_user_img_path __pyx_string_tab[296] +#define __pyx_n_u_value __pyx_string_tab[297] +#define __pyx_n_u_w __pyx_string_tab[298] +#define __pyx_n_u_warnings __pyx_string_tab[299] +#define __pyx_n_u_wrap_result __pyx_string_tab[300] +#define __pyx_n_u_wspace __pyx_string_tab[301] +#define __pyx_n_u_x1 __pyx_string_tab[302] +#define __pyx_n_u_x2 __pyx_string_tab[303] +#define __pyx_n_u_x_coords __pyx_string_tab[304] +#define __pyx_n_u_x_max __pyx_string_tab[305] +#define __pyx_n_u_x_middle __pyx_string_tab[306] +#define __pyx_n_u_x_min __pyx_string_tab[307] +#define __pyx_n_u_y_max __pyx_string_tab[308] +#define __pyx_n_u_y_min __pyx_string_tab[309] +#define __pyx_n_u_zip __pyx_string_tab[310] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { @@ -3553,7 +3566,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } for (int i=0; i<10; ++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<305; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<311; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } Py_CLEAR(clear_module_state->__pyx_float_0_5); Py_CLEAR(clear_module_state->__pyx_float_0_8); Py_CLEAR(clear_module_state->__pyx_float_2_0); @@ -3608,7 +3621,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } for (int i=0; i<10; ++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<305; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<311; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_0_5); __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_0_8); __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_2_0); @@ -3631,7 +3644,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void #endif /* #### Code section: module_code ### */ -/* "dopt_sensor_anomalies/detection.py":34 +/* "dopt_sensor_anomalies/detection.py":38 * * # measuring * def midpoint( # <<<<<<<<<<<<<< @@ -3679,39 +3692,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, 34, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 38, __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, 34, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 38, __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, 34, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __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, 34, __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, 38, __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, 34, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, i); __PYX_ERR(0, 38, __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, 34, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 34, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 38, __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, 34, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3744,7 +3757,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":38 + /* "dopt_sensor_anomalies/detection.py":42 * 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) # <<<<<<<<<<<<<< @@ -3752,41 +3765,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, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_A, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt_B, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __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, 38, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __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, 38, __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, 42, __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, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt_A, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __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, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_B, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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, 38, __pyx_L1_error) + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __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, 38, __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, 42, __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, 38, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __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, 38, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 42, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 38, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 42, __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":34 + /* "dopt_sensor_anomalies/detection.py":38 * * # measuring * def midpoint( # <<<<<<<<<<<<<< @@ -3808,7 +3821,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":41 +/* "dopt_sensor_anomalies/detection.py":45 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -3857,40 +3870,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, 41, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 45, __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, 41, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 45, __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, 41, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 45, __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, 41, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 45, __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, 41, __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, 45, __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, 41, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, i); __PYX_ERR(0, 45, __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, 41, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 45, __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, 41, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 45, __pyx_L3_error) values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 41, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 45, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3898,14 +3911,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, 44, __pyx_L3_error) + __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 48, __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, 41, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3956,7 +3969,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":47 + /* "dopt_sensor_anomalies/detection.py":51 * ) -> bool: * # unpack the boxes * c1, s1, _ = box_1 # <<<<<<<<<<<<<< @@ -3969,7 +3982,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, 47, __pyx_L1_error) + __PYX_ERR(0, 51, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3981,26 +3994,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __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, 47, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __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, 47, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __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; @@ -4009,7 +4022,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, 47, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -4017,7 +4030,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, 47, __pyx_L1_error) + __PYX_ERR(0, 51, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_c1 = __pyx_t_1; @@ -4027,7 +4040,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":48 + /* "dopt_sensor_anomalies/detection.py":52 * # unpack the boxes * c1, s1, _ = box_1 * c2, s2, _ = box_2 # <<<<<<<<<<<<<< @@ -4040,7 +4053,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, 48, __pyx_L1_error) + __PYX_ERR(0, 52, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4052,26 +4065,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_INCREF(__pyx_t_1); } else { __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __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, 48, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __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, 48, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __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; @@ -4080,7 +4093,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, 48, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 52, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L6_unpacking_done; @@ -4088,7 +4101,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, 48, __pyx_L1_error) + __PYX_ERR(0, 52, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_v_c2 = __pyx_t_3; @@ -4098,33 +4111,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":51 + /* "dopt_sensor_anomalies/detection.py":55 * # sort width and height such that (w, h) == (h, w) is treated the same * # (might have been recognized in different orders) * s1 = sorted(s1) # <<<<<<<<<<<<<< * s2 = sorted(s2) * */ - __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 51, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":52 + /* "dopt_sensor_anomalies/detection.py":56 * # (might have been recognized in different orders) * 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, 52, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 52, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":54 + /* "dopt_sensor_anomalies/detection.py":58 * s2 = sorted(s2) * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) # <<<<<<<<<<<<<< @@ -4132,19 +4145,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, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __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, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __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, 54, __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, 58, __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, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __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, 54, __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, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -4164,13 +4177,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_7 = __Pyx_PyObject_FastCall(__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, 54, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __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, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __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, 54, __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, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -4190,10 +4203,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_11 = __Pyx_PyObject_FastCall(__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, 54, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 58, __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, 54, __pyx_L1_error) + __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __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; @@ -4204,7 +4217,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, 54, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_t_12 = 1; @@ -4225,13 +4238,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, 54, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_center_dist = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":55 + /* "dopt_sensor_anomalies/detection.py":59 * * 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))) # <<<<<<<<<<<<<< @@ -4239,19 +4252,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, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __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, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __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, 55, __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, 59, __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, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __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, 55, __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, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4271,13 +4284,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_13 = __Pyx_PyObject_FastCall(__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, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __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, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __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, 55, __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, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4297,10 +4310,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_9 = __Pyx_PyObject_FastCall(__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, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __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, 55, __pyx_L1_error) + __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __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; @@ -4311,7 +4324,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, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_12 = 1; @@ -4332,13 +4345,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, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_size_diff = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":57 + /* "dopt_sensor_anomalies/detection.py":61 * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) * * return bool(center_dist < tolerance and size_diff < tolerance) # <<<<<<<<<<<<<< @@ -4346,32 +4359,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, 57, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __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, 57, __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, 61, __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, 57, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 61, __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, 57, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __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, 57, __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, 61, __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, 57, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 61, __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, 57, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_14))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __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":41 + /* "dopt_sensor_anomalies/detection.py":45 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -4407,11 +4420,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":61 +/* "dopt_sensor_anomalies/detection.py":65 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * pixels_per_metric_X: float, */ @@ -4431,7 +4444,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_file_path = 0; + PyObject *__pyx_v_img_path = 0; double __pyx_v_pixels_per_metric_X; double __pyx_v_pixels_per_metric_Y; #if !CYTHON_METH_FASTCALL @@ -4454,48 +4467,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_file_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_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, 61, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 65, __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, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 65, __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, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 65, __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, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 65, __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, 61, __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, 65, __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, 61, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, i); __PYX_ERR(0, 65, __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, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 65, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 65, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 65, __pyx_L3_error) } - __pyx_v_file_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, 63, __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, 64, __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, 67, __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, 68, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 61, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 65, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4506,7 +4519,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(__pyx_self, __pyx_v_file_path, __pyx_v_pixels_per_metric_X, __pyx_v_pixels_per_metric_Y); + __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(__pyx_self, __pyx_v_img_path, __pyx_v_pixels_per_metric_X, __pyx_v_pixels_per_metric_Y); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -4517,7 +4530,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":93 +/* "dopt_sensor_anomalies/detection.py":97 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< @@ -4537,7 +4550,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, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4545,7 +4558,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, 93, __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, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4588,17 +4601,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, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 93, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 97, __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, 93, __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, 97, __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, 93, __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, 97, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { @@ -4606,7 +4619,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, 93, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 97, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4616,7 +4629,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, 93, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 97, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4627,13 +4640,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g #endif ++__pyx_t_2; } - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __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, 93, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 97, __pyx_L1_error) PyErr_Clear(); } break; @@ -4646,7 +4659,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, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4656,22 +4669,22 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_INCREF(__pyx_t_6); } else { __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __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, 93, __pyx_L1_error) + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __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, 93, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __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); @@ -4679,7 +4692,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, 93, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; @@ -4687,7 +4700,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, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x1); @@ -4698,7 +4711,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, 93, __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, 97, __pyx_L1_error) __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_t_1); @@ -4717,7 +4730,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, 93, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 97, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -4747,7 +4760,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":133 +/* "dopt_sensor_anomalies/detection.py":137 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4767,7 +4780,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, 133, __pyx_L1_error) + __PYX_ERR(0, 137, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4778,7 +4791,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, 133, __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, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4817,30 +4830,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, 133, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 133, __pyx_L1_error) } + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 137, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 137, __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, 133, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 137, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __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, 133, __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, 137, __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, 133, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_rbox)) { __Pyx_RaiseClosureNameError("rbox"); __PYX_ERR(0, 137, __pyx_L1_error) } __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { @@ -4858,14 +4871,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 133, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __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, 133, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "dopt_sensor_anomalies/detection.py":132 + /* "dopt_sensor_anomalies/detection.py":136 * * # check for redundancy * is_duplicate = any( # <<<<<<<<<<<<<< @@ -4874,7 +4887,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":133 + /* "dopt_sensor_anomalies/detection.py":137 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4890,7 +4903,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":132 + /* "dopt_sensor_anomalies/detection.py":136 * * # check for redundancy * is_duplicate = any( # <<<<<<<<<<<<<< @@ -4899,7 +4912,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":133 + /* "dopt_sensor_anomalies/detection.py":137 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4935,7 +4948,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":168 +/* "dopt_sensor_anomalies/detection.py":172 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -4955,7 +4968,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, 168, __pyx_L1_error) + __PYX_ERR(0, 172, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4963,7 +4976,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, 168, __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, 172, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5005,34 +5018,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, 168, __pyx_L1_error) + __PYX_ERR(0, 172, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 168, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 172, __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, 168, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 172, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __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, 168, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __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, 168, __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, 172, __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, 168, __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, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5052,7 +5065,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, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5071,7 +5084,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, 168, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 172, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5101,7 +5114,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":169 +/* "dopt_sensor_anomalies/detection.py":173 * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -5121,7 +5134,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, 169, __pyx_L1_error) + __PYX_ERR(0, 173, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5129,7 +5142,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, 169, __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, 173, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5171,34 +5184,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, 169, __pyx_L1_error) + __PYX_ERR(0, 173, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 169, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 173, __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, 169, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 173, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __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, 169, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __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, 169, __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, 173, __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, 169, __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, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5218,7 +5231,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, 169, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5237,7 +5250,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, 169, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 173, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5267,7 +5280,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":170 +/* "dopt_sensor_anomalies/detection.py":174 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -5287,7 +5300,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, 170, __pyx_L1_error) + __PYX_ERR(0, 174, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5295,7 +5308,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, 170, __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, 174, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5337,34 +5350,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, 170, __pyx_L1_error) + __PYX_ERR(0, 174, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 170, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 174, __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, 170, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 174, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __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, 170, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __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, 170, __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, 174, __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, 170, __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, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5384,7 +5397,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, 170, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5403,7 +5416,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, 170, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 174, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5433,7 +5446,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":171 +/* "dopt_sensor_anomalies/detection.py":175 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -5453,7 +5466,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, 171, __pyx_L1_error) + __PYX_ERR(0, 175, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5461,7 +5474,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, 171, __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, 175, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5503,34 +5516,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, 171, __pyx_L1_error) + __PYX_ERR(0, 175, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 171, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 175, __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, 171, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 175, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __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, 171, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __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, 171, __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, 175, __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, 171, __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, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5550,7 +5563,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, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5569,7 +5582,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, 171, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 175, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5598,15 +5611,15 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":61 +/* "dopt_sensor_anomalies/detection.py":65 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * pixels_per_metric_X: float, */ -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file_path, double __pyx_v_pixels_per_metric_X, double __pyx_v_pixels_per_metric_Y) { +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_image = NULL; @@ -5689,37 +5702,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, 61, __pyx_L1_error) + __PYX_ERR(0, 65, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - /* "dopt_sensor_anomalies/detection.py":66 + /* "dopt_sensor_anomalies/detection.py":70 * pixels_per_metric_Y: float, * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] # <<<<<<<<<<<<<< - * image = cv2.imread(str(file_path)) + * image = cv2.imread(str(img_path)) * if image is None: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_data_csv = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":67 + /* "dopt_sensor_anomalies/detection.py":71 * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] - * image = cv2.imread(str(file_path)) # <<<<<<<<<<<<<< + * image = cv2.imread(str(img_path)) # <<<<<<<<<<<<<< * if image is None: - * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") + * 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, 67, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __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, 67, __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, 71, __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_file_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_img_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -5739,42 +5752,42 @@ 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, 67, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":68 + /* "dopt_sensor_anomalies/detection.py":72 * data_csv: list[str | int] = [] - * image = cv2.imread(str(file_path)) + * image = cv2.imread(str(img_path)) * if image is None: # <<<<<<<<<<<<<< - * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") + * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * */ __pyx_t_6 = (__pyx_v_image == Py_None); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":69 - * image = cv2.imread(str(file_path)) + /* "dopt_sensor_anomalies/detection.py":73 + * image = cv2.imread(str(img_path)) * if image is None: - * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") # <<<<<<<<<<<<<< + * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") # <<<<<<<<<<<<<< * * 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, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __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, 69, __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, 73, __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_file_path, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __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, 73, __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, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5795,55 +5808,55 @@ 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, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __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, 69, __pyx_L1_error) + __PYX_ERR(0, 73, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":68 + /* "dopt_sensor_anomalies/detection.py":72 * data_csv: list[str | int] = [] - * image = cv2.imread(str(file_path)) + * image = cv2.imread(str(img_path)) * if image is None: # <<<<<<<<<<<<<< - * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") + * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * */ } - /* "dopt_sensor_anomalies/detection.py":71 - * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") + /* "dopt_sensor_anomalies/detection.py":75 + * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * * cropped = image[500:1500, 100 : image.shape[1] - 100] # <<<<<<<<<<<<<< * orig = cropped.copy() * # change colours in the image to black and white */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __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, 75, __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, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __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, 71, __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, 75, __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, 71, __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, 75, __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, 71, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __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, 71, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[1]) != (0)) __PYX_ERR(0, 75, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 71, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 75, __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, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_image, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __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":72 + /* "dopt_sensor_anomalies/detection.py":76 * * cropped = image[500:1500, 100 : image.shape[1] - 100] * orig = cropped.copy() # <<<<<<<<<<<<<< @@ -5857,13 +5870,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(__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, 72, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_orig = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":74 + /* "dopt_sensor_anomalies/detection.py":78 * orig = cropped.copy() * # change colours in the image to black and white * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) # <<<<<<<<<<<<<< @@ -5871,14 +5884,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # perform edge detection, identify rectangular shapes */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __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, 74, __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, 78, __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, 74, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __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, 74, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -5899,13 +5912,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, 74, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_gray = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":75 + /* "dopt_sensor_anomalies/detection.py":79 * # change colours in the image to black and white * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) # <<<<<<<<<<<<<< @@ -5913,19 +5926,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, 75, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __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, 75, __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, 79, __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, 75, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __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, 75, __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, 79, __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, 75, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __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, 75, __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, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5947,7 +5960,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, 75, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -5956,7 +5969,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, 75, __pyx_L1_error) + __PYX_ERR(0, 79, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5966,22 +5979,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_9); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __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, 75, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __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, 75, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 79, __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); @@ -5989,7 +6002,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, 75, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 79, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L5_unpacking_done; @@ -5997,7 +6010,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, 75, __pyx_L1_error) + __PYX_ERR(0, 79, __pyx_L1_error) __pyx_L5_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -6005,7 +6018,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":77 + /* "dopt_sensor_anomalies/detection.py":81 * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) * # perform edge detection, identify rectangular shapes * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) # <<<<<<<<<<<<<< @@ -6013,14 +6026,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, 77, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __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, 77, __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, 81, __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, 77, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __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, 77, __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, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6041,13 +6054,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, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_kernel = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":78 + /* "dopt_sensor_anomalies/detection.py":82 * # perform edge detection, identify rectangular shapes * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) # <<<<<<<<<<<<<< @@ -6055,14 +6068,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # find contours in the edge map */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __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, 78, __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, 82, __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, 78, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __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, 78, __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, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6083,13 +6096,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, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_closed = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":79 + /* "dopt_sensor_anomalies/detection.py":83 * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) # <<<<<<<<<<<<<< @@ -6097,9 +6110,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, 79, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __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, 79, __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, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6119,13 +6132,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 79, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_edged = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":81 + /* "dopt_sensor_anomalies/detection.py":85 * edged = cv2.Canny(closed, 50, 100) * # find contours in the edge map * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) # <<<<<<<<<<<<<< @@ -6133,9 +6146,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * if cnts is None: */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __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, 81, __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, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_4 = __pyx_v_edged; @@ -6145,17 +6158,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(__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, 81, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __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, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __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, 81, __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, 85, __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, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __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, 81, __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, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6178,13 +6191,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, 81, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_cnts = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":82 + /* "dopt_sensor_anomalies/detection.py":86 * # find contours in the edge map * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) # <<<<<<<<<<<<<< @@ -6192,9 +6205,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, 82, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_imutils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 86, __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, 82, __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, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_5 = 1; @@ -6214,13 +6227,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __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":83 + /* "dopt_sensor_anomalies/detection.py":87 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # <<<<<<<<<<<<<< @@ -6230,7 +6243,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":84 + /* "dopt_sensor_anomalies/detection.py":88 * cnts = imutils.grab_contours(cnts) * if cnts is None: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6238,9 +6251,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, 84, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __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, 84, __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, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6260,14 +6273,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __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, 84, __pyx_L1_error) + __PYX_ERR(0, 88, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":83 + /* "dopt_sensor_anomalies/detection.py":87 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # <<<<<<<<<<<<<< @@ -6276,7 +6289,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":88 + /* "dopt_sensor_anomalies/detection.py":92 * ) * # sort the contours from left to right (i.e., use x coordinates) * cnts, _ = contours.sort_contours(cnts) # <<<<<<<<<<<<<< @@ -6284,9 +6297,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # get x coordinates of bounding boxes */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __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, 88, __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, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6306,7 +6319,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 88, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -6315,7 +6328,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, 88, __pyx_L1_error) + __PYX_ERR(0, 92, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6325,22 +6338,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_11); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __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, 88, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __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, 88, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __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); @@ -6348,7 +6361,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, 88, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 92, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_unpacking_done; @@ -6356,7 +6369,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, 88, __pyx_L1_error) + __PYX_ERR(0, 92, __pyx_L1_error) __pyx_L8_unpacking_done:; } __Pyx_DECREF_SET(__pyx_v_cnts, __pyx_t_1); @@ -6364,7 +6377,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":91 + /* "dopt_sensor_anomalies/detection.py":95 * # check if this sorting was correct (might not be correct if we have overlaps or misfindings) * # get x coordinates of bounding boxes * x_coords = [cv2.boundingRect(c)[0] for c in cnts] # <<<<<<<<<<<<<< @@ -6372,16 +6385,16 @@ 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 */ { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L11_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __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, 91, __pyx_L11_error) + __pyx_t_12 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 95, __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, 91, __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, 95, __pyx_L11_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6389,7 +6402,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, 91, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 95, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6399,7 +6412,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, 91, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 95, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6410,13 +6423,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __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, 91, __pyx_L11_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 95, __pyx_L11_error) PyErr_Clear(); } break; @@ -6426,9 +6439,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, 91, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 95, __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, 91, __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, 95, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6448,13 +6461,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 91, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __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, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L11_error) + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __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, 91, __pyx_L11_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 95, __pyx_L11_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -6468,7 +6481,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":93 + /* "dopt_sensor_anomalies/detection.py":97 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< @@ -6476,15 +6489,15 @@ 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, 93, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __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, 93, __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, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_builtin_zip); __pyx_t_9 = __pyx_builtin_zip; - __pyx_t_4 = __Pyx_PyList_GetSlice(__pyx_v_x_coords, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyList_GetSlice(__pyx_v_x_coords, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; { @@ -6493,10 +6506,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __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, 93, __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, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6517,24 +6530,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, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_is_sorted = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":94 + /* "dopt_sensor_anomalies/detection.py":98 * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # <<<<<<<<<<<<<< * 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, 94, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_sorted); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 98, __pyx_L1_error) __pyx_t_14 = (!__pyx_t_6); if (unlikely(__pyx_t_14)) { - /* "dopt_sensor_anomalies/detection.py":95 + /* "dopt_sensor_anomalies/detection.py":99 * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6542,9 +6555,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, 95, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __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, 95, __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, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6564,14 +6577,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 95, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __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, 95, __pyx_L1_error) + __PYX_ERR(0, 99, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":94 + /* "dopt_sensor_anomalies/detection.py":98 * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # <<<<<<<<<<<<<< @@ -6580,31 +6593,31 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":100 + /* "dopt_sensor_anomalies/detection.py":104 * ) * # to store only electrodes contours and nothing redundant * accepted_boxes: list[t.Box] = [] # <<<<<<<<<<<<<< * filtered_cnts: list[Any] = [] * */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __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":101 + /* "dopt_sensor_anomalies/detection.py":105 * # to store only electrodes contours and nothing redundant * accepted_boxes: list[t.Box] = [] * filtered_cnts: list[Any] = [] # <<<<<<<<<<<<<< * * # loop over the contours individually */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __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":104 + /* "dopt_sensor_anomalies/detection.py":108 * * # loop over the contours individually * for c in cnts: # <<<<<<<<<<<<<< @@ -6616,9 +6629,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, 104, __pyx_L1_error) + __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __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, 104, __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, 108, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6626,7 +6639,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, 104, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 108, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6636,7 +6649,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, 104, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 108, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6647,13 +6660,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 108, __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, 104, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 108, __pyx_L1_error) PyErr_Clear(); } break; @@ -6663,7 +6676,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":106 + /* "dopt_sensor_anomalies/detection.py":110 * for c in cnts: * # compute the rotated bounding box of the contour * rbox = cast(t.Box, cv2.minAreaRect(c)) # <<<<<<<<<<<<<< @@ -6671,17 +6684,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __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, 106, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Box); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Box); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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, 106, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 110, __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, 106, __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, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_5 = 1; @@ -6701,7 +6714,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_16, __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_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_5 = 1; @@ -6723,7 +6736,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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, 106, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rbox); @@ -6731,7 +6744,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":109 + /* "dopt_sensor_anomalies/detection.py":113 * # !! should only be newer OpenCV versions * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) * box = cv2.boxPoints(rbox) # <<<<<<<<<<<<<< @@ -6739,9 +6752,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # order the points in the contour in top-left, top-right, bottom-right, and bottom-left */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_boxPoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_boxPoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6761,13 +6774,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_4, __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_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 109, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 113, __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":110 + /* "dopt_sensor_anomalies/detection.py":114 * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) # <<<<<<<<<<<<<< @@ -6775,14 +6788,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __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, 110, __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, 114, __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, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __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, 110, __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, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6799,21 +6812,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_box}; - __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __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, 110, __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, 114, __pyx_L1_error) __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder(__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_4); __pyx_t_4 = 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, 110, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __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":112 + /* "dopt_sensor_anomalies/detection.py":116 * box = np.array(box, dtype=np.int32) * # order the points in the contour in top-left, top-right, bottom-right, and bottom-left * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) # <<<<<<<<<<<<<< @@ -6821,26 +6834,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # unpack the bounding 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, 112, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 116, __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, 112, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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, 112, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __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, 112, __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, 116, __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_4, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_order_points); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_order_points); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6860,7 +6873,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = __Pyx_PyObject_FastCall(__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_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); } __pyx_t_5 = 1; @@ -6882,13 +6895,13 @@ 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, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 116, __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":115 + /* "dopt_sensor_anomalies/detection.py":119 * * # unpack the bounding box * (tl, tr, br, bl) = box # <<<<<<<<<<<<<< @@ -6901,7 +6914,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, 115, __pyx_L1_error) + __PYX_ERR(0, 119, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6915,16 +6928,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_1); } else { __pyx_t_11 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_11); __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 115, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 3); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); } #else @@ -6932,7 +6945,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, 115, __pyx_L1_error) + PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -6941,7 +6954,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, 115, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_v_box); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __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++) { @@ -6949,7 +6962,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, 115, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 4) < (0)) __PYX_ERR(0, 119, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L20_unpacking_done; @@ -6957,7 +6970,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, 115, __pyx_L1_error) + __PYX_ERR(0, 119, __pyx_L1_error) __pyx_L20_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tl, __pyx_t_11); @@ -6969,267 +6982,12 @@ 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":117 + /* "dopt_sensor_anomalies/detection.py":121 * (tl, tr, br, bl) = box * # compute the midpoints between the top-left and top-right as well as bottom-left and bottom-right coordinates * (tltrX, tltrY) = midpoint(tl, tr) # <<<<<<<<<<<<<< * (blbrX, blbrY) = midpoint(bl, br) * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates -*/ - __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 117, __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(__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, 117, __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, 117, __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_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 117, __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, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 117, __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, 117, __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, 117, __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, 117, __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":118 - * # compute the midpoints between the top-left and top-right as well as bottom-left and bottom-right coordinates - * (tltrX, tltrY) = midpoint(tl, tr) - * (blbrX, blbrY) = midpoint(bl, br) # <<<<<<<<<<<<<< - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates - * (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, 118, __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(__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, 118, __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, 118, __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_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 118, __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, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 118, __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, 118, __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, 118, __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, 118, __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":120 - * (blbrX, blbrY) = midpoint(bl, br) - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates - * (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, 120, __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_bl}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 120, __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, 120, __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_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 120, __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, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 120, __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, 120, __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, 120, __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, 120, __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; - - /* "dopt_sensor_anomalies/detection.py":121 - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates - * (tlblX, tlblY) = midpoint(tl, bl) - * (trbrX, trbrY) = midpoint(tr, br) # <<<<<<<<<<<<<< - * - * # compute the Euclidean distance between the midpoints */ __pyx_t_16 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) @@ -7247,7 +7005,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_v_tr, __pyx_v_br}; + PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_v_tl, __pyx_v_tr}; __pyx_t_1 = __Pyx_PyObject_FastCall(__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; @@ -7289,11 +7047,266 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 121, __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, 121, __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":122 + * # compute the midpoints between the top-left and top-right as well as bottom-left and bottom-right coordinates + * (tltrX, tltrY) = midpoint(tl, tr) + * (blbrX, blbrY) = midpoint(bl, br) # <<<<<<<<<<<<<< + * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates + * (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, 122, __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(__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, 122, __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, 122, __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_GetItemRef(sequence, 0); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 122, __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, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 122, __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, 122, __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, 122, __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, 122, __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":124 + * (blbrX, blbrY) = midpoint(bl, br) + * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates + * (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, 124, __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_bl}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 124, __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, 124, __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_GetItemRef(sequence, 0); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 124, __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, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 124, __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, 124, __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, 124, __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, 124, __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; + + /* "dopt_sensor_anomalies/detection.py":125 + * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates + * (tlblX, tlblY) = midpoint(tl, bl) + * (trbrX, trbrY) = midpoint(tr, br) # <<<<<<<<<<<<<< + * + * # compute the Euclidean distance between the midpoints +*/ + __pyx_t_16 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __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_tr, __pyx_v_br}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 125, __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, 125, __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_GetItemRef(sequence, 0); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 125, __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, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 125, __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, 125, __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, 121, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 125, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L28_unpacking_done; @@ -7301,7 +7314,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 121, __pyx_L1_error) + __PYX_ERR(0, 125, __pyx_L1_error) __pyx_L28_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_trbrX, __pyx_t_9); @@ -7309,7 +7322,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_trbrY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":124 + /* "dopt_sensor_anomalies/detection.py":128 * * # compute the Euclidean distance between the midpoints * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) # <<<<<<<<<<<<<< @@ -7317,27 +7330,27 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * */ __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __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, 124, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 128, __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, 124, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __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, 124, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_tltrX) != (0)) __PYX_ERR(0, 128, __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, 124, __pyx_L1_error); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_tltrY) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __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, 124, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_blbrX) != (0)) __PYX_ERR(0, 128, __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, 124, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_blbrY) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { @@ -7357,13 +7370,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 124, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_dA, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":125 + /* "dopt_sensor_anomalies/detection.py":129 * # compute the Euclidean distance between the midpoints * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) # <<<<<<<<<<<<<< @@ -7371,27 +7384,27 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # if the contour is not sufficiently large, ignore it */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __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, 125, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 129, __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, 125, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __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, 125, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_tlblX) != (0)) __PYX_ERR(0, 129, __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, 125, __pyx_L1_error); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 125, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_tlblY) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 129, __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, 125, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_trbrX) != (0)) __PYX_ERR(0, 129, __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, 125, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_trbrY) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_9))) { @@ -7411,35 +7424,35 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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, 125, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_dB, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":128 + /* "dopt_sensor_anomalies/detection.py":132 * * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 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, 128, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 128, __pyx_L1_error) + __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, 132, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 132, __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; } - __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, 128, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 128, __pyx_L1_error) + __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, 132, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_t_6; __pyx_L30_bool_binop_done:; if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":129 + /* "dopt_sensor_anomalies/detection.py":133 * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 100: * continue # <<<<<<<<<<<<<< @@ -7448,7 +7461,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":128 + /* "dopt_sensor_anomalies/detection.py":132 * * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 100: # <<<<<<<<<<<<<< @@ -7457,32 +7470,32 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":133 + /* "dopt_sensor_anomalies/detection.py":137 * # check for redundancy * 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, 133, __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, 137, __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, 133, __pyx_L1_error) + __pyx_t_9 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_is_duplicate, __pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":135 + /* "dopt_sensor_anomalies/detection.py":139 * 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, 135, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 139, __pyx_L1_error) if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":136 + /* "dopt_sensor_anomalies/detection.py":140 * ) * if is_duplicate: * continue # <<<<<<<<<<<<<< @@ -7491,7 +7504,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":135 + /* "dopt_sensor_anomalies/detection.py":139 * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) * if is_duplicate: # <<<<<<<<<<<<<< @@ -7500,7 +7513,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":139 + /* "dopt_sensor_anomalies/detection.py":143 * * # accept box and contour * accepted_boxes.append(rbox) # <<<<<<<<<<<<<< @@ -7509,106 +7522,106 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ __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, 139, __pyx_L1_error) + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_accepted_boxes, __pyx_t_9); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":140 + /* "dopt_sensor_anomalies/detection.py":144 * # accept box and contour * accepted_boxes.append(rbox) * filtered_cnts.append(c) # <<<<<<<<<<<<<< * * # compute the size of the electrode object */ - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_filtered_cnts, __pyx_v_c); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 140, __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, 144, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":143 + /* "dopt_sensor_anomalies/detection.py":147 * * # compute the size of the electrode object * dimA = dA / pixels_per_metric_Y # y # <<<<<<<<<<<<<< * dimB = dB / pixels_per_metric_X # x * */ - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 147, __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, 143, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __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":144 + /* "dopt_sensor_anomalies/detection.py":148 * # compute the size of the electrode object * dimA = dA / pixels_per_metric_Y # y * dimB = dB / pixels_per_metric_X # x # <<<<<<<<<<<<<< * * data_csv.extend( */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __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, 144, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_v_dB, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __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":148 + /* "dopt_sensor_anomalies/detection.py":152 * 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, 148, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimB, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 152, __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, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":149 + /* "dopt_sensor_anomalies/detection.py":153 * [ * 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, 149, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimA, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __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, -1L); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_16 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":150 + /* "dopt_sensor_anomalies/detection.py":154 * 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, 150, __pyx_L1_error) + __pyx_t_9 = PyNumber_Multiply(__pyx_v_dimA, __pyx_v_dimB); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 154, __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, 150, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 154, __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, -1L); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_9 = PyUnicode_Replace(((PyObject*)__pyx_t_8), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":146 + /* "dopt_sensor_anomalies/detection.py":150 * dimB = dB / pixels_per_metric_X # x * * data_csv.extend( # <<<<<<<<<<<<<< * [ * f"{dimB:.3f}".replace(".", ","), */ - __pyx_t_17 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 146, __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, 146, __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, 146, __pyx_L1_error) + __pyx_t_17 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 150, __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, 150, __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, 150, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (void)((__pyx_t_17 | (__pyx_t_18 | __pyx_t_19))); - /* "dopt_sensor_anomalies/detection.py":104 + /* "dopt_sensor_anomalies/detection.py":108 * * # loop over the contours individually * for c in cnts: # <<<<<<<<<<<<<< @@ -7619,7 +7632,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":154 + /* "dopt_sensor_anomalies/detection.py":158 * ) * * if not filtered_cnts: # <<<<<<<<<<<<<< @@ -7628,14 +7641,14 @@ 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, 154, __pyx_L1_error) + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 158, __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":155 + /* "dopt_sensor_anomalies/detection.py":159 * * if not filtered_cnts: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -7643,9 +7656,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 159, __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, 155, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; @@ -7665,14 +7678,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 155, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __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, 155, __pyx_L1_error) + __PYX_ERR(0, 159, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":154 + /* "dopt_sensor_anomalies/detection.py":158 * ) * * if not filtered_cnts: # <<<<<<<<<<<<<< @@ -7681,82 +7694,82 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":160 + /* "dopt_sensor_anomalies/detection.py":164 * * # if incorrect number of electrodes has been identified * num_contours = len(filtered_cnts) # <<<<<<<<<<<<<< * if num_contours != const.NUM_VALID_ELECTRODES: * 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, 160, __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, 164, __pyx_L1_error) __pyx_v_num_contours = __pyx_t_12; - /* "dopt_sensor_anomalies/detection.py":161 + /* "dopt_sensor_anomalies/detection.py":165 * # if incorrect number of electrodes has been identified * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( - * f"Number of counted electroedes does not match the " + * 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, 161, __pyx_L1_error) + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __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, 161, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 165, __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, 161, __pyx_L1_error) + __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, 165, __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, 161, __pyx_L1_error) + __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, 165, __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, 161, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":162 + /* "dopt_sensor_anomalies/detection.py":166 * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( # <<<<<<<<<<<<<< - * f"Number of counted electroedes does not match the " + * 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, 162, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __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, 162, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InvalidElectrodeCount); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":164 + /* "dopt_sensor_anomalies/detection.py":168 * raise errors.InvalidElectrodeCount( - * f"Number of counted electroedes does not match the " + * 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, 164, __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, 168, __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, 164, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __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, 164, __pyx_L1_error) + __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, 168, __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, 164, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_Number_of_counted_electroedes_do; + __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; - /* "dopt_sensor_anomalies/detection.py":163 + /* "dopt_sensor_anomalies/detection.py":167 * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( - * f"Number of counted electroedes does not match the " # <<<<<<<<<<<<<< + * 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, 73 + __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, 163, __pyx_L1_error) + __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, 167, __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; @@ -7778,23 +7791,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 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, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 162, __pyx_L1_error) + __PYX_ERR(0, 166, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":161 + /* "dopt_sensor_anomalies/detection.py":165 * # if incorrect number of electrodes has been identified * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( - * f"Number of counted electroedes does not match the " + * f"Number of counted electrodes does not match the " */ } - /* "dopt_sensor_anomalies/detection.py":168 + /* "dopt_sensor_anomalies/detection.py":172 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -7804,7 +7817,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_11 = __pyx_builtin_min; - __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = 1; { @@ -7813,16 +7826,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } - __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, 168, __pyx_L1_error) + __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, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_x_min = __pyx_t_11; __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":169 + /* "dopt_sensor_anomalies/detection.py":173 * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -7832,7 +7845,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_1 = __pyx_builtin_max; - __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, 169, __pyx_L1_error) + __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, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __pyx_t_5 = 1; { @@ -7841,16 +7854,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } - __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_x_max = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":170 + /* "dopt_sensor_anomalies/detection.py":174 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -7860,7 +7873,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_16 = __pyx_builtin_min; - __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; { @@ -7869,16 +7882,16 @@ 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_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_16 = __Pyx_PyLong_SubtractObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyLong_SubtractObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_y_min = __pyx_t_16; __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":171 + /* "dopt_sensor_anomalies/detection.py":175 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -7888,7 +7901,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_9 = __pyx_builtin_max; - __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_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = 1; { @@ -7897,16 +7910,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); } - __pyx_t_9 = __Pyx_PyLong_AddObjC(__pyx_t_16, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyLong_AddObjC(__pyx_t_16, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_v_y_max = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":173 + /* "dopt_sensor_anomalies/detection.py":177 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7916,9 +7929,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_11 = __pyx_builtin_max; - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 2, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 2, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -7928,13 +7941,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } __pyx_v_rightmost_x_third = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":174 + /* "dopt_sensor_anomalies/detection.py":178 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7944,9 +7957,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_8 = __pyx_builtin_min; - __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 3, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 3, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; @@ -7956,84 +7969,84 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } __pyx_v_leftmost_x_fourth = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":175 + /* "dopt_sensor_anomalies/detection.py":179 * 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) # <<<<<<<<<<<<<< * * # perform further cropping and separation of left and right sensor */ - __pyx_t_9 = PyNumber_Subtract(__pyx_v_leftmost_x_fourth, __pyx_v_rightmost_x_third); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_9 = PyNumber_Subtract(__pyx_v_leftmost_x_fourth, __pyx_v_rightmost_x_third); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_9, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_9, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_v_rightmost_x_third, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_8 = PyNumber_Add(__pyx_v_rightmost_x_third, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_x_middle = __pyx_t_8; __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":178 + /* "dopt_sensor_anomalies/detection.py":182 * * # perform further cropping and separation of left and right sensor * 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_8 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_8 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PySlice_New(__pyx_v_x_min, __pyx_v_x_middle, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_9 = PySlice_New(__pyx_v_x_min, __pyx_v_x_middle, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_8); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 178, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 178, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); __pyx_t_8 = 0; __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cropped_sensor_left = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":179 + /* "dopt_sensor_anomalies/detection.py":183 * # perform further cropping and separation of left and right sensor * 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) */ - __pyx_t_9 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_9 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PySlice_New(__pyx_v_x_middle, __pyx_v_x_max, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_1 = PySlice_New(__pyx_v_x_middle, __pyx_v_x_max, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 179, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 179, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); __pyx_t_9 = 0; __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_cropped_sensor_right = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":181 + /* "dopt_sensor_anomalies/detection.py":185 * 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) # <<<<<<<<<<<<<< @@ -8042,9 +8055,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_SensorImages); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_SensorImages); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -8061,34 +8074,34 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, NULL}; - __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 185, __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, 181, __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, 181, __pyx_L1_error) + 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, 185, __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, 185, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_11, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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, 181, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_data_csv); __Pyx_GIVEREF(__pyx_v_data_csv); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 185, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 185, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":61 + /* "dopt_sensor_anomalies/detection.py":65 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * pixels_per_metric_X: float, */ @@ -8162,7 +8175,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":186 +/* "dopt_sensor_anomalies/detection.py":190 * # helper function * # anomaly detection * def infer_image( # <<<<<<<<<<<<<< @@ -8210,39 +8223,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_image,&__pyx_mstate_global->__pyx_n_u_model,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, 186, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 190, __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, 186, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 190, __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, 186, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 190, __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, 186, __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, 190, __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, 186, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, i); __PYX_ERR(0, 190, __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, 186, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 190, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 190, __pyx_L3_error) } __pyx_v_image = values[0]; __pyx_v_model = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 190, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8298,7 +8311,7 @@ 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":190 + /* "dopt_sensor_anomalies/detection.py":194 * model: Patchcore, * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # <<<<<<<<<<<<<< @@ -8306,14 +8319,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __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, 190, __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, 190, __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, 190, __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; @@ -8324,10 +8337,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__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, 190, __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, 190, __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); @@ -8354,13 +8367,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, 190, __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":191 + /* "dopt_sensor_anomalies/detection.py":195 * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") * model.to(torch_device) # <<<<<<<<<<<<<< @@ -8374,12 +8387,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(__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, 191, __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":193 + /* "dopt_sensor_anomalies/detection.py":197 * model.to(torch_device) * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # <<<<<<<<<<<<<< @@ -8387,14 +8400,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, 193, __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, 193, __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, 193, __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, 193, __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; @@ -8415,13 +8428,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, 193, __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":194 + /* "dopt_sensor_anomalies/detection.py":198 * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) # <<<<<<<<<<<<<< @@ -8429,9 +8442,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, 194, __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, 194, __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; @@ -8451,13 +8464,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 194, __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":195 + /* "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") # <<<<<<<<<<<<<< @@ -8471,13 +8484,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(__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, 195, __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":196 + /* "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 # <<<<<<<<<<<<<< @@ -8485,9 +8498,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, 196, __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, 196, __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; @@ -8507,14 +8520,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 196, __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, 196, __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, 196, __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; @@ -8524,16 +8537,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, 196, __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, 196, __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":197 + /* "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) # <<<<<<<<<<<<<< @@ -8541,9 +8554,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, 197, __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, 197, __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; @@ -8563,19 +8576,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 197, __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, 197, __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, 197, __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":199 + /* "dopt_sensor_anomalies/detection.py":203 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) * * input_tensor = input_tensor.unsqueeze(0) # <<<<<<<<<<<<<< @@ -8589,13 +8602,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(__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, 199, __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":200 + /* "dopt_sensor_anomalies/detection.py":204 * * input_tensor = input_tensor.unsqueeze(0) * input_tensor = input_tensor.to(torch_device) # <<<<<<<<<<<<<< @@ -8609,13 +8622,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(__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, 200, __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":202 + /* "dopt_sensor_anomalies/detection.py":206 * input_tensor = input_tensor.to(torch_device) * * model.eval() # <<<<<<<<<<<<<< @@ -8629,12 +8642,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(__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, 202, __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":203 + /* "dopt_sensor_anomalies/detection.py":207 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8643,9 +8656,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, 203, __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, 203, __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; @@ -8665,13 +8678,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 203, __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, 203, __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, 203, __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 @@ -8690,7 +8703,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCall(__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, 203, __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; @@ -8705,7 +8718,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGOTREF(__pyx_t_14); /*try:*/ { - /* "dopt_sensor_anomalies/detection.py":204 + /* "dopt_sensor_anomalies/detection.py":208 * model.eval() * with torch.no_grad(): * output = model(input_tensor) # <<<<<<<<<<<<<< @@ -8732,13 +8745,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__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, 204, __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":203 + /* "dopt_sensor_anomalies/detection.py":207 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8761,20 +8774,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, 203, __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, 203, __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, 203, __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, 203, __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); @@ -8782,7 +8795,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, 203, __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; @@ -8808,7 +8821,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, 203, __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; } @@ -8823,15 +8836,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_L16:; } - /* "dopt_sensor_anomalies/detection.py":206 + /* "dopt_sensor_anomalies/detection.py":210 * output = model(input_tensor) * * anomaly_score = output.pred_score.item() # <<<<<<<<<<<<<< * anomaly_label = output.pred_label.item() * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 206, __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, 206, __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); @@ -8841,21 +8854,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__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, 206, __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":207 + /* "dopt_sensor_anomalies/detection.py":211 * * anomaly_score = output.pred_score.item() * anomaly_label = output.pred_label.item() # <<<<<<<<<<<<<< * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() * */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 207, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 211, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); @@ -8865,21 +8878,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_label = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":208 + /* "dopt_sensor_anomalies/detection.py":212 * anomaly_score = output.pred_score.item() * anomaly_label = output.pred_label.item() * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() # <<<<<<<<<<<<<< * * # resize heatmap to original image size */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 208, __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, 208, __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); @@ -8889,7 +8902,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__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, 208, __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; @@ -8900,7 +8913,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__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_2)) __PYX_ERR(0, 208, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_1 = __pyx_t_2; @@ -8911,13 +8924,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__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_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) + 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":211 + /* "dopt_sensor_anomalies/detection.py":215 * * # resize heatmap to original image size * img_np = np.array(pil_image) # <<<<<<<<<<<<<< @@ -8925,9 +8938,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __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, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; @@ -8947,13 +8960,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCall(__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, 211, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_img_np = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":212 + /* "dopt_sensor_anomalies/detection.py":216 * # resize heatmap to original image size * img_np = np.array(pil_image) * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) # <<<<<<<<<<<<<< @@ -8961,27 +8974,27 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * 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, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __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, 212, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_resize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __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, 212, __pyx_L1_error) + __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, 216, __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, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __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, 212, __pyx_L1_error) + __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, 216, __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, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 216, __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, 212, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __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, 212, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 216, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 216, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_9 = 1; @@ -9002,13 +9015,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __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, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __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":214 + /* "dopt_sensor_anomalies/detection.py":218 * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) * * return t.InferenceResult( # <<<<<<<<<<<<<< @@ -9017,13 +9030,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON */ __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, 214, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __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, 214, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InferenceResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":218 + /* "dopt_sensor_anomalies/detection.py":222 * anomaly_map_resized=anomaly_map_resized, * anomaly_score=anomaly_score, * anomaly_label=anomaly_label, # <<<<<<<<<<<<<< @@ -9044,24 +9057,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_1, NULL}; - __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_v_anomaly_label, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_v_anomaly_label, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__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) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __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":186 + /* "dopt_sensor_anomalies/detection.py":190 * # helper function * # anomaly detection * def infer_image( # <<<<<<<<<<<<<< @@ -9098,11 +9111,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":223 +/* "dopt_sensor_anomalies/detection.py":227 * * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * detection_models: t.DetectionModels, */ @@ -9122,7 +9135,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_file_path = 0; + PyObject *__pyx_v_img_path = 0; PyObject *__pyx_v_detection_models = 0; PyObject *__pyx_v_data_csv = 0; PyObject *__pyx_v_sensor_images = 0; @@ -9146,55 +9159,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_file_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_data_csv,&__pyx_mstate_global->__pyx_n_u_sensor_images,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, 223, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 227, __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, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 227, __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, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 227, __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, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 227, __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, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 227, __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, 223, __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, 227, __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, 223, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, i); __PYX_ERR(0, 227, __pyx_L3_error) } } } 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, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 227, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 227, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 227, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 223, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 227, __pyx_L3_error) } - __pyx_v_file_path = values[0]; + __pyx_v_img_path = values[0]; __pyx_v_detection_models = values[1]; __pyx_v_data_csv = values[2]; __pyx_v_sensor_images = values[3]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 223, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 227, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9205,7 +9218,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_file_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_data_csv, __pyx_v_sensor_images); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -9215,7 +9228,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file_path, PyObject *__pyx_v_detection_models, PyObject *__pyx_v_data_csv, PyObject *__pyx_v_sensor_images) { +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) { PyObject *__pyx_v_file_stem = NULL; PyObject *__pyx_v_folder_path = NULL; PyObject *__pyx_v_model = NULL; @@ -9250,31 +9263,31 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("anomaly_detection", 0); - /* "dopt_sensor_anomalies/detection.py":229 + /* "dopt_sensor_anomalies/detection.py":233 * sensor_images: t.SensorImages, * ) -> None: - * file_stem = file_path.stem # <<<<<<<<<<<<<< - * folder_path = file_path.parent + * file_stem = img_path.stem # <<<<<<<<<<<<<< + * folder_path = img_path.parent * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_file_path, __pyx_mstate_global->__pyx_n_u_stem); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __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, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_file_stem = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":230 + /* "dopt_sensor_anomalies/detection.py":234 * ) -> None: - * file_stem = file_path.stem - * folder_path = file_path.parent # <<<<<<<<<<<<<< + * file_stem = img_path.stem + * folder_path = img_path.parent # <<<<<<<<<<<<<< * * # reconstruct the model and initialize the engine */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_file_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __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, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_folder_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":233 + /* "dopt_sensor_anomalies/detection.py":237 * * # reconstruct the model and initialize the engine * model = Patchcore( # <<<<<<<<<<<<<< @@ -9282,29 +9295,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, 233, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "dopt_sensor_anomalies/detection.py":234 + /* "dopt_sensor_anomalies/detection.py":238 * # reconstruct the model and initialize the engine * model = Patchcore( * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO # <<<<<<<<<<<<<< * ) - * # ?? bentigt? Wird nicht genutzt + * # preparation for plot */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __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, 234, __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, 238, __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, 234, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __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, 234, __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, 238, __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, 234, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __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, 234, __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, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = 1; @@ -9321,11 +9334,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, 233, __pyx_L1_error) + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __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, 233, __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, 233, __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, 233, __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, 237, __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, 237, __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, 237, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__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; @@ -9333,28 +9346,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, 233, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_model = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":240 - * + /* "dopt_sensor_anomalies/detection.py":241 + * ) * # preparation for plot * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< - * * # loop over left and right sensor + * 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, 240, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __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, 240, __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, 241, __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, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __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, 240, __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, 240, __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, 241, __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, 241, __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; @@ -9364,7 +9377,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, 240, __pyx_L1_error) + __PYX_ERR(0, 241, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -9374,22 +9387,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __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, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __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, 240, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __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); @@ -9397,7 +9410,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, 240, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 241, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L4_unpacking_done; @@ -9405,7 +9418,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, 240, __pyx_L1_error) + __PYX_ERR(0, 241, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -9414,7 +9427,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_3 = 0; /* "dopt_sensor_anomalies/detection.py":243 - * + * _, axes = plt.subplots(1, 2, figsize=(12, 6)) * # loop over left and right sensor * for i, (side, image) in enumerate(sensor_images.items()): # <<<<<<<<<<<<<< * # Ich habe die Modellpfade als Funktionsparameter hinzugefgt @@ -9948,11 +9961,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":223 + /* "dopt_sensor_anomalies/detection.py":227 * * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * detection_models: t.DetectionModels, */ @@ -9991,9 +10004,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( /* "dopt_sensor_anomalies/detection.py":276 * * - * def pipeline( # <<<<<<<<<<<<<< - * user_file_path: str, - * pixels_per_metric_X: float, + * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< + * def pipeline( + * user_img_path: str, */ /* Python wrapper */ @@ -10012,7 +10025,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_user_file_path = 0; + PyObject *__pyx_v_user_img_path = 0; double __pyx_v_pixels_per_metric_X; double __pyx_v_pixels_per_metric_Y; #if !CYTHON_METH_FASTCALL @@ -10035,7 +10048,7 @@ 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_file_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,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, 276, __pyx_L3_error) if (__pyx_kwds_len > 0) { @@ -10070,9 +10083,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 276, __pyx_L3_error) } - __pyx_v_user_file_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, 278, __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, 279, __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, 279, __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, 280, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; @@ -10087,8 +10100,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_file_path), (&PyUnicode_Type), 0, "user_file_path", 2))) __PYX_ERR(0, 277, __pyx_L1_error) - __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(__pyx_self, __pyx_v_user_file_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, 278, __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); /* function exit code */ goto __pyx_L0; @@ -10107,7 +10120,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_file_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) { PyObject *__pyx_v_file_path = NULL; PyObject *__pyx_v_MODEL_FOLDER = NULL; PyObject *__pyx_v_DETECTION_MODELS = NULL; @@ -10129,15 +10142,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":281 + /* "dopt_sensor_anomalies/detection.py":282 * pixels_per_metric_Y: float, * ) -> None: - * file_path = Path(user_file_path) # <<<<<<<<<<<<<< + * 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, 281, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10152,19 +10165,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_user_file_path}; + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_user_img_path}; __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 281, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_file_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":282 + /* "dopt_sensor_anomalies/detection.py":283 * ) -> None: - * file_path = Path(user_file_path) + * file_path = Path(user_img_path) * if not file_path.exists(): # <<<<<<<<<<<<<< * raise FileNotFoundError("The provided path seems not to exist") * @@ -10176,16 +10189,16 @@ 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(__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, 282, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __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, 282, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 283, __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":283 - * file_path = Path(user_file_path) + /* "dopt_sensor_anomalies/detection.py":284 + * file_path = Path(user_img_path) * if not file_path.exists(): * raise FileNotFoundError("The provided path seems not to exist") # <<<<<<<<<<<<<< * @@ -10200,32 +10213,32 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __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; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __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, 283, __pyx_L1_error) + __PYX_ERR(0, 284, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":282 + /* "dopt_sensor_anomalies/detection.py":283 * ) -> None: - * file_path = Path(user_file_path) + * file_path = Path(user_img_path) * if not file_path.exists(): # <<<<<<<<<<<<<< * raise FileNotFoundError("The provided path seems not to exist") * */ } - /* "dopt_sensor_anomalies/detection.py":285 + /* "dopt_sensor_anomalies/detection.py":286 * 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_3, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __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, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_7; @@ -10236,22 +10249,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_MODEL_FOLDER = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":287 + /* "dopt_sensor_anomalies/detection.py":288 * 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, 287, __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, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = __pyx_t_3; @@ -10262,13 +10275,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_DETECTION_MODELS = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":290 + /* "dopt_sensor_anomalies/detection.py":291 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10276,19 +10289,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * ) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_measure_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_measure_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":291 + /* "dopt_sensor_anomalies/detection.py":292 * * data_csv, sensor_images = measure_length( * file_path, pixels_per_metric_X, pixels_per_metric_Y # <<<<<<<<<<<<<< * ) * anomaly_detection( */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10309,7 +10322,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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, 290, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -10318,7 +10331,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, 290, __pyx_L1_error) + __PYX_ERR(0, 291, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -10328,22 +10341,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_INCREF(__pyx_t_8); } else { __pyx_t_7 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __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, 290, __pyx_L1_error) + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __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_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); @@ -10351,7 +10364,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_2); if (unlikely(!__pyx_t_8)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 290, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 291, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L5_unpacking_done; @@ -10359,11 +10372,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 290, __pyx_L1_error) + __PYX_ERR(0, 291, __pyx_L1_error) __pyx_L5_unpacking_done:; } - /* "dopt_sensor_anomalies/detection.py":290 + /* "dopt_sensor_anomalies/detection.py":291 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10375,18 +10388,18 @@ 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":293 + /* "dopt_sensor_anomalies/detection.py":294 * file_path, pixels_per_metric_X, pixels_per_metric_Y * ) * anomaly_detection( # <<<<<<<<<<<<<< - * file_path=file_path, + * img_path=file_path, * 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, 293, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":297 + /* "dopt_sensor_anomalies/detection.py":298 * detection_models=DETECTION_MODELS, * data_csv=data_csv, * sensor_images=sensor_images, # <<<<<<<<<<<<<< @@ -10406,17 +10419,17 @@ 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_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_file_path, __pyx_v_file_path, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 293, __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, 293, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data_csv, __pyx_v_data_csv, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 293, __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, 293, __pyx_L1_error) + 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, 294, __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, 294, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data_csv, __pyx_v_data_csv, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 294, __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, 294, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10424,9 +10437,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U /* "dopt_sensor_anomalies/detection.py":276 * * - * def pipeline( # <<<<<<<<<<<<<< - * user_file_path: str, - * pixels_per_metric_X: float, + * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< + * def pipeline( + * user_img_path: str, */ /* function exit code */ @@ -11660,15 +11673,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, 61, __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, 61, __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, 65, __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, 65, __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, 61, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) #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__measure_length->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length->tp_getattro == PyObject_GenericGetAttr)) { @@ -11676,15 +11689,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, 93, __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, 93, __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, 97, __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, 97, __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, 93, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) #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_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11692,15 +11705,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, 133, __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, 133, __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, 137, __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, 137, __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, 133, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 137, __pyx_L1_error) #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_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11708,15 +11721,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, 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) + __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, 172, __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, 172, __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, 168, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 172, __pyx_L1_error) #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_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11724,15 +11737,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, 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) + __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, 173, __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, 173, __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, 169, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 173, __pyx_L1_error) #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_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11740,15 +11753,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, 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) + __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, 174, __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, 174, __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, 170, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 174, __pyx_L1_error) #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_5_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11756,15 +11769,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, 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) + __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, 175, __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, 175, __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, 171, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 175, __pyx_L1_error) #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_6_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11983,7 +11996,10 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_detection(PyObject *__pyx_pyinit_m PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - size_t __pyx_t_5; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12092,7 +12108,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); /* "dopt_sensor_anomalies/detection.py":1 * import csv # <<<<<<<<<<<<<< - * from os import path + * import warnings * from pathlib import Path */ __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_csv_2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -12102,502 +12118,555 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); /* "dopt_sensor_anomalies/detection.py":2 * import csv - * from os import path # <<<<<<<<<<<<<< + * import warnings # <<<<<<<<<<<<<< * from pathlib import Path * from typing import Any, Final, cast */ - __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_warnings, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_os, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_path, __pyx_t_2) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "dopt_sensor_anomalies/detection.py":3 * import csv - * from os import path + * import warnings * from pathlib import Path # <<<<<<<<<<<<<< * from typing import Any, Final, cast * */ - __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pathlib, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pathlib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Path, __pyx_t_3) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Path, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "dopt_sensor_anomalies/detection.py":4 - * from os import path + * import warnings * from pathlib import Path * from typing import Any, Final, cast # <<<<<<<<<<<<<< * - * # Image.MAX_IMAGE_PIXELS = None + * import cv2 */ - __pyx_t_2 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_Any, __pyx_mstate_global->__pyx_n_u_Final, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_Any, __pyx_mstate_global->__pyx_n_u_Final, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Any); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Any, __pyx_t_2) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Final); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Final, __pyx_t_2) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cast, __pyx_t_2) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Any, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Final); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Final, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cast, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":7 + /* "dopt_sensor_anomalies/detection.py":6 + * from typing import Any, Final, cast * - * # Image.MAX_IMAGE_PIXELS = None * import cv2 # <<<<<<<<<<<<<< * import imutils * import matplotlib.pyplot as plt */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_cv2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cv2, __pyx_t_3) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_cv2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cv2, __pyx_t_2) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":8 - * # Image.MAX_IMAGE_PIXELS = None + /* "dopt_sensor_anomalies/detection.py":7 + * * import cv2 * import imutils # <<<<<<<<<<<<<< * import matplotlib.pyplot as plt * import numpy as np */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_imutils, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_imutils, __pyx_t_3) < (0)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_imutils, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_imutils, __pyx_t_2) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":9 + /* "dopt_sensor_anomalies/detection.py":8 * import cv2 * import imutils * import matplotlib.pyplot as plt # <<<<<<<<<<<<<< * import numpy as np * import numpy.typing as npt */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_matplotlib_pyplot, __pyx_mstate_global->__pyx_tuple[7]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plt, __pyx_t_3) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_matplotlib_pyplot, __pyx_mstate_global->__pyx_tuple[7]); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plt, __pyx_t_2) < (0)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":10 + /* "dopt_sensor_anomalies/detection.py":9 * import imutils * import matplotlib.pyplot as plt * import numpy as np # <<<<<<<<<<<<<< * import numpy.typing as npt * import torch */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_3) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_2) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":11 + /* "dopt_sensor_anomalies/detection.py":10 * import matplotlib.pyplot as plt * import numpy as np * import numpy.typing as npt # <<<<<<<<<<<<<< * import torch - * + * from anomalib.models import Patchcore */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy_typing, __pyx_mstate_global->__pyx_tuple[8]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_npt, __pyx_t_3) < (0)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy_typing, __pyx_mstate_global->__pyx_tuple[8]); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_npt, __pyx_t_2) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":12 + /* "dopt_sensor_anomalies/detection.py":11 * import numpy as np * import numpy.typing as npt * import torch # <<<<<<<<<<<<<< - * - * # from anomalib.engine import Engine + * from anomalib.models import Patchcore + * from dopt_basics import result_pattern */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_torch, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_torch, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_torch, __pyx_t_2) < (0)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dopt_sensor_anomalies/detection.py":12 + * import numpy.typing as npt + * import torch + * from anomalib.models import Patchcore # <<<<<<<<<<<<<< + * from dopt_basics import result_pattern + * from imutils import contours, perspective +*/ + __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_anomalib_models, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_torch, __pyx_t_3) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Patchcore, __pyx_t_2) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":15 - * - * # from anomalib.engine import Engine - * from anomalib.models import Patchcore # <<<<<<<<<<<<<< + /* "dopt_sensor_anomalies/detection.py":13 + * import torch + * from anomalib.models import Patchcore + * from dopt_basics import result_pattern # <<<<<<<<<<<<<< * from imutils import contours, perspective * from pandas import DataFrame */ - __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_anomalib_models, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_basics, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Patchcore, __pyx_t_3) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_result_pattern, __pyx_t_3) < (0)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":16 - * # from anomalib.engine import Engine + /* "dopt_sensor_anomalies/detection.py":14 * from anomalib.models import Patchcore + * from dopt_basics import result_pattern * from imutils import contours, perspective # <<<<<<<<<<<<<< * from pandas import DataFrame * from PIL import Image */ - __pyx_t_2 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_contours, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_contours, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_imutils, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_imutils, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_contours, __pyx_t_2) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_contours, __pyx_t_2) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_perspective, __pyx_t_2) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_perspective, __pyx_t_2) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":17 - * from anomalib.models import Patchcore + /* "dopt_sensor_anomalies/detection.py":15 + * from dopt_basics import result_pattern * from imutils import contours, perspective * from pandas import DataFrame # <<<<<<<<<<<<<< * from PIL import Image * from scipy.spatial import distance as dist */ - __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pandas, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pandas, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DataFrame, __pyx_t_3) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DataFrame, __pyx_t_3) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":18 + /* "dopt_sensor_anomalies/detection.py":16 * from imutils import contours, perspective * from pandas import DataFrame * from PIL import Image # <<<<<<<<<<<<<< * from scipy.spatial import distance as dist - * from torchvision.transforms.v2.functional import to_dtype, to_image + * */ - __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_PIL, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_PIL, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Image, __pyx_t_2) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Image, __pyx_t_2) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":19 + /* "dopt_sensor_anomalies/detection.py":17 * from pandas import DataFrame * from PIL import Image * from scipy.spatial import distance as dist # <<<<<<<<<<<<<< - * from torchvision.transforms.v2.functional import to_dtype, to_image - * -*/ - __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_scipy_spatial, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dist, __pyx_t_3) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dopt_sensor_anomalies/detection.py":20 - * from PIL import Image - * from scipy.spatial import distance as dist - * from torchvision.transforms.v2.functional import to_dtype, to_image # <<<<<<<<<<<<<< * * import dopt_sensor_anomalies._find_paths */ - __pyx_t_2 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_to_dtype, __pyx_mstate_global->__pyx_n_u_to_image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_torchvision_transforms_v2_functi, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_to_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_scipy_spatial, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_to_dtype, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_to_image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_to_image, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dist, __pyx_t_3) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":22 - * from torchvision.transforms.v2.functional import to_dtype, to_image + /* "dopt_sensor_anomalies/detection.py":19 + * 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_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies__find_path, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_3) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies__find_path, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __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) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":23 + /* "dopt_sensor_anomalies/detection.py":20 * * import dopt_sensor_anomalies._find_paths * from dopt_sensor_anomalies import constants as const # <<<<<<<<<<<<<< * from dopt_sensor_anomalies import errors * from dopt_sensor_anomalies import types as t */ - __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_constants); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_constants); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_constants); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_const, __pyx_t_3) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_constants); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_const, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":24 + /* "dopt_sensor_anomalies/detection.py":21 * import dopt_sensor_anomalies._find_paths * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors # <<<<<<<<<<<<<< * from dopt_sensor_anomalies import types as t * */ - __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_errors, __pyx_t_2) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_errors, __pyx_t_3) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":25 + /* "dopt_sensor_anomalies/detection.py":22 * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors * from dopt_sensor_anomalies import types as t # <<<<<<<<<<<<<< * - * # input parameters: user-defined + * # Suppress the specific HuggingFace cache symlink warning */ - __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_t, __pyx_t_3) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_t, __pyx_t_2) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dopt_sensor_anomalies/detection.py":25 + * + * # Suppress the specific HuggingFace cache symlink warning + * warnings.filterwarnings( # <<<<<<<<<<<<<< + * "ignore", + * message=".*huggingface_hub.*cache-system uses symlinks.*", +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_filterwarnings); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "dopt_sensor_anomalies/detection.py":28 + * "ignore", + * message=".*huggingface_hub.*cache-system uses symlinks.*", + * category=UserWarning, # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ignore}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_message, __pyx_mstate_global->__pyx_kp_u_huggingface_hub_cache_system_us, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_category, __pyx_builtin_UserWarning, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dopt_sensor_anomalies/detection.py":32 * * # input parameters: user-defined * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") # <<<<<<<<<<<<<< * pixels_per_metric_X: float = 0.251 * pixels_per_metric_Y: float = 0.251 */ - __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = 1; + __pyx_t_6 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_C_Users_demon_Documents_EKF_Anal}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __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; + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_C_Users_demon_Documents_EKF_Anal}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_file_path, __pyx_t_2) < (0)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_file_path, __pyx_t_3) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":29 + /* "dopt_sensor_anomalies/detection.py":33 * # input parameters: user-defined * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") * pixels_per_metric_X: float = 0.251 # <<<<<<<<<<<<<< * pixels_per_metric_Y: float = 0.251 * */ - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_float_0_251) < (0)) __PYX_ERR(0, 29, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_float_0_251) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":30 + /* "dopt_sensor_anomalies/detection.py":34 * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") * pixels_per_metric_X: float = 0.251 * pixels_per_metric_Y: float = 0.251 # <<<<<<<<<<<<<< * * */ - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_float_0_251) < (0)) __PYX_ERR(0, 30, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_float_0_251) < (0)) __PYX_ERR(0, 34, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":34 + /* "dopt_sensor_anomalies/detection.py":38 * * # measuring * 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, 34, __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, 34, __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, 34, __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, 34, __pyx_L1_error) - __pyx_t_4 = __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_4)) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_A, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_B, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_float_float) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_4 = __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_4)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __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_4) < (0)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_midpoint, __pyx_t_4) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":44 + /* "dopt_sensor_anomalies/detection.py":48 * box_1: t.Box, * box_2: t.Box, * tolerance: float = 5.0, # <<<<<<<<<<<<<< * ) -> bool: * # unpack the boxes */ - __pyx_t_4 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "dopt_sensor_anomalies/detection.py":41 + /* "dopt_sensor_anomalies/detection.py":45 * * * def check_box_redundancy( # <<<<<<<<<<<<<< * box_1: t.Box, * box_2: t.Box, */ - __pyx_t_2 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_box_1, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) - __pyx_t_3 = __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_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_3 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, __pyx_t_3) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_box_1, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, __pyx_t_5) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":61 + /* "dopt_sensor_anomalies/detection.py":65 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * pixels_per_metric_X: float, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_file_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_t_CsvData_t_SensorImages) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) - __pyx_t_4 = __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_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_t_CsvData_t_SensorImages) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_4 = __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_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_measure_length, __pyx_t_4) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_measure_length, __pyx_t_4) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":186 + /* "dopt_sensor_anomalies/detection.py":190 * # helper function * # anomaly detection * def infer_image( # <<<<<<<<<<<<<< * image: npt.NDArray[np.uint8], * model: Patchcore, */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_model, __pyx_mstate_global->__pyx_n_u_Patchcore) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_t_InferenceResult) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) - __pyx_t_3 = __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_3)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_model, __pyx_mstate_global->__pyx_n_u_Patchcore) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_t_InferenceResult) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_infer_image, __pyx_t_3) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_infer_image, __pyx_t_5) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":223 + /* "dopt_sensor_anomalies/detection.py":227 * * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< - * file_path: Path, + * img_path: Path, * detection_models: t.DetectionModels, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_file_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_detection_models, __pyx_mstate_global->__pyx_kp_u_t_DetectionModels) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_data_csv, __pyx_mstate_global->__pyx_kp_u_t_CsvData) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_mstate_global->__pyx_kp_u_t_SensorImages) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) - __pyx_t_4 = __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_4)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_detection_models, __pyx_mstate_global->__pyx_kp_u_t_DetectionModels) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_data_csv, __pyx_mstate_global->__pyx_kp_u_t_CsvData) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_mstate_global->__pyx_kp_u_t_SensorImages) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_4 = __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_4)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_anomaly_detection, __pyx_t_4) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_anomaly_detection, __pyx_t_4) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "dopt_sensor_anomalies/detection.py":276 * * - * def pipeline( # <<<<<<<<<<<<<< - * user_file_path: str, - * pixels_per_metric_X: float, + * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< + * def pipeline( + * user_img_path: str, */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_user_file_path, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - __pyx_t_3 = __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_3)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_wrap_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_100}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__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_3)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_8 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_user_img_path, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_2 = __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_2)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pipeline, __pyx_t_4) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pipeline, __pyx_t_3) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "dopt_sensor_anomalies/detection.py":1 * import csv # <<<<<<<<<<<<<< - * from os import path + * import warnings * from pathlib import Path */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_3) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /*--- Wrapped vars code ---*/ @@ -12606,6 +12675,9 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); if (__pyx_m) { if (__pyx_mstate->__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init dopt_sensor_anomalies.detection", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -12692,7 +12764,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_No_contours_were_found_in_the_pr, sizeof(__pyx_k_No_contours_were_found_in_the_pr), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_No_contours_were_found_in_the_pr */ {__pyx_k_None, sizeof(__pyx_k_None), 0, 1, 1}, /* PyObject cname: __pyx_n_u_None */ {__pyx_k_Note_that_Cython_is_deliberately, sizeof(__pyx_k_Note_that_Cython_is_deliberately), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Note_that_Cython_is_deliberately */ - {__pyx_k_Number_of_counted_electroedes_do, sizeof(__pyx_k_Number_of_counted_electroedes_do), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Number_of_counted_electroedes_do */ + {__pyx_k_Number_of_counted_electrodes_doe, sizeof(__pyx_k_Number_of_counted_electrodes_doe), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Number_of_counted_electrodes_doe */ {__pyx_k_PIL, sizeof(__pyx_k_PIL), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PIL */ {__pyx_k_Patchcore, sizeof(__pyx_k_Patchcore), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Patchcore */ {__pyx_k_Path, sizeof(__pyx_k_Path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Path */ @@ -12704,6 +12776,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_THRESHOLD_BW, sizeof(__pyx_k_THRESHOLD_BW), 0, 1, 1}, /* PyObject cname: __pyx_n_u_THRESHOLD_BW */ {__pyx_k_THRESH_BINARY, sizeof(__pyx_k_THRESH_BINARY), 0, 1, 1}, /* PyObject cname: __pyx_n_u_THRESH_BINARY */ {__pyx_k_The_provided_path_seems_not_to_e, sizeof(__pyx_k_The_provided_path_seems_not_to_e), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_The_provided_path_seems_not_to_e */ + {__pyx_k_UserWarning, sizeof(__pyx_k_UserWarning), 0, 1, 1}, /* PyObject cname: __pyx_n_u_UserWarning */ {__pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__2 */ {__pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__3 */ {__pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__4 */ @@ -12742,6 +12815,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_c1, sizeof(__pyx_k_c1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c1 */ {__pyx_k_c2, sizeof(__pyx_k_c2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c2 */ {__pyx_k_cast, sizeof(__pyx_k_cast), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cast */ + {__pyx_k_category, sizeof(__pyx_k_category), 0, 1, 1}, /* PyObject cname: __pyx_n_u_category */ {__pyx_k_center_dist, sizeof(__pyx_k_center_dist), 0, 1, 1}, /* PyObject cname: __pyx_n_u_center_dist */ {__pyx_k_check_box_redundancy, sizeof(__pyx_k_check_box_redundancy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_check_box_redundancy */ {__pyx_k_checkpoint, sizeof(__pyx_k_checkpoint), 0, 1, 1}, /* PyObject cname: __pyx_n_u_checkpoint */ @@ -12777,6 +12851,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_disable */ {__pyx_k_dist, sizeof(__pyx_k_dist), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dist */ {__pyx_k_distance, sizeof(__pyx_k_distance), 0, 1, 1}, /* PyObject cname: __pyx_n_u_distance */ + {__pyx_k_dopt_basics, sizeof(__pyx_k_dopt_basics), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dopt_basics */ {__pyx_k_dopt_sensor_anomalies, sizeof(__pyx_k_dopt_sensor_anomalies), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dopt_sensor_anomalies */ {__pyx_k_dopt_sensor_anomalies__find_path, sizeof(__pyx_k_dopt_sensor_anomalies__find_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dopt_sensor_anomalies__find_path */ {__pyx_k_dopt_sensor_anomalies_detection, sizeof(__pyx_k_dopt_sensor_anomalies_detection), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dopt_sensor_anomalies_detection */ @@ -12797,6 +12872,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_file_path, sizeof(__pyx_k_file_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_file_path */ {__pyx_k_file_stem, sizeof(__pyx_k_file_stem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_file_stem */ {__pyx_k_filtered_cnts, sizeof(__pyx_k_filtered_cnts), 0, 1, 1}, /* PyObject cname: __pyx_n_u_filtered_cnts */ + {__pyx_k_filterwarnings, sizeof(__pyx_k_filterwarnings), 0, 1, 1}, /* PyObject cname: __pyx_n_u_filterwarnings */ {__pyx_k_findContours, sizeof(__pyx_k_findContours), 0, 1, 1}, /* PyObject cname: __pyx_n_u_findContours */ {__pyx_k_find_paths, sizeof(__pyx_k_find_paths), 0, 1, 1}, /* PyObject cname: __pyx_n_u_find_paths */ {__pyx_k_float, sizeof(__pyx_k_float), 0, 1, 1}, /* PyObject cname: __pyx_n_u_float */ @@ -12814,12 +12890,15 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_gray, sizeof(__pyx_k_gray), 0, 1, 1}, /* PyObject cname: __pyx_n_u_gray */ {__pyx_k_header, sizeof(__pyx_k_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_header */ {__pyx_k_hspace, sizeof(__pyx_k_hspace), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hspace */ + {__pyx_k_huggingface_hub_cache_system_us, sizeof(__pyx_k_huggingface_hub_cache_system_us), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_huggingface_hub_cache_system_us */ {__pyx_k_i, sizeof(__pyx_k_i), 0, 1, 1}, /* PyObject cname: __pyx_n_u_i */ + {__pyx_k_ignore, sizeof(__pyx_k_ignore), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ignore */ {__pyx_k_image, sizeof(__pyx_k_image), 0, 1, 1}, /* PyObject cname: __pyx_n_u_image */ {__pyx_k_image_np, sizeof(__pyx_k_image_np), 0, 1, 1}, /* PyObject cname: __pyx_n_u_image_np */ {__pyx_k_image_rgb, sizeof(__pyx_k_image_rgb), 0, 1, 1}, /* PyObject cname: __pyx_n_u_image_rgb */ {__pyx_k_img, sizeof(__pyx_k_img), 0, 1, 1}, /* PyObject cname: __pyx_n_u_img */ {__pyx_k_img_np, sizeof(__pyx_k_img_np), 0, 1, 1}, /* PyObject cname: __pyx_n_u_img_np */ + {__pyx_k_img_path, sizeof(__pyx_k_img_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_img_path */ {__pyx_k_imread, sizeof(__pyx_k_imread), 0, 1, 1}, /* PyObject cname: __pyx_n_u_imread */ {__pyx_k_imshow, sizeof(__pyx_k_imshow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_imshow */ {__pyx_k_imutils, sizeof(__pyx_k_imutils), 0, 1, 1}, /* PyObject cname: __pyx_n_u_imutils */ @@ -12849,6 +12928,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_max, sizeof(__pyx_k_max), 0, 1, 1}, /* PyObject cname: __pyx_n_u_max */ {__pyx_k_measure_length, sizeof(__pyx_k_measure_length), 0, 1, 1}, /* PyObject cname: __pyx_n_u_measure_length */ {__pyx_k_measure_length_locals_genexpr, sizeof(__pyx_k_measure_length_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_measure_length_locals_genexpr */ + {__pyx_k_message, sizeof(__pyx_k_message), 0, 1, 1}, /* PyObject cname: __pyx_n_u_message */ {__pyx_k_midpoint, sizeof(__pyx_k_midpoint), 0, 1, 1}, /* PyObject cname: __pyx_n_u_midpoint */ {__pyx_k_min, sizeof(__pyx_k_min), 0, 1, 1}, /* PyObject cname: __pyx_n_u_min */ {__pyx_k_minAreaRect, sizeof(__pyx_k_minAreaRect), 0, 1, 1}, /* PyObject cname: __pyx_n_u_minAreaRect */ @@ -12871,12 +12951,10 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_off, sizeof(__pyx_k_off), 0, 1, 1}, /* PyObject cname: __pyx_n_u_off */ {__pyx_k_order_points, sizeof(__pyx_k_order_points), 0, 1, 1}, /* PyObject cname: __pyx_n_u_order_points */ {__pyx_k_orig, sizeof(__pyx_k_orig), 0, 1, 1}, /* PyObject cname: __pyx_n_u_orig */ - {__pyx_k_os, sizeof(__pyx_k_os), 0, 1, 1}, /* PyObject cname: __pyx_n_u_os */ {__pyx_k_output, sizeof(__pyx_k_output), 0, 1, 1}, /* PyObject cname: __pyx_n_u_output */ {__pyx_k_pad_inches, sizeof(__pyx_k_pad_inches), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pad_inches */ {__pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pandas */ {__pyx_k_parent, sizeof(__pyx_k_parent), 0, 1, 1}, /* PyObject cname: __pyx_n_u_parent */ - {__pyx_k_path, sizeof(__pyx_k_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_path */ {__pyx_k_pathlib, sizeof(__pyx_k_pathlib), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pathlib */ {__pyx_k_permute, sizeof(__pyx_k_permute), 0, 1, 1}, /* PyObject cname: __pyx_n_u_permute */ {__pyx_k_perspective, sizeof(__pyx_k_perspective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_perspective */ @@ -12897,6 +12975,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_rbox, sizeof(__pyx_k_rbox), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rbox */ {__pyx_k_resize, sizeof(__pyx_k_resize), 0, 1, 1}, /* PyObject cname: __pyx_n_u_resize */ {__pyx_k_result, sizeof(__pyx_k_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_result */ + {__pyx_k_result_pattern, sizeof(__pyx_k_result_pattern), 0, 1, 1}, /* PyObject cname: __pyx_n_u_result_pattern */ {__pyx_k_return, sizeof(__pyx_k_return), 0, 1, 1}, /* PyObject cname: __pyx_n_u_return */ {__pyx_k_right, sizeof(__pyx_k_right), 0, 1, 1}, /* PyObject cname: __pyx_n_u_right */ {__pyx_k_rightmost_x_third, sizeof(__pyx_k_rightmost_x_third), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rightmost_x_third */ @@ -12936,12 +13015,9 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_tltrY, sizeof(__pyx_k_tltrY), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tltrY */ {__pyx_k_to, sizeof(__pyx_k_to), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to */ {__pyx_k_to_csv, sizeof(__pyx_k_to_csv), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_csv */ - {__pyx_k_to_dtype, sizeof(__pyx_k_to_dtype), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_dtype */ - {__pyx_k_to_image, sizeof(__pyx_k_to_image), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_image */ {__pyx_k_tolerance, sizeof(__pyx_k_tolerance), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tolerance */ {__pyx_k_torch, sizeof(__pyx_k_torch), 0, 1, 1}, /* PyObject cname: __pyx_n_u_torch */ {__pyx_k_torch_device, sizeof(__pyx_k_torch_device), 0, 1, 1}, /* PyObject cname: __pyx_n_u_torch_device */ - {__pyx_k_torchvision_transforms_v2_functi, sizeof(__pyx_k_torchvision_transforms_v2_functi), 0, 1, 1}, /* PyObject cname: __pyx_n_u_torchvision_transforms_v2_functi */ {__pyx_k_tr, sizeof(__pyx_k_tr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tr */ {__pyx_k_trbrX, sizeof(__pyx_k_trbrX), 0, 1, 1}, /* PyObject cname: __pyx_n_u_trbrX */ {__pyx_k_trbrY, sizeof(__pyx_k_trbrY), 0, 1, 1}, /* PyObject cname: __pyx_n_u_trbrY */ @@ -12951,9 +13027,11 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_typing, sizeof(__pyx_k_typing), 0, 1, 1}, /* PyObject cname: __pyx_n_u_typing */ {__pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 1, 1}, /* PyObject cname: __pyx_n_u_uint8 */ {__pyx_k_unsqueeze, sizeof(__pyx_k_unsqueeze), 0, 1, 1}, /* PyObject cname: __pyx_n_u_unsqueeze */ - {__pyx_k_user_file_path, sizeof(__pyx_k_user_file_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_user_file_path */ + {__pyx_k_user_img_path, sizeof(__pyx_k_user_img_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_user_img_path */ {__pyx_k_value, sizeof(__pyx_k_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_value */ {__pyx_k_w, sizeof(__pyx_k_w), 0, 1, 1}, /* PyObject cname: __pyx_n_u_w */ + {__pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 1, 1}, /* PyObject cname: __pyx_n_u_warnings */ + {__pyx_k_wrap_result, sizeof(__pyx_k_wrap_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_wrap_result */ {__pyx_k_wspace, sizeof(__pyx_k_wspace), 0, 1, 1}, /* PyObject cname: __pyx_n_u_wspace */ {__pyx_k_x1, sizeof(__pyx_k_x1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_x1 */ {__pyx_k_x2, sizeof(__pyx_k_x2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_x2 */ @@ -12973,11 +13051,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, c 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, 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_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_builtin_UserWarning = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_UserWarning); if (!__pyx_builtin_UserWarning) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 97, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 243, __pyx_L1_error) - __pyx_builtin_FileNotFoundError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_FileNotFoundError); if (!__pyx_builtin_FileNotFoundError) __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_builtin_FileNotFoundError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_FileNotFoundError); if (!__pyx_builtin_FileNotFoundError) __PYX_ERR(0, 284, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -12989,119 +13068,119 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "dopt_sensor_anomalies/detection.py":168 + /* "dopt_sensor_anomalies/detection.py":172 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 */ - __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_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 172, __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, 168, __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, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); - /* "dopt_sensor_anomalies/detection.py":170 + /* "dopt_sensor_anomalies/detection.py":174 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 * */ - __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_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, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); - /* "dopt_sensor_anomalies/detection.py":71 - * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") + /* "dopt_sensor_anomalies/detection.py":75 + * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * * cropped = image[500:1500, 100 : image.shape[1] - 100] # <<<<<<<<<<<<<< * orig = cropped.copy() * # change colours in the image to black and white */ - __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, 71, __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, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); - /* "dopt_sensor_anomalies/detection.py":77 + /* "dopt_sensor_anomalies/detection.py":81 * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) * # perform edge detection, identify rectangular shapes * 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, 77, __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, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); - /* "dopt_sensor_anomalies/detection.py":197 + /* "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, 197, __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":203 + /* "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, 203, __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":240 - * + /* "dopt_sensor_anomalies/detection.py":241 + * ) * # preparation for plot * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< - * * # loop over left and right sensor + * 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, 240, __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, 241, __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, 240, __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, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); - /* "dopt_sensor_anomalies/detection.py":9 + /* "dopt_sensor_anomalies/detection.py":8 * import cv2 * import imutils * import matplotlib.pyplot as plt # <<<<<<<<<<<<<< * import numpy as np * import numpy.typing as npt */ - __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_matplotlib, __pyx_mstate_global->__pyx_n_u_pyplot); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_matplotlib, __pyx_mstate_global->__pyx_n_u_pyplot); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]); - /* "dopt_sensor_anomalies/detection.py":11 + /* "dopt_sensor_anomalies/detection.py":10 * import matplotlib.pyplot as plt * import numpy as np * import numpy.typing as npt # <<<<<<<<<<<<<< * import torch - * + * from anomalib.models import Patchcore */ - __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_mstate_global->__pyx_n_u_typing); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_mstate_global->__pyx_n_u_typing); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]); - /* "dopt_sensor_anomalies/detection.py":22 - * from torchvision.transforms.v2.functional import to_dtype, to_image + /* "dopt_sensor_anomalies/detection.py":19 + * 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_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]); __Pyx_RefNannyFinishContext(); @@ -13164,63 +13243,63 @@ 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), 93, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 97, 2}; 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_k__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), 133, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 137, 2}; 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_k__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), 168, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 172, 2}; 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_k_a, 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), 169, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 173, 2}; 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_k_a, 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), 170, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 174, 2}; 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_k_a, 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), 171, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 175, 2}; 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_k_a, 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), 34, 52}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 38, 52}; 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_k_AT_Rt1D_AS_at2Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 41, 141}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 45, 141}; 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_k_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 56, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 61, 880}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_file_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}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 56, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 65, 880}; + 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_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 186, 280}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 190, 280}; 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_k_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 = {4, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 223, 344}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_file_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_k_1_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS, 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), 227, 342}; + 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_k_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 = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 276, 118}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_user_file_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}; + 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_k_AQ_t9G1_q_5_ARRS_aq_nA_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; } Py_DECREF(tuple_dedup_map); diff --git a/src/dopt_sensor_anomalies/detection.py b/src/dopt_sensor_anomalies/detection.py index 4dd6e43..5d55cf3 100644 --- a/src/dopt_sensor_anomalies/detection.py +++ b/src/dopt_sensor_anomalies/detection.py @@ -1,24 +1,20 @@ import csv import warnings -from os import path from pathlib import Path from typing import Any, Final, cast -# Image.MAX_IMAGE_PIXELS = None import cv2 import imutils import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt import torch - -# from anomalib.engine import Engine from anomalib.models import Patchcore +from dopt_basics import result_pattern from imutils import contours, perspective from pandas import DataFrame from PIL import Image from scipy.spatial import distance as dist -from torchvision.transforms.v2.functional import to_dtype, to_image import dopt_sensor_anomalies._find_paths from dopt_sensor_anomalies import constants as const @@ -67,14 +63,14 @@ def check_box_redundancy( # ** main function def measure_length( - file_path: Path, + img_path: Path, pixels_per_metric_X: float, pixels_per_metric_Y: float, ) -> tuple[t.CsvData, t.SensorImages]: data_csv: list[str | int] = [] - image = cv2.imread(str(file_path)) + image = cv2.imread(str(img_path)) if image is None: - raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") + raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") cropped = image[500:1500, 100 : image.shape[1] - 100] orig = cropped.copy() @@ -229,13 +225,13 @@ def infer_image( # ** main function def anomaly_detection( - file_path: Path, + img_path: Path, detection_models: t.DetectionModels, data_csv: t.CsvData, sensor_images: t.SensorImages, ) -> None: - file_stem = file_path.stem - folder_path = file_path.parent + file_stem = img_path.stem + folder_path = img_path.parent # reconstruct the model and initialize the engine model = Patchcore( @@ -277,12 +273,13 @@ def anomaly_detection( ) +@result_pattern.wrap_result(100) def pipeline( - user_file_path: str, + user_img_path: str, pixels_per_metric_X: float, pixels_per_metric_Y: float, ) -> None: - file_path = Path(user_file_path) + file_path = Path(user_img_path) if not file_path.exists(): raise FileNotFoundError("The provided path seems not to exist") @@ -295,7 +292,7 @@ def pipeline( file_path, pixels_per_metric_X, pixels_per_metric_Y ) anomaly_detection( - file_path=file_path, + img_path=file_path, detection_models=DETECTION_MODELS, data_csv=data_csv, sensor_images=sensor_images, diff --git a/src/dopt_sensor_anomalies/detection.pyi b/src/dopt_sensor_anomalies/detection.pyi index e6d4b33..eaf06b3 100644 --- a/src/dopt_sensor_anomalies/detection.pyi +++ b/src/dopt_sensor_anomalies/detection.pyi @@ -3,6 +3,7 @@ from pathlib import Path import numpy as np import numpy.typing as npt from anomalib.models import Patchcore +from dopt_basics import result_pattern from dopt_sensor_anomalies import types as t @@ -50,7 +51,7 @@ def check_box_redundancy( ... def measure_length( - file_path: Path, + img_path: Path, pixels_per_metric_X: float, pixels_per_metric_Y: float, ) -> tuple[t.CsvData, t.SensorImages]: @@ -58,7 +59,7 @@ def measure_length( Parameters ---------- - file_path : Path + img_path : Path path to file to analyse pixels_per_metric_X : float scaling parameter x dimension, Pixels per micrometer in image @@ -108,7 +109,7 @@ def infer_image( ... def anomaly_detection( - file_path: Path, + img_path: Path, detection_models: t.DetectionModels, data_csv: t.CsvData, sensor_images: t.SensorImages, @@ -117,7 +118,7 @@ def anomaly_detection( Parameters ---------- - file_path : Path + img_path : Path path to file to analyse detection_models : t.DetectionModels collection of model paths for the left and right sensor @@ -128,8 +129,26 @@ def anomaly_detection( """ ... +@result_pattern.wrap_result(100) def pipeline( - user_file_path: str, + user_img_path: str, pixels_per_metric_X: float, pixels_per_metric_Y: float, -) -> None: ... +) -> None: + """full pipeline defined by the agreed requirements + wrapped as result pattern, handle errors on higher abstraction level + + Parameters + ---------- + user_img_path : str + file path to the image which is to be analysed + pixels_per_metric_X : float + calibration value for the x axis to measure the size of the electrodes + pixels_per_metric_Y : float + calibration value for the y axis to measure the size of the electrodes + + Raises + ------ + FileNotFoundError + provided image path was not found + """ diff --git a/tests/test_detection.py b/tests/test_detection.py index df0873c..c502181 100644 --- a/tests/test_detection.py +++ b/tests/test_detection.py @@ -1,36 +1,36 @@ import shutil -from pathlib import Path from unittest.mock import patch import numpy as np import pytest +from dopt_basics import result_pattern import dopt_sensor_anomalies._find_paths import dopt_sensor_anomalies.detection as detect import dopt_sensor_anomalies.types as t -from dopt_sensor_anomalies import constants +from dopt_sensor_anomalies import constants, errors + +# TODO remove +# @pytest.fixture(scope="module") +# def img_paths() -> tuple[Path, ...]: +# img_folder = Path(__file__).parent / "_img" +# if not img_folder.exists(): +# raise FileNotFoundError("Img path not existing") +# img_paths = tuple(img_folder.glob("*.bmp")) +# if not img_paths: +# raise ValueError("No images found") +# return img_paths -@pytest.fixture(scope="module") -def img_paths() -> tuple[Path, ...]: - img_folder = Path(__file__).parent / "_img" - if not img_folder.exists(): - raise FileNotFoundError("Img path not existing") - img_paths = tuple(img_folder.glob("*.bmp")) - if not img_paths: - raise ValueError("No images found") - return img_paths - - -@pytest.fixture(scope="module") -def single_img_path() -> Path: - img_folder = Path(__file__).parent / "_img" - if not img_folder.exists(): - raise FileNotFoundError("Img path not existing") - img_paths = tuple(img_folder.glob("*_12.bmp")) - if not img_paths: - raise ValueError("No images found") - return img_paths[0] +# @pytest.fixture(scope="module") +# def single_img_path() -> Path: +# img_folder = Path(__file__).parent / "_img" +# if not img_folder.exists(): +# raise FileNotFoundError("Img path not existing") +# img_paths = tuple(img_folder.glob("*_12.bmp")) +# if not img_paths: +# raise ValueError("No images found") +# return img_paths[0] def test_midpoint(): @@ -90,7 +90,6 @@ def test_measure_length(single_img_path): assert img_right.shape[2] == 3 -@pytest.mark.new @patch("dopt_sensor_anomalies._find_paths.STOP_FOLDER_NAME", "lib") def test_isolated_pipeline(results_folder, path_img_with_failure_TrainedModel): pixels_per_metric_X: float = 0.251 @@ -111,7 +110,7 @@ def test_isolated_pipeline(results_folder, path_img_with_failure_TrainedModel): assert sensor_images["left"] is not None assert sensor_images["right"] is not None detect.anomaly_detection( - file_path=path_img_with_failure_TrainedModel, + img_path=path_img_with_failure_TrainedModel, detection_models=DETECTION_MODELS, data_csv=data_csv, sensor_images=sensor_images, @@ -125,3 +124,57 @@ def test_isolated_pipeline(results_folder, path_img_with_failure_TrainedModel): assert heatmap_file.exists() shutil.copy(csv_file, (results_folder / csv_file.name)) shutil.copy(heatmap_file, (results_folder / heatmap_file.name)) + + +@patch("dopt_sensor_anomalies._find_paths.STOP_FOLDER_NAME", "lib") +def test_full_pipeline_wrapped_FailImagePath(setup_temp_dir): + img_path = str(setup_temp_dir / "not-existing.bmp") + MESSAGE = "The provided path seems not to exist" + + pixels_per_metric_X: float = 0.251 + pixels_per_metric_Y: float = 0.251 + + ret = detect.pipeline(img_path, pixels_per_metric_X, pixels_per_metric_Y) + assert ret.status != result_pattern.STATUS_HANDLER.SUCCESS + assert ret.status.ExceptionType is FileNotFoundError + assert ret.status.message == MESSAGE + with pytest.raises(FileNotFoundError, match=MESSAGE): + _ = ret.unwrap() + + +@patch("dopt_sensor_anomalies._find_paths.STOP_FOLDER_NAME", "lib") +def test_full_pipeline_wrapped_FailElectrodeCount(path_img_with_failure_ElectrodeCount): + img_path = str(path_img_with_failure_ElectrodeCount) + MESSAGE = "Number of counted electrodes does not match the" + + pixels_per_metric_X: float = 0.251 + pixels_per_metric_Y: float = 0.251 + + ret = detect.pipeline(img_path, pixels_per_metric_X, pixels_per_metric_Y) + assert ret.status != result_pattern.STATUS_HANDLER.SUCCESS + assert ret.status.ExceptionType is errors.InvalidElectrodeCount + assert MESSAGE in ret.status.message + with pytest.raises(errors.InvalidElectrodeCount, match=MESSAGE): + _ = ret.unwrap() + + +@patch("dopt_sensor_anomalies._find_paths.STOP_FOLDER_NAME", "lib") +def test_full_pipeline_wrapped_Success(results_folder, path_img_with_failure_TrainedModel): + img_path = str(path_img_with_failure_TrainedModel) + pixels_per_metric_X: float = 0.251 + pixels_per_metric_Y: float = 0.251 + + ret = detect.pipeline(img_path, pixels_per_metric_X, pixels_per_metric_Y) + assert ret.status == result_pattern.STATUS_HANDLER.SUCCESS + assert ret.status.code == 0 + assert ret.status.ExceptionType is None + + # check files for existence + root_img = path_img_with_failure_TrainedModel.parent + file_stem = path_img_with_failure_TrainedModel.stem + csv_file = root_img / f"{file_stem}.csv" + heatmap_file = root_img / f"{file_stem}{constants.HEATMAP_FILENAME_SUFFIX}.png" + assert csv_file.exists() + assert heatmap_file.exists() + shutil.copy(csv_file, (results_folder / csv_file.name)) + shutil.copy(heatmap_file, (results_folder / heatmap_file.name))