本文整理汇总了Python中neo.test.iotest.tools.get_test_file_full_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_test_file_full_path函数的具体用法?Python get_test_file_full_path怎么用?Python get_test_file_full_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_test_file_full_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_read_analogsignal
def test_read_analogsignal(self):
"""
Tests reading files in the 2 different formats:
- with GIDs, with times as floats
- with GIDs, with time as integer
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2gex-3Vm-1261-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_analogsignal(gid=1, t_stop=1000. * pq.ms,
sampling_period=pq.ms, lazy=False,
id_column=0, time_column=1,
value_column=2, value_type='V_m')
r.read_segment(gid_list=[1], t_stop=1000. * pq.ms,
sampling_period=pq.ms, lazy=False, id_column_dat=0,
time_column_dat=1, value_columns_dat=2,
value_types='V_m')
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time_in_steps-2Vm-1263-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_analogsignal(gid=1, t_stop=1000. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
sampling_period=pq.ms, lazy=False,
id_column=0, time_column=1,
value_column=2, value_type='V_m')
r.read_segment(gid_list=[1], t_stop=1000. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
sampling_period=pq.ms, lazy=False, id_column_dat=0,
time_column_dat=1, value_columns_dat=2,
value_types='V_m')
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2Vm-1259-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_analogsignal(gid=1, t_stop=1000. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
sampling_period=pq.ms, lazy=False,
id_column=0, time_column=1,
value_column=2, value_type='V_m')
r.read_segment(gid_list=[1], t_stop=1000. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
sampling_period=pq.ms, lazy=False, id_column_dat=0,
time_column_dat=1, value_columns_dat=2,
value_types='V_m')
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:52,代码来源:test_nestio.py
示例2: test_read_spiketrain
def test_read_spiketrain(self):
"""
Tests reading files in the 4 different formats:
- without GIDs, with times as floats
- without GIDs, with times as integers in time steps
- with GIDs, with times as floats
- with GIDs, with times as integers in time steps
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0time-1255-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_spiketrain(t_start=400. * pq.ms, t_stop=500. * pq.ms, lazy=False,
id_column=None, time_column=0)
r.read_segment(t_start=400. * pq.ms, t_stop=500. * pq.ms, lazy=False,
id_column_gdf=None, time_column_gdf=0)
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0time_in_steps-1257-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_spiketrain(t_start=400. * pq.ms, t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
id_column=None, time_column=0)
r.read_segment(t_start=400. * pq.ms, t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
id_column_gdf=None, time_column_gdf=0)
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms, t_stop=500. * pq.ms,
lazy=False, id_column_gdf=0, time_column_gdf=1)
r.read_segment(gid_list=[1], t_start=400. * pq.ms, t_stop=500. * pq.ms,
lazy=False, id_column_gdf=0, time_column_gdf=1)
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time_in_steps-1258-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms, t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
id_column=0, time_column=1)
r.read_segment(gid_list=[1], t_start=400. * pq.ms, t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
id_column_gdf=0, time_column_gdf=1)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:51,代码来源:test_nestio.py
示例3: test_signal_group_mode
def test_signal_group_mode(self):
dirname = get_test_file_full_path(ioclass=TdtIO,
filename='aep_05', directory=self.local_test_dir,
clean=False)
# TdtIO is a hard case they are 3 groups at rawio level
# there are 3 groups of signals
nb_sigs_by_group = [1, 16, 16]
signal_group_mode = 'group-by-same-units'
reader = TdtIO(dirname=dirname)
bl = reader.read_block(signal_group_mode=signal_group_mode)
for seg in bl.segments:
assert len(seg.analogsignals) == 3
i = 0
for anasig in seg.analogsignals:
# print(anasig.shape, anasig.sampling_rate)
assert anasig.shape[1] == nb_sigs_by_group[i]
i += 1
signal_group_mode = 'split-all'
reader = TdtIO(dirname=dirname)
bl = reader.read_block(signal_group_mode=signal_group_mode)
for seg in bl.segments:
assert len(seg.analogsignals) == np.sum(nb_sigs_by_group)
for anasig in seg.analogsignals:
# print(anasig.shape, anasig.sampling_rate)
assert anasig.shape[1] == 1
开发者ID:INM-6,项目名称:python-neo,代码行数:28,代码来源:test_tdtio.py
示例4: test_notimeid
def test_notimeid(self):
"""
Test for warning, when no time column id was provided.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2gex-1262-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
t_start_targ = 450. * pq.ms
t_stop_targ = 460. * pq.ms
sampling_period = pq.CompoundUnit('5*ms')
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered.
warnings.simplefilter("always")
seg = r.read_segment(gid_list=[], t_start=t_start_targ,
sampling_period=sampling_period,
t_stop=t_stop_targ, lazy=False,
id_column_dat=0, time_column_dat=None,
value_columns_dat=2, value_types='V_m')
# Verify number and content of warning
self.assertEqual(len(w), 1)
self.assertIn("no time column id", str(w[0].message))
sts = seg.analogsignals
for st in sts:
self.assertTrue(st.t_start == 1 * 5 * pq.ms)
self.assertTrue(
st.t_stop == len(st) * sampling_period + 1 * 5 * pq.ms)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:31,代码来源:test_nestio.py
示例5: setUp
def setUp(self):
BaseTestIO.setUp(self)
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2Vm-3gex-4gin-1260-0.dat',
directory=self.local_test_dir, clean=False)
self.testIO = ColumnIO(filename=filename)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:7,代码来源:test_nestio.py
示例6: test_wrong_input
def test_wrong_input(self):
"""
Tests two cases of wrong user input, namely
- User does not specify a value column
- User does not make any specifications
- User does not define sampling_period as a unit
- User specifies a non-default value type without
specifying a value_unit
- User specifies t_start < 1.*sampling_period
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2gex-1262-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
with self.assertRaises(ValueError):
r.read_segment(t_stop=1000. * pq.ms, lazy=False,
id_column_dat=0, time_column_dat=1)
with self.assertRaises(ValueError):
r.read_segment()
with self.assertRaises(ValueError):
r.read_segment(gid_list=[1], t_stop=1000. * pq.ms,
sampling_period=1. * pq.ms, lazy=False,
id_column_dat=0, time_column_dat=1,
value_columns_dat=2, value_types='V_m')
with self.assertRaises(ValueError):
r.read_segment(gid_list=[1], t_stop=1000. * pq.ms,
sampling_period=pq.ms, lazy=False,
id_column_dat=0, time_column_dat=1,
value_columns_dat=2, value_types='U_mem')
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:32,代码来源:test_nestio.py
示例7: test_read_segment
def test_read_segment(self):
"""
Tests if signals are correctly stored in a segment.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2gex-1262-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
id_list_to_test = range(1, 10)
seg = r.read_segment(gid_list=id_list_to_test,
t_stop=1000. * pq.ms,
sampling_period=pq.ms, lazy=False,
id_column_dat=0, time_column_dat=1,
value_columns_dat=2, value_types='V_m')
self.assertTrue(len(seg.analogsignals) == len(id_list_to_test))
id_list_to_test = []
seg = r.read_segment(gid_list=id_list_to_test,
t_stop=1000. * pq.ms,
sampling_period=pq.ms, lazy=False,
id_column_dat=0, time_column_dat=1,
value_columns_dat=2, value_types='V_m')
self.assertEqual(len(seg.analogsignals), 50)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:28,代码来源:test_nestio.py
示例8: test_no_gid_no_time
def test_no_gid_no_time(self):
filename = get_test_file_full_path(
ioclass=NestIO,
filename='N1-0Vm-1267-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
anasig = r.read_analogsignal(gid=None,
sampling_period=pq.ms, lazy=False,
id_column=None, time_column=None,
value_column=0, value_type='V_m')
self.assertEqual(anasig.annotations['id'], None)
self.assertEqual(len(anasig), 19)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:12,代码来源:test_nestio.py
示例9: test_single_gid
def test_single_gid(self):
filename = get_test_file_full_path(
ioclass=NestIO,
filename='N1-0gid-1time-2Vm-1265-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
anasig = r.read_analogsignal(gid=1, t_stop=1000. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
sampling_period=pq.ms, lazy=False,
id_column=0, time_column=1,
value_column=2, value_type='V_m')
assert anasig.annotations['id'] == 1
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:12,代码来源:test_nestio.py
示例10: test_read_spiketrain_annotates
def test_read_spiketrain_annotates(self):
"""
Tests if correct annotation is added when reading a spike train.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
ID = 7
st = r.read_spiketrain(gdf_id=ID, t_start=400. * pq.ms,
t_stop=500. * pq.ms)
self.assertEqual(ID, st.annotations['id'])
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:13,代码来源:test_nestio.py
示例11: test_read_spiketrain_can_return_empty_spiketrain
def test_read_spiketrain_can_return_empty_spiketrain(self):
"""
Tests if read_spiketrain returns an empty SpikeTrain if no spikes are in
time range.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
st = r.read_spiketrain(gdf_id=0, t_start=400. * pq.ms,
t_stop=1. * pq.ms)
self.assertEqual(st.size, 0)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:13,代码来源:test_nestio.py
示例12: test_read_integer
def test_read_integer(self):
"""
Tests if spike times are actually stored as integers if they are stored
in time steps in the file.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0time_in_steps-1257-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
st = r.read_spiketrain(gdf_id=None, t_start=400. * pq.ms,
t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
lazy=False, id_column=None, time_column=0)
self.assertTrue(st.magnitude.dtype == np.int32)
seg = r.read_segment(gid_list=[None], t_start=400. * pq.ms,
t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
lazy=False, id_column_gdf=None, time_column_gdf=0)
sts = seg.spiketrains
self.assertTrue(all([st.magnitude.dtype == np.int32 for st in sts]))
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time_in_steps-1258-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(
filenames=filename)
st = r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms,
t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
lazy=False, id_column=0, time_column=1)
self.assertTrue(st.magnitude.dtype == np.int32)
seg = r.read_segment(gid_list=[1], t_start=400. * pq.ms,
t_stop=500. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
lazy=False, id_column_gdf=0, time_column_gdf=1)
sts = seg.spiketrains
self.assertTrue(all([st.magnitude.dtype == np.int32 for st in sts]))
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:39,代码来源:test_nestio.py
示例13: test_no_gid
def test_no_gid(self):
filename = get_test_file_full_path(
ioclass=NestIO,
filename='N1-0time-1Vm-1266-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
anasig = r.read_analogsignal(gid=None, t_stop=1000. * pq.ms,
time_unit=pq.CompoundUnit('0.1*ms'),
sampling_period=pq.ms, lazy=False,
id_column=None, time_column=0,
value_column=1, value_type='V_m')
self.assertEqual(anasig.annotations['id'], None)
self.assertEqual(len(anasig), 19)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:13,代码来源:test_nestio.py
示例14: test_read_segment_annotates
def test_read_segment_annotates(self):
"""
Tests if correct annotation is added when reading a segment.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
IDs = (5, 11)
sts = r.read_segment(gid_list=(5, 11), t_start=400. * pq.ms,
t_stop=500. * pq.ms)
for ID in np.arange(5, 12):
self.assertEqual(ID, sts.spiketrains[ID - 5].annotations['id'])
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:14,代码来源:test_nestio.py
示例15: test_read_segment_accepts_range
def test_read_segment_accepts_range(self):
"""
Tests if spiketrains can be retrieved by specifying a range of GDF IDs.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
seg = r.read_segment(gid_list=(10, 39), t_start=400. * pq.ms,
t_stop=500. * pq.ms, lazy=False,
id_column_gdf=0, time_column_gdf=1)
self.assertEqual(len(seg.spiketrains), 30)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:14,代码来源:test_nestio.py
示例16: test_read_segment_can_return_empty_spiketrains
def test_read_segment_can_return_empty_spiketrains(self):
"""
Tests if read_segment makes sure that only non-zero spike trains are
returned.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
seg = r.read_segment(gid_list=[], t_start=400. * pq.ms,
t_stop=1. * pq.ms)
for st in seg.spiketrains:
self.assertEqual(st.size, 0)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:14,代码来源:test_nestio.py
示例17: test_signal_group_mode
def test_signal_group_mode(self):
filename = get_test_file_full_path(ioclass=NeuroExplorerIO,
filename='File_neuroexplorer_1.nex',directory=self.local_test_dir,
clean=False)
#test that 2 signals are rendered with 2 sampling_rate
for signal_group_mode in ('group-by-same-units', 'split-all'):
reader = NeuroExplorerIO(filename=filename)
bl = reader.read_block(signal_group_mode=signal_group_mode)
seg = bl.segments[0]
assert len(seg.analogsignals) ==2
anasig0 = seg.analogsignals[0]
anasig1 = seg.analogsignals[1]
assert anasig0.sampling_rate != anasig1.sampling_rate
assert anasig0.shape != anasig1.shape
开发者ID:msenoville,项目名称:python-neo,代码行数:15,代码来源:test_neuroexplorerio.py
示例18: test_t_stop_undefined_raises_error
def test_t_stop_undefined_raises_error(self):
"""
Tests if undefined t_stop, i.e., t_stop=None raises error.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
with self.assertRaises(ValueError):
r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms, lazy=False,
id_column=0, time_column=1)
with self.assertRaises(ValueError):
r.read_segment(gid_list=[1, 2, 3], t_start=400. * pq.ms, lazy=False,
id_column_gdf=0, time_column_gdf=1)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:15,代码来源:test_nestio.py
示例19: test_adding_custom_annotation
def test_adding_custom_annotation(self):
"""
Tests if custom annotation is correctly added.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-1256-0.gdf',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
st = r.read_spiketrain(gdf_id=0, t_start=400. * pq.ms,
t_stop=500. * pq.ms,
layer='L23', population='I')
self.assertEqual(0, st.annotations.pop('id'))
self.assertEqual('L23', st.annotations.pop('layer'))
self.assertEqual('I', st.annotations.pop('population'))
self.assertEqual({}, st.annotations)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:16,代码来源:test_nestio.py
示例20: test_multiple_value_columns
def test_multiple_value_columns(self):
"""
Test for simultaneous loading of multiple columns from dat file.
"""
filename = get_test_file_full_path(
ioclass=NestIO,
filename='0gid-1time-2Vm-3Iex-4Iin-1264-0.dat',
directory=self.local_test_dir, clean=False)
r = NestIO(filenames=filename)
sampling_period = pq.CompoundUnit('5*ms')
seg = r.read_segment(gid_list=[1001],
value_columns_dat=[2, 3],
sampling_period=sampling_period)
anasigs = seg.analogsignals
self.assertEqual(len(anasigs), 2)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:17,代码来源:test_nestio.py
注:本文中的neo.test.iotest.tools.get_test_file_full_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论