Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Plio
Commits
9376ac55
Commit
9376ac55
authored
6 years ago
by
Adam Paquette
Browse files
Options
Downloads
Patches
Plain Diff
Added to ipf from dataframe. Also updated both gpf and ipf writer tests
parent
38da1c1c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
notebooks/Socet2ISIS.ipynb
+104
-77
104 additions, 77 deletions
notebooks/Socet2ISIS.ipynb
plio/io/io_bae.py
+49
-2
49 additions, 2 deletions
plio/io/io_bae.py
plio/io/tests/test_io_bae.py
+36
-5
36 additions, 5 deletions
plio/io/tests/test_io_bae.py
with
189 additions
and
84 deletions
notebooks/Socet2ISIS.ipynb
+
104
−
77
View file @
9376ac55
...
...
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count":
8
,
"execution_count":
2
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -15,12 +15,12 @@
"import numpy as np\n",
"\n",
"from plio.examples import get_path\n",
"from plio.io.io_bae import read_gpf"
"from plio.io.io_bae import read_gpf
, read_ipf
"
]
},
{
"cell_type": "code",
"execution_count":
9
,
"execution_count":
null
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -69,80 +69,7 @@
" # Sets the value of PATH to the path of the ATF file\n",
" files_dict['PATH'] = os.path.dirname(os.path.abspath(atf_file))\n",
" \n",
" return files_dict\n",
" \n",
"@singledispatch\n",
"def read_ipf(arg):\n",
" return str(arg)\n",
"\n",
"@read_ipf.register(str)\n",
"def read_ipf_str(input_data):\n",
" \"\"\"\n",
" Read a socet ipf file into a pandas data frame\n",
"\n",
" Parameters\n",
" ----------\n",
" input_data : str\n",
" path to the an input data file\n",
"\n",
" Returns\n",
" -------\n",
" df : pd.DataFrame\n",
" containing the ipf data with appropriate column names and indices\n",
" \"\"\"\n",
"\n",
" # Check that the number of rows is matching the expected number\n",
" with open(input_data, 'r') as f:\n",
" for i, l in enumerate(f):\n",
" if i == 1:\n",
" cnt = int(l)\n",
" elif i == 2:\n",
" col = l\n",
" break\n",
" \n",
" columns = np.genfromtxt(input_data, skip_header=2, dtype='unicode',\n",
" max_rows = 1, delimiter = ',')\n",
"\n",
" # TODO: Add unicode conversion\n",
" d = [line.split() for line in open(input_data, 'r')]\n",
" d = np.hstack(np.array(d[3:]))\n",
" \n",
" d = d.reshape(-1, 12)\n",
" \n",
" df = pd.DataFrame(d, columns=columns)\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",
" # Soft conversion of numeric types to numerics, allows str in first col for point_id\n",
" df = df.apply(pd.to_numeric, errors='ignore')\n",
"\n",
" return df\n",
"\n",
"@read_ipf.register(list)\n",
"def read_ipf_list(input_data_list):\n",
" \"\"\"\n",
" Read a socet ipf file into a pandas data frame\n",
"\n",
" Parameters\n",
" ----------\n",
" input_data_list : list\n",
" list of paths to the a set of input data files\n",
"\n",
" Returns\n",
" -------\n",
" df : pd.DataFrame\n",
" containing the ipf data with appropriate column names and indices\n",
" \"\"\"\n",
" frames = []\n",
"\n",
" for input_file in input_data_list:\n",
" frames.append(read_ipf(input_file))\n",
"\n",
" df = pd.concat(frames)\n",
"\n",
" return df"
" return files_dict"
]
},
{
...
...
@@ -2019,6 +1946,106 @@
"new_df"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"@singledispatch\n",
"def read_ipf(arg):\n",
" return str(arg)\n",
"\n",
"@read_ipf.register(str)\n",
"def read_ipf_str(input_data):\n",
" \"\"\"\n",
" Read a socet ipf file into a pandas data frame\n",
"\n",
" Parameters\n",
" ----------\n",
" input_data : str\n",
" path to the an input data file\n",
"\n",
" Returns\n",
" -------\n",
" df : pd.DataFrame\n",
" containing the ipf data with appropriate column names and indices\n",
" \"\"\"\n",
"\n",
" # Check that the number of rows is matching the expected number\n",
" with open(input_data, 'r') as f:\n",
" for i, l in enumerate(f):\n",
" if i == 1:\n",
" cnt = int(l)\n",
" elif i == 2:\n",
" col = l\n",
" break\n",
" \n",
" columns = np.genfromtxt(input_data, skip_header=2, dtype='unicode',\n",
" max_rows = 1, delimiter = ',')\n",
"\n",
" # TODO: Add unicode conversion\n",
" d = [line.split() for line in open(input_data, 'r')]\n",
" d = np.hstack(np.array(d[3:]))\n",
" \n",
" d = d.reshape(-1, 12)\n",
" \n",
" df = pd.DataFrame(d, columns=columns)\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",
" # Soft conversion of numeric types to numerics, allows str in first col for point_id\n",
" df = df.apply(pd.to_numeric, errors='ignore')\n",
"\n",
" return df\n",
"\n",
"@read_ipf.register(list)\n",
"def read_ipf_list(input_data_list):\n",
" \"\"\"\n",
" Read a socet ipf file into a pandas data frame\n",
"\n",
" Parameters\n",
" ----------\n",
" input_data_list : list\n",
" list of paths to the a set of input data files\n",
"\n",
" Returns\n",
" -------\n",
" df : pd.DataFrame\n",
" containing the ipf data with appropriate column names and indices\n",
" \"\"\"\n",
" frames = []\n",
"\n",
" for input_file in input_data_list:\n",
" frames.append(read_ipf(input_file))\n",
"\n",
" df = pd.concat(frames)\n",
"\n",
" return df"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"x = np.array(['1', '2', '3'])\n",
"y = np.array(['1', '2', '3'])\n",
"\n",
"print((x == y).all())"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
%% Cell type:code id: tags:
```
python
import
os
import
sys
from
functools
import
singledispatch
import
warnings
import
pandas
as
pd
import
numpy
as
np
from
plio.examples
import
get_path
from
plio.io.io_bae
import
read_gpf
from
plio.io.io_bae
import
read_gpf
,
read_ipf
```
%% Cell type:code id: tags:
```
python
# Reads a .atf file and outputs all of the
# .ipf, .gpf, .sup, .prj, and path to locate the
# .apf file (should be the same as all others)
def
read_atf
(
atf_file
):
with
open
(
atf_file
)
as
f
:
files
=
[]
ipf
=
[]
sup
=
[]
files_dict
=
[]
# Grabs every PRJ, GPF, SUP, and IPF image from the ATF file
for
line
in
f
:
if
line
[
-
4
:
-
1
]
==
'
prj
'
or
line
[
-
4
:
-
1
]
==
'
gpf
'
or
line
[
-
4
:
-
1
]
==
'
sup
'
or
line
[
-
4
:
-
1
]
==
'
ipf
'
or
line
[
-
4
:
-
1
]
==
'
atf
'
:
files
.
append
(
line
)
files
=
np
.
array
(
files
)
# Creates appropriate arrays for certain files in the right format
for
file
in
files
:
file
=
file
.
strip
()
file
=
file
.
split
(
'
'
)
# Grabs all the IPF files
if
file
[
1
].
endswith
(
'
.ipf
'
):
ipf
.
append
(
file
[
1
])
# Grabs all the SUP files
if
file
[
1
].
endswith
(
'
.sup
'
):
sup
.
append
(
file
[
1
])
files_dict
.
append
(
file
)
# Creates a dict out of file lists for GPF, PRJ, IPF, and ATF
files_dict
=
(
dict
(
files_dict
))
# Sets the value of IMAGE_IPF to all IPF images
files_dict
[
'
IMAGE_IPF
'
]
=
ipf
# Sets the value of IMAGE_SUP to all SUP images
files_dict
[
'
IMAGE_SUP
'
]
=
sup
# Sets the value of PATH to the path of the ATF file
files_dict
[
'
PATH
'
]
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
atf_file
))
return
files_dict
@singledispatch
def
read_ipf
(
arg
):
return
str
(
arg
)
@read_ipf.register
(
str
)
def
read_ipf_str
(
input_data
):
"""
Read a socet ipf file into a pandas data frame
Parameters
----------
input_data : str
path to the an input data file
Returns
-------
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
):
if
i
==
1
:
cnt
=
int
(
l
)
elif
i
==
2
:
col
=
l
break
columns
=
np
.
genfromtxt
(
input_data
,
skip_header
=
2
,
dtype
=
'
unicode
'
,
max_rows
=
1
,
delimiter
=
'
,
'
)
# TODO: Add unicode conversion
d
=
[
line
.
split
()
for
line
in
open
(
input_data
,
'
r
'
)]
d
=
np
.
hstack
(
np
.
array
(
d
[
3
:]))
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
))
# Soft conversion of numeric types to numerics, allows str in first col for point_id
df
=
df
.
apply
(
pd
.
to_numeric
,
errors
=
'
ignore
'
)
return
df
@read_ipf.register
(
list
)
def
read_ipf_list
(
input_data_list
):
"""
Read a socet ipf file into a pandas data frame
Parameters
----------
input_data_list : list
list of paths to the a set of input data files
Returns
-------
df : pd.DataFrame
containing the ipf data with appropriate column names and indices
"""
frames
=
[]
for
input_file
in
input_data_list
:
frames
.
append
(
read_ipf
(
input_file
))
df
=
pd
.
concat
(
frames
)
return
df
```
%% Cell type:code id: tags:
```
python
atf_dict
=
read_atf
(
get_path
(
'
CTX_Athabasca_Middle_step0.atf
'
))
gpf_file
=
os
.
path
.
join
(
atf_dict
[
'
PATH
'
],
atf_dict
[
'
GP_FILE
'
]);
ipf_list
=
[
os
.
path
.
join
(
atf_dict
[
'
PATH
'
],
i
)
for
i
in
atf_dict
[
'
IMAGE_IPF
'
]]
gpf_df
=
read_gpf
(
gpf_file
).
set_index
(
'
point_id
'
)
ipf_df
=
read_ipf
(
ipf_list
).
set_index
(
'
pt_id
'
)
point_diff
=
ipf_df
.
index
.
difference
(
gpf_df
.
index
)
if
len
(
point_diff
)
!=
0
:
warnings
.
warn
(
"
The following points found in ipf files missing from gpf file:
\n\n
{}.
\
\n\n
Continuing, but these points will be missing from the control network
"
.
format
(
list
(
point_diff
)))
new_df
=
ipf_df
.
merge
(
gpf_df
,
left_index
=
True
,
right_index
=
True
)
new_df
```
%% Output
/Users/adampaquette/anaconda/envs/pysat/lib/python3.6/site-packages/ipykernel_launcher.py:12: UserWarning: The following points found in ipf files missing from gpf file:
['P03_002226_1895_XI_09N203W_15', 'P03_002226_1895_XI_09N203W_16', 'P03_002226_1895_XI_09N203W_17', 'P03_002226_1895_XI_09N203W_18', 'P03_002226_1895_XI_09N203W_19', 'P03_002226_1895_XI_09N203W_20', 'P03_002226_1895_XI_09N203W_21', 'P03_002226_1895_XI_09N203W_22', 'P03_002226_1895_XI_09N203W_24', 'P03_002226_1895_XI_09N203W_26', 'P03_002226_1895_XI_09N203W_30', 'P03_002226_1895_XI_09N203W_31', 'P03_002226_1895_XI_09N203W_32', 'P03_002226_1895_XI_09N203W_34', 'P03_002226_1895_XI_09N203W_36', 'P03_002226_1895_XI_09N203W_37', 'P03_002226_1895_XI_09N203W_44', 'P03_002226_1895_XI_09N203W_48', 'P03_002226_1895_XI_09N203W_49', 'P03_002226_1895_XI_09N203W_56', 'P03_002226_1895_XI_09N203W_57', 'P03_002226_1895_XI_09N203W_61', 'P03_002226_1895_XI_09N203W_62', 'P03_002226_1895_XI_09N203W_63', 'P03_002226_1895_XI_09N203W_65', 'P19_008344_1894_XN_09N203W_4', 'P20_008845_1894_XN_09N203W_15'].
Continuing, but these points will be missing from the control network
if sys.path[0] == '':
val fid_val no_obs l. s. \
10_8344_8845_4r 1 0 0 -2919.380615 1052.729004
10_8344_8845_4r 1 0 0 -4044.697510 1008.950928
10_8344_8845_4r 1 0 0 1700.584473 -2390.001709
10_8344_8845_4r 1 0 0 2006.141113 -2234.915283
11_8344_8845_4r 1 0 0 370.151917 2340.653076
11_8344_8845_4r 1 0 0 -761.216064 2303.787109
11_8344_8845_4r 1 0 0 4985.437988 -1070.364990
11_8344_8845_4r 1 0 0 5293.700195 -993.390625
12_8344_8845_4r 1 0 0 236.395218 984.833252
12_8344_8845_4r 1 0 0 -889.364441 966.533997
12_8344_8845_4r 1 0 0 4856.525391 -2439.154785
12_8344_8845_4r 1 0 0 5158.205566 -2295.737549
13_8344_8845_4r 1 0 0 -1431.023804 1817.888672
13_8344_8845_4r 1 0 0 -2559.871338 1777.522827
13_8344_8845_4r 1 0 0 3186.063232 -1598.743530
13_8344_8845_4r 1 0 0 3493.876221 -1493.029175
14_8344_8845_4r 1 0 0 3518.268066 2495.108643
14_8344_8845_4r 1 0 0 2385.278320 2476.032227
14_8344_8845_4r 1 0 0 8131.361816 -902.645325
14_8344_8845_4r 1 0 0 8437.115234 -842.309326
15_8344_8845_4r_mt_z 1 0 0 3522.998535 1049.406982
15_8344_8845_4r_mt_z 1 0 0 2395.869385 1038.165405
15_8344_8845_4r_mt_z 1 0 0 8142.054688 -2364.445557
15_8344_8845_4r_mt_z 1 0 0 8440.085938 -2219.049805
16_8344_8845_4r 1 0 0 1885.346313 1807.367065
16_8344_8845_4r 1 0 0 756.099792 1785.494751
16_8344_8845_4r 1 0 0 6502.070313 -1593.964233
16_8344_8845_4r 1 0 0 6805.896973 -1493.774048
17_8344_8845_2r_mt_z 1 0 0 -2015.364380 465.268188
17_8344_8845_2r_mt_z 1 0 0 -3138.269531 442.515503
... ... ... ... ... ...
P20_008845_1894_XN_09N203W_18 1 0 1 8918.806641 -1701.755249
P20_008845_1894_XN_09N203W_2 1 0 1 -2277.691406 -2240.823486
P20_008845_1894_XN_09N203W_2 1 0 0 -3389.000000 -2155.000000
P20_008845_1894_XN_09N203W_2 1 0 1 -5474.326660 842.207031
P20_008845_1894_XN_09N203W_2 1 0 0 -4613.785645 643.217224
P20_008845_1894_XN_09N203W_3 1 0 1 -1801.096436 -2078.479004
P20_008845_1894_XN_09N203W_3 1 0 0 -2913.000000 -2000.000000
P20_008845_1894_XN_09N203W_3 1 0 1 -4997.791504 1000.375854
P20_008845_1894_XN_09N203W_3 1 0 0 -4137.536133 774.480347
P20_008845_1894_XN_09N203W_4 1 0 1 -2103.971680 184.334869
P20_008845_1894_XN_09N203W_4 1 0 1 -3226.000000 167.000000
P20_008845_1894_XN_09N203W_5 1 0 1 -1813.285278 3.928788
P20_008845_1894_XN_09N203W_5 1 0 1 -2934.000000 -6.000000
P20_008845_1894_XN_09N203W_5 1 0 0 -4165.228516 2507.076660
P20_008845_1894_XN_09N203W_6 1 0 1 -2250.549072 1572.788086
P20_008845_1894_XN_09N203W_6 1 0 3 -3378.000000 1532.000000
P20_008845_1894_XN_09N203W_6 1 0 1 2367.587646 -1849.272095
P20_008845_1894_XN_09N203W_6 1 0 1 2675.137207 -1730.558105
P20_008845_1894_XN_09N203W_7 1 0 1 -2249.931396 1712.971436
P20_008845_1894_XN_09N203W_7 1 0 3 -3378.000000 1672.000000
P20_008845_1894_XN_09N203W_7 1 0 1 2367.507813 -1706.241821
P20_008845_1894_XN_09N203W_7 1 0 1 2675.892578 -1596.527100
P20_008845_1894_XN_09N203W_8 1 0 1 -1664.131104 1875.622437
P20_008845_1894_XN_09N203W_8 1 0 3 -2793.000000 1837.000000
P20_008845_1894_XN_09N203W_8 1 0 1 2953.094727 -1538.956543
P20_008845_1894_XN_09N203W_8 1 0 1 3261.290039 -1439.873169
P20_008845_1894_XN_09N203W_9 1 0 1 332.072113 -2045.152222
P20_008845_1894_XN_09N203W_9 1 0 0 -780.000000 -1953.000000
P20_008845_1894_XN_09N203W_9 1 0 0 -2866.689453 1031.006104
P20_008845_1894_XN_09N203W_9 1 0 0 -2002.366211 824.604126
sig_l sig_s res_l res_s fid_x \
10_8344_8845_4r 0.000000 0.000000 0.059914 0.930311 0.0
10_8344_8845_4r 0.000000 0.000000 0.063678 0.661294 0.0
10_8344_8845_4r 0.000000 0.000000 -0.063695 -1.055619 0.0
10_8344_8845_4r 0.000000 0.000000 0.318779 -0.585138 0.0
11_8344_8845_4r 0.000000 0.000000 -0.239226 -1.113693 0.0
11_8344_8845_4r 0.000000 0.000000 -0.247307 -0.587299 0.0
11_8344_8845_4r 0.000000 0.000000 0.239207 1.080801 0.0
11_8344_8845_4r 0.000000 0.000000 0.672877 0.626316 0.0
12_8344_8845_4r 0.000000 0.000000 0.073683 -0.237114 0.0
12_8344_8845_4r 0.000000 0.000000 -0.251753 0.008170 0.0
12_8344_8845_4r 0.000000 0.000000 0.133406 0.068024 0.0
12_8344_8845_4r 0.000000 0.000000 0.487209 0.036399 0.0
13_8344_8845_4r 0.000000 0.000000 -0.056901 -0.383259 0.0
13_8344_8845_4r 0.000000 0.000000 -0.131265 -0.305102 0.0
13_8344_8845_4r 0.000000 0.000000 0.019201 0.485372 0.0
13_8344_8845_4r 0.000000 0.000000 0.568393 0.146750 0.0
14_8344_8845_4r 0.000000 0.000000 0.268449 1.000455 0.0
14_8344_8845_4r 0.000000 0.000000 0.389532 -0.299258 0.0
14_8344_8845_4r 0.000000 0.000000 -0.469784 0.023018 0.0
14_8344_8845_4r 0.000000 0.000000 0.289877 -0.829150 0.0
15_8344_8845_4r_mt_z 0.000000 0.000000 0.466921 1.168062 0.0
15_8344_8845_4r_mt_z 0.000000 0.000000 -0.170850 0.372485 0.0
15_8344_8845_4r_mt_z 0.000000 0.000000 -0.072035 -0.832436 0.0
15_8344_8845_4r_mt_z 0.000000 0.000000 0.274030 -0.850105 0.0
16_8344_8845_4r 0.000000 0.000000 -0.028473 -0.238015 0.0
16_8344_8845_4r 0.000000 0.000000 0.165338 -0.327408 0.0
16_8344_8845_4r 0.000000 0.000000 -0.007916 0.463232 0.0
16_8344_8845_4r 0.000000 0.000000 0.328896 0.019526 0.0
17_8344_8845_2r_mt_z 0.000000 0.000000 0.010045 0.244017 0.0
17_8344_8845_2r_mt_z 0.000000 0.000000 -0.023370 -0.248643 0.0
... ... ... ... ... ...
P20_008845_1894_XN_09N203W_18 0.022017 0.022017 0.734173 -0.074947 0.0
P20_008845_1894_XN_09N203W_2 0.144273 0.144273 -0.061422 -0.263554 0.0
P20_008845_1894_XN_09N203W_2 0.000000 0.000000 -0.073150 -0.271173 0.0
P20_008845_1894_XN_09N203W_2 0.275627 0.275627 0.164525 0.349547 0.0
P20_008845_1894_XN_09N203W_2 0.091086 0.091086 0.132736 0.239899 0.0
P20_008845_1894_XN_09N203W_3 0.062058 0.062058 -0.198696 -0.105860 0.0
P20_008845_1894_XN_09N203W_3 0.000000 0.000000 -0.088180 -0.049593 0.0
P20_008845_1894_XN_09N203W_3 0.132941 0.132941 0.257260 0.117777 0.0
P20_008845_1894_XN_09N203W_3 0.185544 0.185544 0.199301 0.065777 0.0
P20_008845_1894_XN_09N203W_4 0.146920 0.146920 0.182557 -0.000683 0.0
P20_008845_1894_XN_09N203W_4 0.000000 0.000000 -0.195774 -0.000066 0.0
P20_008845_1894_XN_09N203W_5 0.019047 0.019047 -0.235171 -0.174079 0.0
P20_008845_1894_XN_09N203W_5 0.000000 0.000000 -0.049005 0.437424 0.0
P20_008845_1894_XN_09N203W_5 0.000000 0.000000 0.447100 -0.219764 0.0
P20_008845_1894_XN_09N203W_6 0.025015 0.025015 -0.146990 0.192274 0.0
P20_008845_1894_XN_09N203W_6 0.000000 0.000000 0.026541 0.063346 0.0
P20_008845_1894_XN_09N203W_6 0.025110 0.025110 -0.040890 -0.136247 0.0
P20_008845_1894_XN_09N203W_6 0.064276 0.064276 0.546035 -0.185103 0.0
P20_008845_1894_XN_09N203W_7 0.010596 0.010596 -0.102909 0.079389 0.0
P20_008845_1894_XN_09N203W_7 0.000000 0.000000 0.055623 0.013456 0.0
P20_008845_1894_XN_09N203W_7 0.047435 0.047435 -0.157931 -0.042074 0.0
P20_008845_1894_XN_09N203W_7 0.058218 0.058218 0.589561 -0.111421 0.0
P20_008845_1894_XN_09N203W_8 0.017266 0.017266 -0.239689 -0.402891 0.0
P20_008845_1894_XN_09N203W_8 0.000000 0.000000 -0.117483 -0.229337 0.0
P20_008845_1894_XN_09N203W_8 0.023364 0.023364 0.177406 0.403161 0.0
P20_008845_1894_XN_09N203W_8 0.023538 0.023538 0.575510 0.180705 0.0
P20_008845_1894_XN_09N203W_9 0.232865 0.232865 0.095817 -0.483899 0.0
P20_008845_1894_XN_09N203W_9 0.000000 0.000000 0.298743 -0.045963 0.0
P20_008845_1894_XN_09N203W_9 0.000000 0.000000 -0.038437 0.471309 0.0
P20_008845_1894_XN_09N203W_9 0.397616 0.397616 -0.141172 0.105223 0.0
... known lat_Y_North long_X_East \
10_8344_8845_4r ... 0 0.159378 2.724649
10_8344_8845_4r ... 0 0.159378 2.724649
10_8344_8845_4r ... 0 0.159378 2.724649
10_8344_8845_4r ... 0 0.159378 2.724649
11_8344_8845_4r ... 0 0.164905 2.721815
11_8344_8845_4r ... 0 0.164905 2.721815
11_8344_8845_4r ... 0 0.164905 2.721815
11_8344_8845_4r ... 0 0.164905 2.721815
12_8344_8845_4r ... 0 0.164949 2.724076
12_8344_8845_4r ... 0 0.164949 2.724076
12_8344_8845_4r ... 0 0.164949 2.724076
12_8344_8845_4r ... 0 0.164949 2.724076
13_8344_8845_4r ... 0 0.161840 2.723059
13_8344_8845_4r ... 0 0.161840 2.723059
13_8344_8845_4r ... 0 0.161840 2.723059
13_8344_8845_4r ... 0 0.161840 2.723059
14_8344_8845_4r ... 0 0.170415 2.720880
14_8344_8845_4r ... 0 0.170415 2.720880
14_8344_8845_4r ... 0 0.170415 2.720880
14_8344_8845_4r ... 0 0.170415 2.720880
15_8344_8845_4r_mt_z ... 1 0.170723 2.723266
15_8344_8845_4r_mt_z ... 1 0.170723 2.723266
15_8344_8845_4r_mt_z ... 1 0.170723 2.723266
15_8344_8845_4r_mt_z ... 1 0.170723 2.723266
16_8344_8845_4r ... 0 0.167682 2.722359
16_8344_8845_4r ... 0 0.167682 2.722359
16_8344_8845_4r ... 0 0.167682 2.722359
16_8344_8845_4r ... 0 0.167682 2.722359
17_8344_8845_2r_mt_z ... 1 0.161092 2.725426
17_8344_8845_2r_mt_z ... 1 0.161092 2.725426
... ... ... ... ...
P20_008845_1894_XN_09N203W_18 ... 0 0.171455 2.722281
P20_008845_1894_XN_09N203W_2 ... 0 0.161184 2.729925
P20_008845_1894_XN_09N203W_2 ... 0 0.161184 2.729925
P20_008845_1894_XN_09N203W_2 ... 0 0.161184 2.729925
P20_008845_1894_XN_09N203W_2 ... 0 0.161184 2.729925
P20_008845_1894_XN_09N203W_3 ... 0 0.161992 2.729563
P20_008845_1894_XN_09N203W_3 ... 0 0.161992 2.729563
P20_008845_1894_XN_09N203W_3 ... 0 0.161992 2.729563
P20_008845_1894_XN_09N203W_3 ... 0 0.161992 2.729563
P20_008845_1894_XN_09N203W_4 ... 0 0.160994 2.725912
P20_008845_1894_XN_09N203W_4 ... 0 0.160994 2.725912
P20_008845_1894_XN_09N203W_5 ... 0 0.161544 2.726149
P20_008845_1894_XN_09N203W_5 ... 0 0.161544 2.726149
P20_008845_1894_XN_09N203W_5 ... 0 0.161544 2.726149
P20_008845_1894_XN_09N203W_6 ... 0 0.160447 2.723639
P20_008845_1894_XN_09N203W_6 ... 0 0.160447 2.723639
P20_008845_1894_XN_09N203W_6 ... 0 0.160447 2.723639
P20_008845_1894_XN_09N203W_6 ... 0 0.160447 2.723639
P20_008845_1894_XN_09N203W_7 ... 0 0.160419 2.723407
P20_008845_1894_XN_09N203W_7 ... 0 0.160419 2.723407
P20_008845_1894_XN_09N203W_7 ... 0 0.160419 2.723407
P20_008845_1894_XN_09N203W_7 ... 0 0.160419 2.723407
P20_008845_1894_XN_09N203W_8 ... 0 0.161417 2.723012
P20_008845_1894_XN_09N203W_8 ... 0 0.161417 2.723012
P20_008845_1894_XN_09N203W_8 ... 0 0.161417 2.723012
P20_008845_1894_XN_09N203W_8 ... 0 0.161417 2.723012
P20_008845_1894_XN_09N203W_9 ... 0 0.165741 2.729053
P20_008845_1894_XN_09N203W_9 ... 0 0.165741 2.729053
P20_008845_1894_XN_09N203W_9 ... 0 0.165741 2.729053
P20_008845_1894_XN_09N203W_9 ... 0 0.165741 2.729053
ht sig0 sig1 sig2 res0 \
10_8344_8845_4r -2523.828227 0.0 0.0 25.000000 18.301328
10_8344_8845_4r -2523.828227 0.0 0.0 25.000000 18.301328
10_8344_8845_4r -2523.828227 0.0 0.0 25.000000 18.301328
10_8344_8845_4r -2523.828227 0.0 0.0 25.000000 18.301328
11_8344_8845_4r -2445.237027 0.0 0.0 30.000000 -22.046575
11_8344_8845_4r -2445.237027 0.0 0.0 30.000000 -22.046575
11_8344_8845_4r -2445.237027 0.0 0.0 30.000000 -22.046575
11_8344_8845_4r -2445.237027 0.0 0.0 30.000000 -22.046575
12_8344_8845_4r -2606.935163 0.0 0.0 100.000000 -7.549561
12_8344_8845_4r -2606.935163 0.0 0.0 100.000000 -7.549561
12_8344_8845_4r -2606.935163 0.0 0.0 100.000000 -7.549561
12_8344_8845_4r -2606.935163 0.0 0.0 100.000000 -7.549561
13_8344_8845_4r -2551.901554 0.0 0.0 4.536068 -1.643694
13_8344_8845_4r -2551.901554 0.0 0.0 4.536068 -1.643694
13_8344_8845_4r -2551.901554 0.0 0.0 4.536068 -1.643694
13_8344_8845_4r -2551.901554 0.0 0.0 4.536068 -1.643694
14_8344_8845_4r -2505.953426 0.0 0.0 5.000000 -50.069808
14_8344_8845_4r -2505.953426 0.0 0.0 5.000000 -50.069808
14_8344_8845_4r -2505.953426 0.0 0.0 5.000000 -50.069808
14_8344_8845_4r -2505.953426 0.0 0.0 5.000000 -50.069808
15_8344_8845_4r_mt_z -2502.470000 0.0 0.0 5.000000 -34.817656
15_8344_8845_4r_mt_z -2502.470000 0.0 0.0 5.000000 -34.817656
15_8344_8845_4r_mt_z -2502.470000 0.0 0.0 5.000000 -34.817656
15_8344_8845_4r_mt_z -2502.470000 0.0 0.0 5.000000 -34.817656
16_8344_8845_4r -2558.312931 0.0 0.0 1.707214 -29.465246
16_8344_8845_4r -2558.312931 0.0 0.0 1.707214 -29.465246
16_8344_8845_4r -2558.312931 0.0 0.0 1.707214 -29.465246
16_8344_8845_4r -2558.312931 0.0 0.0 1.707214 -29.465246
17_8344_8845_2r_mt_z -2590.130000 0.0 0.0 2.000000 -10.779830
17_8344_8845_2r_mt_z -2590.130000 0.0 0.0 2.000000 -10.779830
... ... ... ... ... ...
P20_008845_1894_XN_09N203W_18 -2514.431453 0.0 0.0 0.000000 -38.388316
P20_008845_1894_XN_09N203W_2 -2535.712262 0.0 0.0 0.000000 42.067289
P20_008845_1894_XN_09N203W_2 -2535.712262 0.0 0.0 0.000000 42.067289
P20_008845_1894_XN_09N203W_2 -2535.712262 0.0 0.0 0.000000 42.067289
P20_008845_1894_XN_09N203W_2 -2535.712262 0.0 0.0 0.000000 42.067289
P20_008845_1894_XN_09N203W_3 -2525.215515 0.0 0.0 0.000000 36.033823
P20_008845_1894_XN_09N203W_3 -2525.215515 0.0 0.0 0.000000 36.033823
P20_008845_1894_XN_09N203W_3 -2525.215515 0.0 0.0 0.000000 36.033823
P20_008845_1894_XN_09N203W_3 -2525.215515 0.0 0.0 0.000000 36.033823
P20_008845_1894_XN_09N203W_4 -2562.446851 0.0 0.0 0.000000 -7.233876
P20_008845_1894_XN_09N203W_4 -2562.446851 0.0 0.0 0.000000 -7.233876
P20_008845_1894_XN_09N203W_5 -2560.812028 0.0 0.0 0.000000 7.498790
P20_008845_1894_XN_09N203W_5 -2560.812028 0.0 0.0 0.000000 7.498790
P20_008845_1894_XN_09N203W_5 -2560.812028 0.0 0.0 0.000000 7.498790
P20_008845_1894_XN_09N203W_6 -2605.266130 0.0 0.0 0.000000 7.687475
P20_008845_1894_XN_09N203W_6 -2605.266130 0.0 0.0 0.000000 7.687475
P20_008845_1894_XN_09N203W_6 -2605.266130 0.0 0.0 0.000000 7.687475
P20_008845_1894_XN_09N203W_6 -2605.266130 0.0 0.0 0.000000 7.687475
P20_008845_1894_XN_09N203W_7 -2619.498291 0.0 0.0 0.000000 6.358447
P20_008845_1894_XN_09N203W_7 -2619.498291 0.0 0.0 0.000000 6.358447
P20_008845_1894_XN_09N203W_7 -2619.498291 0.0 0.0 0.000000 6.358447
P20_008845_1894_XN_09N203W_7 -2619.498291 0.0 0.0 0.000000 6.358447
P20_008845_1894_XN_09N203W_8 -2608.028730 0.0 0.0 0.000000 -0.219662
P20_008845_1894_XN_09N203W_8 -2608.028730 0.0 0.0 0.000000 -0.219662
P20_008845_1894_XN_09N203W_8 -2608.028730 0.0 0.0 0.000000 -0.219662
P20_008845_1894_XN_09N203W_8 -2608.028730 0.0 0.0 0.000000 -0.219662
P20_008845_1894_XN_09N203W_9 -2586.686862 0.0 0.0 0.000000 15.191825
P20_008845_1894_XN_09N203W_9 -2586.686862 0.0 0.0 0.000000 15.191825
P20_008845_1894_XN_09N203W_9 -2586.686862 0.0 0.0 0.000000 15.191825
P20_008845_1894_XN_09N203W_9 -2586.686862 0.0 0.0 0.000000 15.191825
res1 res2
10_8344_8845_4r 44.206259 416.201741
10_8344_8845_4r 44.206259 416.201741
10_8344_8845_4r 44.206259 416.201741
10_8344_8845_4r 44.206259 416.201741
11_8344_8845_4r 103.403228 173.210013
11_8344_8845_4r 103.403228 173.210013
11_8344_8845_4r 103.403228 173.210013
11_8344_8845_4r 103.403228 173.210013
12_8344_8845_4r 93.170584 180.058858
12_8344_8845_4r 93.170584 180.058858
12_8344_8845_4r 93.170584 180.058858
12_8344_8845_4r 93.170584 180.058858
13_8344_8845_4r 74.244153 319.554535
13_8344_8845_4r 74.244153 319.554535
13_8344_8845_4r 74.244153 319.554535
13_8344_8845_4r 74.244153 319.554535
14_8344_8845_4r 144.316524 -164.540707
14_8344_8845_4r 144.316524 -164.540707
14_8344_8845_4r 144.316524 -164.540707
14_8344_8845_4r 144.316524 -164.540707
15_8344_8845_4r_mt_z 145.864550 0.214023
15_8344_8845_4r_mt_z 145.864550 0.214023
15_8344_8845_4r_mt_z 145.864550 0.214023
15_8344_8845_4r_mt_z 145.864550 0.214023
16_8344_8845_4r 121.908506 19.874949
16_8344_8845_4r 121.908506 19.874949
16_8344_8845_4r 121.908506 19.874949
16_8344_8845_4r 121.908506 19.874949
17_8344_8845_2r_mt_z 38.761214 0.236077
17_8344_8845_2r_mt_z 38.761214 0.236077
... ... ...
P20_008845_1894_XN_09N203W_18 195.050373 -391.289238
P20_008845_1894_XN_09N203W_2 -12.658160 627.742625
P20_008845_1894_XN_09N203W_2 -12.658160 627.742625
P20_008845_1894_XN_09N203W_2 -12.658160 627.742625
P20_008845_1894_XN_09N203W_2 -12.658160 627.742625
P20_008845_1894_XN_09N203W_3 -4.170818 616.480181
P20_008845_1894_XN_09N203W_3 -4.170818 616.480181
P20_008845_1894_XN_09N203W_3 -4.170818 616.480181
P20_008845_1894_XN_09N203W_3 -4.170818 616.480181
P20_008845_1894_XN_09N203W_4 33.324946 574.887719
P20_008845_1894_XN_09N203W_4 33.324946 574.887719
P20_008845_1894_XN_09N203W_5 33.109007 581.149470
P20_008845_1894_XN_09N203W_5 33.109007 581.149470
P20_008845_1894_XN_09N203W_5 33.109007 581.149470
P20_008845_1894_XN_09N203W_6 59.859663 375.680663
P20_008845_1894_XN_09N203W_6 59.859663 375.680663
P20_008845_1894_XN_09N203W_6 59.859663 375.680663
P20_008845_1894_XN_09N203W_6 59.859663 375.680663
P20_008845_1894_XN_09N203W_7 61.278242 375.840988
P20_008845_1894_XN_09N203W_7 61.278242 375.840988
P20_008845_1894_XN_09N203W_7 61.278242 375.840988
P20_008845_1894_XN_09N203W_7 61.278242 375.840988
P20_008845_1894_XN_09N203W_8 71.414267 336.409684
P20_008845_1894_XN_09N203W_8 71.414267 336.409684
P20_008845_1894_XN_09N203W_8 71.414267 336.409684
P20_008845_1894_XN_09N203W_8 71.414267 336.409684
P20_008845_1894_XN_09N203W_9 22.094037 544.874936
P20_008845_1894_XN_09N203W_9 22.094037 544.874936
P20_008845_1894_XN_09N203W_9 22.094037 544.874936
P20_008845_1894_XN_09N203W_9 22.094037 544.874936
[919 rows x 23 columns]
%% Cell type:code id: tags:
```
python
@singledispatch
def
read_ipf
(
arg
):
return
str
(
arg
)
@read_ipf.register
(
str
)
def
read_ipf_str
(
input_data
):
"""
Read a socet ipf file into a pandas data frame
Parameters
----------
input_data : str
path to the an input data file
Returns
-------
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
):
if
i
==
1
:
cnt
=
int
(
l
)
elif
i
==
2
:
col
=
l
break
columns
=
np
.
genfromtxt
(
input_data
,
skip_header
=
2
,
dtype
=
'
unicode
'
,
max_rows
=
1
,
delimiter
=
'
,
'
)
# TODO: Add unicode conversion
d
=
[
line
.
split
()
for
line
in
open
(
input_data
,
'
r
'
)]
d
=
np
.
hstack
(
np
.
array
(
d
[
3
:]))
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
))
# Soft conversion of numeric types to numerics, allows str in first col for point_id
df
=
df
.
apply
(
pd
.
to_numeric
,
errors
=
'
ignore
'
)
return
df
@read_ipf.register
(
list
)
def
read_ipf_list
(
input_data_list
):
"""
Read a socet ipf file into a pandas data frame
Parameters
----------
input_data_list : list
list of paths to the a set of input data files
Returns
-------
df : pd.DataFrame
containing the ipf data with appropriate column names and indices
"""
frames
=
[]
for
input_file
in
input_data_list
:
frames
.
append
(
read_ipf
(
input_file
))
df
=
pd
.
concat
(
frames
)
return
df
```
%% Cell type:code id: tags:
```
python
x
=
np
.
array
([
'
1
'
,
'
2
'
,
'
3
'
])
y
=
np
.
array
([
'
1
'
,
'
2
'
,
'
3
'
])
print
((
x
==
y
).
all
())
```
%% Output
True
%% Cell type:code id: tags:
```
python
```
...
...
This diff is collapsed.
Click to expand it.
plio/io/io_bae.py
+
49
−
2
View file @
9376ac55
...
...
@@ -85,11 +85,10 @@ def read_ipf_str(input_data):
columns
=
np
.
genfromtxt
(
input_data
,
skip_header
=
2
,
dtype
=
'
unicode
'
,
max_rows
=
1
,
delimiter
=
'
,
'
)
# TODO: Add unicode conversion
d
=
[
line
.
split
()
for
line
in
open
(
input_data
,
'
r
'
)]
d
=
np
.
hstack
(
np
.
array
(
d
[
3
:]))
d
=
d
.
reshape
(
-
1
,
12
)
d
=
d
.
reshape
(
-
1
,
12
)
.
astype
(
'
unicode
'
)
df
=
pd
.
DataFrame
(
d
,
columns
=
columns
)
file
=
os
.
path
.
split
(
os
.
path
.
splitext
(
input_data
)[
0
])[
1
]
...
...
@@ -126,6 +125,54 @@ def read_ipf_list(input_data_list):
return
df
def
save_ipf
(
df
,
output_path
):
"""
Write a socet gpf file from a gpf-defined pandas dataframe
Parameters
----------
df : pd.DataFrame
Pandas DataFrame
output_file : str
path to the output data file
Returns
-------
int : success value
0 = success, 1 = errors
"""
for
ipf_file
,
ipf_df
in
df
.
groupby
(
'
ipf_file
'
):
output_file
=
os
.
path
.
join
(
output_path
,
ipf_file
+
'
.ipf
'
)
# Check that file can be opened
try
:
outIPF
=
open
(
output_file
,
'
w
'
,
newline
=
'
\r\n
'
)
except
:
print
(
'
Unable to open output ipf file: {0}
'
.
format
(
output_file
))
return
1
#grab number of rows in pandas dataframe ipf group
numpts
=
len
(
ipf_df
)
#Output ipf header
outIPF
.
write
(
'
IMAGE POINT FILE
\n
'
)
outIPF
.
write
(
'
{0}
\n
'
.
format
(
numpts
))
outIPF
.
write
(
'
pt_id,val,fid_val,no_obs,l.,s.,sig_l,sig_s,res_l,res_s,fid_x,fid_y
\n
'
)
for
index
,
row
in
ipf_df
.
iterrows
():
#Output coordinates to ipf file
outIPF
.
write
(
'
{0} {1} {2} {3}
\n
'
.
format
(
row
[
'
pt_id
'
],
row
[
'
val
'
],
row
[
'
fid_val
'
],
row
[
'
no_obs
'
]))
outIPF
.
write
(
'
{:0.6f} {:0.6f}
\n
'
.
format
(
row
[
'
l.
'
],
row
[
'
s.
'
]))
outIPF
.
write
(
'
{:0.6f} {:0.6f}
\n
'
.
format
(
row
[
'
sig_l
'
],
row
[
'
sig_s
'
]))
outIPF
.
write
(
'
{:0.6f} {:0.6f}
\n
'
.
format
(
row
[
'
res_l
'
],
row
[
'
res_s
'
]))
outIPF
.
write
(
'
{:0.6f} {:0.6f}
\n\n
'
.
format
(
row
[
'
fid_x
'
],
row
[
'
fid_y
'
]))
outIPF
.
close
()
return
def
read_gpf
(
input_data
):
"""
Read a socet gpf file into a pandas data frame
...
...
This diff is collapsed.
Click to expand it.
plio/io/tests/test_io_bae.py
+
36
−
5
View file @
9376ac55
import
json
import
os
import
numpy
as
np
import
pandas
as
pd
from
pandas.util.testing
import
assert_frame_equal
from
plio.io.io_bae
import
socetset_keywords_to_json
,
read_gpf
,
save_gpf
,
read_ipf
from
plio.io.io_bae
import
socetset_keywords_to_json
,
read_gpf
,
save_gpf
,
read_ipf
,
save_ipf
from
plio.examples
import
get_path
import
pytest
...
...
@@ -25,15 +26,42 @@ def insight_ipf():
def
insight_expected_ipf
():
return
pd
.
read_csv
(
get_path
(
'
P20_008845_1894_XN_09N203W.csv
'
))
@pytest.mark.parametrize
(
'
ipf, expected
'
,
[([
insight_ipf
()],
insight_expected_ipf
())])
def
test_read_ifp
(
ipf
,
expected
):
df
=
read_ipf
(
ipf
)
assert_frame_equal
(
df
,
expected
)
@pytest.mark.parametrize
(
'
gpf, expected
'
,
[(
insight_gpf
(),
insight_expected_gpf
())])
def
test_read_gfp
(
gpf
,
expected
):
df
=
read_gpf
(
gpf
)
assert_frame_equal
(
df
,
expected
)
@pytest.mark.parametrize
(
'
ipf,
expected
'
,
[(
[
insight_ipf
()
],
insight_expected_ipf
()
)])
def
test_
read_ifp
(
ipf
,
expected
):
@pytest.mark.parametrize
(
'
ipf,
file
'
,
[(
insight_ipf
()
,
'
plio/io/tests/temp
'
)])
def
test_
write_ipf
(
ipf
,
file
):
df
=
read_ipf
(
ipf
)
assert_frame_equal
(
df
,
expected
)
save_ipf
(
df
,
file
)
file
=
os
.
path
.
join
(
file
,
'
P20_008845_1894_XN_09N203W.ipf
'
)
with
open
(
ipf
)
as
f
:
fl
=
f
.
readlines
()
with
open
(
file
)
as
f
:
fs
=
f
.
readlines
()
# Check that the header is the same
for
i
in
range
(
3
):
assert
fl
[
i
]
==
fs
[
i
]
truth_arr
=
[
line
.
split
()
for
line
in
open
(
ipf
,
'
r
'
)][
3
:]
truth_arr
=
np
.
hstack
(
np
.
array
(
truth_arr
))
truth_arr
=
truth_arr
.
reshape
(
-
1
,
12
)
test_arr
=
[
line
.
split
()
for
line
in
open
(
file
,
'
r
'
)][
3
:]
test_arr
=
np
.
hstack
(
np
.
array
(
test_arr
))
test_arr
=
test_arr
.
reshape
(
-
1
,
12
)
(
truth_arr
==
test_arr
).
all
()
@pytest.mark.parametrize
(
'
gpf, file
'
,
[(
insight_gpf
(),
'
out.gpf
'
)])
def
test_write_gpf
(
gpf
,
file
):
...
...
@@ -56,7 +84,10 @@ def test_write_gpf(gpf, file):
truth_arr
=
np
.
genfromtxt
(
gpf
,
skip_header
=
3
)
test_arr
=
np
.
genfromtxt
(
file
,
skip_header
=
3
)
np
.
testing
.
assert_array_almost_equal
(
truth_arr
,
test_arr
)
(
truth_arr
==
test_arr
).
all
()
# np.testing.assert_array_almost_equal(truth_arr, test_arr)
def
test_create_from_socet_lis
():
socetlis
=
get_path
(
'
socet_isd.lis
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment