Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
63510ae
files to test phase wrap between matlab and python
kuziekj Jun 1, 2020
0db0ff8
some testing
kuziekj Jun 18, 2020
d501cb2
added tests for first bad points and norm
kuziekj Jun 18, 2020
09a655d
more tests, found error, should match ppod
kuziekj Jun 19, 2020
7189784
removed unneeded if statement
kuziekj Jun 19, 2020
81bf184
more testing
kuziekj Jun 19, 2020
fe64262
changed how sd was calculated
kuziekj Jun 19, 2020
e48f7ef
nothing
kuziekj Jun 19, 2020
2ec933b
more testing
kuziekj Jun 19, 2020
eb7f55a
merging with py_mat_tests
kuziekj Jun 19, 2020
0c0345c
more testing
kuziekj Jun 19, 2020
b099f91
added file to compare p_pod and boxy.py outputs
kuziekj Jun 23, 2020
70e05d7
prelim work on making a testing file, based on fnirs tests
kuziekj Jun 24, 2020
509b749
fixed merged conflicts
kuziekj Jul 3, 2020
53ec209
removed files to test phase wrap, renamed other folders
kuziekj Jul 3, 2020
6029cca
changed test file to be similar in format to test_nirs
kuziekj Jul 3, 2020
31ee1df
added smaller files for testing
kuziekj Jul 6, 2020
10ffcd8
added tests for channels, coords, and data shape
kuziekj Jul 7, 2020
2fcecd9
added more tests, ready for testing data to be added
kuziekj Jul 8, 2020
fca7aad
forgot to remove dev folder, since this will be moved to the testing …
kuziekj Jul 8, 2020
ef8fede
moved test_boxy.py to io instead of preprocessing, same as test_nirx.py
kuziekj Jul 8, 2020
3646de2
coord tests were failing on mac due to very small diffs, use asser_al…
kuziekj Jul 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lasthdr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
D:\data\anc\1anc.hdr
43 changes: 29 additions & 14 deletions mne/io/boxy/boxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,14 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):

# Save our data based on data type.
data_[index_loc, :] = boxy_array[:, channel]

###need to fix the first few bad points in the recording###
n_bad_points = 12
for i_point in range(n_bad_points):
data_[:,i_point] = data_[:,n_bad_points]

# Phase unwrapping.

if i_data == 'Ph':
print('Fixing phase wrap')
# Accounts for sharp, sudden changes in phase
Expand All @@ -558,7 +564,7 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):

print('Detrending phase data')
# Remove trends and drifts that occur over time.
y = np.linspace(0, np.size(data_, axis=1) - 1,
y = np.linspace(1, np.size(data_, axis=1),
np.size(data_, axis=1))
x = np.transpose(y)
for i_chan in range(np.size(data_, axis=0)):
Expand All @@ -580,7 +586,7 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
ph_out_thr = 3

# Set ddof to 1 to mimic matlab.
sdph = np.std(data_, 1, ddof=1)
sdph = np.std(data_[:, n_bad_points - 1:], 1, ddof=1)
n_ph_out = np.zeros(np.size(data_, axis=0),
dtype=np.int8)

Expand All @@ -591,18 +597,27 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
if len(outliers) > 0:
if outliers[0] == 0:
outliers = outliers[1:]
if len(outliers) > 0:
if (outliers[-1] == np.size(data_,
axis=1) - 1):
outliers = outliers[:-1]
n_ph_out[i_chan] = int(len(outliers))
for i_pt in range(n_ph_out[i_chan]):
j_pt = outliers[i_pt]
data_[i_chan, j_pt] = (
(data_[i_chan, j_pt - 1] +
data_[i_chan, j_pt + 1]) / 2)

# Convert phase to pico seconds.
if (outliers[-1] == np.size(data_,
axis=1) - 1):
outliers = outliers[:-1]
n_ph_out[i_chan] = int(len(outliers))
for i_pt in range(n_ph_out[i_chan]):
j_pt = outliers[i_pt]
data_[i_chan, j_pt] = (
(data_[i_chan, j_pt - 1] +
data_[i_chan, j_pt + 1]) / 2)

# now let's normalise our data #
for i_chan in range(len(data_)):
if i_data == 'Ph':
data_[i_chan,:] = (data_[i_chan,:] -
np.mean(data_[i_chan,:]))
else:
data_[i_chan,:] = (data_[i_chan,:] /
np.mean(data_[i_chan,:]) - 1)

# Convert phase to pico seconds.
if i_data == 'Ph':
for i_chan in range(np.size(data_, axis=0)):
data_[i_chan, :] = ((1e12 * data_[i_chan, :]) /
(360 * mtg_mdf[i_mtg][i_chan]))
Expand Down
Loading