diff --git a/pyproject.toml b/pyproject.toml index 9d5778a..20b9ec2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,7 @@ log_cli = true [tool.coverage.run] relative_files = true +plugins = ["Cython.Coverage"] source = [ "src/", "tests/", diff --git a/setup.py b/setup.py index 2f79c25..c35716f 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +import os + from Cython.Build import cythonize from Cython.Compiler import Options from setuptools import setup @@ -13,8 +15,14 @@ ext_modules = cythonize( "language_level": 3, "embedsignature": False, "annotation_typing": True, + "linetrace": True, }, ) +DEBUG = bool(os.getenv("DOPT_DEBUG", None)) + +if DEBUG: + ext_modules[0].define_macros.append(("CYTHON_TRACE", "1")) + setup(ext_modules=ext_modules) diff --git a/src/dopt_sensor_anomalies/detection.c b/src/dopt_sensor_anomalies/detection.c index 7ffbcf8..94092f4 100644 --- a/src/dopt_sensor_anomalies/detection.c +++ b/src/dopt_sensor_anomalies/detection.c @@ -1481,6 +1481,62 @@ static const char* const __pyx_f[] = { __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif +/* Profile_config.proto */ +#ifndef CYTHON_PROFILE +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #define CYTHON_PROFILE 0 +#else + #define CYTHON_PROFILE 1 +#endif +#endif +#ifndef CYTHON_TRACE_NOGIL + #define CYTHON_TRACE_NOGIL 0 +#else + #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE) + #define CYTHON_TRACE 1 + #endif +#endif +#ifndef CYTHON_TRACE + #define CYTHON_TRACE 0 +#endif +#if CYTHON_PROFILE || CYTHON_TRACE +#if CYTHON_USE_SYS_MONITORING + typedef enum { + __Pyx_Monitoring_PY_START = 0, + __Pyx_Monitoring_PY_RETURN, + __Pyx_Monitoring_PY_UNWIND, + __Pyx_Monitoring_LINE, + __Pyx_Monitoring_RAISE, + __Pyx_Monitoring_RERAISE, + __Pyx_Monitoring_EXCEPTION_HANDLED, + __Pyx_Monitoring_PY_RESUME, + __Pyx_Monitoring_PY_YIELD, + __Pyx_Monitoring_STOP_ITERATION, + } __Pyx_Monitoring_Event_Index; + static const unsigned char __Pyx_MonitoringEventTypes[] = { + PY_MONITORING_EVENT_PY_START, + PY_MONITORING_EVENT_PY_RETURN, + PY_MONITORING_EVENT_PY_UNWIND, + PY_MONITORING_EVENT_LINE, + PY_MONITORING_EVENT_RAISE, + PY_MONITORING_EVENT_RERAISE, + PY_MONITORING_EVENT_EXCEPTION_HANDLED, + PY_MONITORING_EVENT_PY_RESUME, + PY_MONITORING_EVENT_PY_YIELD, + PY_MONITORING_EVENT_STOP_ITERATION, + }; + #define __Pyx_MonitoringEventTypes_CyFunc_count (sizeof(__Pyx_MonitoringEventTypes) - 3) + #define __Pyx_MonitoringEventTypes_CyGen_count (sizeof(__Pyx_MonitoringEventTypes)) +#endif +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* CriticalSections.proto */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection void* @@ -1552,7 +1608,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_ * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< - * if not is_sorted: + * if not is_sorted: # pragma: no cover * raise errors.ContourCalculationError( */ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr { @@ -1950,6 +2006,432 @@ static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); +/* Profile.proto */ +#if CYTHON_TRACE + #undef CYTHON_PROFILE_REUSE_FRAME +#endif +#if CYTHON_USE_MODULE_STATE + #undef CYTHON_PROFILE_REUSE_CODEOBJ + #define CYTHON_PROFILE_REUSE_CODEOBJ 0 + #undef CYTHON_PROFILE_REUSE_FRAME +#endif +#ifndef CYTHON_PROFILE_REUSE_CODEOBJ + #define CYTHON_PROFILE_REUSE_CODEOBJ 1 +#endif +#ifndef CYTHON_PROFILE_REUSE_FRAME + #define CYTHON_PROFILE_REUSE_FRAME 0 +#endif +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + #define __PYX_MONITORING_ABI_SUFFIX "_mon" +#else + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_PROFILE || CYTHON_TRACE +#if CYTHON_USE_SYS_MONITORING + typedef uint64_t __pyx_monitoring_version_type; + #define __Pyx_TraceDeclarationsFunc\ + PyObject *__pyx_frame_code = NULL;\ + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyFunc_count];\ + int __pyx_exception_already_reported = 0;\ + const int __pyx_sys_monitoring_disabled_in_parallel = 0; CYTHON_UNUSED_VAR(__pyx_sys_monitoring_disabled_in_parallel); + #define __Pyx_TraceDeclarationsGen\ + PyObject *__pyx_frame_code = Py_NewRef(__pyx_generator->gi_code);\ + PyMonitoringState* __pyx_pymonitoring_state = __pyx_generator->__pyx_pymonitoring_state;\ + __pyx_monitoring_version_type __pyx_pymonitoring_version = __pyx_generator->__pyx_pymonitoring_version;\ + int __pyx_exception_already_reported = 0;\ + const int __pyx_sys_monitoring_disabled_in_parallel = 0; CYTHON_UNUSED_VAR(__pyx_sys_monitoring_disabled_in_parallel); + #define __Pyx_IsTracing(event_id) ((!__pyx_sys_monitoring_disabled_in_parallel) && (__pyx_pymonitoring_state[event_id]).active) + #define __Pyx_TraceFrameInit(codeobj)\ + if (codeobj) __pyx_frame_code = codeobj; + #define __Pyx_TurnOffSysMonitoringInParallel\ + const int __pyx_sys_monitoring_disabled_in_parallel = 1;\ + CYTHON_UNUSED_VAR(__pyx_sys_monitoring_disabled_in_parallel); + CYTHON_UNUSED static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno); + CYTHON_UNUSED static int __Pyx__TraceStartFunc(PyMonitoringState *state_array, PyObject *code_obj, int offset, int skip_event); + CYTHON_UNUSED static int __Pyx__TraceStartGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset); + CYTHON_UNUSED static int __Pyx__TraceResumeGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset); + CYTHON_UNUSED static void __Pyx__TraceException(PyMonitoringState *monitoring_state, PyObject *code_obj, int offset, int reraised); + #define __Pyx_PyMonitoring_ExitScope(nogil)\ + if (nogil) {\ + (void) __pyx_exception_already_reported;\ + if (CYTHON_TRACE_NOGIL) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + PyMonitoring_ExitScope();\ + Py_XDECREF(__pyx_frame_code);\ + PyGILState_Release(state);\ + }\ + } else {\ + PyMonitoring_ExitScope();\ + Py_XDECREF(__pyx_frame_code);\ + } + #define __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)\ + if ((0) ); else {\ + int ret = 0;\ + memset(__pyx_pymonitoring_state, 0, sizeof(__pyx_pymonitoring_state));\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + if (!__Pyx_PyThreadState_Current->tracing) {\ + if (likely(__pyx_frame_code)) Py_INCREF(__pyx_frame_code);\ + else __pyx_frame_code = (PyObject*) __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);\ + if (unlikely(!__pyx_frame_code)) ret = -1;\ + else ret = __Pyx__TraceStartFunc(__pyx_pymonitoring_state, __pyx_frame_code, offset, skip_event);\ + } else __pyx_frame_code = NULL;\ + PyGILState_Release(state);\ + } else __pyx_frame_code = NULL;\ + } else {\ + if (!__Pyx_PyThreadState_Current->tracing) {\ + if (likely(__pyx_frame_code)) Py_INCREF(__pyx_frame_code);\ + else __pyx_frame_code = (PyObject*) __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);\ + if (unlikely(!__pyx_frame_code)) ret = -1;\ + else ret = __Pyx__TraceStartFunc(__pyx_pymonitoring_state, __pyx_frame_code, offset, skip_event);\ + } else __pyx_frame_code = NULL;\ + }\ + if (unlikely(ret == -1)) goto_error;\ + } + #define __Pyx_TraceStartGen(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)\ + if ((0) ); else {\ + int ret = __Pyx__TraceStartGen(__pyx_pymonitoring_state, &__pyx_pymonitoring_version, __pyx_frame_code, offset);\ + if (unlikely(ret == -1)) goto_error;\ + } + #define __Pyx_TraceResumeGen(funcname, srcfile, firstlineno, offset, goto_error)\ + if ((0) ); else {\ + int ret = __Pyx__TraceResumeGen(__pyx_pymonitoring_state, &__pyx_pymonitoring_version, __pyx_frame_code, offset);\ + if (unlikely(ret == -1)) goto_error;\ + } + #define __Pyx_TraceYield(result, offset, goto_error)\ + if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_YIELD)); else {\ + int ret = PyMonitoring_FirePyYieldEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, result);\ + PyMonitoring_ExitScope();\ + if (unlikely(ret == -1)) goto_error;\ + } + #define __Pyx_TraceException(offset, reraised, fresh)\ + if (!__Pyx_IsTracing((reraised) ? __Pyx_Monitoring_RERAISE : __Pyx_Monitoring_RAISE)); else {\ + if (fresh || reraised || !__pyx_exception_already_reported) {\ + __Pyx__TraceException(&__pyx_pymonitoring_state[(reraised) ? __Pyx_Monitoring_RERAISE : __Pyx_Monitoring_RAISE], __pyx_frame_code, offset, reraised);\ + }\ + __pyx_exception_already_reported = 1;\ + } + #define __Pyx_TraceExceptionDone() __pyx_exception_already_reported = 0 + #define __Pyx_TraceExceptionHandled(offset)\ + if (!__Pyx_IsTracing(__Pyx_Monitoring_EXCEPTION_HANDLED)); else {\ + (void) PyMonitoring_FireExceptionHandledEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_EXCEPTION_HANDLED], __pyx_frame_code, offset);\ + __pyx_exception_already_reported = 0;\ + } + #define __Pyx_TraceReturnValue(result, offset, nogil, goto_error)\ + if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_RETURN)); else {\ + int ret = 0;\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, result);\ + PyGILState_Release(state);\ + }\ + } else {\ + ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, result);\ + }\ + if (unlikely(ret == -1)) goto_error;\ + } + #define __Pyx_TraceReturnCValue(cresult, convert_function, offset, nogil, goto_error)\ + if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_RETURN)); else {\ + int ret = 0;\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + PyObject *pyvalue = convert_function(cresult);\ + if (unlikely(!pyvalue)) {\ + PyErr_Clear();\ + pyvalue = Py_None; Py_INCREF(Py_None);\ + }\ + ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, pyvalue);\ + Py_DECREF(pyvalue);\ + PyGILState_Release(state);\ + }\ + } else {\ + PyObject *pyvalue = convert_function(cresult);\ + if (unlikely(!pyvalue)) {\ + PyErr_Clear();\ + pyvalue = Py_None; Py_INCREF(Py_None);\ + }\ + ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, pyvalue);\ + Py_DECREF(pyvalue);\ + }\ + if (unlikely(ret == -1)) goto_error;\ + } + #define __Pyx_TraceExceptionUnwind(offset, nogil)\ + if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_UNWIND)); else {\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + (void) PyMonitoring_FirePyUnwindEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_UNWIND], __pyx_frame_code, offset);\ + PyGILState_Release(state);\ + }\ + } else {\ + (void) PyMonitoring_FirePyUnwindEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_UNWIND], __pyx_frame_code, offset);\ + }\ + } + #if CYTHON_TRACE + CYTHON_UNUSED static int __Pyx__TraceLine(PyMonitoringState *monitoring_state, PyObject *code_obj, int line, int offset); + #define __Pyx_TraceLine(line, offset, nogil, goto_error)\ + if (!__Pyx_IsTracing(__Pyx_Monitoring_LINE)); else {\ + int ret = 0;\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + ret = __Pyx__TraceLine(&__pyx_pymonitoring_state[__Pyx_Monitoring_LINE], __pyx_frame_code, line, offset);\ + PyGILState_Release(state);\ + }\ + } else {\ + ret = __Pyx__TraceLine(&__pyx_pymonitoring_state[__Pyx_Monitoring_LINE], __pyx_frame_code, line, offset);\ + }\ + if (unlikely(ret == -1)) goto_error;\ + } + #endif +#else + #include "compile.h" + #include "frameobject.h" + #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #if CYTHON_PROFILE_REUSE_FRAME + #define CYTHON_FRAME_MODIFIER static + #define CYTHON_FRAME_DEL(frame) + #else + #define CYTHON_FRAME_MODIFIER + #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame) + #endif + #if CYTHON_PROFILE_REUSE_CODEOBJ + #define CYTHON_CODEOBJ_MODIFIER static + #else + #define CYTHON_CODEOBJ_MODIFIER + #endif + #define __Pyx_TraceDeclarationsFunc\ + CYTHON_CODEOBJ_MODIFIER PyCodeObject *__pyx_frame_code = NULL;\ + CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\ + int __Pyx_use_tracing = 0; + #define __Pyx_TraceDeclarationsGen\ + PyObject *__pyx_frame_code = __pyx_generator->gi_code;\ + CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\ + int __Pyx_use_tracing = 0; + #define __Pyx_TraceFrameInit(codeobj)\ + if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj; + #define __Pyx_PyMonitoring_ExitScope(nogil)\ + if (!CYTHON_PROFILE_REUSE_FRAME && nogil) {\ + PyGILState_STATE state = PyGILState_Ensure();\ + CYTHON_FRAME_DEL(__pyx_frame);\ + PyGILState_Release(state);\ + } else {\ + CYTHON_FRAME_DEL(__pyx_frame);\ + } + #define __Pyx_TraceException(offset, reraised, fresh) {} + #define __Pyx_TraceExceptionHandled(offset) {} + #define __Pyx_TraceExceptionDone() {} + #define __Pyx_TurnOffSysMonitoringInParallel {} // Only needed for freethreading +#if PY_VERSION_HEX >= 0x030b00a2 + #if PY_VERSION_HEX >= 0x030C00b1 + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\ + ((!(check_tracing) || !(tstate)->tracing) &&\ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) + #else + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\ + (unlikely((tstate)->cframe->use_tracing) &&\ + (!(check_tracing) || !(tstate)->tracing) &&\ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) + #endif + #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate) + #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate) +#elif PY_VERSION_HEX >= 0x030a00b1 + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\ + (unlikely((tstate)->cframe->use_tracing) &&\ + (!(check_tracing) || !(tstate)->tracing) &&\ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) + #define __Pyx_EnterTracing(tstate)\ + do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0) + #define __Pyx_LeaveTracing(tstate)\ + do {\ + tstate->tracing--;\ + tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\ + || tstate->c_profilefunc != NULL);\ + } while (0) +#else + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\ + (unlikely((tstate)->use_tracing) &&\ + (!(check_tracing) || !(tstate)->tracing) &&\ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) + #define __Pyx_EnterTracing(tstate)\ + do { tstate->tracing++; tstate->use_tracing = 0; } while (0) + #define __Pyx_LeaveTracing(tstate)\ + do {\ + tstate->tracing--;\ + tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\ + || tstate->c_profilefunc != NULL);\ + } while (0) +#endif + #define __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyThreadState *tstate;\ + PyGILState_STATE state = PyGILState_Ensure();\ + tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 1, 1)) {\ + __Pyx_use_tracing = __Pyx_TraceSetupAndCall((PyCodeObject**)&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno, skip_event);\ + }\ + PyGILState_Release(state);\ + if (unlikely(__Pyx_use_tracing < 0)) goto_error;\ + }\ + } else {\ + PyThreadState* tstate = PyThreadState_GET();\ + if (__Pyx_IsTracing(tstate, 1, 1)) {\ + __Pyx_use_tracing = __Pyx_TraceSetupAndCall((PyCodeObject**)&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno, skip_event);\ + if (unlikely(__Pyx_use_tracing < 0)) goto_error;\ + }\ + } + #define __Pyx_TraceStartGen __Pyx_TraceStartFunc + #define __Pyx_TraceYield(result, offset, goto_error)\ + if (likely(!__Pyx_use_tracing)); else {\ + PyThreadState* tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\ + }\ + if ((1)); else goto_error;\ + } + #define __Pyx_TraceResumeGen(funcname, srcfile, firstlineno, offset, goto_error)\ + __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, 0, 0, goto_error) + CYTHON_UNUSED static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) { + PyObject *type, *value, *traceback; + __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); + __Pyx_EnterTracing(tstate); + if (CYTHON_TRACE && tstate->c_tracefunc) + tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result); + if (tstate->c_profilefunc) + tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result); + __Pyx_LeaveTracing(tstate); + __Pyx_ErrRestoreInState(tstate, type, value, traceback); + } + #define __Pyx_TraceReturnValue(result, offset, nogil, goto_error)\ + if (likely(!__Pyx_use_tracing)); else {\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyThreadState *tstate;\ + PyGILState_STATE state = PyGILState_Ensure();\ + tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\ + }\ + PyGILState_Release(state);\ + }\ + } else {\ + PyThreadState* tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\ + }\ + }\ + if ((1)); else goto_error;\ + } + #define __Pyx_TraceReturnCValue(cresult, convert_function, offset, nogil, goto_error)\ + if (likely(!__Pyx_use_tracing)); else {\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyThreadState *tstate;\ + PyGILState_STATE state = PyGILState_Ensure();\ + tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + PyObject *pyvalue = convert_function(cresult);\ + if (unlikely(!pyvalue)) {\ + PyErr_Clear();\ + pyvalue = Py_None; Py_INCREF(Py_None);\ + }\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, pyvalue);\ + Py_DECREF(pyvalue);\ + }\ + PyGILState_Release(state);\ + }\ + } else {\ + PyThreadState* tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + PyObject *pyvalue = convert_function(cresult);\ + if (unlikely(!pyvalue)) {\ + PyErr_Clear();\ + pyvalue = Py_None; Py_INCREF(Py_None);\ + }\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, pyvalue);\ + Py_DECREF(pyvalue);\ + }\ + }\ + if ((1)); else goto_error;\ + } + #define __Pyx_TraceExceptionUnwind(offset, nogil)\ + if (likely(!__Pyx_use_tracing)); else {\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyThreadState *tstate;\ + PyGILState_STATE state = PyGILState_Ensure();\ + tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, Py_None);\ + }\ + PyGILState_Release(state);\ + }\ + } else {\ + PyThreadState* tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0)) {\ + __Pyx_call_return_trace_func(tstate, __pyx_frame, Py_None);\ + }\ + }\ + } + static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno, int skip_event); +#if CYTHON_TRACE + CYTHON_UNUSED static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int line); + #define __Pyx_TraceLine(line, offset, nogil, goto_error)\ + if (likely(!__Pyx_use_tracing)); else {\ + int ret = 0;\ + if (nogil) {\ + if (CYTHON_TRACE_NOGIL) {\ + PyThreadState *tstate;\ + PyGILState_STATE state = __Pyx_PyGILState_Ensure();\ + tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\ + ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, line);\ + }\ + __Pyx_PyGILState_Release(state);\ + }\ + } else {\ + PyThreadState* tstate = __Pyx_PyThreadState_Current;\ + if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\ + ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, line);\ + }\ + }\ + if (unlikely(ret)) goto_error;\ + } +#endif +#endif +#else + #define __Pyx_TraceDeclarationsFunc + #define __Pyx_TraceDeclarationsGen + #define __Pyx_TraceExceptionDone() {} + #define __Pyx_TraceFrameInit(codeobj) {} + #define __Pyx_TurnOffSysMonitoringInParallel {} + #define __Pyx_PyMonitoring_ExitScope(nogil) {} + #define __Pyx_TraceException(offset, reraised, fresh) {} + #define __Pyx_TraceExceptionUnwind(offset, nogil) {} + #define __Pyx_TraceExceptionHandled(offset) {} + #define __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error) if ((1)); else goto_error; + #define __Pyx_TraceStartGen __Pyx_TraceStartFunc + #define __Pyx_TraceResumeGen(funcname, srcfile, firstlineno, offset, goto_error) if ((1)); else goto_error; + #define __Pyx_TraceYield(result, offset, goto_error) if ((1)); else goto_error; + #define __Pyx_TraceReturnValue(result, offset, nogil, goto_error)\ + if ((1)); else goto_error; + #define __Pyx_TraceReturnCValue(cresult, convert_function, offset, nogil, goto_error)\ + if ((1)); else { (void) convert_function; goto_error } +#endif +#if !CYTHON_TRACE + #define __Pyx_TraceLine(line, offset, nogil, goto_error) if ((1)); else goto_error; +#endif + /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -2739,9 +3221,9 @@ static const char __pyx_k__2[] = "."; static const char __pyx_k__3[] = ","; static const char __pyx_k__4[] = ";"; static const char __pyx_k__5[] = "?"; -static const char __pyx_k__6[] = "\230!"; -static const char __pyx_k__7[] = "\240\001"; -static const char __pyx_k__8[] = "_"; +static const char __pyx_k__6[] = "_"; +static const char __pyx_k__7[] = "\230!"; +static const char __pyx_k__8[] = "\240\001"; static const char __pyx_k_ax[] = "ax"; static const char __pyx_k_bl[] = "bl"; static const char __pyx_k_br[] = "br"; @@ -3265,7 +3747,7 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u__3 __pyx_string_tab[46] #define __pyx_kp_u__4 __pyx_string_tab[47] #define __pyx_kp_u__5 __pyx_string_tab[48] -#define __pyx_n_u__8 __pyx_string_tab[49] +#define __pyx_n_u__6 __pyx_string_tab[49] #define __pyx_n_u_accepted_boxes __pyx_string_tab[50] #define __pyx_kp_u_add_note __pyx_string_tab[51] #define __pyx_n_u_all __pyx_string_tab[52] @@ -3742,6 +4224,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt_A, PyObject *__pyx_v_pt_B) { PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsFunc __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -3750,7 +4233,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])) __Pyx_RefNannySetupContext("midpoint", 0); + __Pyx_TraceStartFunc("midpoint", __pyx_f[0], 32, 0, 0, 0, __PYX_ERR(0, 32, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":36 * pt_B: npt.NDArray[np.floating], @@ -3759,6 +4244,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU * * */ + __Pyx_TraceLine(36,4,0,__PYX_ERR(0, 36, __pyx_L1_error)) __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, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -3792,6 +4278,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; + __Pyx_TraceReturnValue(__pyx_r, 4, 0, __PYX_ERR(0, 36, __pyx_L1_error)); goto __pyx_L0; /* "dopt_sensor_anomalies/detection.py":32 @@ -3808,10 +4295,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_TraceException(__pyx_lineno, 0, 0); + #if CYTHON_USE_SYS_MONITORING + __Pyx_TraceExceptionUnwind(0, 0); + #else + __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 32, __pyx_L1_error)); + #endif __Pyx_AddTraceback("dopt_sensor_anomalies.detection.midpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3943,6 +4437,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan PyObject *__pyx_v_center_dist = NULL; PyObject *__pyx_v_size_diff = NULL; PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsFunc __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -3962,7 +4457,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])) __Pyx_RefNannySetupContext("check_box_redundancy", 0); + __Pyx_TraceStartFunc("check_box_redundancy", __pyx_f[0], 39, 0, 0, 0, __PYX_ERR(0, 39, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":44 * tolerance: float = 5.0, @@ -3971,6 +4468,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * c2, s2, _ = box_2 * s1 = sorted(s1) */ + __Pyx_TraceLine(44,9,0,__PYX_ERR(0, 44, __pyx_L1_error)) if ((likely(PyTuple_CheckExact(__pyx_v_box_1))) || (PyList_CheckExact(__pyx_v_box_1))) { PyObject* sequence = __pyx_v_box_1; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); @@ -4042,6 +4540,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * s1 = sorted(s1) * s2 = sorted(s2) */ + __Pyx_TraceLine(45,13,0,__PYX_ERR(0, 45, __pyx_L1_error)) if ((likely(PyTuple_CheckExact(__pyx_v_box_2))) || (PyList_CheckExact(__pyx_v_box_2))) { PyObject* sequence = __pyx_v_box_2; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); @@ -4113,6 +4612,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * s2 = sorted(s2) * */ + __Pyx_TraceLine(46,15,0,__PYX_ERR(0, 46, __pyx_L1_error)) __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 46, __pyx_L1_error) @@ -4126,6 +4626,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) */ + __Pyx_TraceLine(47,18,0,__PYX_ERR(0, 47, __pyx_L1_error)) __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 47, __pyx_L1_error) @@ -4139,6 +4640,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) * */ + __Pyx_TraceLine(49,22,0,__PYX_ERR(0, 49, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -4246,6 +4748,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * * return bool(center_dist < tolerance and size_diff < tolerance) */ + __Pyx_TraceLine(50,39,0,__PYX_ERR(0, 50, __pyx_L1_error)) __pyx_t_3 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -4353,6 +4856,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * * */ + __Pyx_TraceLine(52,54,0,__PYX_ERR(0, 52, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -4377,6 +4881,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; + __Pyx_TraceReturnValue(__pyx_r, 54, 0, __PYX_ERR(0, 52, __pyx_L1_error)); goto __pyx_L0; /* "dopt_sensor_anomalies/detection.py":39 @@ -4400,6 +4905,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_13); + __Pyx_TraceException(__pyx_lineno, 0, 0); + #if CYTHON_USE_SYS_MONITORING + __Pyx_TraceExceptionUnwind(0, 0); + #else + __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 39, __pyx_L1_error)); + #endif __Pyx_AddTraceback("dopt_sensor_anomalies.detection.check_box_redundancy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4411,6 +4922,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_v_center_dist); __Pyx_XDECREF(__pyx_v_size_diff); __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4529,7 +5041,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< - * if not is_sorted: + * if not is_sorted: # pragma: no cover * raise errors.ContourCalculationError( */ @@ -4553,7 +5065,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_ge __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[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, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4573,6 +5085,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsGen PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *(*__pyx_t_3)(PyObject *); @@ -4590,10 +5103,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L8_resume_from_yield; default: /* CPython raises the right error here */ + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 84, 0, 0, 0, __PYX_ERR(0, 84, __pyx_L1_error)); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 84, __pyx_L1_error)); __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 84, 0, 0, 0, __PYX_ERR(0, 84, __pyx_L1_error)); if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); __PYX_ERR(0, 84, __pyx_L1_error) @@ -4706,6 +5222,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_TraceLine(84,0,0,__PYX_ERR(0, 84, __pyx_L1_error)) __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_x2, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -4713,6 +5230,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 84, __pyx_L1_error)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); @@ -4720,6 +5238,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L8_resume_from_yield:; + __Pyx_TraceResumeGen("genexpr", __pyx_f[0], 84, 0, __PYX_ERR(0, 84, __pyx_L1_error)); __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -4729,6 +5248,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 84, __pyx_L1_error)); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -4740,11 +5260,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); if (__Pyx_PyErr_Occurred()) { + __Pyx_TraceException(__pyx_lineno, 0, 0); __Pyx_Generator_Replace_StopIteration(0); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionUnwind(0, 0); } __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif @@ -4786,7 +5309,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[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, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4806,6 +5329,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsGen PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; @@ -4821,10 +5345,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; default: /* CPython raises the right error here */ + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 112, 0, 0, 0, __PYX_ERR(0, 112, __pyx_L1_error)); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 112, __pyx_L1_error)); __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 112, 0, 0, 0, __PYX_ERR(0, 112, __pyx_L1_error)); if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 112, __pyx_L1_error) if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 112, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); @@ -4845,6 +5372,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_existing, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_TraceLine(112,0,0,__PYX_ERR(0, 112, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_check_box_redundancy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -4880,6 +5408,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) */ + __Pyx_TraceLine(111,233,0,__PYX_ERR(0, 111, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); /* "dopt_sensor_anomalies/detection.py":112 @@ -4889,8 +5418,10 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g * ) * if is_duplicate: */ + __Pyx_TraceLine(112,0,0,__PYX_ERR(0, 112, __pyx_L1_error)) __Pyx_INCREF(Py_True); __pyx_r = Py_True; + __Pyx_TraceReturnValue(__pyx_r, 233, 0, __PYX_ERR(0, 111, __pyx_L1_error)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } @@ -4905,6 +5436,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) */ + __Pyx_TraceLine(111,233,0,__PYX_ERR(0, 111, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); /* "dopt_sensor_anomalies/detection.py":112 @@ -4914,11 +5446,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g * ) * if is_duplicate: */ + __Pyx_TraceLine(112,0,0,__PYX_ERR(0, 112, __pyx_L1_error)) __Pyx_INCREF(Py_False); __pyx_r = Py_False; + __Pyx_TraceReturnValue(__pyx_r, 233, 0, __PYX_ERR(0, 111, __pyx_L1_error)); goto __pyx_L0; } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 112, __pyx_L1_error)); /* function exit code */ goto __pyx_L0; @@ -4928,11 +5463,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); if (__Pyx_PyErr_Occurred()) { + __Pyx_TraceException(__pyx_lineno, 0, 0); __Pyx_Generator_Replace_StopIteration(0); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionUnwind(0, 0); } __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif @@ -4971,7 +5509,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[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, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4991,6 +5529,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsGen PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; @@ -5007,10 +5546,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 143, 0, 0, 0, __PYX_ERR(0, 143, __pyx_L1_error)); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 143, __pyx_L1_error)); __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 143, 0, 0, 0, __PYX_ERR(0, 143, __pyx_L1_error)); if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); __PYX_ERR(0, 143, __pyx_L1_error) @@ -5034,6 +5576,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_TraceLine(143,0,0,__PYX_ERR(0, 143, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -5068,6 +5611,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __Pyx_XGIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 143, __pyx_L1_error)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); @@ -5075,6 +5619,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; + __Pyx_TraceResumeGen("genexpr", __pyx_f[0], 143, 0, __PYX_ERR(0, 143, __pyx_L1_error)); __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -5083,6 +5628,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 143, __pyx_L1_error)); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -5094,11 +5640,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); if (__Pyx_PyErr_Occurred()) { + __Pyx_TraceException(__pyx_lineno, 0, 0); __Pyx_Generator_Replace_StopIteration(0); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionUnwind(0, 0); } __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif @@ -5137,7 +5686,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[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, 144, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5157,6 +5706,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsGen PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; @@ -5173,10 +5723,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 144, 0, 0, 0, __PYX_ERR(0, 144, __pyx_L1_error)); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 144, __pyx_L1_error)); __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 144, 0, 0, 0, __PYX_ERR(0, 144, __pyx_L1_error)); if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); __PYX_ERR(0, 144, __pyx_L1_error) @@ -5200,6 +5753,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_TraceLine(144,0,0,__PYX_ERR(0, 144, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -5234,6 +5788,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __Pyx_XGIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 144, __pyx_L1_error)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); @@ -5241,6 +5796,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; + __Pyx_TraceResumeGen("genexpr", __pyx_f[0], 144, 0, __PYX_ERR(0, 144, __pyx_L1_error)); __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -5249,6 +5805,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 144, __pyx_L1_error)); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -5260,11 +5817,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); if (__Pyx_PyErr_Occurred()) { + __Pyx_TraceException(__pyx_lineno, 0, 0); __Pyx_Generator_Replace_StopIteration(0); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionUnwind(0, 0); } __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif @@ -5303,7 +5863,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12 __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5323,6 +5883,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsGen PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; @@ -5339,10 +5900,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 145, 0, 0, 0, __PYX_ERR(0, 145, __pyx_L1_error)); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 145, __pyx_L1_error)); __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 145, 0, 0, 0, __PYX_ERR(0, 145, __pyx_L1_error)); if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); __PYX_ERR(0, 145, __pyx_L1_error) @@ -5366,6 +5930,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_TraceLine(145,0,0,__PYX_ERR(0, 145, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -5400,6 +5965,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __Pyx_XGIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 145, __pyx_L1_error)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); @@ -5407,6 +5973,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; + __Pyx_TraceResumeGen("genexpr", __pyx_f[0], 145, 0, __PYX_ERR(0, 145, __pyx_L1_error)); __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -5415,6 +5982,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 145, __pyx_L1_error)); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -5426,11 +5994,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); if (__Pyx_PyErr_Occurred()) { + __Pyx_TraceException(__pyx_lineno, 0, 0); __Pyx_Generator_Replace_StopIteration(0); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionUnwind(0, 0); } __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif @@ -5469,7 +6040,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15 __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5489,6 +6060,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 { struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsGen PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; @@ -5505,10 +6077,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 146, 0, 0, 0, __PYX_ERR(0, 146, __pyx_L1_error)); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 146, __pyx_L1_error)); __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; + __Pyx_TraceStartGen("genexpr", __pyx_f[0], 146, 0, 0, 0, __PYX_ERR(0, 146, __pyx_L1_error)); if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); __PYX_ERR(0, 146, __pyx_L1_error) @@ -5532,6 +6107,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_TraceLine(146,0,0,__PYX_ERR(0, 146, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -5566,6 +6142,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __Pyx_XGIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 146, __pyx_L1_error)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); @@ -5573,6 +6150,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; + __Pyx_TraceResumeGen("genexpr", __pyx_f[0], 146, 0, __PYX_ERR(0, 146, __pyx_L1_error)); __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -5581,6 +6159,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 146, __pyx_L1_error)); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -5592,11 +6171,14 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); if (__Pyx_PyErr_Occurred()) { + __Pyx_TraceException(__pyx_lineno, 0, 0); __Pyx_Generator_Replace_StopIteration(0); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionUnwind(0, 0); } __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif @@ -5668,6 +6250,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4 = 0; PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5 = 0; PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsFunc __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -5692,6 +6275,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])) __Pyx_RefNannySetupContext("measure_length", 0); __pyx_cur_scope = (struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length *)__pyx_tp_new_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length(__pyx_mstate_global->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length, __pyx_mstate_global->__pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { @@ -5701,14 +6285,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } + __Pyx_TraceStartFunc("measure_length", __pyx_f[0], 55, 0, 0, 0, __PYX_ERR(0, 55, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":60 * pixels_per_metric_Y: float, * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] # <<<<<<<<<<<<<< * image = cv2.imread(str(img_path)) - * if image is None: + * if image is None: # pragma: no cover */ + __Pyx_TraceLine(60,6,0,__PYX_ERR(0, 60, __pyx_L1_error)) __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_data_csv = ((PyObject*)__pyx_t_1); @@ -5718,9 +6304,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] * image = cv2.imread(str(img_path)) # <<<<<<<<<<<<<< - * if image is None: + * if image is None: # pragma: no cover * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") */ + __Pyx_TraceLine(61,10,0,__PYX_ERR(0, 61, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -5756,20 +6343,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":62 * data_csv: list[str | int] = [] * image = cv2.imread(str(img_path)) - * if image is None: # <<<<<<<<<<<<<< + * if image is None: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * */ + __Pyx_TraceLine(62,17,0,__PYX_ERR(0, 62, __pyx_L1_error)) __pyx_t_6 = (__pyx_v_image == Py_None); if (unlikely(__pyx_t_6)) { /* "dopt_sensor_anomalies/detection.py":63 * image = cv2.imread(str(img_path)) - * if image is None: + * if image is None: # pragma: no cover * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") # <<<<<<<<<<<<<< * * cropped = image[500:1500, 100 : image.shape[1] - 100] */ + __Pyx_TraceLine(63,21,0,__PYX_ERR(0, 63, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -5813,7 +6402,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":62 * data_csv: list[str | int] = [] * image = cv2.imread(str(img_path)) - * if image is None: # <<<<<<<<<<<<<< + * if image is None: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * */ @@ -5826,6 +6415,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * orig = cropped.copy() * */ + __Pyx_TraceLine(65,32,0,__PYX_ERR(0, 65, __pyx_L1_error)) __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __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, 65, __pyx_L1_error) @@ -5858,6 +6448,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) */ + __Pyx_TraceLine(66,38,0,__PYX_ERR(0, 66, __pyx_L1_error)) __pyx_t_1 = __pyx_v_cropped; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; @@ -5878,6 +6469,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) * */ + __Pyx_TraceLine(68,44,0,__PYX_ERR(0, 68, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -5920,6 +6512,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) */ + __Pyx_TraceLine(69,52,0,__PYX_ERR(0, 69, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -6020,6 +6613,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) */ + __Pyx_TraceLine(71,62,0,__PYX_ERR(0, 71, __pyx_L1_error)) __pyx_t_9 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -6062,6 +6656,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * edged = cv2.Canny(closed, 50, 100) * */ + __Pyx_TraceLine(72,70,0,__PYX_ERR(0, 72, __pyx_L1_error)) __pyx_t_8 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -6104,6 +6699,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) */ + __Pyx_TraceLine(73,78,0,__PYX_ERR(0, 73, __pyx_L1_error)) __pyx_t_9 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -6138,8 +6734,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) # <<<<<<<<<<<<<< * cnts = imutils.grab_contours(cnts) - * if cnts is None: + * if cnts is None: # pragma: no cover */ + __Pyx_TraceLine(75,85,0,__PYX_ERR(0, 75, __pyx_L1_error)) __pyx_t_8 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -6196,9 +6793,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) # <<<<<<<<<<<<<< - * if cnts is None: + * if cnts is None: # pragma: no cover * raise errors.ContourCalculationError( */ + __Pyx_TraceLine(76,96,0,__PYX_ERR(0, 76, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_imutils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); @@ -6231,20 +6829,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":77 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) - * if cnts is None: # <<<<<<<<<<<<<< + * if cnts is None: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "No contours were found in the provided image. Can not continue analysis." */ + __Pyx_TraceLine(77,101,0,__PYX_ERR(0, 77, __pyx_L1_error)) __pyx_t_6 = (__pyx_v_cnts == Py_None); if (unlikely(__pyx_t_6)) { /* "dopt_sensor_anomalies/detection.py":78 * cnts = imutils.grab_contours(cnts) - * if cnts is None: + * if cnts is None: # pragma: no cover * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< * "No contours were found in the provided image. Can not continue analysis." * ) */ + __Pyx_TraceLine(78,105,0,__PYX_ERR(0, 78, __pyx_L1_error)) __pyx_t_3 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -6278,7 +6878,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":77 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) - * if cnts is None: # <<<<<<<<<<<<<< + * if cnts is None: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "No contours were found in the provided image. Can not continue analysis." */ @@ -6291,6 +6891,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore */ + __Pyx_TraceLine(82,111,0,__PYX_ERR(0, 82, __pyx_L1_error)) __pyx_t_11 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -6377,8 +6978,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] # <<<<<<<<<<<<<< * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore - * if not is_sorted: + * if not is_sorted: # pragma: no cover */ + __Pyx_TraceLine(83,114,0,__PYX_ERR(0, 83, __pyx_L1_error)) { /* enter inner scope */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_2); @@ -6433,6 +7035,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_c, __pyx_t_1); __pyx_t_1 = 0; + __Pyx_TraceLine(83,121,0,__PYX_ERR(0, 83, __pyx_L11_error)) __pyx_t_3 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); @@ -6480,9 +7083,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< - * if not is_sorted: + * if not is_sorted: # pragma: no cover * raise errors.ContourCalculationError( */ + __Pyx_TraceLine(84,127,0,__PYX_ERR(0, 84, __pyx_L1_error)) __pyx_t_11 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -6534,21 +7138,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":85 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore - * if not is_sorted: # <<<<<<<<<<<<<< + * if not is_sorted: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "Contour detection not valid: contours are not " */ + __Pyx_TraceLine(85,131,0,__PYX_ERR(0, 85, __pyx_L1_error)) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_sorted); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 85, __pyx_L1_error) __pyx_t_14 = (!__pyx_t_6); if (unlikely(__pyx_t_14)) { /* "dopt_sensor_anomalies/detection.py":86 * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore - * if not is_sorted: + * if not is_sorted: # pragma: no cover * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< * "Contour detection not valid: contours are not " * "properly sorted from left to right." */ + __Pyx_TraceLine(86,135,0,__PYX_ERR(0, 86, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -6582,7 +7188,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":85 * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore - * if not is_sorted: # <<<<<<<<<<<<<< + * if not is_sorted: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "Contour detection not valid: contours are not " */ @@ -6595,6 +7201,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * filtered_cnts: list[Any] = [] * */ + __Pyx_TraceLine(90,138,0,__PYX_ERR(0, 90, __pyx_L1_error)) __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_accepted_boxes = ((PyObject*)__pyx_t_2); @@ -6607,6 +7214,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * for c in cnts: */ + __Pyx_TraceLine(91,140,0,__PYX_ERR(0, 91, __pyx_L1_error)) __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_filtered_cnts = ((PyObject*)__pyx_t_2); @@ -6619,6 +7227,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * rbox = cast(t.Box, cv2.minAreaRect(c)) * box = cv2.boxPoints(rbox) */ + __Pyx_TraceLine(93,143,0,__PYX_ERR(0, 93, __pyx_L1_error)) if (likely(PyList_CheckExact(__pyx_v_cnts)) || PyTuple_CheckExact(__pyx_v_cnts)) { __pyx_t_2 = __pyx_v_cnts; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0; @@ -6670,6 +7279,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_11); __pyx_t_11 = 0; + __Pyx_TraceLine(93,141,0,__PYX_ERR(0, 93, __pyx_L1_error)) /* "dopt_sensor_anomalies/detection.py":94 * @@ -6678,6 +7288,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) */ + __Pyx_TraceLine(94,146,0,__PYX_ERR(0, 94, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -6746,6 +7357,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * box = np.array(box, dtype=np.int32) * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) */ + __Pyx_TraceLine(95,156,0,__PYX_ERR(0, 95, __pyx_L1_error)) __pyx_t_9 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -6782,6 +7394,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) * */ + __Pyx_TraceLine(96,161,0,__PYX_ERR(0, 96, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -6828,6 +7441,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * (tl, tr, br, bl) = box */ + __Pyx_TraceLine(97,168,0,__PYX_ERR(0, 97, __pyx_L1_error)) __pyx_t_8 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -6903,6 +7517,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * (tltrX, tltrY) = midpoint(tl, tr) * (blbrX, blbrY) = midpoint(bl, br) */ + __Pyx_TraceLine(99,182,0,__PYX_ERR(0, 99, __pyx_L1_error)) if ((likely(PyTuple_CheckExact(__pyx_v_box))) || (PyList_CheckExact(__pyx_v_box))) { PyObject* sequence = __pyx_v_box; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); @@ -6984,6 +7599,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * (blbrX, blbrY) = midpoint(bl, br) * (tlblX, tlblY) = midpoint(tl, bl) */ + __Pyx_TraceLine(100,186,0,__PYX_ERR(0, 100, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -7069,6 +7685,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * (tlblX, tlblY) = midpoint(tl, bl) * (trbrX, trbrY) = midpoint(tr, br) */ + __Pyx_TraceLine(101,192,0,__PYX_ERR(0, 101, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -7154,6 +7771,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * (trbrX, trbrY) = midpoint(tr, br) * */ + __Pyx_TraceLine(102,198,0,__PYX_ERR(0, 102, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -7239,6 +7857,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) */ + __Pyx_TraceLine(103,204,0,__PYX_ERR(0, 103, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -7324,6 +7943,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) * */ + __Pyx_TraceLine(105,210,0,__PYX_ERR(0, 105, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); @@ -7378,6 +7998,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * if dA < 100 or dB < 100: */ + __Pyx_TraceLine(106,218,0,__PYX_ERR(0, 106, __pyx_L1_error)) __pyx_t_11 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -7432,6 +8053,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * continue * */ + __Pyx_TraceLine(108,224,0,__PYX_ERR(0, 108, __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, 108, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7454,6 +8076,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * is_duplicate = any( */ + __Pyx_TraceLine(109,231,0,__PYX_ERR(0, 109, __pyx_L1_error)) goto __pyx_L17_continue; /* "dopt_sensor_anomalies/detection.py":108 @@ -7472,6 +8095,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) * if is_duplicate: */ + __Pyx_TraceLine(112,234,0,__PYX_ERR(0, 112, __pyx_L1_error)) __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_accepted_boxes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error) @@ -7487,6 +8111,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * continue * */ + __Pyx_TraceLine(114,236,0,__PYX_ERR(0, 114, __pyx_L1_error)) __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 114, __pyx_L1_error) if (__pyx_t_14) { @@ -7497,6 +8122,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * accepted_boxes.append(rbox) */ + __Pyx_TraceLine(115,237,0,__PYX_ERR(0, 115, __pyx_L1_error)) goto __pyx_L17_continue; /* "dopt_sensor_anomalies/detection.py":114 @@ -7515,6 +8141,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * filtered_cnts.append(c) * */ + __Pyx_TraceLine(117,241,0,__PYX_ERR(0, 117, __pyx_L1_error)) __pyx_t_9 = __pyx_cur_scope->__pyx_v_rbox; __Pyx_INCREF(__pyx_t_9); __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_accepted_boxes, __pyx_t_9); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 117, __pyx_L1_error) @@ -7527,6 +8154,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * dimA = dA / pixels_per_metric_Y */ + __Pyx_TraceLine(118,244,0,__PYX_ERR(0, 118, __pyx_L1_error)) __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_filtered_cnts, __pyx_v_c); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 118, __pyx_L1_error) /* "dopt_sensor_anomalies/detection.py":120 @@ -7536,6 +8164,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * dimB = dB / pixels_per_metric_X * */ + __Pyx_TraceLine(120,249,0,__PYX_ERR(0, 120, __pyx_L1_error)) __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) @@ -7551,6 +8180,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * data_csv.extend( */ + __Pyx_TraceLine(121,253,0,__PYX_ERR(0, 121, __pyx_L1_error)) __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_v_dB, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) @@ -7566,6 +8196,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * f"{dimA:.3f}".replace(".", ","), * f"{dimA * dimB:.1f}".replace(".", ","), */ + __Pyx_TraceLine(125,258,0,__PYX_ERR(0, 125, __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, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) @@ -7579,6 +8210,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * f"{dimA * dimB:.1f}".replace(".", ","), * ] */ + __Pyx_TraceLine(126,264,0,__PYX_ERR(0, 126, __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, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_16 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 126, __pyx_L1_error) @@ -7592,6 +8224,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ] * ) */ + __Pyx_TraceLine(127,272,0,__PYX_ERR(0, 127, __pyx_L1_error)) __pyx_t_9 = PyNumber_Multiply(__pyx_v_dimA, __pyx_v_dimB); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error) @@ -7608,6 +8241,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * [ * f"{dimB:.3f}".replace(".", ","), */ + __Pyx_TraceLine(123,256,0,__PYX_ERR(0, 123, __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, 123, __pyx_L1_error) __pyx_t_18 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_16); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_data_csv, __pyx_t_9); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) @@ -7623,6 +8257,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * rbox = cast(t.Box, cv2.minAreaRect(c)) * box = cv2.boxPoints(rbox) */ + __Pyx_TraceLine(93,141,0,__PYX_ERR(0, 93, __pyx_L1_error)) __pyx_L17_continue:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7630,10 +8265,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":131 * ) * - * if not filtered_cnts: # <<<<<<<<<<<<<< + * if not filtered_cnts: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "Contour detection not valid: no contours recognized" */ + __Pyx_TraceLine(131,280,0,__PYX_ERR(0, 131, __pyx_L1_error)) { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 131, __pyx_L1_error) @@ -7645,11 +8281,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":132 * - * if not filtered_cnts: + * if not filtered_cnts: # pragma: no cover * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< * "Contour detection not valid: no contours recognized" * ) */ + __Pyx_TraceLine(132,284,0,__PYX_ERR(0, 132, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); @@ -7683,7 +8320,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":131 * ) * - * if not filtered_cnts: # <<<<<<<<<<<<<< + * if not filtered_cnts: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "Contour detection not valid: no contours recognized" */ @@ -7693,19 +8330,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) * * num_contours = len(filtered_cnts) # <<<<<<<<<<<<<< - * if num_contours != const.NUM_VALID_ELECTRODES: + * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover * raise errors.InvalidElectrodeCount( */ + __Pyx_TraceLine(136,288,0,__PYX_ERR(0, 136, __pyx_L1_error)) __pyx_t_12 = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 136, __pyx_L1_error) __pyx_v_num_contours = __pyx_t_12; /* "dopt_sensor_anomalies/detection.py":137 * * num_contours = len(filtered_cnts) - * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< + * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " */ + __Pyx_TraceLine(137,291,0,__PYX_ERR(0, 137, __pyx_L1_error)) __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) @@ -7722,11 +8361,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":138 * num_contours = len(filtered_cnts) - * if num_contours != const.NUM_VALID_ELECTRODES: + * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover * raise errors.InvalidElectrodeCount( # <<<<<<<<<<<<<< * f"Number of counted electrodes does not match the " * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" */ + __Pyx_TraceLine(138,298,0,__PYX_ERR(0, 138, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -7741,6 +8381,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) * */ + __Pyx_TraceLine(140,301,0,__PYX_ERR(0, 140, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_num_contours, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error) @@ -7757,12 +8398,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_20[3] = __pyx_t_8; /* "dopt_sensor_anomalies/detection.py":139 - * if num_contours != const.NUM_VALID_ELECTRODES: + * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " # <<<<<<<<<<<<<< * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" * ) */ + __Pyx_TraceLine(139,299,0,__PYX_ERR(0, 139, __pyx_L1_error)) __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_20, 4, 72 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); @@ -7796,7 +8438,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT /* "dopt_sensor_anomalies/detection.py":137 * * num_contours = len(filtered_cnts) - * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< + * if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " */ @@ -7809,6 +8451,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * 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_TraceLine(143,307,0,__PYX_ERR(0, 143, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_11 = __pyx_builtin_min; @@ -7837,6 +8480,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * 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_TraceLine(144,313,0,__PYX_ERR(0, 144, __pyx_L1_error)) __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_1 = __pyx_builtin_max; @@ -7865,6 +8509,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 * */ + __Pyx_TraceLine(145,319,0,__PYX_ERR(0, 145, __pyx_L1_error)) __pyx_t_11 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_16 = __pyx_builtin_min; @@ -7893,6 +8538,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) */ + __Pyx_TraceLine(146,325,0,__PYX_ERR(0, 146, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_9 = __pyx_builtin_max; @@ -7921,6 +8567,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) */ + __Pyx_TraceLine(148,331,0,__PYX_ERR(0, 148, __pyx_L1_error)) __pyx_t_16 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_11 = __pyx_builtin_max; @@ -7949,6 +8596,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) * */ + __Pyx_TraceLine(149,340,0,__PYX_ERR(0, 149, __pyx_L1_error)) __pyx_t_11 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_8 = __pyx_builtin_min; @@ -7977,6 +8625,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] */ + __Pyx_TraceLine(150,353,0,__PYX_ERR(0, 150, __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, 150, __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, 150, __pyx_L1_error) @@ -7998,6 +8647,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] * */ + __Pyx_TraceLine(152,359,0,__PYX_ERR(0, 152, __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, 152, __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, 152, __pyx_L1_error) @@ -8023,6 +8673,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * return data_csv, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) */ + __Pyx_TraceLine(153,366,0,__PYX_ERR(0, 153, __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, 153, __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, 153, __pyx_L1_error) @@ -8048,6 +8699,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * * */ + __Pyx_TraceLine(155,371,0,__PYX_ERR(0, 155, __pyx_L1_error)) __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, 155, __pyx_L1_error) @@ -8090,6 +8742,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_11); __pyx_t_11 = 0; + __Pyx_TraceReturnValue(__pyx_r, 371, 0, __PYX_ERR(0, 155, __pyx_L1_error)); goto __pyx_L0; /* "dopt_sensor_anomalies/detection.py":55 @@ -8111,6 +8764,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_15); __Pyx_XDECREF(__pyx_t_16); + __Pyx_TraceException(__pyx_lineno, 0, 0); + #if CYTHON_USE_SYS_MONITORING + __Pyx_TraceExceptionUnwind(0, 0); + #else + __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 55, __pyx_L1_error)); + #endif __Pyx_AddTraceback("dopt_sensor_anomalies.detection.measure_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -8166,6 +8825,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5); __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8284,6 +8944,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_v_img_np = NULL; PyObject *__pyx_v_anomaly_map_resized = NULL; PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsFunc __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -8304,7 +8965,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])) __Pyx_RefNannySetupContext("infer_image", 0); + __Pyx_TraceStartFunc("infer_image", __pyx_f[0], 158, 0, 0, 0, __PYX_ERR(0, 158, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":162 * model: Patchcore, @@ -8313,6 +8976,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * model.to(torch_device) * */ + __Pyx_TraceLine(162,7,0,__PYX_ERR(0, 162, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -8375,6 +9039,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) */ + __Pyx_TraceLine(163,14,0,__PYX_ERR(0, 163, __pyx_L1_error)) __pyx_t_4 = __pyx_v_model; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; @@ -8394,6 +9059,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * pil_image = Image.fromarray(image_rgb) * pil_image = pil_image.convert("RGB") */ + __Pyx_TraceLine(165,21,0,__PYX_ERR(0, 165, __pyx_L1_error)) __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -8436,6 +9102,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 */ + __Pyx_TraceLine(166,28,0,__PYX_ERR(0, 166, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -8472,6 +9139,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * image_np = np.array(pil_image).astype(np.float32) / 255.0 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) */ + __Pyx_TraceLine(167,31,0,__PYX_ERR(0, 167, __pyx_L1_error)) __pyx_t_4 = __pyx_v_pil_image; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; @@ -8492,6 +9160,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) * */ + __Pyx_TraceLine(168,38,0,__PYX_ERR(0, 168, __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, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -8548,6 +9217,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * * input_tensor = input_tensor.unsqueeze(0) */ + __Pyx_TraceLine(169,49,0,__PYX_ERR(0, 169, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -8590,6 +9260,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * input_tensor = input_tensor.to(torch_device) * */ + __Pyx_TraceLine(171,57,0,__PYX_ERR(0, 171, __pyx_L1_error)) __pyx_t_4 = __pyx_v_input_tensor; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; @@ -8610,6 +9281,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * * model.eval() */ + __Pyx_TraceLine(172,62,0,__PYX_ERR(0, 172, __pyx_L1_error)) __pyx_t_4 = __pyx_v_input_tensor; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; @@ -8630,6 +9302,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * with torch.no_grad(): * output = model(input_tensor) */ + __Pyx_TraceLine(174,66,0,__PYX_ERR(0, 174, __pyx_L1_error)) __pyx_t_4 = __pyx_v_model; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; @@ -8649,6 +9322,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * output = model(input_tensor) * */ + __Pyx_TraceLine(175,69,0,__PYX_ERR(0, 175, __pyx_L1_error)) /*with:*/ { __pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) @@ -8720,6 +9394,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * * anomaly_score = output.pred_score.item() */ + __Pyx_TraceLine(176,74,0,__PYX_ERR(0, 176, __pyx_L7_error)) __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_model); __pyx_t_1 = __pyx_v_model; @@ -8767,12 +9442,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_TraceException(__pyx_lineno, 0, 0); /*except:*/ { __Pyx_AddTraceback("dopt_sensor_anomalies.detection.infer_image", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_TraceExceptionHandled(69); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 175, __pyx_L9_except_error) __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_5); + __Pyx_TraceExceptionDone(); __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); @@ -8790,6 +9468,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_5); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; + __Pyx_TraceException(69, 1, 0); __PYX_ERR(0, 175, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -8838,6 +9517,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * anomaly_label = output.pred_label.item() * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() */ + __Pyx_TraceLine(178,77,0,__PYX_ERR(0, 178, __pyx_L1_error)) if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 178, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_score); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -8862,6 +9542,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() * */ + __Pyx_TraceLine(179,82,0,__PYX_ERR(0, 179, __pyx_L1_error)) if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 179, __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, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -8886,6 +9567,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * * img_np = np.array(pil_image) */ + __Pyx_TraceLine(180,87,0,__PYX_ERR(0, 180, __pyx_L1_error)) if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 180, __pyx_L1_error) } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_anomaly_map); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); @@ -8932,6 +9614,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) * */ + __Pyx_TraceLine(182,98,0,__PYX_ERR(0, 182, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -8968,6 +9651,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * * return t.InferenceResult( */ + __Pyx_TraceLine(183,103,0,__PYX_ERR(0, 183, __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, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -9023,6 +9707,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * img=img_np, * anomaly_map_resized=anomaly_map_resized, */ + __Pyx_TraceLine(185,113,0,__PYX_ERR(0, 185, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) @@ -9038,6 +9723,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * ) * */ + __Pyx_TraceLine(189,124,0,__PYX_ERR(0, 189, __pyx_L1_error)) __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { @@ -9067,6 +9753,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON } __pyx_r = __pyx_t_5; __pyx_t_5 = 0; + __Pyx_TraceReturnValue(__pyx_r, 113, 0, __PYX_ERR(0, 185, __pyx_L1_error)); goto __pyx_L0; /* "dopt_sensor_anomalies/detection.py":158 @@ -9087,6 +9774,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); + __Pyx_TraceException(__pyx_lineno, 0, 0); + #if CYTHON_USE_SYS_MONITORING + __Pyx_TraceExceptionUnwind(0, 0); + #else + __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 158, __pyx_L1_error)); + #endif __Pyx_AddTraceback("dopt_sensor_anomalies.detection.infer_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -9102,6 +9795,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_v_img_np); __Pyx_XDECREF(__pyx_v_anomaly_map_resized); __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -9237,6 +9931,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( PyObject *__pyx_v_ax = NULL; PyObject *__pyx_v_df = NULL; PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsFunc __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -9256,7 +9951,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])) __Pyx_RefNannySetupContext("anomaly_detection", 0); + __Pyx_TraceStartFunc("anomaly_detection", __pyx_f[0], 193, 0, 0, 0, __PYX_ERR(0, 193, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":199 * sensor_images: t.SensorImages, @@ -9265,6 +9962,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * folder_path = img_path.parent * */ + __Pyx_TraceLine(199,8,0,__PYX_ERR(0, 199, __pyx_L1_error)) __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_stem); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_file_stem = __pyx_t_1; @@ -9277,6 +9975,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * * model = Patchcore( */ + __Pyx_TraceLine(200,11,0,__PYX_ERR(0, 200, __pyx_L1_error)) __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_folder_path = __pyx_t_1; @@ -9289,6 +9988,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO * ) */ + __Pyx_TraceLine(202,14,0,__PYX_ERR(0, 202, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -9300,6 +10000,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * ) * _, axes = plt.subplots(1, 2, figsize=(12, 6)) */ + __Pyx_TraceLine(203,16,0,__PYX_ERR(0, 203, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_BACKBONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error) @@ -9354,6 +10055,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * * for i, (side, image) in enumerate(sensor_images.items()): */ + __Pyx_TraceLine(205,26,0,__PYX_ERR(0, 205, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_subplots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) @@ -9428,6 +10130,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) */ + __Pyx_TraceLine(207,34,0,__PYX_ERR(0, 207, __pyx_L1_error)) __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; __pyx_t_10 = 0; @@ -9465,6 +10168,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * checkpoint = torch.load(detection_models[side]) * model.load_state_dict(checkpoint["model_state_dict"]) */ + __Pyx_TraceLine(208,45,0,__PYX_ERR(0, 208, __pyx_L1_error)) __pyx_t_1 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); @@ -9513,6 +10217,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * model.load_state_dict(checkpoint["model_state_dict"]) * */ + __Pyx_TraceLine(209,55,0,__PYX_ERR(0, 209, __pyx_L1_error)) __pyx_t_6 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -9552,6 +10257,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * * result = infer_image(image, model) */ + __Pyx_TraceLine(210,59,0,__PYX_ERR(0, 210, __pyx_L1_error)) __pyx_t_1 = __pyx_v_model; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) @@ -9574,6 +10280,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * data_csv.extend([int(result.anomaly_label)]) * */ + __Pyx_TraceLine(212,67,0,__PYX_ERR(0, 212, __pyx_L1_error)) __pyx_t_5 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -9607,6 +10314,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * * ax = axes[i] */ + __Pyx_TraceLine(213,70,0,__PYX_ERR(0, 213, __pyx_L1_error)) __pyx_t_1 = __pyx_v_data_csv; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) @@ -9637,6 +10345,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * ax.axis("off") * ax.imshow(image, alpha=0.8) */ + __Pyx_TraceLine(215,80,0,__PYX_ERR(0, 215, __pyx_L1_error)) __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_ax, __pyx_t_7); @@ -9649,6 +10358,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * ax.imshow(image, alpha=0.8) * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) */ + __Pyx_TraceLine(216,82,0,__PYX_ERR(0, 216, __pyx_L1_error)) __pyx_t_5 = __pyx_v_ax; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0; @@ -9668,6 +10378,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) * */ + __Pyx_TraceLine(217,86,0,__PYX_ERR(0, 217, __pyx_L1_error)) __pyx_t_5 = __pyx_v_ax; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0; @@ -9691,6 +10402,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * * plt.subplots_adjust(wspace=0, hspace=0) */ + __Pyx_TraceLine(218,92,0,__PYX_ERR(0, 218, __pyx_L1_error)) __pyx_t_1 = __pyx_v_ax; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error) @@ -9721,6 +10433,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * plt.savefig( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), */ + __Pyx_TraceLine(220,103,0,__PYX_ERR(0, 220, __pyx_L1_error)) __pyx_t_3 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); @@ -9761,6 +10474,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), * bbox_inches="tight", */ + __Pyx_TraceLine(221,110,0,__PYX_ERR(0, 221, __pyx_L1_error)) __pyx_t_6 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); @@ -9775,6 +10489,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * bbox_inches="tight", * pad_inches=0, */ + __Pyx_TraceLine(222,114,0,__PYX_ERR(0, 222, __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, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) @@ -9831,6 +10546,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * * df = DataFrame([data_csv]) */ + __Pyx_TraceLine(226,124,0,__PYX_ERR(0, 226, __pyx_L1_error)) __pyx_t_3 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -9866,6 +10582,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * df.to_csv( * (folder_path / f"{file_stem}.csv"), */ + __Pyx_TraceLine(228,127,0,__PYX_ERR(0, 228, __pyx_L1_error)) __pyx_t_5 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -9905,6 +10622,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}.csv"), * mode="w", */ + __Pyx_TraceLine(229,130,0,__PYX_ERR(0, 229, __pyx_L1_error)) __pyx_t_3 = __pyx_v_df; __Pyx_INCREF(__pyx_t_3); @@ -9915,6 +10633,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * mode="w", * index=False, */ + __Pyx_TraceLine(230,136,0,__PYX_ERR(0, 230, __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, 230, __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, 230, __pyx_L1_error) @@ -9931,6 +10650,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * sep=";", * ) */ + __Pyx_TraceLine(234,145,0,__PYX_ERR(0, 234, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error) @@ -9966,6 +10686,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 193, __pyx_L1_error)); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -9976,6 +10697,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_14); + __Pyx_TraceException(__pyx_lineno, 0, 0); + #if CYTHON_USE_SYS_MONITORING + __Pyx_TraceExceptionUnwind(0, 0); + #else + __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 193, __pyx_L1_error)); + #endif __Pyx_AddTraceback("dopt_sensor_anomalies.detection.anomaly_detection", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -9992,6 +10719,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_v_ax); __Pyx_XDECREF(__pyx_v_df); __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -10122,6 +10850,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U PyObject *__pyx_v_data_csv = NULL; PyObject *__pyx_v_sensor_images = NULL; PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarationsFunc __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -10135,7 +10864,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])) __Pyx_RefNannySetupContext("pipeline", 0); + __Pyx_TraceStartFunc("pipeline", __pyx_f[0], 239, 0, 0, 0, __PYX_ERR(0, 239, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":245 * pixels_per_metric_Y: float, @@ -10144,6 +10875,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * if not file_path.exists(): * raise FileNotFoundError("The provided path seems not to exist") */ + __Pyx_TraceLine(245,7,0,__PYX_ERR(0, 245, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -10177,6 +10909,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * raise FileNotFoundError("The provided path seems not to exist") * */ + __Pyx_TraceLine(246,11,0,__PYX_ERR(0, 246, __pyx_L1_error)) __pyx_t_3 = __pyx_v_file_path; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; @@ -10199,6 +10932,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * * MODEL_FOLDER: Final[Path] = dopt_sensor_anomalies._find_paths.get_model_folder() */ + __Pyx_TraceLine(247,16,0,__PYX_ERR(0, 247, __pyx_L1_error)) __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_builtin_FileNotFoundError); __pyx_t_2 = __pyx_builtin_FileNotFoundError; @@ -10231,6 +10965,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * DETECTION_MODELS: Final[t.DetectionModels] = ( * dopt_sensor_anomalies._find_paths.get_detection_models(MODEL_FOLDER) */ + __Pyx_TraceLine(249,19,0,__PYX_ERR(0, 249, __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, 249, __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, 249, __pyx_L1_error) @@ -10257,6 +10992,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * ) * */ + __Pyx_TraceLine(251,24,0,__PYX_ERR(0, 251, __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, 251, __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, 251, __pyx_L1_error) @@ -10283,6 +11019,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * file_path, pixels_per_metric_X, pixels_per_metric_Y * ) */ + __Pyx_TraceLine(254,32,0,__PYX_ERR(0, 254, __pyx_L1_error)) __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, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); @@ -10294,6 +11031,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * ) * anomaly_detection( */ + __Pyx_TraceLine(255,34,0,__PYX_ERR(0, 255, __pyx_L1_error)) __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __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, 255, __pyx_L1_error) @@ -10378,6 +11116,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * file_path, pixels_per_metric_X, pixels_per_metric_Y * ) */ + __Pyx_TraceLine(254,29,0,__PYX_ERR(0, 254, __pyx_L1_error)) __pyx_v_data_csv = __pyx_t_7; __pyx_t_7 = 0; __pyx_v_sensor_images = __pyx_t_8; @@ -10390,6 +11129,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * img_path=file_path, * detection_models=DETECTION_MODELS, */ + __Pyx_TraceLine(257,37,0,__PYX_ERR(0, 257, __pyx_L1_error)) __pyx_t_8 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); @@ -10400,6 +11140,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * sensor_images=sensor_images, # <<<<<<<<<<<<<< * ) */ + __Pyx_TraceLine(261,45,0,__PYX_ERR(0, 261, __pyx_L1_error)) __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { @@ -10439,6 +11180,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 239, __pyx_L1_error)); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -10446,6 +11188,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); + __Pyx_TraceException(__pyx_lineno, 0, 0); + #if CYTHON_USE_SYS_MONITORING + __Pyx_TraceExceptionUnwind(0, 0); + #else + __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 239, __pyx_L1_error)); + #endif __Pyx_AddTraceback("dopt_sensor_anomalies.detection.pipeline", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -10455,6 +11203,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_XDECREF(__pyx_v_data_csv); __Pyx_XDECREF(__pyx_v_sensor_images); __Pyx_XGIVEREF(__pyx_r); + __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -11987,6 +12736,7 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_detection(PyObject *__pyx_pyinit_m int pystate_addmodule_run = 0; #endif __pyx_mstatetype *__pyx_mstate = NULL; + __Pyx_TraceDeclarationsFunc PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -12100,12 +12850,14 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); (void)__Pyx_modinit_variable_import_code(__pyx_mstate); (void)__Pyx_modinit_function_import_code(__pyx_mstate); /*--- Execution code ---*/ + __Pyx_TraceStartFunc("PyInit_detection", __pyx_f[0], 1, 0, 0, 0, __PYX_ERR(0, 1, __pyx_L1_error)); /* "dopt_sensor_anomalies/detection.py":1 * import csv # <<<<<<<<<<<<<< * import warnings * from pathlib import Path */ + __Pyx_TraceLine(1,1,0,__PYX_ERR(0, 1, __pyx_L1_error)) __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) @@ -12117,6 +12869,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from pathlib import Path * from typing import Any, Final, cast */ + __Pyx_TraceLine(2,2,0,__PYX_ERR(0, 2, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_warnings, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) @@ -12129,6 +12882,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from typing import Any, Final, cast * */ + __Pyx_TraceLine(3,5,0,__PYX_ERR(0, 3, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pathlib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) @@ -12147,6 +12901,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * * import cv2 */ + __Pyx_TraceLine(4,8,0,__PYX_ERR(0, 4, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_Any, __pyx_mstate_global->__pyx_n_u_Final, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) @@ -12173,6 +12928,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import imutils * import matplotlib.pyplot as plt */ + __Pyx_TraceLine(6,11,0,__PYX_ERR(0, 6, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_cv2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cv2, __pyx_t_2) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) @@ -12185,6 +12941,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import matplotlib.pyplot as plt * import numpy as np */ + __Pyx_TraceLine(7,12,0,__PYX_ERR(0, 7, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_imutils, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_imutils, __pyx_t_2) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) @@ -12197,6 +12954,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import numpy as np * import numpy.typing as npt */ + __Pyx_TraceLine(8,13,0,__PYX_ERR(0, 8, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_matplotlib_pyplot, __pyx_mstate_global->__pyx_tuple[7]); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plt, __pyx_t_2) < (0)) __PYX_ERR(0, 8, __pyx_L1_error) @@ -12209,6 +12967,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import numpy.typing as npt * import torch */ + __Pyx_TraceLine(9,14,0,__PYX_ERR(0, 9, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_2) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) @@ -12221,6 +12980,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import torch * from anomalib.models import Patchcore */ + __Pyx_TraceLine(10,15,0,__PYX_ERR(0, 10, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy_typing, __pyx_mstate_global->__pyx_tuple[8]); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_npt, __pyx_t_2) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) @@ -12233,6 +12993,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from anomalib.models import Patchcore * from dopt_basics import result_pattern */ + __Pyx_TraceLine(11,16,0,__PYX_ERR(0, 11, __pyx_L1_error)) __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_torch, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_torch, __pyx_t_2) < (0)) __PYX_ERR(0, 11, __pyx_L1_error) @@ -12245,6 +13006,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from dopt_basics import result_pattern * from imutils import contours, perspective */ + __Pyx_TraceLine(12,19,0,__PYX_ERR(0, 12, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_anomalib_models, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) @@ -12263,6 +13025,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from imutils import contours, perspective * from pandas import DataFrame */ + __Pyx_TraceLine(13,22,0,__PYX_ERR(0, 13, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_basics, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) @@ -12281,6 +13044,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from pandas import DataFrame * from PIL import Image */ + __Pyx_TraceLine(14,25,0,__PYX_ERR(0, 14, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_contours, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_imutils, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) @@ -12303,6 +13067,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from PIL import Image * from scipy.spatial import distance as dist */ + __Pyx_TraceLine(15,29,0,__PYX_ERR(0, 15, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pandas, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) @@ -12321,6 +13086,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from scipy.spatial import distance as dist * */ + __Pyx_TraceLine(16,32,0,__PYX_ERR(0, 16, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_PIL, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) @@ -12339,6 +13105,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * * import dopt_sensor_anomalies._find_paths */ + __Pyx_TraceLine(17,35,0,__PYX_ERR(0, 17, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_scipy_spatial, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) @@ -12357,6 +13124,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from dopt_sensor_anomalies import constants as const * from dopt_sensor_anomalies import errors */ + __Pyx_TraceLine(19,36,0,__PYX_ERR(0, 19, __pyx_L1_error)) __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies__find_path, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) @@ -12369,6 +13137,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from dopt_sensor_anomalies import errors * from dopt_sensor_anomalies import types as t */ + __Pyx_TraceLine(20,39,0,__PYX_ERR(0, 20, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_constants); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) @@ -12387,6 +13156,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * from dopt_sensor_anomalies import types as t * */ + __Pyx_TraceLine(21,42,0,__PYX_ERR(0, 21, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) @@ -12405,6 +13175,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * * # Suppress the specific HuggingFace cache symlink warning */ + __Pyx_TraceLine(22,45,0,__PYX_ERR(0, 22, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) @@ -12423,6 +13194,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * "ignore", * message=".*huggingface_hub.*cache-system uses symlinks.*", */ + __Pyx_TraceLine(25,48,0,__PYX_ERR(0, 25, __pyx_L1_error)) __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -12437,6 +13209,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * ) * */ + __Pyx_TraceLine(28,53,0,__PYX_ERR(0, 28, __pyx_L1_error)) __pyx_t_6 = 1; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ignore}; @@ -12460,12 +13233,13 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], */ + __Pyx_TraceLine(32,54,0,__PYX_ERR(0, 32, __pyx_L1_error)) __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_A, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_B, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_float_float) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - __pyx_t_5 = __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_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_5 = __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[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12479,6 +13253,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * ) -> bool: * c1, s1, _ = box_1 */ + __Pyx_TraceLine(42,65,0,__PYX_ERR(0, 42, __pyx_L1_error)) __pyx_t_5 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); @@ -12489,6 +13264,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * box_1: t.Box, * box_2: t.Box, */ + __Pyx_TraceLine(39,60,0,__PYX_ERR(0, 39, __pyx_L1_error)) __pyx_t_3 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -12498,7 +13274,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) - __pyx_t_4 = __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_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_4 = __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[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); @@ -12514,6 +13290,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * img_path: Path, * pixels_per_metric_X: float, */ + __Pyx_TraceLine(55,68,0,__PYX_ERR(0, 55, __pyx_L1_error)) __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) @@ -12534,6 +13311,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * image: npt.NDArray[np.uint8], * model: Patchcore, */ + __Pyx_TraceLine(158,76,0,__PYX_ERR(0, 158, __pyx_L1_error)) __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) @@ -12553,6 +13331,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * img_path: Path, * detection_models: t.DetectionModels, */ + __Pyx_TraceLine(193,82,0,__PYX_ERR(0, 193, __pyx_L1_error)) __pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) @@ -12574,6 +13353,7 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * def pipeline( * user_img_path: str, */ + __Pyx_TraceLine(239,92,0,__PYX_ERR(0, 239, __pyx_L1_error)) __pyx_t_4 = NULL; __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 239, __pyx_L1_error) @@ -12618,10 +13398,13 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); * import warnings * from pathlib import Path */ + __Pyx_TraceLine(1,0,0,__PYX_ERR(0, 1, __pyx_L1_error)) __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1, __pyx_L1_error)); + __Pyx_PyMonitoring_ExitScope(0); /*--- Wrapped vars code ---*/ @@ -12633,6 +13416,8 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); + __Pyx_TraceException(__pyx_lineno, 0, 0); + __Pyx_TraceExceptionUnwind(0, 0); if (__pyx_m) { if (__pyx_mstate->__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init dopt_sensor_anomalies.detection", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -12735,7 +13520,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__3 */ {__pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__4 */ {__pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__5 */ - {__pyx_k__8, sizeof(__pyx_k__8), 0, 1, 1}, /* PyObject cname: __pyx_n_u__8 */ + {__pyx_k__6, sizeof(__pyx_k__6), 0, 1, 1}, /* PyObject cname: __pyx_n_u__6 */ {__pyx_k_accepted_boxes, sizeof(__pyx_k_accepted_boxes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_accepted_boxes */ {__pyx_k_add_note, sizeof(__pyx_k_add_note), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_add_note */ {__pyx_k_all, sizeof(__pyx_k_all), 0, 1, 1}, /* PyObject cname: __pyx_n_u_all */ @@ -13195,49 +13980,49 @@ static PyObject* __Pyx_PyCode_New( 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 = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 32, 52}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt_A, __pyx_mstate->__pyx_n_u_pt_B}; + __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_midpoint, __pyx_k_AT_Rt1D_AS_at2Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 39, 139}; + 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__6, __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[1] = __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[1])) goto bad; + } { const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 84, 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; + __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__7, 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), 112, 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; + __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__8, 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), 143, 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; + __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), 144, 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; + __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 = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 145, 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; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 146, 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), 32, 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), 39, 139}; - 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; + __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_genexpr, __pyx_k_a, 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), 55, 860}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_cropped, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_gray, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_binary, __pyx_mstate->__pyx_n_u_kernel, __pyx_mstate->__pyx_n_u_closed, __pyx_mstate->__pyx_n_u_edged, __pyx_mstate->__pyx_n_u_cnts, __pyx_mstate->__pyx_n_u_x_coords, __pyx_mstate->__pyx_n_u_is_sorted, __pyx_mstate->__pyx_n_u_accepted_boxes, __pyx_mstate->__pyx_n_u_filtered_cnts, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_rbox, __pyx_mstate->__pyx_n_u_box, __pyx_mstate->__pyx_n_u_tl, __pyx_mstate->__pyx_n_u_tr, __pyx_mstate->__pyx_n_u_br, __pyx_mstate->__pyx_n_u_bl, __pyx_mstate->__pyx_n_u_tltrX, __pyx_mstate->__pyx_n_u_tltrY, __pyx_mstate->__pyx_n_u_blbrX, __pyx_mstate->__pyx_n_u_blbrY, __pyx_mstate->__pyx_n_u_tlblX, __pyx_mstate->__pyx_n_u_tlblY, __pyx_mstate->__pyx_n_u_trbrX, __pyx_mstate->__pyx_n_u_trbrY, __pyx_mstate->__pyx_n_u_dA, __pyx_mstate->__pyx_n_u_dB, __pyx_mstate->__pyx_n_u_is_duplicate, __pyx_mstate->__pyx_n_u_dimA, __pyx_mstate->__pyx_n_u_dimB, __pyx_mstate->__pyx_n_u_num_contours, __pyx_mstate->__pyx_n_u_x_min, __pyx_mstate->__pyx_n_u_x_max, __pyx_mstate->__pyx_n_u_y_min, __pyx_mstate->__pyx_n_u_y_max, __pyx_mstate->__pyx_n_u_rightmost_x_third, __pyx_mstate->__pyx_n_u_leftmost_x_fourth, __pyx_mstate->__pyx_n_u_x_middle, __pyx_mstate->__pyx_n_u_cropped_sensor_left, __pyx_mstate->__pyx_n_u_cropped_sensor_right, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_cropped, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_gray, __pyx_mstate->__pyx_n_u__6, __pyx_mstate->__pyx_n_u_binary, __pyx_mstate->__pyx_n_u_kernel, __pyx_mstate->__pyx_n_u_closed, __pyx_mstate->__pyx_n_u_edged, __pyx_mstate->__pyx_n_u_cnts, __pyx_mstate->__pyx_n_u_x_coords, __pyx_mstate->__pyx_n_u_is_sorted, __pyx_mstate->__pyx_n_u_accepted_boxes, __pyx_mstate->__pyx_n_u_filtered_cnts, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_rbox, __pyx_mstate->__pyx_n_u_box, __pyx_mstate->__pyx_n_u_tl, __pyx_mstate->__pyx_n_u_tr, __pyx_mstate->__pyx_n_u_br, __pyx_mstate->__pyx_n_u_bl, __pyx_mstate->__pyx_n_u_tltrX, __pyx_mstate->__pyx_n_u_tltrY, __pyx_mstate->__pyx_n_u_blbrX, __pyx_mstate->__pyx_n_u_blbrY, __pyx_mstate->__pyx_n_u_tlblX, __pyx_mstate->__pyx_n_u_tlblY, __pyx_mstate->__pyx_n_u_trbrX, __pyx_mstate->__pyx_n_u_trbrY, __pyx_mstate->__pyx_n_u_dA, __pyx_mstate->__pyx_n_u_dB, __pyx_mstate->__pyx_n_u_is_duplicate, __pyx_mstate->__pyx_n_u_dimA, __pyx_mstate->__pyx_n_u_dimB, __pyx_mstate->__pyx_n_u_num_contours, __pyx_mstate->__pyx_n_u_x_min, __pyx_mstate->__pyx_n_u_x_max, __pyx_mstate->__pyx_n_u_y_min, __pyx_mstate->__pyx_n_u_y_max, __pyx_mstate->__pyx_n_u_rightmost_x_third, __pyx_mstate->__pyx_n_u_leftmost_x_fourth, __pyx_mstate->__pyx_n_u_x_middle, __pyx_mstate->__pyx_n_u_cropped_sensor_left, __pyx_mstate->__pyx_n_u_cropped_sensor_right, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_measure_length, __pyx_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { @@ -13247,7 +14032,7 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { } { const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 193, 338}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_detection_models, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images, __pyx_mstate->__pyx_n_u_file_stem, __pyx_mstate->__pyx_n_u_folder_path, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_axes, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_side, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_checkpoint, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_df}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_detection_models, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images, __pyx_mstate->__pyx_n_u_file_stem, __pyx_mstate->__pyx_n_u_folder_path, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u__6, __pyx_mstate->__pyx_n_u_axes, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_side, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_checkpoint, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_df}; __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_anomaly_detection, __pyx_k_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { @@ -14502,6 +15287,124 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } +/* Profile */ +#if CYTHON_PROFILE || CYTHON_TRACE +#if CYTHON_TRACE && !CYTHON_USE_SYS_MONITORING +static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int line) { + int ret; + PyObject *type, *value, *traceback; + __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); + __Pyx_PyFrame_SetLineNumber(frame, line); + __Pyx_EnterTracing(tstate); + ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL); + __Pyx_LeaveTracing(tstate); + if (likely(!ret)) { + __Pyx_ErrRestoreInState(tstate, type, value, traceback); + } else { + Py_XDECREF(type); + Py_XDECREF(value); + Py_XDECREF(traceback); + } + return ret; +} +#endif +CYTHON_UNUSED static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) { + PyCodeObject *py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno); + if (likely(py_code)) { + py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS; + } + return py_code; +} +#if CYTHON_USE_SYS_MONITORING +CYTHON_UNUSED static int __Pyx__TraceStartFunc(PyMonitoringState *state_array, PyObject *code_obj, int offset, int skip_event) { + int ret; + __pyx_monitoring_version_type version = 0; + ret = PyMonitoring_EnterScope(state_array, &version, __Pyx_MonitoringEventTypes, __Pyx_MonitoringEventTypes_CyFunc_count); + if (unlikely(ret == -1)) return -1; + return skip_event ? 0 : PyMonitoring_FirePyStartEvent(&state_array[__Pyx_Monitoring_PY_START], code_obj, offset); +} +CYTHON_UNUSED static int __Pyx__TraceStartGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset) { + int ret; + ret = PyMonitoring_EnterScope(state_array, version, __Pyx_MonitoringEventTypes, __Pyx_MonitoringEventTypes_CyGen_count); + if (unlikely(ret == -1)) return -1; + return PyMonitoring_FirePyStartEvent(&state_array[__Pyx_Monitoring_PY_START], code_obj, offset); +} +CYTHON_UNUSED static int __Pyx__TraceResumeGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset) { + int ret; + ret = PyMonitoring_EnterScope(state_array, version, __Pyx_MonitoringEventTypes, __Pyx_MonitoringEventTypes_CyGen_count); + if (unlikely(ret == -1)) return -1; + return PyMonitoring_FirePyResumeEvent(&state_array[__Pyx_Monitoring_PY_RESUME], code_obj, offset); +} +CYTHON_UNUSED static void __Pyx__TraceException(PyMonitoringState *monitoring_state, PyObject *code_obj, int offset, int reraised) { + if (reraised) { + (void) PyMonitoring_FireReraiseEvent(monitoring_state, code_obj, offset); + } else { + (void) PyMonitoring_FireRaiseEvent(monitoring_state, code_obj, offset); + } +} +#if CYTHON_TRACE +CYTHON_UNUSED static int __Pyx__TraceLine(PyMonitoringState *monitoring_state, PyObject *code_obj, int line, int offset) { + int ret; + PyObject *exc = PyErr_GetRaisedException(); + ret = PyMonitoring_FireLineEvent(monitoring_state, code_obj, offset, line); + if (exc) PyErr_SetRaisedException(exc); + return ret; +} +#endif +#else +static int __Pyx_TraceSetupAndCall(PyCodeObject** code, + PyFrameObject** frame, + PyThreadState* tstate, + const char *funcname, + const char *srcfile, + int firstlineno, + int skip_event) { + if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) { + int needs_new_code_obj = (*code == NULL); + if (needs_new_code_obj) { + *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno); + if (*code == NULL) return 0; + } + *frame = PyFrame_New( + tstate, /*PyThreadState *tstate*/ + *code, /*PyCodeObject *code*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals*/ + 0 /*PyObject *locals*/ + ); + if (needs_new_code_obj && !CYTHON_PROFILE_REUSE_CODEOBJ) + Py_CLEAR(*code); // otherwise the reference is owned externally + if (*frame == NULL) return 0; + if (CYTHON_TRACE && (*frame)->f_trace == NULL) { + Py_INCREF(Py_None); + (*frame)->f_trace = Py_None; + } + } + if (!skip_event) { + PyObject *type, *value, *traceback; + int retval = 1; + __Pyx_PyFrame_SetLineNumber(*frame, firstlineno); + __Pyx_EnterTracing(tstate); + __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); + #if CYTHON_TRACE + if (tstate->c_tracefunc) + retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0; + if (retval && tstate->c_profilefunc) + #endif + retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0; + __Pyx_LeaveTracing(tstate); + if (unlikely(!retval)) { + Py_XDECREF(type); + Py_XDECREF(value); + Py_XDECREF(traceback); + return -1; + } + __Pyx_ErrRestoreInState(tstate, type, value, traceback); + } + return __Pyx_IsTracing(tstate, 0, 0); +} +#endif +#endif + /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; diff --git a/src/dopt_sensor_anomalies/detection.py b/src/dopt_sensor_anomalies/detection.py index 64d3b3c..f74d133 100644 --- a/src/dopt_sensor_anomalies/detection.py +++ b/src/dopt_sensor_anomalies/detection.py @@ -74,7 +74,7 @@ def measure_length( cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) cnts = imutils.grab_contours(cnts) - if cnts is None: + if cnts is None: # pragma: no cover raise errors.ContourCalculationError( "No contours were found in the provided image. Can not continue analysis." ) @@ -82,7 +82,7 @@ def measure_length( cnts, _ = contours.sort_contours(cnts) x_coords = [cv2.boundingRect(c)[0] for c in cnts] is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore - if not is_sorted: + if not is_sorted: # pragma: no cover raise errors.ContourCalculationError( "Contour detection not valid: contours are not " "properly sorted from left to right." @@ -128,13 +128,13 @@ def measure_length( ] ) - if not filtered_cnts: + if not filtered_cnts: # pragma: no cover raise errors.ContourCalculationError( "Contour detection not valid: no contours recognized" ) num_contours = len(filtered_cnts) - if num_contours != const.NUM_VALID_ELECTRODES: + if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover raise errors.InvalidElectrodeCount( f"Number of counted electrodes does not match the " f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}"