浏览代码

Add files via upload

Michael Pyrcz 1 年之前
父节点
当前提交
26aa080e46
共有 1 个文件被更改,包括 18 次插入13 次删除
  1. 18 13
      Interactive_Simulation.ipynb

+ 18 - 13
Interactive_Simulation.ipynb

@@ -335,7 +335,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 13,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -441,7 +441,9 @@
     "        else:\n",
     "            sk_std[isim] = math.sqrt(sk_var[isim])\n",
     "        sim[isim] = norm.rvs(loc=sk_est[isim], scale=sk_std[isim], size=1)[0]  # random seedset at the start \n",
-    "        df = df.append({'X': dfl.loc[isim,'X'],'Y': dfl.loc[isim,'Y'],'Value': sim[isim]}, ignore_index=True)\n",
+    "        #df = df.append({'X': dfl.loc[isim,'X'],'Y': dfl.loc[isim,'Y'],'Value': sim[isim]}, ignore_index=True) # append is removed\n",
+    "        df = pd.concat([df, pd.DataFrame.from_records([{'X': dfl.loc[isim,'X'],'Y': dfl.loc[isim,'Y'],'Value': sim[isim]}])]\n",
+    "            ,ignore_index=True)\n",
     "        dfl.at[isim,'Value'] = float(sim[isim])\n",
     "    \n",
     "# plot the variogram model\n",
@@ -538,7 +540,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 14,
    "metadata": {
     "scrolled": false
    },
@@ -546,7 +548,7 @@
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "f2e29c3f849a4d40921a703ae5e3fc85",
+       "model_id": "23d6a33e436f49de9f3a5cdb56d7c793",
        "version_major": 2,
        "version_minor": 0
       },
@@ -560,12 +562,12 @@
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "0187bdd543124595a61c2835ae29983b",
+       "model_id": "5f131774884e4df68a4b2834f0801aa6",
        "version_major": 2,
        "version_minor": 0
       },
       "text/plain": [
-       "Output()"
+       "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 4 Axes>', 'i…"
       ]
      },
      "metadata": {},
@@ -595,7 +597,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 11,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -711,7 +713,10 @@
     "            sk_std[isim] = math.sqrt(sk_var[isim])\n",
     "        sim[isim] = norm.rvs(loc=sk_est[isim], scale=sk_std[isim], size=1)[0]  # random seedset at the start \n",
     "  \n",
-    "        df = df.append({'X': dfl.loc[isim,'X'],'Y': dfl.loc[isim,'Y'],'Value': sim[isim]}, ignore_index=True)\n",
+    "        #df = df.append({'X': dfl.loc[isim,'X'],'Y': dfl.loc[isim,'Y'],'Value': sim[isim]}, ignore_index=True) # append has been removed\n",
+    "        df = pd.concat([df, pd.DataFrame.from_records([{'X': dfl.loc[isim,'X'],'Y': dfl.loc[isim,'Y'],'Value': sim[isim]}])]\n",
+    "                      ,ignore_index=True)\n",
+    "    \n",
     "        dfl.at[isim,'Value'] = float(sim[isim])\n",
     "\n",
     "# make the 2D simulated model on a regular grid        \n",
@@ -802,7 +807,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 12,
    "metadata": {
     "scrolled": false
    },
@@ -810,7 +815,7 @@
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "9c8357390a12455a8285bf4feb0476cb",
+       "model_id": "ecf1423970ad4fe3b0eb914a3c38127b",
        "version_major": 2,
        "version_minor": 0
       },
@@ -824,12 +829,12 @@
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "22e3a06b5a5243219b21db31732e097d",
+       "model_id": "70416ed18def48d1a00a1af209b2dbe6",
        "version_major": 2,
        "version_minor": 0
       },
       "text/plain": [
-       "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 432x288 with 3 Axes>', 'i…"
+       "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 3 Axes>', 'i…"
       ]
      },
      "metadata": {},
@@ -903,7 +908,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.9.12"
+   "version": "3.11.4"
   }
  },
  "nbformat": 4,