From 91949961bd3f887e7ce2012c676646b7536756cd Mon Sep 17 00:00:00 2001
From: Adam Paquette <acp263@nau.edu>
Date: Fri, 20 Apr 2018 14:50:47 -0700
Subject: [PATCH] Small change to update file column in dataframe.

---
 notebooks/Socet2ISIS.ipynb | 13 +++++++------
 plio/io/io_bae.py          |  3 ++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/notebooks/Socet2ISIS.ipynb b/notebooks/Socet2ISIS.ipynb
index fe3a81a..04b6b2c 100644
--- a/notebooks/Socet2ISIS.ipynb
+++ b/notebooks/Socet2ISIS.ipynb
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -20,7 +20,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -110,7 +110,8 @@
     "    d = d.reshape(-1, 12)\n",
     "    \n",
     "    df = pd.DataFrame(d, columns=columns)\n",
-    "    df['ipf_file'] = pd.Series(np.full((len(df['pt_id'])), input_data), index = df.index)\n",
+    "    file = os.path.split(os.path.splitext(input_data)[0])[1]\n",
+    "    df['ipf_file'] = pd.Series(np.full((len(df['pt_id'])), file), index = df.index)\n",
     "\n",
     "    assert int(cnt) == len(df), 'Dataframe length {} does not match point length {}.'.format(int(cnt), len(df))\n",
     "    \n",
@@ -127,7 +128,7 @@
     "    Parameters\n",
     "    ----------\n",
     "    input_data_list : list\n",
-    "                 list of paths to the a set of input data files\n",
+    "                      list of paths to the a set of input data files\n",
     "\n",
     "    Returns\n",
     "    -------\n",
@@ -146,7 +147,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 22,
+   "execution_count": 10,
    "metadata": {},
    "outputs": [
     {
@@ -1994,7 +1995,7 @@
        "[919 rows x 23 columns]"
       ]
      },
-     "execution_count": 22,
+     "execution_count": 10,
      "metadata": {},
      "output_type": "execute_result"
     }
diff --git a/plio/io/io_bae.py b/plio/io/io_bae.py
index 9f1dbcc..b9830c2 100644
--- a/plio/io/io_bae.py
+++ b/plio/io/io_bae.py
@@ -72,7 +72,6 @@ def read_ipf_str(input_data):
     df : pd.DataFrame
          containing the ipf data with appropriate column names and indices
     """
-
     # Check that the number of rows is matching the expected number
     with open(input_data, 'r') as f:
         for i, l in enumerate(f):
@@ -92,6 +91,8 @@ def read_ipf_str(input_data):
     d = d.reshape(-1, 12)
 
     df = pd.DataFrame(d, columns=columns)
+    file = os.path.split(os.path.splitext(input_data)[0])[1]
+    df['ipf_file'] = pd.Series(np.full((len(df['pt_id'])), file), index = df.index)
 
     assert int(cnt) == len(df), 'Dataframe length {} does not match point length {}.'.format(int(cnt), len(df))
 
-- 
GitLab