diff --git a/notebooks/Socet2ISIS.ipynb b/notebooks/Socet2ISIS.ipynb index fe3a81a97930daff220df4be6cdf336f5081aaf4..04b6b2c273ff071d3d8d461331c9114267aeadfe 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 9f1dbcc99b4399f805d7f58bed893471e752d250..b9830c225eeb82c697ce349196565c01fafde965 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))