Commit 2a5e1b49 authored by Tyler Thatcher's avatar Tyler Thatcher
Browse files
parents 8e5906f7 1bf9a376
Loading
Loading
Loading
Loading
+1894 −504

File changed.

Preview size limit exceeded, changes collapsed.

+122 −122

File changed.

Preview size limit exceeded, changes collapsed.

+3 −1
Original line number Diff line number Diff line
import json
import re
import os
from functools import singledispatch

import numpy as np
@@ -72,7 +73,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 +92,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))