From b2162af624cdccd4825cb028c7b34b1ced771615 Mon Sep 17 00:00:00 2001 From: foefl Date: Wed, 22 Oct 2025 10:03:52 +0200 Subject: [PATCH] move annotation descriptions and docstrings to stub file to securely remove them from the output --- src/dopt_sensor_anomalies/detection.c | 3048 ++++++++++++----------- src/dopt_sensor_anomalies/detection.py | 90 +- src/dopt_sensor_anomalies/detection.pyi | 135 + 3 files changed, 1661 insertions(+), 1612 deletions(-) create mode 100644 src/dopt_sensor_anomalies/detection.pyi diff --git a/src/dopt_sensor_anomalies/detection.c b/src/dopt_sensor_anomalies/detection.c index ca673ef..2e0bf13 100644 --- a/src/dopt_sensor_anomalies/detection.c +++ b/src/dopt_sensor_anomalies/detection.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.1.4 */ +/* Generated by Cython 3.1.5 */ /* BEGIN: Cython Metadata { @@ -16,8 +16,16 @@ END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ /* InitLimitedAPI */ -#if defined(Py_LIMITED_API) && !defined(CYTHON_LIMITED_API) +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif #endif #include "Python.h" @@ -26,8 +34,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x03080000 #error Cython requires Python 3.8+. #else -#define __PYX_ABI_VERSION "3_1_4" -#define CYTHON_HEX_VERSION 0x030104F0 +#define __PYX_ABI_VERSION "3_1_5" +#define CYTHON_HEX_VERSION 0x030105F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include @@ -1285,6 +1293,7 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); typedef sdigit __Pyx_compact_pylong; typedef digit __Pyx_compact_upylong; #endif + static CYTHON_INLINE int __Pyx_PyLong_CompactAsLong(PyObject *x, long *return_value); #if PY_VERSION_HEX >= 0x030C00A5 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) #else @@ -1518,7 +1527,7 @@ typedef struct __pyx_ctuple_double__and_double __pyx_ctuple_double__and_double; * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], * ) -> tuple[float, float]: # <<<<<<<<<<<<<< - * """to identify the midpoint of a 2D area + * return ((pt_A[0] + pt_B[0]) * 0.5, (pt_A[1] + pt_B[1]) * 0.5) * */ struct __pyx_ctuple_double__and_double { @@ -1526,7 +1535,7 @@ struct __pyx_ctuple_double__and_double { double f1; }; -/* "dopt_sensor_anomalies/detection.py":91 +/* "dopt_sensor_anomalies/detection.py":61 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< @@ -1539,7 +1548,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_ }; -/* "dopt_sensor_anomalies/detection.py":149 +/* "dopt_sensor_anomalies/detection.py":93 * 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 # <<<<<<<<<<<<<< @@ -1557,7 +1566,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr }; -/* "dopt_sensor_anomalies/detection.py":189 +/* "dopt_sensor_anomalies/detection.py":133 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -1572,7 +1581,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr }; -/* "dopt_sensor_anomalies/detection.py":224 +/* "dopt_sensor_anomalies/detection.py":168 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -1588,7 +1597,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr }; -/* "dopt_sensor_anomalies/detection.py":225 +/* "dopt_sensor_anomalies/detection.py":169 * # 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 # <<<<<<<<<<<<<< @@ -1604,7 +1613,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr }; -/* "dopt_sensor_anomalies/detection.py":226 +/* "dopt_sensor_anomalies/detection.py":170 * 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 # <<<<<<<<<<<<<< @@ -1620,7 +1629,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr }; -/* "dopt_sensor_anomalies/detection.py":227 +/* "dopt_sensor_anomalies/detection.py":171 * 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 # <<<<<<<<<<<<<< @@ -2830,7 +2839,6 @@ static const char __pyx_k_items[] = "items"; static const char __pyx_k_model[] = "model"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_right[] = "right"; -static const char __pyx_k_scale[] = "scale"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_t_Box[] = "t.Box"; static const char __pyx_k_throw[] = "throw"; @@ -2850,6 +2858,7 @@ static const char __pyx_k_x_min[] = "x_min"; static const char __pyx_k_y_max[] = "y_max"; static const char __pyx_k_y_min[] = "y_min"; static const char __pyx_k_LAYERS[] = "LAYERS"; +static const char __pyx_k_astype[] = "astype"; static const char __pyx_k_binary[] = "binary"; static const char __pyx_k_closed[] = "closed"; static const char __pyx_k_device[] = "device"; @@ -2886,6 +2895,7 @@ static const char __pyx_k_genexpr[] = "genexpr"; static const char __pyx_k_imutils[] = "imutils"; static const char __pyx_k_no_grad[] = "no_grad"; static const char __pyx_k_pathlib[] = "pathlib"; +static const char __pyx_k_permute[] = "permute"; static const char __pyx_k_quoting[] = "quoting"; static const char __pyx_k_savefig[] = "savefig"; static const char __pyx_k_squeeze[] = "squeeze"; @@ -2898,6 +2908,7 @@ static const char __pyx_k_data_csv[] = "data_csv"; 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_midpoint[] = "midpoint"; static const char __pyx_k_pipeline[] = "pipeline"; static const char __pyx_k_qualname[] = "__qualname__"; @@ -2910,7 +2921,6 @@ static const char __pyx_k_x_middle[] = "x_middle"; static const char __pyx_k_DataFrame[] = "DataFrame"; static const char __pyx_k_Patchcore[] = "Patchcore"; static const char __pyx_k_RETR_TREE[] = "RETR_TREE"; -static const char __pyx_k_as_tensor[] = "as_tensor"; static const char __pyx_k_boxPoints[] = "boxPoints"; static const char __pyx_k_constants[] = "constants"; static const char __pyx_k_enumerate[] = "enumerate"; @@ -2931,6 +2941,7 @@ static const char __pyx_k_MORPH_RECT[] = "MORPH_RECT"; static const char __pyx_k_QUOTE_NONE[] = "QUOTE_NONE"; static const char __pyx_k_checkpoint[] = "checkpoint"; static const char __pyx_k_find_paths[] = "_find_paths"; +static const char __pyx_k_from_numpy[] = "from_numpy"; static const char __pyx_k_matplotlib[] = "matplotlib"; static const char __pyx_k_pad_inches[] = "pad_inches"; static const char __pyx_k_pred_label[] = "pred_label"; @@ -2973,7 +2984,7 @@ static const char __pyx_k_accepted_boxes[] = "accepted_boxes"; static const char __pyx_k_measure_length[] = "measure_length"; 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\360\036\000\005\r\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_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"; static const char __pyx_k_load_state_dict[] = "load_state_dict"; @@ -3014,11 +3025,11 @@ static const char __pyx_k_AQ_t9G1_q_5_ARRS_aq_nA_Q_a[] = "\200\001\330\024\025\3 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\360\034\000\005\021\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_e_V1_vQk_1_z[] = "\200\001\330\013\014\330\013\014\330\005\006\360(\000\005\024\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\005\330\010\020\220\001\220\030\230\021\230,\240e\250:\260V\2701\330\013\020\220\001\340\r\017\210v\220Q\220k\240\022\2401\360\006\000\005\024\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_6_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q[] = "\200\001\330\017\020\330\031\032\330\031\032\330\005\006\3606\000\005!\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_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_dopt_sensor_anomalies_detection[] = "dopt_sensor_anomalies.detection"; -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\360$\000\005\t\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_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"; @@ -3103,9 +3114,9 @@ typedef struct { PyTypeObject *__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; PyObject *__pyx_slice[2]; - PyObject *__pyx_tuple[9]; + PyObject *__pyx_tuple[10]; PyObject *__pyx_codeobj_tab[12]; - PyObject *__pyx_string_tab[303]; + PyObject *__pyx_string_tab[305]; PyObject *__pyx_float_0_5; PyObject *__pyx_float_0_8; PyObject *__pyx_float_2_0; @@ -3261,7 +3272,7 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #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_as_tensor __pyx_string_tab[61] +#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] @@ -3343,166 +3354,168 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #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_fromarray __pyx_string_tab[143] -#define __pyx_n_u_func __pyx_string_tab[144] -#define __pyx_kp_u_gc __pyx_string_tab[145] -#define __pyx_n_u_genexpr __pyx_string_tab[146] -#define __pyx_n_u_getStructuringElement __pyx_string_tab[147] -#define __pyx_n_u_get_detection_models __pyx_string_tab[148] -#define __pyx_n_u_get_model_folder __pyx_string_tab[149] -#define __pyx_n_u_grab_contours __pyx_string_tab[150] -#define __pyx_n_u_gray __pyx_string_tab[151] -#define __pyx_n_u_header __pyx_string_tab[152] -#define __pyx_n_u_hspace __pyx_string_tab[153] -#define __pyx_n_u_i __pyx_string_tab[154] -#define __pyx_n_u_image __pyx_string_tab[155] -#define __pyx_n_u_image_rgb __pyx_string_tab[156] -#define __pyx_n_u_img __pyx_string_tab[157] -#define __pyx_n_u_img_np __pyx_string_tab[158] -#define __pyx_n_u_imread __pyx_string_tab[159] -#define __pyx_n_u_imshow __pyx_string_tab[160] -#define __pyx_n_u_imutils __pyx_string_tab[161] -#define __pyx_n_u_index __pyx_string_tab[162] -#define __pyx_n_u_infer_image __pyx_string_tab[163] -#define __pyx_n_u_initializing __pyx_string_tab[164] -#define __pyx_n_u_input_tensor __pyx_string_tab[165] -#define __pyx_n_u_int32 __pyx_string_tab[166] -#define __pyx_n_u_is_available __pyx_string_tab[167] -#define __pyx_n_u_is_coroutine __pyx_string_tab[168] -#define __pyx_n_u_is_duplicate __pyx_string_tab[169] -#define __pyx_n_u_is_sorted __pyx_string_tab[170] -#define __pyx_kp_u_isenabled __pyx_string_tab[171] -#define __pyx_n_u_item __pyx_string_tab[172] -#define __pyx_n_u_items __pyx_string_tab[173] -#define __pyx_n_u_jet __pyx_string_tab[174] -#define __pyx_n_u_kernel __pyx_string_tab[175] -#define __pyx_n_u_layers __pyx_string_tab[176] -#define __pyx_n_u_left __pyx_string_tab[177] -#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[178] -#define __pyx_n_u_linalg __pyx_string_tab[179] -#define __pyx_n_u_load __pyx_string_tab[180] -#define __pyx_n_u_load_state_dict __pyx_string_tab[181] -#define __pyx_n_u_main __pyx_string_tab[182] -#define __pyx_n_u_matplotlib __pyx_string_tab[183] -#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[184] -#define __pyx_n_u_max __pyx_string_tab[185] -#define __pyx_n_u_measure_length __pyx_string_tab[186] -#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[187] -#define __pyx_n_u_midpoint __pyx_string_tab[188] -#define __pyx_n_u_min __pyx_string_tab[189] -#define __pyx_n_u_minAreaRect __pyx_string_tab[190] -#define __pyx_n_u_mode __pyx_string_tab[191] -#define __pyx_n_u_model __pyx_string_tab[192] -#define __pyx_n_u_model_state_dict __pyx_string_tab[193] -#define __pyx_n_u_module __pyx_string_tab[194] -#define __pyx_n_u_morphologyEx __pyx_string_tab[195] -#define __pyx_n_u_name __pyx_string_tab[196] -#define __pyx_n_u_next __pyx_string_tab[197] -#define __pyx_n_u_no_grad __pyx_string_tab[198] -#define __pyx_n_u_norm __pyx_string_tab[199] -#define __pyx_n_u_np __pyx_string_tab[200] -#define __pyx_n_u_npt __pyx_string_tab[201] -#define __pyx_kp_u_npt_NDArray_np_floating __pyx_string_tab[202] -#define __pyx_kp_u_npt_NDArray_np_uint8 __pyx_string_tab[203] -#define __pyx_n_u_num_contours __pyx_string_tab[204] -#define __pyx_n_u_numpy __pyx_string_tab[205] -#define __pyx_n_u_numpy_typing __pyx_string_tab[206] -#define __pyx_n_u_off __pyx_string_tab[207] -#define __pyx_n_u_order_points __pyx_string_tab[208] -#define __pyx_n_u_orig __pyx_string_tab[209] -#define __pyx_n_u_os __pyx_string_tab[210] -#define __pyx_n_u_output __pyx_string_tab[211] -#define __pyx_n_u_pad_inches __pyx_string_tab[212] -#define __pyx_n_u_pandas __pyx_string_tab[213] -#define __pyx_n_u_parent __pyx_string_tab[214] -#define __pyx_n_u_path __pyx_string_tab[215] -#define __pyx_n_u_pathlib __pyx_string_tab[216] -#define __pyx_n_u_perspective __pyx_string_tab[217] -#define __pyx_n_u_pil_image __pyx_string_tab[218] -#define __pyx_n_u_pipeline __pyx_string_tab[219] -#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[220] -#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[221] -#define __pyx_n_u_plt __pyx_string_tab[222] -#define __pyx_kp_u_png __pyx_string_tab[223] -#define __pyx_n_u_pop __pyx_string_tab[224] -#define __pyx_n_u_pred_label __pyx_string_tab[225] -#define __pyx_n_u_pred_score __pyx_string_tab[226] -#define __pyx_n_u_pt_A __pyx_string_tab[227] -#define __pyx_n_u_pt_B __pyx_string_tab[228] -#define __pyx_n_u_pyplot __pyx_string_tab[229] -#define __pyx_n_u_qualname __pyx_string_tab[230] -#define __pyx_n_u_quoting __pyx_string_tab[231] -#define __pyx_n_u_rbox __pyx_string_tab[232] -#define __pyx_n_u_resize __pyx_string_tab[233] -#define __pyx_n_u_result __pyx_string_tab[234] -#define __pyx_n_u_return __pyx_string_tab[235] -#define __pyx_n_u_right __pyx_string_tab[236] -#define __pyx_n_u_rightmost_x_third __pyx_string_tab[237] -#define __pyx_n_u_s1 __pyx_string_tab[238] -#define __pyx_n_u_s2 __pyx_string_tab[239] -#define __pyx_n_u_savefig __pyx_string_tab[240] -#define __pyx_n_u_scale __pyx_string_tab[241] -#define __pyx_n_u_scipy_spatial __pyx_string_tab[242] -#define __pyx_n_u_send __pyx_string_tab[243] -#define __pyx_n_u_sensor_images __pyx_string_tab[244] -#define __pyx_n_u_sep __pyx_string_tab[245] -#define __pyx_n_u_set_name __pyx_string_tab[246] -#define __pyx_n_u_shape __pyx_string_tab[247] -#define __pyx_n_u_side __pyx_string_tab[248] -#define __pyx_n_u_size_diff __pyx_string_tab[249] -#define __pyx_n_u_sort_contours __pyx_string_tab[250] -#define __pyx_n_u_spec __pyx_string_tab[251] -#define __pyx_n_u_squeeze __pyx_string_tab[252] -#define __pyx_kp_u_src_dopt_sensor_anomalies_detect __pyx_string_tab[253] -#define __pyx_n_u_stem __pyx_string_tab[254] -#define __pyx_n_u_str __pyx_string_tab[255] -#define __pyx_n_u_subplots __pyx_string_tab[256] -#define __pyx_n_u_subplots_adjust __pyx_string_tab[257] -#define __pyx_n_u_t __pyx_string_tab[258] -#define __pyx_kp_u_t_Box __pyx_string_tab[259] -#define __pyx_kp_u_t_CsvData __pyx_string_tab[260] -#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[261] -#define __pyx_kp_u_t_InferenceResult __pyx_string_tab[262] -#define __pyx_kp_u_t_SensorImages __pyx_string_tab[263] -#define __pyx_n_u_test __pyx_string_tab[264] -#define __pyx_n_u_threshold __pyx_string_tab[265] -#define __pyx_n_u_throw __pyx_string_tab[266] -#define __pyx_n_u_tight __pyx_string_tab[267] -#define __pyx_n_u_tl __pyx_string_tab[268] -#define __pyx_n_u_tlblX __pyx_string_tab[269] -#define __pyx_n_u_tlblY __pyx_string_tab[270] -#define __pyx_n_u_tltrX __pyx_string_tab[271] -#define __pyx_n_u_tltrY __pyx_string_tab[272] -#define __pyx_n_u_to __pyx_string_tab[273] -#define __pyx_n_u_to_csv __pyx_string_tab[274] -#define __pyx_n_u_to_dtype __pyx_string_tab[275] -#define __pyx_n_u_to_image __pyx_string_tab[276] -#define __pyx_n_u_tolerance __pyx_string_tab[277] -#define __pyx_n_u_torch __pyx_string_tab[278] -#define __pyx_n_u_torch_device __pyx_string_tab[279] -#define __pyx_n_u_torchvision_transforms_v2_functi __pyx_string_tab[280] -#define __pyx_n_u_tr __pyx_string_tab[281] -#define __pyx_n_u_trbrX __pyx_string_tab[282] -#define __pyx_n_u_trbrY __pyx_string_tab[283] -#define __pyx_kp_u_tuple_float_float __pyx_string_tab[284] -#define __pyx_kp_u_tuple_t_CsvData_t_SensorImages __pyx_string_tab[285] -#define __pyx_n_u_types __pyx_string_tab[286] -#define __pyx_n_u_typing __pyx_string_tab[287] -#define __pyx_n_u_uint8 __pyx_string_tab[288] -#define __pyx_n_u_unsqueeze __pyx_string_tab[289] -#define __pyx_n_u_user_file_path __pyx_string_tab[290] -#define __pyx_n_u_value __pyx_string_tab[291] -#define __pyx_n_u_w __pyx_string_tab[292] -#define __pyx_n_u_wspace __pyx_string_tab[293] -#define __pyx_n_u_x1 __pyx_string_tab[294] -#define __pyx_n_u_x2 __pyx_string_tab[295] -#define __pyx_n_u_x_coords __pyx_string_tab[296] -#define __pyx_n_u_x_max __pyx_string_tab[297] -#define __pyx_n_u_x_middle __pyx_string_tab[298] -#define __pyx_n_u_x_min __pyx_string_tab[299] -#define __pyx_n_u_y_max __pyx_string_tab[300] -#define __pyx_n_u_y_min __pyx_string_tab[301] -#define __pyx_n_u_zip __pyx_string_tab[302] +#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] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { @@ -3538,9 +3551,9 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); Py_CLEAR(clear_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } - for (int i=0; i<9; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[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<303; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<305; ++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); @@ -3593,9 +3606,9 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); Py_VISIT(traverse_module_state->__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr); for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } - for (int i=0; i<9; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[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<303; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<305; ++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); @@ -3634,8 +3647,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_21dopt_sensor_anomalies_9detection_midpoint, "to identify the midpoint of a 2D area\n\n Parameters\n ----------\n pt_A : npt.NDArray[np.floating]\n tuple of coordinates x, y; shape (2, )\n pt_B : npt.NDArray[np.floating]\n tuple of coordinates x, y; shape (2, )\n\n Returns\n -------\n tuple[float, float]\n tuple of midpoint coordinates\n "); -static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_1midpoint = {"midpoint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_1midpoint, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_21dopt_sensor_anomalies_9detection_midpoint}; +static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_1midpoint = {"midpoint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_1midpoint, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_21dopt_sensor_anomalies_9detection_1midpoint(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds @@ -3682,7 +3694,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds 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, 34, __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) } } @@ -3732,42 +3744,42 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU int __pyx_clineno = 0; __Pyx_RefNannySetupContext("midpoint", 0); - /* "dopt_sensor_anomalies/detection.py":52 - * tuple of midpoint coordinates - * """ + /* "dopt_sensor_anomalies/detection.py":38 + * 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) # <<<<<<<<<<<<<< * * */ __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, 52, __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, 38, __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, 52, __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, 38, __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, 52, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __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, 52, __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, 38, __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, 52, __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, 38, __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, 52, __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, 38, __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, 52, __pyx_L1_error) + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __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, 52, __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, 38, __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, 52, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __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, 52, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 38, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 52, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 38, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_4; @@ -3796,7 +3808,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":55 +/* "dopt_sensor_anomalies/detection.py":41 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -3812,8 +3824,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_21dopt_sensor_anomalies_9detection_2check_box_redundancy, "to check if bounding box has already been identified and is just a redundant one\n\n Parameters\n ----------\n box_1 : t.Box\n tuple of box values: ((center_x, center_y), (width, height), angle)\n box_2 : t.Box\n tuple of box values: ((center_x, center_y), (width, height), angle)\n tolerance : float, optional\n distance threshold for width and height, by default 5.0\n\n Returns\n -------\n bool\n redundancy evaluation\n "); -static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_3check_box_redundancy = {"check_box_redundancy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_3check_box_redundancy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_21dopt_sensor_anomalies_9detection_2check_box_redundancy}; +static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_3check_box_redundancy = {"check_box_redundancy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_3check_box_redundancy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_21dopt_sensor_anomalies_9detection_3check_box_redundancy(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds @@ -3846,40 +3857,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, 55, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 41, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 41, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 41, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 41, __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, 55, __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, 41, __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, 55, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, i); __PYX_ERR(0, 41, __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, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 41, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 41, __pyx_L3_error) values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 55, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 41, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3887,14 +3898,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, 58, __pyx_L3_error) + __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 44, __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, 55, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 41, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3945,8 +3956,8 @@ 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":77 - * """ + /* "dopt_sensor_anomalies/detection.py":47 + * ) -> bool: * # unpack the boxes * c1, s1, _ = box_1 # <<<<<<<<<<<<<< * c2, s2, _ = box_2 @@ -3958,7 +3969,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, 77, __pyx_L1_error) + __PYX_ERR(0, 47, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3970,26 +3981,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, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __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, 77, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __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, 77, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __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; @@ -3998,7 +4009,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, 77, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 47, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -4006,7 +4017,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, 77, __pyx_L1_error) + __PYX_ERR(0, 47, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_c1 = __pyx_t_1; @@ -4016,7 +4027,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":78 + /* "dopt_sensor_anomalies/detection.py":48 * # unpack the boxes * c1, s1, _ = box_1 * c2, s2, _ = box_2 # <<<<<<<<<<<<<< @@ -4029,7 +4040,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, 78, __pyx_L1_error) + __PYX_ERR(0, 48, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4041,26 +4052,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, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __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, 78, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __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, 78, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __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; @@ -4069,7 +4080,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, 78, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L6_unpacking_done; @@ -4077,7 +4088,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, 78, __pyx_L1_error) + __PYX_ERR(0, 48, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_v_c2 = __pyx_t_3; @@ -4087,33 +4098,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":81 + /* "dopt_sensor_anomalies/detection.py":51 * # 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, 81, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 81, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":82 + /* "dopt_sensor_anomalies/detection.py":52 * # (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, 82, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":84 + /* "dopt_sensor_anomalies/detection.py":54 * s2 = sorted(s2) * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) # <<<<<<<<<<<<<< @@ -4121,19 +4132,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, 84, __pyx_L1_error) + __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_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error) + __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_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, 84, __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, 54, __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, 84, __pyx_L1_error) + __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_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, 84, __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, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -4153,13 +4164,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, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __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, 84, __pyx_L1_error) + __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_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, 84, __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, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -4179,10 +4190,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, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 54, __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, 84, __pyx_L1_error) + __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 54, __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; @@ -4193,7 +4204,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, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_t_12 = 1; @@ -4214,13 +4225,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, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_center_dist = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":85 + /* "dopt_sensor_anomalies/detection.py":55 * * 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))) # <<<<<<<<<<<<<< @@ -4228,19 +4239,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, 85, __pyx_L1_error) + __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_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 85, __pyx_L1_error) + __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_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, 85, __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, 55, __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, 85, __pyx_L1_error) + __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_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, 85, __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, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4260,13 +4271,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, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 55, __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, 85, __pyx_L1_error) + __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_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, 85, __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, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4286,10 +4297,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, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __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, 85, __pyx_L1_error) + __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 55, __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; @@ -4300,7 +4311,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, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_12 = 1; @@ -4321,13 +4332,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, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_size_diff = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":87 + /* "dopt_sensor_anomalies/detection.py":57 * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) * * return bool(center_dist < tolerance and size_diff < tolerance) # <<<<<<<<<<<<<< @@ -4335,32 +4346,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, 87, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __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, 87, __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, 57, __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, 87, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 57, __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, 87, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __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, 87, __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, 57, __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, 87, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 57, __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, 87, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_14))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __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":55 + /* "dopt_sensor_anomalies/detection.py":41 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -4396,7 +4407,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":91 +/* "dopt_sensor_anomalies/detection.py":61 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< @@ -4412,8 +4423,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_21dopt_sensor_anomalies_9detection_4measure_length, "detect and measure the size of the electrodes\n\n Parameters\n ----------\n file_path : Path\n path to file to analyse\n pixels_per_metric_X : float\n scaling parameter x dimension, Pixels per micrometer in image\n pixels_per_metric_Y : float\n scaling parameter y dimension, Pixels per micrometer in image\n\n Returns\n -------\n tuple[t.CsvData, t.SensorImages]\n t.CsvData: (list) data to save as CSV according to requirements, contains strings and ints\n t.SensorImages: (TypedDict) contains left and right image corresponding to each sensor\n\n Raises\n ------\n errors.ImageNotReadError\n image was not read successfully\n errors.ContourCalculationError\n during contour detection there were several possible error causes\n errors.InvalidElectrodeCount\n an invalid number of electrodes were detected\n "); -static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_5measure_length = {"measure_length", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_5measure_length, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_21dopt_sensor_anomalies_9detection_4measure_length}; +static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_5measure_length = {"measure_length", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_5measure_length, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_21dopt_sensor_anomalies_9detection_5measure_length(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds @@ -4446,46 +4456,46 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 91, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 61, __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, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 61, __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, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 61, __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, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 61, __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, 91, __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, 61, __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, 91, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, i); __PYX_ERR(0, 61, __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, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 61, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 61, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 61, __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, 93, __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, 94, __pyx_L3_error) + __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 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) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 61, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4507,7 +4517,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":149 +/* "dopt_sensor_anomalies/detection.py":93 * 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 # <<<<<<<<<<<<<< @@ -4527,7 +4537,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, 149, __pyx_L1_error) + __PYX_ERR(0, 93, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4535,7 +4545,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, 149, __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, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4578,17 +4588,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, 149, __pyx_L1_error) + __PYX_ERR(0, 93, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 149, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 93, __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, 149, __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, 93, __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, 149, __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, 93, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { @@ -4596,7 +4606,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, 149, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4606,7 +4616,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, 149, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4617,13 +4627,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g #endif ++__pyx_t_2; } - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __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, 149, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 93, __pyx_L1_error) PyErr_Clear(); } break; @@ -4636,7 +4646,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, 149, __pyx_L1_error) + __PYX_ERR(0, 93, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4646,22 +4656,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, 149, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __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, 149, __pyx_L1_error) + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __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, 149, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __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); @@ -4669,7 +4679,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, 149, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 93, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; @@ -4677,7 +4687,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, 149, __pyx_L1_error) + __PYX_ERR(0, 93, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x1); @@ -4688,7 +4698,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, 149, __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, 93, __pyx_L1_error) __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_t_1); @@ -4707,7 +4717,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, 149, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 93, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -4737,7 +4747,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":189 +/* "dopt_sensor_anomalies/detection.py":133 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4757,7 +4767,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, 189, __pyx_L1_error) + __PYX_ERR(0, 133, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4768,7 +4778,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, 189, __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, 133, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4807,30 +4817,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, 189, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 189, __pyx_L1_error) } + 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) } __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, 189, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 133, __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, 189, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __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, 189, __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, 133, __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, 189, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_rbox)) { __Pyx_RaiseClosureNameError("rbox"); __PYX_ERR(0, 133, __pyx_L1_error) } __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { @@ -4848,14 +4858,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, 189, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __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, 189, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "dopt_sensor_anomalies/detection.py":188 + /* "dopt_sensor_anomalies/detection.py":132 * * # check for redundancy * is_duplicate = any( # <<<<<<<<<<<<<< @@ -4864,7 +4874,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":189 + /* "dopt_sensor_anomalies/detection.py":133 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4880,7 +4890,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":188 + /* "dopt_sensor_anomalies/detection.py":132 * * # check for redundancy * is_duplicate = any( # <<<<<<<<<<<<<< @@ -4889,7 +4899,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":189 + /* "dopt_sensor_anomalies/detection.py":133 * # check for redundancy * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< @@ -4925,7 +4935,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":224 +/* "dopt_sensor_anomalies/detection.py":168 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -4945,7 +4955,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, 224, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4953,7 +4963,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, 224, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4995,34 +5005,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, 224, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 224, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 168, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 224, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 168, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5042,7 +5052,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, 224, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5061,7 +5071,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, 224, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 168, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5091,7 +5101,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":225 +/* "dopt_sensor_anomalies/detection.py":169 * # 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 # <<<<<<<<<<<<<< @@ -5111,7 +5121,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, 225, __pyx_L1_error) + __PYX_ERR(0, 169, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5119,7 +5129,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, 225, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5161,34 +5171,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, 225, __pyx_L1_error) + __PYX_ERR(0, 169, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 225, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 169, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 225, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 169, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5208,7 +5218,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, 225, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5227,7 +5237,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, 225, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 169, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5257,7 +5267,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":226 +/* "dopt_sensor_anomalies/detection.py":170 * 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 # <<<<<<<<<<<<<< @@ -5277,7 +5287,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, 226, __pyx_L1_error) + __PYX_ERR(0, 170, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5285,7 +5295,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, 226, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5327,34 +5337,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, 226, __pyx_L1_error) + __PYX_ERR(0, 170, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 226, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 170, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 226, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 170, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5374,7 +5384,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, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5393,7 +5403,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, 226, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 170, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5423,7 +5433,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":227 +/* "dopt_sensor_anomalies/detection.py":171 * 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 # <<<<<<<<<<<<<< @@ -5443,7 +5453,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, 227, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5451,7 +5461,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, 227, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5493,34 +5503,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, 227, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 227, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 171, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 227, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 171, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5540,7 +5550,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, 227, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5559,7 +5569,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, 227, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 171, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5588,7 +5598,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":91 +/* "dopt_sensor_anomalies/detection.py":61 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< @@ -5679,37 +5689,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, 91, __pyx_L1_error) + __PYX_ERR(0, 61, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - /* "dopt_sensor_anomalies/detection.py":122 - * an invalid number of electrodes were detected - * """ + /* "dopt_sensor_anomalies/detection.py":66 + * pixels_per_metric_Y: float, + * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] # <<<<<<<<<<<<<< * image = cv2.imread(str(file_path)) * if image is None: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __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":123 - * """ + /* "dopt_sensor_anomalies/detection.py":67 + * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] * image = cv2.imread(str(file_path)) # <<<<<<<<<<<<<< * if image is None: * raise errors.ImageNotReadError(f"Image could not be read from: >{file_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, 123, __pyx_L1_error) + __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_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, 123, __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, 67, __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, 123, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_file_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -5729,13 +5739,13 @@ 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, 123, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":124 + /* "dopt_sensor_anomalies/detection.py":68 * data_csv: list[str | int] = [] * image = cv2.imread(str(file_path)) * if image is None: # <<<<<<<<<<<<<< @@ -5745,7 +5755,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_6 = (__pyx_v_image == Py_None); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":125 + /* "dopt_sensor_anomalies/detection.py":69 * image = cv2.imread(str(file_path)) * if image is None: * raise errors.ImageNotReadError(f"Image could not be read from: >{file_path}<") # <<<<<<<<<<<<<< @@ -5753,18 +5763,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cropped = image[500:1500, 100 : image.shape[1] - 100] */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error) + __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_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, 125, __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, 69, __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, 125, __pyx_L1_error) + __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_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, 125, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5785,14 +5795,14 @@ 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, 125, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 125, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":124 + /* "dopt_sensor_anomalies/detection.py":68 * data_csv: list[str | int] = [] * image = cv2.imread(str(file_path)) * if image is None: # <<<<<<<<<<<<<< @@ -5801,39 +5811,39 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":127 + /* "dopt_sensor_anomalies/detection.py":71 * raise errors.ImageNotReadError(f"Image could not be read from: >{file_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, 127, __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, 71, __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, 127, __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, 71, __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, 127, __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, 71, __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, 127, __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, 71, __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, 127, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __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, 127, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[1]) != (0)) __PYX_ERR(0, 71, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 71, __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, 127, __pyx_L1_error) + __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_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":128 + /* "dopt_sensor_anomalies/detection.py":72 * * cropped = image[500:1500, 100 : image.shape[1] - 100] * orig = cropped.copy() # <<<<<<<<<<<<<< @@ -5847,13 +5857,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, 128, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_orig = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":130 + /* "dopt_sensor_anomalies/detection.py":74 * orig = cropped.copy() * # change colours in the image to black and white * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) # <<<<<<<<<<<<<< @@ -5861,14 +5871,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, 130, __pyx_L1_error) + __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_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, 130, __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, 74, __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, 130, __pyx_L1_error) + __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_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, 130, __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, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -5889,13 +5899,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, 130, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_gray = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":131 + /* "dopt_sensor_anomalies/detection.py":75 * # 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) # <<<<<<<<<<<<<< @@ -5903,19 +5913,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, 131, __pyx_L1_error) + __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_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, 131, __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, 75, __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, 131, __pyx_L1_error) + __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_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, 131, __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, 75, __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, 131, __pyx_L1_error) + __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_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, 131, __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, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5937,7 +5947,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, 131, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -5946,7 +5956,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, 131, __pyx_L1_error) + __PYX_ERR(0, 75, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5956,22 +5966,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, 131, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __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, 131, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __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, 131, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __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); @@ -5979,7 +5989,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, 131, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 75, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L5_unpacking_done; @@ -5987,7 +5997,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, 131, __pyx_L1_error) + __PYX_ERR(0, 75, __pyx_L1_error) __pyx_L5_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -5995,7 +6005,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":133 + /* "dopt_sensor_anomalies/detection.py":77 * _, 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)) # <<<<<<<<<<<<<< @@ -6003,14 +6013,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, 133, __pyx_L1_error) + __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_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, 133, __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, 77, __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, 133, __pyx_L1_error) + __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_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, 133, __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, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6031,13 +6041,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, 133, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_kernel = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":134 + /* "dopt_sensor_anomalies/detection.py":78 * # perform edge detection, identify rectangular shapes * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) # <<<<<<<<<<<<<< @@ -6045,14 +6055,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, 134, __pyx_L1_error) + __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_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, 134, __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, 78, __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, 134, __pyx_L1_error) + __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_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, 134, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6073,13 +6083,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, 134, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_closed = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":135 + /* "dopt_sensor_anomalies/detection.py":79 * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) # <<<<<<<<<<<<<< @@ -6087,9 +6097,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, 135, __pyx_L1_error) + __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_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, 135, __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, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6109,13 +6119,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, 135, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_edged = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":137 + /* "dopt_sensor_anomalies/detection.py":81 * edged = cv2.Canny(closed, 50, 100) * # find contours in the edge map * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) # <<<<<<<<<<<<<< @@ -6123,9 +6133,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, 137, __pyx_L1_error) + __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_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, 137, __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, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_4 = __pyx_v_edged; @@ -6135,17 +6145,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, 137, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 81, __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, 137, __pyx_L1_error) + __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_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, 137, __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, 81, __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, 137, __pyx_L1_error) + __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_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, 137, __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, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6168,13 +6178,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, 137, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_cnts = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":138 + /* "dopt_sensor_anomalies/detection.py":82 * # find contours in the edge map * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) # <<<<<<<<<<<<<< @@ -6182,9 +6192,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, 138, __pyx_L1_error) + __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_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, 138, __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, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_5 = 1; @@ -6204,13 +6214,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, 138, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __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":139 + /* "dopt_sensor_anomalies/detection.py":83 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # <<<<<<<<<<<<<< @@ -6220,7 +6230,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":140 + /* "dopt_sensor_anomalies/detection.py":84 * cnts = imutils.grab_contours(cnts) * if cnts is None: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6228,9 +6238,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, 140, __pyx_L1_error) + __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_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, 140, __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, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6250,14 +6260,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, 140, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __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, 140, __pyx_L1_error) + __PYX_ERR(0, 84, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":139 + /* "dopt_sensor_anomalies/detection.py":83 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # <<<<<<<<<<<<<< @@ -6266,7 +6276,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":144 + /* "dopt_sensor_anomalies/detection.py":88 * ) * # sort the contours from left to right (i.e., use x coordinates) * cnts, _ = contours.sort_contours(cnts) # <<<<<<<<<<<<<< @@ -6274,9 +6284,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, 144, __pyx_L1_error) + __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_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, 144, __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, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6296,7 +6306,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, 144, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -6305,7 +6315,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, 144, __pyx_L1_error) + __PYX_ERR(0, 88, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6315,22 +6325,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, 144, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __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, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __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, 144, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __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); @@ -6338,7 +6348,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, 144, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 88, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_unpacking_done; @@ -6346,7 +6356,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, 144, __pyx_L1_error) + __PYX_ERR(0, 88, __pyx_L1_error) __pyx_L8_unpacking_done:; } __Pyx_DECREF_SET(__pyx_v_cnts, __pyx_t_1); @@ -6354,7 +6364,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":147 + /* "dopt_sensor_anomalies/detection.py":91 * # 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] # <<<<<<<<<<<<<< @@ -6362,16 +6372,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, 147, __pyx_L11_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __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, 147, __pyx_L11_error) + __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_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, 147, __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, 91, __pyx_L11_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6379,7 +6389,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, 147, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 91, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6389,7 +6399,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, 147, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 91, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6400,13 +6410,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __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, 147, __pyx_L11_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 91, __pyx_L11_error) PyErr_Clear(); } break; @@ -6416,9 +6426,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, 147, __pyx_L11_error) + __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_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, 147, __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, 91, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6438,13 +6448,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, 147, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __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, 147, __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, 91, __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, 147, __pyx_L11_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 91, __pyx_L11_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -6458,7 +6468,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":149 + /* "dopt_sensor_anomalies/detection.py":93 * 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 # <<<<<<<<<<<<<< @@ -6466,15 +6476,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, 149, __pyx_L1_error) + __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_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, 149, __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, 93, __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, 149, __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, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; { @@ -6483,10 +6493,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, 149, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 93, __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, 149, __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, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6507,24 +6517,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, 149, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_is_sorted = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":150 + /* "dopt_sensor_anomalies/detection.py":94 * # 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, 150, __pyx_L1_error) + __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_14 = (!__pyx_t_6); if (unlikely(__pyx_t_14)) { - /* "dopt_sensor_anomalies/detection.py":151 + /* "dopt_sensor_anomalies/detection.py":95 * 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( # <<<<<<<<<<<<<< @@ -6532,9 +6542,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, 151, __pyx_L1_error) + __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_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, 151, __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, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6554,14 +6564,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, 151, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __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, 151, __pyx_L1_error) + __PYX_ERR(0, 95, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":150 + /* "dopt_sensor_anomalies/detection.py":94 * # 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: # <<<<<<<<<<<<<< @@ -6570,31 +6580,31 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":156 + /* "dopt_sensor_anomalies/detection.py":100 * ) * # 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, 156, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __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":157 + /* "dopt_sensor_anomalies/detection.py":101 * # 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, 157, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __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":160 + /* "dopt_sensor_anomalies/detection.py":104 * * # loop over the contours individually * for c in cnts: # <<<<<<<<<<<<<< @@ -6606,9 +6616,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, 160, __pyx_L1_error) + __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_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, 160, __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, 104, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6616,7 +6626,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, 160, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 104, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6626,7 +6636,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, 160, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 104, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6637,13 +6647,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 160, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 104, __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, 160, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 104, __pyx_L1_error) PyErr_Clear(); } break; @@ -6653,7 +6663,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":162 + /* "dopt_sensor_anomalies/detection.py":106 * for c in cnts: * # compute the rotated bounding box of the contour * rbox = cast(t.Box, cv2.minAreaRect(c)) # <<<<<<<<<<<<<< @@ -6661,17 +6671,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, 162, __pyx_L1_error) + __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_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error) + __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_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, 162, __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, 106, __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, 162, __pyx_L1_error) + __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_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, 162, __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, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_5 = 1; @@ -6691,7 +6701,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, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_5 = 1; @@ -6713,7 +6723,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, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rbox); @@ -6721,7 +6731,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":165 + /* "dopt_sensor_anomalies/detection.py":109 * # !! should only be newer OpenCV versions * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) * box = cv2.boxPoints(rbox) # <<<<<<<<<<<<<< @@ -6729,9 +6739,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, 165, __pyx_L1_error) + __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_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, 165, __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, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6751,13 +6761,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, 165, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 109, __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":166 + /* "dopt_sensor_anomalies/detection.py":110 * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) # <<<<<<<<<<<<<< @@ -6765,14 +6775,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, 166, __pyx_L1_error) + __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_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, 166, __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, 110, __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, 166, __pyx_L1_error) + __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_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, 166, __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, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6789,21 +6799,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, 166, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __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, 166, __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, 110, __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, 166, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 110, __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":168 + /* "dopt_sensor_anomalies/detection.py":112 * 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)) # <<<<<<<<<<<<<< @@ -6811,26 +6821,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, 168, __pyx_L1_error) + __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_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) + __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_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, 168, __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, 112, __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, 168, __pyx_L1_error) + __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_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, 168, __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, 112, __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, 168, __pyx_L1_error) + __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_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, 168, __pyx_L1_error) + __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_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, 168, __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, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6850,7 +6860,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, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); } __pyx_t_5 = 1; @@ -6872,13 +6882,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, 168, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 112, __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":171 + /* "dopt_sensor_anomalies/detection.py":115 * * # unpack the bounding box * (tl, tr, br, bl) = box # <<<<<<<<<<<<<< @@ -6891,7 +6901,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, 171, __pyx_L1_error) + __PYX_ERR(0, 115, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6905,16 +6915,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, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_11); __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 3); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); } #else @@ -6922,7 +6932,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, 171, __pyx_L1_error) + PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -6931,7 +6941,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, 171, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_v_box); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __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++) { @@ -6939,7 +6949,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, 171, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 4) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L20_unpacking_done; @@ -6947,7 +6957,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, 171, __pyx_L1_error) + __PYX_ERR(0, 115, __pyx_L1_error) __pyx_L20_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tl, __pyx_t_11); @@ -6959,7 +6969,7 @@ 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":173 + /* "dopt_sensor_anomalies/detection.py":117 * (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) # <<<<<<<<<<<<<< @@ -6967,7 +6977,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # 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, 173, __pyx_L1_error) + __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 @@ -6986,7 +6996,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 173, __pyx_L1_error) + 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))) { @@ -6995,7 +7005,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, 173, __pyx_L1_error) + __PYX_ERR(0, 117, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7005,22 +7015,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 173, __pyx_L1_error) + 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, 173, __pyx_L1_error) + 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, 173, __pyx_L1_error) + __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, 173, __pyx_L1_error) + __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, 173, __pyx_L1_error) + __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); @@ -7028,7 +7038,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 173, __pyx_L1_error) + 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; @@ -7036,7 +7046,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, 173, __pyx_L1_error) + __PYX_ERR(0, 117, __pyx_L1_error) __pyx_L22_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tltrX, __pyx_t_9); @@ -7044,7 +7054,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_tltrY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":174 + /* "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) # <<<<<<<<<<<<<< @@ -7052,7 +7062,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * (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, 174, __pyx_L1_error) + __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 @@ -7071,7 +7081,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 174, __pyx_L1_error) + 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))) { @@ -7080,7 +7090,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, 174, __pyx_L1_error) + __PYX_ERR(0, 118, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7090,22 +7100,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 174, __pyx_L1_error) + 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, 174, __pyx_L1_error) + 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, 174, __pyx_L1_error) + __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, 174, __pyx_L1_error) + __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, 174, __pyx_L1_error) + __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); @@ -7113,7 +7123,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 174, __pyx_L1_error) + 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; @@ -7121,7 +7131,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, 174, __pyx_L1_error) + __PYX_ERR(0, 118, __pyx_L1_error) __pyx_L24_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_blbrX, __pyx_t_9); @@ -7129,7 +7139,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_blbrY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":176 + /* "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) # <<<<<<<<<<<<<< @@ -7137,7 +7147,7 @@ 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_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 176, __pyx_L1_error) + __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 @@ -7156,7 +7166,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 176, __pyx_L1_error) + 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))) { @@ -7165,7 +7175,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, 176, __pyx_L1_error) + __PYX_ERR(0, 120, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7175,22 +7185,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 176, __pyx_L1_error) + 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, 176, __pyx_L1_error) + 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, 176, __pyx_L1_error) + __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, 176, __pyx_L1_error) + __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, 176, __pyx_L1_error) + __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); @@ -7198,7 +7208,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 176, __pyx_L1_error) + 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; @@ -7206,7 +7216,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, 176, __pyx_L1_error) + __PYX_ERR(0, 120, __pyx_L1_error) __pyx_L26_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tlblX, __pyx_t_9); @@ -7214,7 +7224,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_tlblY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":177 + /* "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) # <<<<<<<<<<<<<< @@ -7222,7 +7232,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * # 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, 177, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -7241,7 +7251,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 177, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -7250,7 +7260,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, 177, __pyx_L1_error) + __PYX_ERR(0, 121, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7260,22 +7270,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 177, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 177, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 121, __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, 177, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 121, __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, 177, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __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); @@ -7283,7 +7293,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __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, 177, __pyx_L1_error) + 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_L28_unpacking_done; @@ -7291,7 +7301,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, 177, __pyx_L1_error) + __PYX_ERR(0, 121, __pyx_L1_error) __pyx_L28_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_trbrX, __pyx_t_9); @@ -7299,7 +7309,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":180 + /* "dopt_sensor_anomalies/detection.py":124 * * # compute the Euclidean distance between the midpoints * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) # <<<<<<<<<<<<<< @@ -7307,27 +7317,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, 180, __pyx_L1_error) + __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_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, 180, __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, 124, __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, 180, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __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, 180, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_tltrX) != (0)) __PYX_ERR(0, 124, __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, 180, __pyx_L1_error); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error) + 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) __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, 180, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_blbrX) != (0)) __PYX_ERR(0, 124, __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, 180, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_blbrY) != (0)) __PYX_ERR(0, 124, __pyx_L1_error); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { @@ -7347,13 +7357,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, 180, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __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":181 + /* "dopt_sensor_anomalies/detection.py":125 * # compute the Euclidean distance between the midpoints * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) # <<<<<<<<<<<<<< @@ -7361,27 +7371,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, 181, __pyx_L1_error) + __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_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, 181, __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, 125, __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, 181, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __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, 181, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_tlblX) != (0)) __PYX_ERR(0, 125, __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, 181, __pyx_L1_error); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 181, __pyx_L1_error) + 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) __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, 181, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_trbrX) != (0)) __PYX_ERR(0, 125, __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, 181, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_trbrY) != (0)) __PYX_ERR(0, 125, __pyx_L1_error); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_9))) { @@ -7401,35 +7411,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, 181, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __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":184 + /* "dopt_sensor_anomalies/detection.py":128 * * # 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, 184, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 184, __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, 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_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, 184, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 184, __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, 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_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":185 + /* "dopt_sensor_anomalies/detection.py":129 * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 100: * continue # <<<<<<<<<<<<<< @@ -7438,7 +7448,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":184 + /* "dopt_sensor_anomalies/detection.py":128 * * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 100: # <<<<<<<<<<<<<< @@ -7447,32 +7457,32 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":189 + /* "dopt_sensor_anomalies/detection.py":133 * # 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, 189, __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, 133, __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, 189, __pyx_L1_error) + __pyx_t_9 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 133, __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":191 + /* "dopt_sensor_anomalies/detection.py":135 * 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, 191, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 135, __pyx_L1_error) if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":192 + /* "dopt_sensor_anomalies/detection.py":136 * ) * if is_duplicate: * continue # <<<<<<<<<<<<<< @@ -7481,7 +7491,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":191 + /* "dopt_sensor_anomalies/detection.py":135 * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) * if is_duplicate: # <<<<<<<<<<<<<< @@ -7490,7 +7500,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":195 + /* "dopt_sensor_anomalies/detection.py":139 * * # accept box and contour * accepted_boxes.append(rbox) # <<<<<<<<<<<<<< @@ -7499,106 +7509,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, 195, __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, 139, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":196 + /* "dopt_sensor_anomalies/detection.py":140 * # 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, 196, __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, 140, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":199 + /* "dopt_sensor_anomalies/detection.py":143 * * # 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, 199, __pyx_L1_error) + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __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, 199, __pyx_L1_error) + __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_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":200 + /* "dopt_sensor_anomalies/detection.py":144 * # 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, 200, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __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, 200, __pyx_L1_error) + __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_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":204 + /* "dopt_sensor_anomalies/detection.py":148 * 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, 204, __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, 148, __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, 204, __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, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":205 + /* "dopt_sensor_anomalies/detection.py":149 * [ * 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, 205, __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, 149, __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, 205, __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, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":206 + /* "dopt_sensor_anomalies/detection.py":150 * 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, 206, __pyx_L1_error) + __pyx_t_9 = PyNumber_Multiply(__pyx_v_dimA, __pyx_v_dimB); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __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, 206, __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, 150, __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, 206, __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, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":202 + /* "dopt_sensor_anomalies/detection.py":146 * 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, 202, __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, 202, __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, 202, __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, 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_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":160 + /* "dopt_sensor_anomalies/detection.py":104 * * # loop over the contours individually * for c in cnts: # <<<<<<<<<<<<<< @@ -7609,7 +7619,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":210 + /* "dopt_sensor_anomalies/detection.py":154 * ) * * if not filtered_cnts: # <<<<<<<<<<<<<< @@ -7618,14 +7628,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, 210, __pyx_L1_error) + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 154, __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":211 + /* "dopt_sensor_anomalies/detection.py":155 * * if not filtered_cnts: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -7633,9 +7643,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, 211, __pyx_L1_error) + __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_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, 211, __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, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; @@ -7655,14 +7665,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, 211, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __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, 211, __pyx_L1_error) + __PYX_ERR(0, 155, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":210 + /* "dopt_sensor_anomalies/detection.py":154 * ) * * if not filtered_cnts: # <<<<<<<<<<<<<< @@ -7671,38 +7681,38 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":216 + /* "dopt_sensor_anomalies/detection.py":160 * * # 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, 216, __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, 160, __pyx_L1_error) __pyx_v_num_contours = __pyx_t_12; - /* "dopt_sensor_anomalies/detection.py":217 + /* "dopt_sensor_anomalies/detection.py":161 * # 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 " */ - __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __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, 217, __pyx_L1_error) + __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_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, 217, __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, 161, __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, 217, __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, 161, __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, 217, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":218 + /* "dopt_sensor_anomalies/detection.py":162 * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( # <<<<<<<<<<<<<< @@ -7710,27 +7720,27 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * 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, 218, __pyx_L1_error) + __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_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, 218, __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, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":220 + /* "dopt_sensor_anomalies/detection.py":164 * raise errors.InvalidElectrodeCount( * f"Number of counted electroedes 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, 220, __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, 164, __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, 220, __pyx_L1_error) + __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_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, 220, __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, 164, __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, 220, __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, 164, __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; @@ -7738,7 +7748,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_expected; __pyx_t_20[3] = __pyx_t_8; - /* "dopt_sensor_anomalies/detection.py":219 + /* "dopt_sensor_anomalies/detection.py":163 * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( * f"Number of counted electroedes does not match the " # <<<<<<<<<<<<<< @@ -7746,7 +7756,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) */ __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, 219, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 163, __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; @@ -7768,14 +7778,14 @@ 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, 218, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 162, __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, 218, __pyx_L1_error) + __PYX_ERR(0, 162, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":217 + /* "dopt_sensor_anomalies/detection.py":161 * # if incorrect number of electrodes has been identified * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< @@ -7784,7 +7794,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":224 + /* "dopt_sensor_anomalies/detection.py":168 * * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -7794,7 +7804,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, 224, __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, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = 1; { @@ -7803,16 +7813,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, 224, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 168, __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, 224, __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, 168, __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":225 + /* "dopt_sensor_anomalies/detection.py":169 * # 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 # <<<<<<<<<<<<<< @@ -7822,7 +7832,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, 225, __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, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __pyx_t_5 = 1; { @@ -7831,16 +7841,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, 225, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __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, 225, __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, 169, __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":226 + /* "dopt_sensor_anomalies/detection.py":170 * 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 # <<<<<<<<<<<<<< @@ -7850,7 +7860,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, 226, __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, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; { @@ -7859,16 +7869,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, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __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, 226, __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, 170, __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":227 + /* "dopt_sensor_anomalies/detection.py":171 * 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 # <<<<<<<<<<<<<< @@ -7878,7 +7888,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, 227, __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, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = 1; { @@ -7887,16 +7897,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, 227, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 171, __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, 227, __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, 171, __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":229 + /* "dopt_sensor_anomalies/detection.py":173 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7906,9 +7916,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, 229, __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, 173, __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, 229, __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, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -7918,13 +7928,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, 229, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 173, __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":230 + /* "dopt_sensor_anomalies/detection.py":174 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7934,9 +7944,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, 230, __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, 174, __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, 230, __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, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; @@ -7946,84 +7956,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, 230, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 174, __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":231 + /* "dopt_sensor_anomalies/detection.py":175 * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) # <<<<<<<<<<<<<< * * # 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, 231, __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, 175, __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, 231, __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, 175, __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, 231, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __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, 231, __pyx_L1_error) + __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_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":234 + /* "dopt_sensor_anomalies/detection.py":178 * * # 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, 234, __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, 178, __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, 234, __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, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __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, 234, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 178, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 234, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 178, __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, 234, __pyx_L1_error) + __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_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":235 + /* "dopt_sensor_anomalies/detection.py":179 * # 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, 235, __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, 179, __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, 235, __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, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __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, 235, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 179, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 235, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 179, __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, 235, __pyx_L1_error) + __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_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":237 + /* "dopt_sensor_anomalies/detection.py":181 * 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) # <<<<<<<<<<<<<< @@ -8032,9 +8042,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, 237, __pyx_L1_error) + __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_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, 237, __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, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -8051,30 +8061,30 @@ 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, 237, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __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, 237, __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, 237, __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, 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) __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, 237, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 181, __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, 237, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 237, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 181, __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":91 + /* "dopt_sensor_anomalies/detection.py":61 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< @@ -8152,7 +8162,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":242 +/* "dopt_sensor_anomalies/detection.py":186 * # helper function * # anomaly detection * def infer_image( # <<<<<<<<<<<<<< @@ -8168,8 +8178,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_21dopt_sensor_anomalies_9detection_6infer_image, "evaluate one image\n\n Parameters\n ----------\n image : npt.NDArray[np.uint8]\n represents image to be checked for anomalies\n model : Patchcore\n (loaded PyTorch state dictionary): model for anomaly detection\n\n Returns\n -------\n t.InferenceResult\n contains:\n img (numpy.ndarray)\n anomaly_map_resized (numpy.ndarray): heatmap to visualize detected anomalies\n anomaly_score (float): evaluation metric, in [0, 1] with close to 0 being no\n anomaly detected\n anomaly_label (bool): anomaly detected (1) or not (0)\n "); -static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_7infer_image = {"infer_image", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_7infer_image, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_21dopt_sensor_anomalies_9detection_6infer_image}; +static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_7infer_image = {"infer_image", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_7infer_image, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_21dopt_sensor_anomalies_9detection_7infer_image(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds @@ -8201,39 +8210,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, 242, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 186, __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, 242, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __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, 242, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 186, __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, 242, __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, 186, __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, 242, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, i); __PYX_ERR(0, 186, __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, 242, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 186, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 242, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __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, 242, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 186, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8258,6 +8267,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_v_torch_device = NULL; PyObject *__pyx_v_image_rgb = NULL; PyObject *__pyx_v_pil_image = NULL; + PyObject *__pyx_v_image_np = NULL; PyObject *__pyx_v_input_tensor = NULL; PyObject *__pyx_v_output = NULL; PyObject *__pyx_v_anomaly_score = NULL; @@ -8288,22 +8298,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON int __pyx_clineno = 0; __Pyx_RefNannySetupContext("infer_image", 0); - /* "dopt_sensor_anomalies/detection.py":265 - * anomaly_label (bool): anomaly detected (1) or not (0) - * """ + /* "dopt_sensor_anomalies/detection.py":190 + * model: Patchcore, + * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # <<<<<<<<<<<<<< * model.to(torch_device) * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) + __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_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, 265, __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, 190, __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, 265, __pyx_L1_error) + __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_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, 265, __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, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __pyx_t_8; @@ -8314,10 +8324,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, 265, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __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, 265, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 190, __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); @@ -8344,18 +8354,18 @@ 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, 265, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_torch_device = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":266 - * """ + /* "dopt_sensor_anomalies/detection.py":191 + * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") * model.to(torch_device) # <<<<<<<<<<<<<< * - * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # this is optional + * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) */ __pyx_t_4 = __pyx_v_model; __Pyx_INCREF(__pyx_t_4); @@ -8364,27 +8374,27 @@ 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, 266, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":268 + /* "dopt_sensor_anomalies/detection.py":193 * model.to(torch_device) * - * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # this is optional # <<<<<<<<<<<<<< + * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # <<<<<<<<<<<<<< * pil_image = Image.fromarray(image_rgb) * 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, 268, __pyx_L1_error) + __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_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, 268, __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, 193, __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, 268, __pyx_L1_error) + __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_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, 268, __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, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -8405,23 +8415,23 @@ 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, 268, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image_rgb = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":269 + /* "dopt_sensor_anomalies/detection.py":194 * - * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # this is optional + * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) # <<<<<<<<<<<<<< * pil_image = pil_image.convert("RGB") - * input_tensor = ( + * 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, 269, __pyx_L1_error) + __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_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, 269, __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, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -8441,18 +8451,18 @@ 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, 269, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_pil_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":270 - * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # this is optional + /* "dopt_sensor_anomalies/detection.py":195 + * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) * pil_image = pil_image.convert("RGB") # <<<<<<<<<<<<<< - * input_tensor = ( - * to_dtype(to_image(pil_image), torch.float32, scale=True) + * image_np = np.array(pil_image).astype(np.float32) / 255.0 + * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) */ __pyx_t_4 = __pyx_v_pil_image; __Pyx_INCREF(__pyx_t_4); @@ -8461,66 +8471,183 @@ 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, 270, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __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":273 - * input_tensor = ( - * to_dtype(to_image(pil_image), torch.float32, scale=True) - * if torch.as_tensor # ?? Question: Wie passt diese Funktion hier rein? # <<<<<<<<<<<<<< - * # ?? Konvertiert, aber wird zur Evaluation der Aussage genutzt (sollte immer wahr sein?) - * else np.array(pil_image) / 255.0 + /* "dopt_sensor_anomalies/detection.py":196 + * pil_image = Image.fromarray(image_rgb) + * 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) + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error) + __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_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_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_pil_image}; + __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) + __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_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_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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) + __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_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 + * 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_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_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_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_as_tensor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_image_np}; + __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) + __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_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_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_10) { + __pyx_v_input_tensor = __pyx_t_2; + __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":272 - * pil_image = pil_image.convert("RGB") - * input_tensor = ( - * to_dtype(to_image(pil_image), torch.float32, scale=True) # <<<<<<<<<<<<<< - * if torch.as_tensor # ?? Question: Wie passt diese Funktion hier rein? - * # ?? Konvertiert, aber wird zur Evaluation der Aussage genutzt (sollte immer wahr sein?) + /* "dopt_sensor_anomalies/detection.py":199 + * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) + * + * input_tensor = input_tensor.unsqueeze(0) # <<<<<<<<<<<<<< + * input_tensor = input_tensor.to(torch_device) + * */ + __pyx_t_4 = __pyx_v_input_tensor; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + { + 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) + __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 + * + * input_tensor = input_tensor.unsqueeze(0) + * input_tensor = input_tensor.to(torch_device) # <<<<<<<<<<<<<< + * + * model.eval() +*/ + __pyx_t_4 = __pyx_v_input_tensor; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + { + 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) + __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 + * input_tensor = input_tensor.to(torch_device) + * + * model.eval() # <<<<<<<<<<<<<< + * with torch.no_grad(): + * output = model(input_tensor) +*/ + __pyx_t_4 = __pyx_v_model; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + { + 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) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dopt_sensor_anomalies/detection.py":203 + * + * model.eval() + * with torch.no_grad(): # <<<<<<<<<<<<<< + * output = model(input_tensor) + * +*/ + /*with:*/ { __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_to_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 272, __pyx_L1_error) + __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_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_GOTREF(__pyx_t_5); - __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_to_image); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - assert(__pyx_t_8); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); - __pyx_t_9 = 0; - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_pil_image}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { @@ -8534,185 +8661,40 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON } #endif { - PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_3, __pyx_t_8}; - __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_scale, Py_True, __pyx_t_6, __pyx_callargs+3, 0) < 0) __PYX_ERR(0, 272, __pyx_L1_error) - __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_5, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __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_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_1 = __pyx_t_2; - __pyx_t_2 = 0; - } else { - - /* "dopt_sensor_anomalies/detection.py":275 - * if torch.as_tensor # ?? Question: Wie passt diese Funktion hier rein? - * # ?? Konvertiert, aber wird zur Evaluation der Aussage genutzt (sollte immer wahr sein?) - * else np.array(pil_image) / 255.0 # <<<<<<<<<<<<<< - * ) - * # ?? Ist das immer ein Torch-Tensor? Falls nicht, msste die Methode gendert werden -*/ - __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - assert(__pyx_t_5); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); - __pyx_t_9 = 0; - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_pil_image}; - __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, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_2, __pyx_mstate_global->__pyx_float_255_0, 255.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __pyx_t_8; - __pyx_t_8 = 0; - } - __pyx_v_input_tensor = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dopt_sensor_anomalies/detection.py":278 - * ) - * # ?? Ist das immer ein Torch-Tensor? Falls nicht, msste die Methode gendert werden - * input_tensor = input_tensor.unsqueeze(0) # <<<<<<<<<<<<<< - * input_tensor = input_tensor.to(torch_device) - * -*/ - __pyx_t_8 = __pyx_v_input_tensor; - __Pyx_INCREF(__pyx_t_8); - __pyx_t_9 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_int_0}; - __pyx_t_1 = __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_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF_SET(__pyx_v_input_tensor, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dopt_sensor_anomalies/detection.py":279 - * # ?? Ist das immer ein Torch-Tensor? Falls nicht, msste die Methode gendert werden - * input_tensor = input_tensor.unsqueeze(0) - * input_tensor = input_tensor.to(torch_device) # <<<<<<<<<<<<<< - * - * model.eval() -*/ - __pyx_t_8 = __pyx_v_input_tensor; - __Pyx_INCREF(__pyx_t_8); - __pyx_t_9 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, __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_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF_SET(__pyx_v_input_tensor, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dopt_sensor_anomalies/detection.py":281 - * input_tensor = input_tensor.to(torch_device) - * - * model.eval() # <<<<<<<<<<<<<< - * with torch.no_grad(): - * output = model(input_tensor) -*/ - __pyx_t_8 = __pyx_v_model; - __Pyx_INCREF(__pyx_t_8); - __pyx_t_9 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_1 = __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_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dopt_sensor_anomalies/detection.py":282 - * - * model.eval() - * with torch.no_grad(): # <<<<<<<<<<<<<< - * output = model(input_tensor) - * -*/ - /*with:*/ { - __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_no_grad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - assert(__pyx_t_8); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); - __pyx_t_9 = 0; - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_1 = __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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 282, __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, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_8 = NULL; - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); + __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_GOTREF(__pyx_t_1); __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - assert(__pyx_t_8); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); __pyx_t_9 = 0; } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L3_error) + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __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) __Pyx_GOTREF(__pyx_t_5); } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_PyThreadState_declare @@ -8723,7 +8705,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGOTREF(__pyx_t_14); /*try:*/ { - /* "dopt_sensor_anomalies/detection.py":283 + /* "dopt_sensor_anomalies/detection.py":204 * model.eval() * with torch.no_grad(): * output = model(input_tensor) # <<<<<<<<<<<<<< @@ -8732,31 +8714,31 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON */ __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_model); - __pyx_t_2 = __pyx_v_model; + __pyx_t_1 = __pyx_v_model; __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); assert(__pyx_t_5); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); __pyx_t_9 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_input_tensor}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_2); } - __pyx_v_output = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_output = __pyx_t_2; + __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":282 + /* "dopt_sensor_anomalies/detection.py":203 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8779,31 +8761,31 @@ 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_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 282, __pyx_L9_except_error) - __Pyx_XGOTREF(__pyx_t_1); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 203, __pyx_L9_except_error) __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 282, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, NULL); + __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_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_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L9_except_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 203, __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, 282, __pyx_L9_except_error) + if (__pyx_t_10 < (0)) __PYX_ERR(0, 203, __pyx_L9_except_error) __pyx_t_16 = (!__pyx_t_10); if (unlikely(__pyx_t_16)) { - __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_5); - __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 282, __pyx_L9_except_error) + __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_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L8_exception_handled; } @@ -8824,9 +8806,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON /*finally:*/ { /*normal exit:*/{ if (__pyx_t_11) { - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[3], NULL); + __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, 282, __pyx_L1_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } @@ -8841,39 +8823,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_L16:; } - /* "dopt_sensor_anomalies/detection.py":285 + /* "dopt_sensor_anomalies/detection.py":206 * 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, 285, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_9 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; - __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, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } - __pyx_v_anomaly_score = __pyx_t_5; - __pyx_t_5 = 0; - - /* "dopt_sensor_anomalies/detection.py":286 - * - * 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, 286, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error) + 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) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); @@ -8883,150 +8841,174 @@ 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, 286, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __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 + * + * 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) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __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) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_label = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":287 + /* "dopt_sensor_anomalies/detection.py":208 * 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, 287, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_anomaly_map); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; + 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) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_6 = __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_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_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - } - __pyx_t_8 = __pyx_t_6; - __Pyx_INCREF(__pyx_t_8); - __pyx_t_9 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_1 = __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_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); } - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; { - PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __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) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_1 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_map = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":290 + /* "dopt_sensor_anomalies/detection.py":211 * * # 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])) * */ - __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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_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_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - assert(__pyx_t_1); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); __pyx_t_9 = 0; } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_pil_image}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __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_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error) + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_pil_image}; + __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) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_img_np = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":291 + /* "dopt_sensor_anomalies/detection.py":212 * # 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])) # <<<<<<<<<<<<<< * * return t.InferenceResult( */ - __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_resize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) + __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_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __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, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error) + __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_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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __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, 291, __pyx_L1_error); + __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_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_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_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 291, __pyx_L1_error); - __pyx_t_8 = 0; + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 212, __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); __pyx_t_4 = 0; + __pyx_t_6 = 0; __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - assert(__pyx_t_6); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_8); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); __pyx_t_9 = 0; } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_anomaly_map, __pyx_t_1}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_anomaly_map, __pyx_t_2}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __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":293 + /* "dopt_sensor_anomalies/detection.py":214 * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) * * return t.InferenceResult( # <<<<<<<<<<<<<< @@ -9034,14 +9016,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * anomaly_map_resized=anomaly_map_resized, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_InferenceResult); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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_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_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":297 + /* "dopt_sensor_anomalies/detection.py":218 * anomaly_map_resized=anomaly_map_resized, * anomaly_score=anomaly_score, * anomaly_label=anomaly_label, # <<<<<<<<<<<<<< @@ -9050,36 +9032,36 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON */ __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); - assert(__pyx_t_2); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_2); + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); __pyx_t_9 = 0; } #endif { - PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_2, NULL}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_1, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 293, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_1, __pyx_callargs+1, 1) < 0) __PYX_ERR(0, 293, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_1, __pyx_callargs+1, 2) < 0) __PYX_ERR(0, 293, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_v_anomaly_label, __pyx_t_1, __pyx_callargs+1, 3) < 0) __PYX_ERR(0, 293, __pyx_L1_error) - __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_6, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error) + 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_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) + __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) __Pyx_GOTREF(__pyx_t_5); } __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":242 + /* "dopt_sensor_anomalies/detection.py":186 * # helper function * # anomaly detection * def infer_image( # <<<<<<<<<<<<<< @@ -9103,6 +9085,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_v_torch_device); __Pyx_XDECREF(__pyx_v_image_rgb); __Pyx_XDECREF(__pyx_v_pil_image); + __Pyx_XDECREF(__pyx_v_image_np); __Pyx_XDECREF(__pyx_v_input_tensor); __Pyx_XDECREF(__pyx_v_output); __Pyx_XDECREF(__pyx_v_anomaly_score); @@ -9115,7 +9098,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":302 +/* "dopt_sensor_anomalies/detection.py":223 * * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< @@ -9131,8 +9114,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_21dopt_sensor_anomalies_9detection_8anomaly_detection, "load the model, call function for anomaly detection and store the results\n\n Parameters\n ----------\n file_path : Path\n path to file to analyse\n detection_models : t.DetectionModels\n collection of model paths for the left and right sensor\n data_csv : t.CsvData\n (list) data to save as CSV according to requirements, contains strings and ints\n sensor_images : t.SensorImages\n _description_\n "); -static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_9anomaly_detection = {"anomaly_detection", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_9anomaly_detection, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_21dopt_sensor_anomalies_9detection_8anomaly_detection}; +static PyMethodDef __pyx_mdef_21dopt_sensor_anomalies_9detection_9anomaly_detection = {"anomaly_detection", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_21dopt_sensor_anomalies_9detection_9anomaly_detection, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_21dopt_sensor_anomalies_9detection_9anomaly_detection(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds @@ -9166,44 +9148,44 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 302, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 223, __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, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 223, __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, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 223, __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, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 223, __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, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 223, __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, 302, __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, 223, __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, 302, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, i); __PYX_ERR(0, 223, __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, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 223, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 223, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 223, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 302, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 223, __pyx_L3_error) } __pyx_v_file_path = values[0]; __pyx_v_detection_models = values[1]; @@ -9212,7 +9194,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 302, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 223, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9268,31 +9250,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":321 - * _description_ - * """ + /* "dopt_sensor_anomalies/detection.py":229 + * sensor_images: t.SensorImages, + * ) -> None: * file_stem = file_path.stem # <<<<<<<<<<<<<< * folder_path = file_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, 321, __pyx_L1_error) + __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_GOTREF(__pyx_t_1); __pyx_v_file_stem = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":322 - * """ + /* "dopt_sensor_anomalies/detection.py":230 + * ) -> None: * file_stem = file_path.stem * folder_path = file_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, 322, __pyx_L1_error) + __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_GOTREF(__pyx_t_1); __pyx_v_folder_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":325 + /* "dopt_sensor_anomalies/detection.py":233 * * # reconstruct the model and initialize the engine * model = Patchcore( # <<<<<<<<<<<<<< @@ -9300,29 +9282,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, 325, __pyx_L1_error) + __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_GOTREF(__pyx_t_3); - /* "dopt_sensor_anomalies/detection.py":326 + /* "dopt_sensor_anomalies/detection.py":234 * # reconstruct the model and initialize the engine * model = Patchcore( * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO # <<<<<<<<<<<<<< * ) * # ?? bentigt? Wird nicht genutzt */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error) + __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_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, 326, __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, 234, __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, 326, __pyx_L1_error) + __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_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, 326, __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, 234, __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, 326, __pyx_L1_error) + __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_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, 326, __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, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = 1; @@ -9339,11 +9321,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, 325, __pyx_L1_error) + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __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, 325, __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, 325, __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, 325, __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, 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) __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; @@ -9351,28 +9333,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, 325, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_model = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":332 + /* "dopt_sensor_anomalies/detection.py":240 * * # preparation for plot * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< * * # loop over left and right sensor */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) + __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_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, 332, __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, 240, __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, 332, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __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[5]) < 0) __PYX_ERR(0, 332, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[4], __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __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, 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) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9382,7 +9364,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, 332, __pyx_L1_error) + __PYX_ERR(0, 240, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -9392,22 +9374,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, 332, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __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, 332, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __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, 332, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); @@ -9415,7 +9397,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, 332, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 240, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L4_unpacking_done; @@ -9423,7 +9405,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, 332, __pyx_L1_error) + __PYX_ERR(0, 240, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -9431,7 +9413,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_v_axes = __pyx_t_3; __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":335 + /* "dopt_sensor_anomalies/detection.py":243 * * # loop over left and right sensor * for i, (side, image) in enumerate(sensor_images.items()): # <<<<<<<<<<<<<< @@ -9443,9 +9425,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_10 = 0; if (unlikely(__pyx_v_sensor_images == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 335, __pyx_L1_error) + __PYX_ERR(0, 243, __pyx_L1_error) } - __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_sensor_images, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_sensor_images, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_1; @@ -9453,7 +9435,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( while (1) { __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_10, &__pyx_t_1, &__pyx_t_7, NULL, __pyx_t_12); if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 335, __pyx_L1_error) + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_side, __pyx_t_1); @@ -9462,13 +9444,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":337 + /* "dopt_sensor_anomalies/detection.py":245 * for i, (side, image) in enumerate(sensor_images.items()): * # Ich habe die Modellpfade als Funktionsparameter hinzugefgt * image = cast(npt.NDArray[np.uint8], image) # <<<<<<<<<<<<<< @@ -9476,19 +9458,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * model.load_state_dict(checkpoint["model_state_dict"]) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -9510,13 +9492,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF_SET(__pyx_v_image, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":338 + /* "dopt_sensor_anomalies/detection.py":246 * # Ich habe die Modellpfade als Funktionsparameter hinzugefgt * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) # <<<<<<<<<<<<<< @@ -9524,12 +9506,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * */ __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_detection_models, __pyx_v_side); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_detection_models, __pyx_v_side); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS @@ -9549,13 +9531,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 338, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_checkpoint, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":339 + /* "dopt_sensor_anomalies/detection.py":247 * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) * model.load_state_dict(checkpoint["model_state_dict"]) # <<<<<<<<<<<<<< @@ -9564,7 +9546,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( */ __pyx_t_1 = __pyx_v_model; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 0; { @@ -9572,12 +9554,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_load_state_dict, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 339, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":341 + /* "dopt_sensor_anomalies/detection.py":249 * model.load_state_dict(checkpoint["model_state_dict"]) * * result = infer_image(image, model) # <<<<<<<<<<<<<< @@ -9585,7 +9567,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS @@ -9604,13 +9586,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__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_7)) __PYX_ERR(0, 341, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":342 + /* "dopt_sensor_anomalies/detection.py":250 * * result = infer_image(image, model) * data_csv.extend([int(result.anomaly_label)]) # <<<<<<<<<<<<<< @@ -9619,15 +9601,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( */ __pyx_t_1 = __pyx_v_data_csv; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 342, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 250, __pyx_L1_error); __pyx_t_6 = 0; __pyx_t_8 = 0; { @@ -9635,24 +9617,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_extend, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":344 + /* "dopt_sensor_anomalies/detection.py":252 * data_csv.extend([int(result.anomaly_label)]) * * ax = axes[i] # <<<<<<<<<<<<<< * ax.axis("off") * ax.imshow(image, alpha=0.8) */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_ax, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":345 + /* "dopt_sensor_anomalies/detection.py":253 * * ax = axes[i] * ax.axis("off") # <<<<<<<<<<<<<< @@ -9666,12 +9648,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_off}; __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_axis, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":346 + /* "dopt_sensor_anomalies/detection.py":254 * ax = axes[i] * ax.axis("off") * ax.imshow(image, alpha=0.8) # <<<<<<<<<<<<<< @@ -9683,18 +9665,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_8 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_image}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_8, __pyx_t_1, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 346, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_8, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 346, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":347 + /* "dopt_sensor_anomalies/detection.py":255 * ax.axis("off") * ax.imshow(image, alpha=0.8) * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) # <<<<<<<<<<<<<< @@ -9703,20 +9685,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( */ __pyx_t_1 = __pyx_v_ax; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_t_5}; - __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cmap, __pyx_mstate_global->__pyx_n_u_jet, __pyx_t_6, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 347, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_5, __pyx_t_6, __pyx_callargs+2, 1) < 0) __PYX_ERR(0, 347, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cmap, __pyx_mstate_global->__pyx_n_u_jet, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 255, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_5, __pyx_t_6, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 255, __pyx_L1_error) __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 347, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -9724,7 +9706,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":349 + /* "dopt_sensor_anomalies/detection.py":257 * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) * * plt.subplots_adjust(wspace=0, hspace=0) # <<<<<<<<<<<<<< @@ -9732,9 +9714,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 349, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_subplots_adjust); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_subplots_adjust); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = 1; @@ -9751,20 +9733,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, NULL}; - __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_wspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 349, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 1) < 0) __PYX_ERR(0, 349, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_wspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 349, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":350 + /* "dopt_sensor_anomalies/detection.py":258 * * plt.subplots_adjust(wspace=0, hspace=0) * plt.savefig( # <<<<<<<<<<<<<< @@ -9772,38 +9754,38 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * bbox_inches="tight", */ __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_savefig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_savefig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":351 + /* "dopt_sensor_anomalies/detection.py":259 * plt.subplots_adjust(wspace=0, hspace=0) * plt.savefig( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), # <<<<<<<<<<<<<< * bbox_inches="tight", * pad_inches=0, */ - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_HEATMAP_FILENAME_SUFFIX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_HEATMAP_FILENAME_SUFFIX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_15[0] = __pyx_t_7; __pyx_t_15[1] = __pyx_t_5; __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u_png; __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 4, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = 1; @@ -9820,21 +9802,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error) + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bbox_inches, __pyx_mstate_global->__pyx_n_u_tight, __pyx_t_1, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 350, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pad_inches, __pyx_mstate_global->__pyx_int_0, __pyx_t_1, __pyx_callargs+2, 1) < 0) __PYX_ERR(0, 350, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bbox_inches, __pyx_mstate_global->__pyx_n_u_tight, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pad_inches, __pyx_mstate_global->__pyx_int_0, __pyx_t_1, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":355 + /* "dopt_sensor_anomalies/detection.py":263 * pad_inches=0, * ) * plt.close() # <<<<<<<<<<<<<< @@ -9842,9 +9824,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * df = DataFrame([data_csv]) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = 1; @@ -9864,12 +9846,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":357 + /* "dopt_sensor_anomalies/detection.py":265 * plt.close() * * df = DataFrame([data_csv]) # <<<<<<<<<<<<<< @@ -9877,13 +9859,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}.csv"), */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_data_csv); __Pyx_GIVEREF(__pyx_v_data_csv); - if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 357, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 265, __pyx_L1_error); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { @@ -9902,13 +9884,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_v_df = __pyx_t_4; __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":358 + /* "dopt_sensor_anomalies/detection.py":266 * * df = DataFrame([data_csv]) * df.to_csv( # <<<<<<<<<<<<<< @@ -9918,55 +9900,55 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_3 = __pyx_v_df; __Pyx_INCREF(__pyx_t_3); - /* "dopt_sensor_anomalies/detection.py":359 + /* "dopt_sensor_anomalies/detection.py":267 * df = DataFrame([data_csv]) * df.to_csv( * (folder_path / f"{file_stem}.csv"), # <<<<<<<<<<<<<< * mode="w", * index=False, */ - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_csv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_csv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":363 + /* "dopt_sensor_anomalies/detection.py":271 * index=False, * header=False, * quoting=csv.QUOTE_NONE, # <<<<<<<<<<<<<< * sep=";", * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_3, __pyx_t_1}; - __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_w, __pyx_t_5, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 358, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_False, __pyx_t_5, __pyx_callargs+2, 1) < 0) __PYX_ERR(0, 358, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_header, Py_False, __pyx_t_5, __pyx_callargs+2, 2) < 0) __PYX_ERR(0, 358, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quoting, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 3) < 0) __PYX_ERR(0, 358, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sep, __pyx_mstate_global->__pyx_kp_u__4, __pyx_t_5, __pyx_callargs+2, 4) < 0) __PYX_ERR(0, 358, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_w, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_False, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_header, Py_False, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quoting, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 3) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sep, __pyx_mstate_global->__pyx_kp_u__4, __pyx_t_5, __pyx_callargs+2, 4) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_to_csv, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":302 + /* "dopt_sensor_anomalies/detection.py":223 * * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< @@ -10006,7 +9988,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":368 +/* "dopt_sensor_anomalies/detection.py":276 * * * def pipeline( # <<<<<<<<<<<<<< @@ -10055,46 +10037,46 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 368, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 276, __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, 368, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 276, __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, 368, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 276, __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, 368, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 276, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipeline", 0) < 0) __PYX_ERR(0, 368, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipeline", 0) < (0)) __PYX_ERR(0, 276, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, i); __PYX_ERR(0, 368, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, i); __PYX_ERR(0, 276, __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, 368, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 276, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 368, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 276, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 368, __pyx_L3_error) + 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, 370, __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, 371, __pyx_L3_error) + __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 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) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 368, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 276, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10105,7 +10087,7 @@ 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, 369, __pyx_L1_error) + 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); /* function exit code */ @@ -10147,7 +10129,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pipeline", 0); - /* "dopt_sensor_anomalies/detection.py":373 + /* "dopt_sensor_anomalies/detection.py":281 * pixels_per_metric_Y: float, * ) -> None: * file_path = Path(user_file_path) # <<<<<<<<<<<<<< @@ -10155,7 +10137,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * 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, 373, __pyx_L1_error) + __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_GOTREF(__pyx_t_3); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10174,13 +10156,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __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, 373, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_file_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":374 + /* "dopt_sensor_anomalies/detection.py":282 * ) -> None: * file_path = Path(user_file_path) * if not file_path.exists(): # <<<<<<<<<<<<<< @@ -10194,15 +10176,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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, 374, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __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, 374, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 282, __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":375 + /* "dopt_sensor_anomalies/detection.py":283 * file_path = Path(user_file_path) * if not file_path.exists(): * raise FileNotFoundError("The provided path seems not to exist") # <<<<<<<<<<<<<< @@ -10218,14 +10200,14 @@ 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, 375, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __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, 375, __pyx_L1_error) + __PYX_ERR(0, 283, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":374 + /* "dopt_sensor_anomalies/detection.py":282 * ) -> None: * file_path = Path(user_file_path) * if not file_path.exists(): # <<<<<<<<<<<<<< @@ -10234,16 +10216,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U */ } - /* "dopt_sensor_anomalies/detection.py":377 + /* "dopt_sensor_anomalies/detection.py":285 * 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, 377, __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, 285, __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, 377, __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, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_7; @@ -10254,22 +10236,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, 377, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_MODEL_FOLDER = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":379 + /* "dopt_sensor_anomalies/detection.py":287 * 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, 379, __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, 287, __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, 379, __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, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = __pyx_t_3; @@ -10280,13 +10262,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, 379, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_DETECTION_MODELS = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":382 + /* "dopt_sensor_anomalies/detection.py":290 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10294,19 +10276,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, 382, __pyx_L1_error) + __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_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":383 + /* "dopt_sensor_anomalies/detection.py":291 * * 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, 383, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __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, 383, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10327,7 +10309,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, 382, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -10336,7 +10318,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, 382, __pyx_L1_error) + __PYX_ERR(0, 290, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -10346,22 +10328,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, 382, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __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, 382, __pyx_L1_error) + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __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, 382, __pyx_L1_error) + __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __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); @@ -10369,7 +10351,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, 382, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 290, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L5_unpacking_done; @@ -10377,11 +10359,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, 382, __pyx_L1_error) + __PYX_ERR(0, 290, __pyx_L1_error) __pyx_L5_unpacking_done:; } - /* "dopt_sensor_anomalies/detection.py":382 + /* "dopt_sensor_anomalies/detection.py":290 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10393,7 +10375,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_v_sensor_images = __pyx_t_8; __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":385 + /* "dopt_sensor_anomalies/detection.py":293 * file_path, pixels_per_metric_X, pixels_per_metric_Y * ) * anomaly_detection( # <<<<<<<<<<<<<< @@ -10401,10 +10383,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * detection_models=DETECTION_MODELS, */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 385, __pyx_L1_error) + __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_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":389 + /* "dopt_sensor_anomalies/detection.py":297 * detection_models=DETECTION_MODELS, * data_csv=data_csv, * sensor_images=sensor_images, # <<<<<<<<<<<<<< @@ -10424,22 +10406,22 @@ 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, 385, __pyx_L1_error) + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __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, 385, __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, 385, __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, 385, __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, 385, __pyx_L1_error) + 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) __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, 385, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":368 + /* "dopt_sensor_anomalies/detection.py":276 * * * def pipeline( # <<<<<<<<<<<<<< @@ -11678,15 +11660,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, 91, __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, 91, __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, 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) #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, 91, __pyx_L1_error) + 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) #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)) { @@ -11694,15 +11676,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, 149, __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, 149, __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, 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) #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, 149, __pyx_L1_error) + 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) #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)) { @@ -11710,15 +11692,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, 189, __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, 189, __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, 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) #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, 189, __pyx_L1_error) + 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) #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)) { @@ -11726,15 +11708,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, 224, __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, 224, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 168, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 168, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 224, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 168, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_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)) { @@ -11742,15 +11724,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, 225, __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, 225, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 169, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 169, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 225, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 169, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_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)) { @@ -11758,15 +11740,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, 226, __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, 226, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 170, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 170, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 226, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 170, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_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)) { @@ -11774,15 +11756,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, 227, __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, 227, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 171, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 227, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_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)) { @@ -12054,7 +12036,7 @@ if (!__Pyx_RefNanny) { #endif __Pyx_RefNannySetupContext("PyInit_detection", 0); - if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif @@ -12062,30 +12044,30 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #if 0 || defined(__Pyx_CyFunction_USED) || defined(__Pyx_FusedFunction_USED) || defined(__Pyx_Coroutine_USED) || defined(__Pyx_Generator_USED) || defined(__Pyx_AsyncGen_USED) - if (__pyx_CommonTypesMetaclass_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CommonTypesMetaclass_init(__pyx_m) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ if (__pyx_module_is_main_dopt_sensor_anomalies__detection) { - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) } { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -12094,10 +12076,10 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); } } /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_CreateCodeObjects(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(__pyx_mstate); (void)__Pyx_modinit_variable_export_code(__pyx_mstate); @@ -12115,7 +12097,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_csv_2, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_csv_2, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "dopt_sensor_anomalies/detection.py":2 @@ -12131,7 +12113,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 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, 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) + 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; @@ -12149,7 +12131,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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) + 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; @@ -12167,15 +12149,15 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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) + 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) + 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) + 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; @@ -12188,7 +12170,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) + 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; /* "dopt_sensor_anomalies/detection.py":8 @@ -12200,7 +12182,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) + 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; /* "dopt_sensor_anomalies/detection.py":9 @@ -12210,9 +12192,9 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * 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[6]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) + __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) + 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; /* "dopt_sensor_anomalies/detection.py":10 @@ -12224,7 +12206,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) + 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; /* "dopt_sensor_anomalies/detection.py":11 @@ -12234,9 +12216,9 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import torch * */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy_typing, __pyx_mstate_global->__pyx_tuple[7]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) + __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) + 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; /* "dopt_sensor_anomalies/detection.py":12 @@ -12248,7 +12230,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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_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) + 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_3); __pyx_t_3 = 0; /* "dopt_sensor_anomalies/detection.py":15 @@ -12265,7 +12247,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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_Patchcore, __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; @@ -12283,11 +12265,11 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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, 16, __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_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, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12305,7 +12287,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -12323,7 +12305,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12341,7 +12323,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 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, 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) + 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; @@ -12359,11 +12341,11 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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) + 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) + 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; @@ -12376,7 +12358,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) + 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; /* "dopt_sensor_anomalies/detection.py":23 @@ -12393,7 +12375,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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) + 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; @@ -12411,7 +12393,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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) + 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; @@ -12429,7 +12411,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __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_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) + 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; @@ -12452,7 +12434,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - 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) + 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; /* "dopt_sensor_anomalies/detection.py":29 @@ -12462,7 +12444,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * 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, 29, __pyx_L1_error) /* "dopt_sensor_anomalies/detection.py":30 * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") @@ -12471,7 +12453,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * * */ - 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, 30, __pyx_L1_error) /* "dopt_sensor_anomalies/detection.py":34 * @@ -12482,129 +12464,129 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) + 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_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) + 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":58 + /* "dopt_sensor_anomalies/detection.py":44 * box_1: t.Box, * box_2: t.Box, * tolerance: float = 5.0, # <<<<<<<<<<<<<< * ) -> bool: - * """to check if bounding box has already been identified and is just a redundant one + * # unpack the boxes */ - __pyx_t_4 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "dopt_sensor_anomalies/detection.py":55 + /* "dopt_sensor_anomalies/detection.py":41 * * * 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, 55, __pyx_L1_error) + __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, 55, __pyx_L1_error) + __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, 55, __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, 55, __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, 55, __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, 55, __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, 55, __pyx_L1_error) + 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_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, 55, __pyx_L1_error) + 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":91 + /* "dopt_sensor_anomalies/detection.py":61 * * # ** main function * def measure_length( # <<<<<<<<<<<<<< * file_path: Path, * pixels_per_metric_X: float, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __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, 91, __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, 91, __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, 91, __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, 91, __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, 91, __pyx_L1_error) + 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_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, 91, __pyx_L1_error) + 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":242 + /* "dopt_sensor_anomalies/detection.py":186 * # 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, 242, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __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, 242, __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, 242, __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, 242, __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, 242, __pyx_L1_error) + 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); __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, 242, __pyx_L1_error) + 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; - /* "dopt_sensor_anomalies/detection.py":302 + /* "dopt_sensor_anomalies/detection.py":223 * * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< * file_path: Path, * detection_models: t.DetectionModels, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) + __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, 302, __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, 302, __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, 302, __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, 302, __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, 302, __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, 302, __pyx_L1_error) + 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_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, 302, __pyx_L1_error) + 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":368 + /* "dopt_sensor_anomalies/detection.py":276 * * * def pipeline( # <<<<<<<<<<<<<< * user_file_path: str, * pixels_per_metric_X: float, */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) + __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, 368, __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, 368, __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, 368, __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, 368, __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, 368, __pyx_L1_error) + 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_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, 368, __pyx_L1_error) + 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 @@ -12614,7 +12596,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); */ __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) + 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; /*--- Wrapped vars code ---*/ @@ -12738,7 +12720,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_anomaly_map_resized, sizeof(__pyx_k_anomaly_map_resized), 0, 1, 1}, /* PyObject cname: __pyx_n_u_anomaly_map_resized */ {__pyx_k_anomaly_score, sizeof(__pyx_k_anomaly_score), 0, 1, 1}, /* PyObject cname: __pyx_n_u_anomaly_score */ {__pyx_k_array, sizeof(__pyx_k_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_array */ - {__pyx_k_as_tensor, sizeof(__pyx_k_as_tensor), 0, 1, 1}, /* PyObject cname: __pyx_n_u_as_tensor */ + {__pyx_k_astype, sizeof(__pyx_k_astype), 0, 1, 1}, /* PyObject cname: __pyx_n_u_astype */ {__pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 1, 1}, /* PyObject cname: __pyx_n_u_asyncio_coroutines */ {__pyx_k_ax, sizeof(__pyx_k_ax), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ax */ {__pyx_k_axes, sizeof(__pyx_k_axes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_axes */ @@ -12820,6 +12802,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_float, sizeof(__pyx_k_float), 0, 1, 1}, /* PyObject cname: __pyx_n_u_float */ {__pyx_k_float32, sizeof(__pyx_k_float32), 0, 1, 1}, /* PyObject cname: __pyx_n_u_float32 */ {__pyx_k_folder_path, sizeof(__pyx_k_folder_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_folder_path */ + {__pyx_k_from_numpy, sizeof(__pyx_k_from_numpy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_numpy */ {__pyx_k_fromarray, sizeof(__pyx_k_fromarray), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fromarray */ {__pyx_k_func, sizeof(__pyx_k_func), 0, 1, 1}, /* PyObject cname: __pyx_n_u_func */ {__pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_gc */ @@ -12833,6 +12816,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_hspace, sizeof(__pyx_k_hspace), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hspace */ {__pyx_k_i, sizeof(__pyx_k_i), 0, 1, 1}, /* PyObject cname: __pyx_n_u_i */ {__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 */ @@ -12894,6 +12878,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__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 */ {__pyx_k_pil_image, sizeof(__pyx_k_pil_image), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pil_image */ {__pyx_k_pipeline, sizeof(__pyx_k_pipeline), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pipeline */ @@ -12918,7 +12903,6 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_s1, sizeof(__pyx_k_s1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_s1 */ {__pyx_k_s2, sizeof(__pyx_k_s2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_s2 */ {__pyx_k_savefig, sizeof(__pyx_k_savefig), 0, 1, 1}, /* PyObject cname: __pyx_n_u_savefig */ - {__pyx_k_scale, sizeof(__pyx_k_scale), 0, 1, 1}, /* PyObject cname: __pyx_n_u_scale */ {__pyx_k_scipy_spatial, sizeof(__pyx_k_scipy_spatial), 0, 1, 1}, /* PyObject cname: __pyx_n_u_scipy_spatial */ {__pyx_k_send, sizeof(__pyx_k_send), 0, 1, 1}, /* PyObject cname: __pyx_n_u_send */ {__pyx_k_sensor_images, sizeof(__pyx_k_sensor_images), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sensor_images */ @@ -12989,11 +12973,11 @@ 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, 224, __pyx_L1_error) - __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 225, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 335, __pyx_L1_error) - __pyx_builtin_FileNotFoundError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_FileNotFoundError); if (!__pyx_builtin_FileNotFoundError) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 93, __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) return 0; __pyx_L1_error:; return -1; @@ -13005,77 +12989,88 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "dopt_sensor_anomalies/detection.py":224 + /* "dopt_sensor_anomalies/detection.py":168 * * # 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, 224, __pyx_L1_error) + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); - __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); - /* "dopt_sensor_anomalies/detection.py":226 + /* "dopt_sensor_anomalies/detection.py":170 * 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, 226, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); - /* "dopt_sensor_anomalies/detection.py":127 + /* "dopt_sensor_anomalies/detection.py":71 * raise errors.ImageNotReadError(f"Image could not be read from: >{file_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, 127, __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, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); - /* "dopt_sensor_anomalies/detection.py":133 + /* "dopt_sensor_anomalies/detection.py":77 * _, 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, 133, __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, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); - /* "dopt_sensor_anomalies/detection.py":282 + /* "dopt_sensor_anomalies/detection.py":197 + * 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_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "dopt_sensor_anomalies/detection.py":203 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< * output = model(input_tensor) * */ - __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); - __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + __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_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); - /* "dopt_sensor_anomalies/detection.py":332 + /* "dopt_sensor_anomalies/detection.py":240 * * # preparation for plot * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< * * # loop over left and right sensor */ - __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); - __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); - __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 332, __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, 240, __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_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); /* "dopt_sensor_anomalies/detection.py":9 * import cv2 @@ -13084,9 +13079,9 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { * import numpy as np * import numpy.typing as npt */ - __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_matplotlib, __pyx_mstate_global->__pyx_n_u_pyplot); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); - __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); + __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_GOTREF(__pyx_mstate_global->__pyx_tuple[7]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]); /* "dopt_sensor_anomalies/detection.py":11 * import matplotlib.pyplot as plt @@ -13095,9 +13090,9 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { * import torch * */ - __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_mstate_global->__pyx_n_u_typing); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]); - __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]); + __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_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 @@ -13106,9 +13101,9 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors */ - __pyx_mstate_global->__pyx_tuple[8] = 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[8])) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]); - __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]); + __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_GOTREF(__pyx_mstate_global->__pyx_tuple[9]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -13169,62 +13164,62 @@ 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), 149, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 93, 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), 189, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 133, 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), 224, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 168, 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), 225, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 169, 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), 226, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 170, 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), 227, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 171, 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, 54}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 34, 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), 55, 143}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 41, 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), 91, 882}; + 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}; - __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_6_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_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, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 242, 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_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_e_V1_vQk_1_z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 186, 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), 302, 346}; + 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 = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 368, 118}; + 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}; __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; } @@ -13457,7 +13452,7 @@ __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; for (i = 0; i < n; i++) { - if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < 0)) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { Py_DECREF(res); return NULL; } @@ -15084,9 +15079,7 @@ static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObjec if (unlikely(__Pyx_PyLong_IsZero(op1))) { return PyLong_FromLong(-intval); } - if (likely(__Pyx_PyLong_IsCompact(op1))) { - a = __Pyx_PyLong_CompactValue(op1); - } else { + if (unlikely(!__Pyx_PyLong_CompactAsLong(op1, &a))) { const digit* digits = __Pyx_PyLong_Digits(op1); const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { @@ -15549,9 +15542,7 @@ static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op if (unlikely(__Pyx_PyLong_IsZero(op1))) { return __Pyx_NewRef(op2); } - if (likely(__Pyx_PyLong_IsCompact(op1))) { - a = __Pyx_PyLong_CompactValue(op1); - } else { + if (unlikely(!__Pyx_PyLong_CompactAsLong(op1, &a))) { const digit* digits = __Pyx_PyLong_Digits(op1); const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { @@ -20890,6 +20881,17 @@ static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { return PyLong_FromSize_t(ival); } +#if CYTHON_USE_PYLONG_INTERNALS +static CYTHON_INLINE int __Pyx_PyLong_CompactAsLong(PyObject *x, long *return_value) { + if (unlikely(!__Pyx_PyLong_IsCompact(x))) + return 0; + Py_ssize_t value = __Pyx_PyLong_CompactValue(x); + if ((sizeof(long) < sizeof(Py_ssize_t)) && unlikely(value != (long) value)) + return 0; + *return_value = (long) value; + return 1; +} +#endif /* MultiPhaseInitModuleState */ diff --git a/src/dopt_sensor_anomalies/detection.py b/src/dopt_sensor_anomalies/detection.py index 660e97a..c9ace10 100644 --- a/src/dopt_sensor_anomalies/detection.py +++ b/src/dopt_sensor_anomalies/detection.py @@ -35,20 +35,6 @@ def midpoint( pt_A: npt.NDArray[np.floating], pt_B: npt.NDArray[np.floating], ) -> tuple[float, float]: - """to identify the midpoint of a 2D area - - Parameters - ---------- - pt_A : npt.NDArray[np.floating] - tuple of coordinates x, y; shape (2, ) - pt_B : npt.NDArray[np.floating] - tuple of coordinates x, y; shape (2, ) - - Returns - ------- - tuple[float, float] - tuple of midpoint coordinates - """ return ((pt_A[0] + pt_B[0]) * 0.5, (pt_A[1] + pt_B[1]) * 0.5) @@ -57,22 +43,6 @@ def check_box_redundancy( box_2: t.Box, tolerance: float = 5.0, ) -> bool: - """to check if bounding box has already been identified and is just a redundant one - - Parameters - ---------- - box_1 : t.Box - tuple of box values: ((center_x, center_y), (width, height), angle) - box_2 : t.Box - tuple of box values: ((center_x, center_y), (width, height), angle) - tolerance : float, optional - distance threshold for width and height, by default 5.0 - - Returns - ------- - bool - redundancy evaluation - """ # unpack the boxes c1, s1, _ = box_1 c2, s2, _ = box_2 @@ -93,32 +63,6 @@ def measure_length( pixels_per_metric_X: float, pixels_per_metric_Y: float, ) -> tuple[t.CsvData, t.SensorImages]: - """detect and measure the size of the electrodes - - Parameters - ---------- - file_path : Path - path to file to analyse - pixels_per_metric_X : float - scaling parameter x dimension, Pixels per micrometer in image - pixels_per_metric_Y : float - scaling parameter y dimension, Pixels per micrometer in image - - Returns - ------- - tuple[t.CsvData, t.SensorImages] - t.CsvData: (list) data to save as CSV according to requirements, contains strings and ints - t.SensorImages: (TypedDict) contains left and right image corresponding to each sensor - - Raises - ------ - errors.ImageNotReadError - image was not read successfully - errors.ContourCalculationError - during contour detection there were several possible error causes - errors.InvalidElectrodeCount - an invalid number of electrodes were detected - """ data_csv: list[str | int] = [] image = cv2.imread(str(file_path)) if image is None: @@ -243,25 +187,6 @@ def infer_image( image: npt.NDArray[np.uint8], model: Patchcore, ) -> t.InferenceResult: - """evaluate one image - - Parameters - ---------- - image : npt.NDArray[np.uint8] - represents image to be checked for anomalies - model : Patchcore - (loaded PyTorch state dictionary): model for anomaly detection - - Returns - ------- - t.InferenceResult - contains: - img (numpy.ndarray) - anomaly_map_resized (numpy.ndarray): heatmap to visualize detected anomalies - anomaly_score (float): evaluation metric, in [0, 1] with close to 0 being no - anomaly detected - anomaly_label (bool): anomaly detected (1) or not (0) - """ torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model.to(torch_device) @@ -270,7 +195,7 @@ def infer_image( 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) input_tensor = input_tensor.to(torch_device) @@ -301,19 +226,6 @@ def anomaly_detection( data_csv: t.CsvData, sensor_images: t.SensorImages, ) -> None: - """load the model, call function for anomaly detection and store the results - - Parameters - ---------- - file_path : Path - path to file to analyse - detection_models : t.DetectionModels - collection of model paths for the left and right sensor - data_csv : t.CsvData - (list) data to save as CSV according to requirements, contains strings and ints - sensor_images : t.SensorImages - _description_ - """ file_stem = file_path.stem folder_path = file_path.parent diff --git a/src/dopt_sensor_anomalies/detection.pyi b/src/dopt_sensor_anomalies/detection.pyi new file mode 100644 index 0000000..e6d4b33 --- /dev/null +++ b/src/dopt_sensor_anomalies/detection.pyi @@ -0,0 +1,135 @@ +from pathlib import Path + +import numpy as np +import numpy.typing as npt +from anomalib.models import Patchcore + +from dopt_sensor_anomalies import types as t + +def midpoint( + pt_A: npt.NDArray[np.floating], + pt_B: npt.NDArray[np.floating], +) -> tuple[float, float]: + """to identify the midpoint of a 2D area + + Parameters + ---------- + pt_A : npt.NDArray[np.floating] + tuple of coordinates x, y; shape (2, ) + pt_B : npt.NDArray[np.floating] + tuple of coordinates x, y; shape (2, ) + + Returns + ------- + tuple[float, float] + tuple of midpoint coordinates + """ + ... + +def check_box_redundancy( + box_1: t.Box, + box_2: t.Box, + tolerance: float = 5.0, +) -> bool: + """to check if bounding box has already been identified and is just a redundant one + + Parameters + ---------- + box_1 : t.Box + tuple of box values: ((center_x, center_y), (width, height), angle) + box_2 : t.Box + tuple of box values: ((center_x, center_y), (width, height), angle) + tolerance : float, optional + distance threshold for width and height, by default 5.0 + + Returns + ------- + bool + redundancy evaluation + """ + ... + +def measure_length( + file_path: Path, + pixels_per_metric_X: float, + pixels_per_metric_Y: float, +) -> tuple[t.CsvData, t.SensorImages]: + """detect and measure the size of the electrodes + + Parameters + ---------- + file_path : Path + path to file to analyse + pixels_per_metric_X : float + scaling parameter x dimension, Pixels per micrometer in image + pixels_per_metric_Y : float + scaling parameter y dimension, Pixels per micrometer in image + + Returns + ------- + tuple[t.CsvData, t.SensorImages] + t.CsvData: (list) data to save as CSV according to requirements, contains strings and ints + t.SensorImages: (TypedDict) contains left and right image corresponding to each sensor + + Raises + ------ + errors.ImageNotReadError + image was not read successfully + errors.ContourCalculationError + during contour detection there were several possible error causes + errors.InvalidElectrodeCount + an invalid number of electrodes were detected + """ + ... + +def infer_image( + image: npt.NDArray[np.uint8], + model: Patchcore, +) -> t.InferenceResult: + """evaluate one image + + Parameters + ---------- + image : npt.NDArray[np.uint8] + represents image to be checked for anomalies + model : Patchcore + (loaded PyTorch state dictionary): model for anomaly detection + + Returns + ------- + t.InferenceResult + contains: + img (numpy.ndarray) + anomaly_map_resized (numpy.ndarray): heatmap to visualize detected anomalies + anomaly_score (float): evaluation metric, in [0, 1] with close to 0 being no + anomaly detected + anomaly_label (bool): anomaly detected (1) or not (0) + """ + ... + +def anomaly_detection( + file_path: Path, + detection_models: t.DetectionModels, + data_csv: t.CsvData, + sensor_images: t.SensorImages, +) -> None: + """load the model, call function for anomaly detection and store the results + + Parameters + ---------- + file_path : Path + path to file to analyse + detection_models : t.DetectionModels + collection of model paths for the left and right sensor + data_csv : t.CsvData + (list) data to save as CSV according to requirements, contains strings and ints + sensor_images : t.SensorImages + _description_ + """ + ... + +def pipeline( + user_file_path: str, + pixels_per_metric_X: float, + pixels_per_metric_Y: float, +) -> None: ...