Forráskód Böngészése

fix noise scaling and remove prints

Tim Büchner 1 éve
szülő
commit
9bb42808b2
2 módosított fájl, 24 hozzáadás és 23 törlés
  1. 23 13
      sample_experiments/manual_extraction.ipynb
  2. 1 10
      src/ebpm/manual.py

+ 23 - 13
sample_experiments/manual_extraction.ipynb

@@ -19,7 +19,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 16,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -39,7 +39,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 17,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [
     {
@@ -126,7 +126,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [
     {
@@ -154,7 +154,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 127,
+   "execution_count": 5,
    "metadata": {},
    "outputs": [
     {
@@ -184,9 +184,18 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 63,
+   "execution_count": 6,
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "/home/buechner/anaconda3/envs/ebpm/lib/python3.10/site-packages/numba/np/ufunc/parallel.py:371: NumbaWarning: The TBB threading layer requires TBB version 2021 update 6 or later i.e., TBB_INTERFACE_VERSION >= 12060. Found TBB_INTERFACE_VERSION = 12050. The TBB threading layer is disabled.\n",
+      "  warnings.warn(problem)\n"
+     ]
+    }
+   ],
    "source": [
     "matches_l = ebpm.match.find_prototype(ear_l, prototype, max_prototype_distance=3.0)\n",
     "matches_r = ebpm.match.find_prototype(ear_r, prototype, max_prototype_distance=3.0)"
@@ -194,7 +203,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 64,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [
     {
@@ -212,7 +221,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 65,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [
     {
@@ -233,7 +242,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 66,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [
     {
@@ -264,7 +273,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 80,
+   "execution_count": 10,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -273,13 +282,13 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 128,
+   "execution_count": 18,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "e6b425316e3541ea8aa8a4a0f6ce22e2",
+       "model_id": "f5e222ee6b3e423d928af2af4d1d831f",
        "version_major": 2,
        "version_minor": 0
       },
@@ -312,7 +321,8 @@
     "        noise=noise,\n",
     "        return_params=True\n",
     "    )\n",
-    "    ebpm.plot.manual_prototype(prototype=prototype, params=params)"
+    "    ebpm.plot.manual_prototype(prototype=prototype, params=params)\n",
+    "    plt.show()"
    ]
   }
  ],

+ 1 - 10
src/ebpm/manual.py

@@ -41,8 +41,6 @@ def define_prototype(
         # this how the prototype is defined in the paper
         apex_location = 0.4
     apex_location = int(window_size * apex_location)
-    print(apex_location, type(apex_location))
-
     onset_x  = apex_location - 3 * sig1
     offset_x = apex_location + 3 * sig2
     
@@ -53,15 +51,8 @@ def define_prototype(
     y1 = -prominance * gaussian(window_size*2, std=sig1) + baseline
     y2 = -prominance * gaussian(window_size*2, std=sig2) + baseline
     y = np.append(y1[:window_size], y2[window_size:])
-    
-    print(y1.shape, y2.shape)
-    
-    if noise:
-        y1 = y1 + _noise_fct(0.05, window_size)
-        y2 = y2 + _noise_fct(0.05, window_size) 
-    
     if noise:
-        y = y + _noise_fct(0.05, window_size)
+        y = y + _noise_fct(0.02, window_size)
     
     y = y[window_size - apex_location: 2*window_size - apex_location]
     if return_params: