Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
armwal committed Dec 19, 2019
2 parents ffa86dc + 95d2830 commit def57e5
Show file tree
Hide file tree
Showing 9 changed files with 13,991 additions and 15 deletions.
4 changes: 2 additions & 2 deletions McsPyDataTools/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include README AUTHORS CHANGES LICENSE
include README.rst AUTHORS.rst HISTORY.rst LICENSE.txt
recursive-include docs *
recursive-include docs-html *
recursive-include docs-pdf *
recursive-exclude docs-html *
prune docs/_build
global-exclude *.pyc *~ *__pycache__* *.pyo
2 changes: 0 additions & 2 deletions McsPyDataTools/McsPy/McsData.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,6 @@ class SegmentStream(Stream):
"""
def __init__(self, stream_grp):
Stream.__init__(self, stream_grp, "SegmentStreamInfoVersion")
self.segment_entity = {}
self.data_subtype = None
self.__read_segment_entities()

def __read_segment_entities(self):
Expand Down
39 changes: 32 additions & 7 deletions McsPyDataTools/McsPy/tests/TestCmosMeaDataStructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from McsPy import *

test_data_file_path = os.path.join(os.path.dirname(__file__), 'TestData', '2017.12.14-18.38.15-GFP8ms_470nm_100pc_10rep_nofilter(AnalysisSet1).cmtr')
test_data_file_path = os.path.join(os.path.dirname(__file__), 'TestData', 'CMOS_MEA_Results.cmtr')
test_rawdata_file_path = os.path.join(os.path.dirname(__file__), 'TestData', '2017.12.14-18.38.15-GFP8ms_470nm_100pc_10rep_nofilter.cmcr')
test_multiple_roi_file_path = os.path.join(os.path.dirname(__file__), 'TestData', 'Rec_1-2-3_1s.cmcr')
test_multiple_streams_file_path = os.path.join(os.path.dirname(__file__), 'TestData', 'V200-SensorRoi-3Aux-Dig-Stim2-DiginEvts-5kHz.cmcr')
Expand Down Expand Up @@ -118,13 +118,38 @@ def test_acquisition(self):


#Test
def test_sta_explorer(self):
sta_explorer = self.data.STA_Explorer
print(sta_explorer)
print(sta_explorer.sta_entity[0])
print(sta_explorer.sta_entity[10])
def test_network_explorer(self):
network_explorer = self.data.Network_Explorer
print(network_explorer)
print(network_explorer.sta_entity[0])
print(network_explorer.sta_entity[10])

test_network_explorer(self)

def test_spike_sorter(self):
spike_sorter = self.data.Spike_Sorter
print(spike_sorter)
units = spike_sorter.get_units_by_id()
self.assertEqual(len(units), 90, "The number of units is {} and not {} as expected!".format(len(units), 90))
ordered = spike_sorter.get_units_by_measure(measure='Separability', descending=False)
self.assertEqual(len(ordered), 90, "The number of ordered units is {} and not {} as expected!".format(len(ordered), 90))
ordered_sep = [u.get_measure('Separability') for u in ordered]
s = sorted(ordered_sep)
self.assertEqual(ordered_sep, s, "The units are not ordered correctly!")
unit = spike_sorter.get_unit(14)
print(unit)
pks = unit.get_peaks()
for p in pks:
self.assertEqual(p['IncludePeak'], 1, "IncludePeak is not set!")
ts = unit.get_peaks_timestamps()
self.assertEqual(len(pks), len(ts), "The number of timestamps is {} and not {} as expected!".format(len(pks), len(ts)))
cutouts = unit.get_peaks_cutouts()
self.assertEqual(len(pks), len(cutouts), "The number of cutouts is {} and not {} as expected!".format(len(pks), len(cutouts)))
amplitudes = unit.get_peaks_amplitudes()
self.assertEqual(len(pks), len(amplitudes), "The number of amplitudes is {} and not {} as expected!".format(len(pks), len(amplitudes)))

test_spike_sorter(self)

test_sta_explorer(self)

#Test access to streams if multiple streams of one type exists: example multiple analog streams
def test_analog_streams(self):
Expand Down
2 changes: 1 addition & 1 deletion McsPyDataTools/McsPy/tests/TestRawDataStructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_analog_stream_data_timestamps(self):
analog_stream = self.data.recordings[0].analog_streams[0]
signal_ts = analog_stream.get_channel_sample_timestamps(6, 1996, 2000)
sig_ts = signal_ts[0]
expected_ts = [3992000, 3994000, 3996000, 3998000, 4000000]
expected_ts = [3992000, 3994000, 3996000, 3998000, 4000000, 4002000]
np.testing.assert_array_equal(sig_ts, expected_ts, "Selected timestamps were '%s' and not as expected '%s'" % (sig_ts, expected_ts))
self.assertEqual(str(signal_ts[1]), 'microsecond', "Unit of timestamps was expected to be 'microsecond' but was '%s'!" % str(signal_ts[1]))

Expand Down

0 comments on commit def57e5

Please sign in to comment.