本文整理汇总了Python中tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory.create_timeseries方法的典型用法代码示例。如果您正苦于以下问题:Python DatatypesFactory.create_timeseries方法的具体用法?Python DatatypesFactory.create_timeseries怎么用?Python DatatypesFactory.create_timeseries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory
的用法示例。
在下文中一共展示了DatatypesFactory.create_timeseries方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_launchable_algorithms
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
def test_get_launchable_algorithms(self):
factory = DatatypesFactory()
conn = factory.create_connectivity(4)[1]
ts = factory.create_timeseries(conn)
result = self.flow_service.get_launchable_algorithms(ts.gid)
self.assertTrue('Analyze' in result)
self.assertTrue('View' in result)
示例2: EEGMonitorTest
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class EEGMonitorTest(TransactionalTestCase):
"""
Unit-tests for EEG Viewer.
"""
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_project = self.datatypeFactory.get_project()
self.test_user = self.datatypeFactory.get_user()
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
self.assertTrue(self.connectivity is not None)
def tearDown(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
zip_path = os.path.join(os.path.dirname(sensors_dataset.__file__),
'EEG_unit_vectors_BrainProducts_62.txt.bz2')
TestFactory.import_sensors(self.test_user, self.test_project, zip_path, 'EEG Sensors')
sensors = TestFactory.get_entity(self.test_project, SensorsEEG())
time_series = self.datatypeFactory.create_timeseries(self.connectivity, 'EEG', sensors)
viewer = EegMonitor()
result = viewer.launch(time_series)
expected_keys = ['tsNames', 'groupedLabels', 'tsModes', 'tsStateVars', 'longestChannelLength',
'label_x', 'entities', 'page_size', 'number_of_visible_points',
'extended_view', 'initialSelection', 'ag_settings', 'ag_settings']
for key in expected_keys:
self.assertTrue(key in result, "key not found %s" % key)
expected_ag_settings = ['channelsPerSet', 'channelLabels', 'noOfChannels', 'translationStep',
'normalizedSteps', 'nan_value_found', 'baseURLS', 'pageSize',
'nrOfPages', 'timeSetPaths', 'totalLength', 'number_of_visible_points',
'extended_view', 'measurePointsSelectionGIDs']
ag_settings = json.loads(result['ag_settings'])
for key in expected_ag_settings:
self.assertTrue(key in ag_settings, "ag_settings should have the key %s" % key)
示例3: TimeSeriesTest
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class TimeSeriesTest(TransactionalTestCase):
"""
Unit-tests for Time Series Viewer.
"""
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_project = self.datatypeFactory.get_project()
self.test_user = self.datatypeFactory.get_user()
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
self.assertTrue(self.connectivity is not None)
def tearDown(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
timeseries = self.datatypeFactory.create_timeseries(self.connectivity)
viewer = TimeSeries()
result = viewer.launch(timeseries)
expected_keys = [
"t0",
"shape",
"preview",
"labelsStateVar",
"labelsModes",
"mainContent",
"labels",
"labels_json",
"figsize",
"dt",
]
for key in expected_keys:
self.assertTrue(key in result)
示例4: TestTimeSeries
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class TestTimeSeries(TransactionalTestCase):
"""
Unit-tests for Time Series Viewer.
"""
def transactional_setup_method(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_project = self.datatypeFactory.get_project()
self.test_user = self.datatypeFactory.get_user()
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
assert self.connectivity is not None
def transactional_teardown_method(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
timeseries = self.datatypeFactory.create_timeseries(self.connectivity)
viewer = TimeSeries()
result = viewer.launch(timeseries)
expected_keys = ['t0', 'shape', 'preview', 'labelsStateVar', 'labelsModes',
'mainContent', 'labels', 'labels_json', 'figsize', 'dt']
for key in expected_keys:
assert key in result
示例5: TestCovarianceViewer
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class TestCovarianceViewer(TransactionalTestCase):
"""
Unit-tests for Covariance Viewer.
"""
def transactional_setup_method(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_project = self.datatypeFactory.get_project()
self.test_user = self.datatypeFactory.get_user()
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
assert self.connectivity is not None
def transactional_teardown_method(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
covariance = self.datatypeFactory.create_covariance(time_series)
viewer = CovarianceVisualizer()
result = viewer.launch(covariance)
expected_keys = ['matrix_shape', 'matrix_data', 'mainContent', 'isAdapter']
for key in expected_keys:
assert (key in result)
示例6: CrossCoherenceViewerTest
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class CrossCoherenceViewerTest(TransactionalTestCase):
"""
Unit-tests for Cross Coherence Viewer.
"""
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_project = self.datatypeFactory.get_project()
self.test_user = self.datatypeFactory.get_user()
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
self.assertTrue(self.connectivity is not None)
def tearDown(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
cross_coherence = self.datatypeFactory.create_crosscoherence(time_series)
viewer = CrossCoherenceVisualizer()
result = viewer.launch(cross_coherence)
expected_keys = ['matrix_data', 'matrix_shape', 'matrix_strides', 'frequency']
for key in expected_keys:
self.assertTrue(key in result)
示例7: BrainViewerTest
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class BrainViewerTest(TransactionalTestCase):
"""
Unit-tests for BrainViewer.
"""
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity, a cortical surface and a face surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_user = self.datatypeFactory.get_user()
self.test_project = TestFactory.import_default_project(self.test_user)
self.datatypeFactory.project = self.test_project
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
self.assertTrue(self.connectivity is not None)
self.face_surface = TestFactory.get_entity(self.test_project, FaceSurface())
self.assertTrue(self.face_surface is not None)
self.assertTrue(TestFactory.get_entity(self.test_project, EEGCap()) is not None)
def tearDown(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
viewer = BrainViewer()
viewer.current_project_id = self.test_project.id
result = viewer.launch(time_series=time_series)
expected_keys = ['urlVertices', 'urlNormals', 'urlTriangles', 'urlMeasurePointsLabels', 'title',
'time_series', 'shelfObject', 'pageSize', 'labelsStateVar', 'labelsModes',
'minActivityLabels', 'minActivity', 'measure_points', 'maxActivity', 'isOneToOneMapping',
'isAdapter', 'extended_view', 'base_activity_url', 'alphas_indices']
for key in expected_keys:
self.assertTrue(key in result and result[key] is not None)
self.assertFalse(result['extended_view'])
def test_get_required_memory(self):
"""
Brainviewer should know required memory so expect positive number and not -1.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
self.assertTrue(BrainViewer().get_required_memory_size(time_series) > 0)
def test_generate_preview(self):
"""
Check that all required keys are present in preview generate by BrainViewer.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
viewer = BrainViewer()
result = viewer.generate_preview(time_series, (500, 200))
expected_keys = ['urlVertices', 'urlNormals', 'urlTriangles', 'minActivity', 'maxActivity',
'isOneToOneMapping', 'isAdapter', 'base_activity_url', 'alphas_indices']
for key in expected_keys:
self.assertTrue(key in result and result[key] is not None)
def test_launch_eeg(self):
"""
Tests successful launch of a BrainEEG and that all required keys are present in returned template dictionary
"""
sensors = TestFactory.get_entity(self.test_project, SensorsEEG())
time_series = self.datatypeFactory.create_timeseries(self.connectivity, 'EEG', sensors)
time_series.configure()
viewer = BrainEEG()
viewer.current_project_id = self.test_project.id
result = viewer.launch(time_series)
expected_keys = ['urlVertices', 'urlNormals', 'urlTriangles', 'urlMeasurePointsLabels', 'title',
'time_series', 'shelfObject', 'pageSize', 'labelsStateVar', 'labelsModes',
'minActivityLabels', 'minActivity', 'measure_points', 'maxActivity', 'isOneToOneMapping',
'isAdapter', 'extended_view', 'base_activity_url', 'alphas_indices']
for key in expected_keys:
self.assertTrue(key in result and result[key] is not None)
self.assertTrue(result['extended_view'])
示例8: TestBrainViewer
# 需要导入模块: from tvb.tests.framework.datatypes.datatypes_factory import DatatypesFactory [as 别名]
# 或者: from tvb.tests.framework.datatypes.datatypes_factory.DatatypesFactory import create_timeseries [as 别名]
class TestBrainViewer(TransactionalTestCase):
"""
Unit-tests for BrainViewer.
"""
EXPECTED_KEYS = ['urlVertices', 'urlNormals', 'urlTriangles', 'urlLines', 'urlRegionMap',
'base_activity_url', 'isOneToOneMapping', 'minActivity', 'maxActivity',
'noOfMeasurePoints', 'isAdapter']
EXPECTED_EXTRA_KEYS = ['urlMeasurePointsLabels', 'urlMeasurePoints', 'time_series', 'pageSize', 'shelfObject',
'extended_view', 'legendLabels', 'labelsStateVar', 'labelsModes', 'title']
def transactional_setup_method(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity, a cortical surface and a face surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_user = self.datatypeFactory.get_user()
self.test_project = TestFactory.import_default_project(self.test_user)
self.datatypeFactory.project = self.test_project
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
assert self.connectivity is not None
self.face_surface = TestFactory.get_entity(self.test_project, FaceSurface())
assert self.face_surface is not None
assert TestFactory.get_entity(self.test_project, EEGCap()) is not None
def transactional_teardown_method(self):
"""
Clean-up tests data
"""
FilesHelper().remove_project_structure(self.test_project.name)
def test_launch(self):
"""
Check that all required keys are present in output from BrainViewer launch.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
viewer = BrainViewer()
viewer.current_project_id = self.test_project.id
result = viewer.launch(time_series=time_series)
for key in TestBrainViewer.EXPECTED_KEYS + TestBrainViewer.EXPECTED_EXTRA_KEYS:
assert key in result and result[key] is not None
assert not result['extended_view']
def test_get_required_memory(self):
"""
Brainviewer should know required memory so expect positive number and not -1.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
assert BrainViewer().get_required_memory_size(time_series) > 0
def test_generate_preview(self):
"""
Check that all required keys are present in preview generate by BrainViewer.
"""
time_series = self.datatypeFactory.create_timeseries(self.connectivity)
viewer = BrainViewer()
result = viewer.generate_preview(time_series, figure_size=(500, 200))
for key in TestBrainViewer.EXPECTED_KEYS:
assert key in result and result[key] is not None, key
def test_launch_eeg(self):
"""
Tests successful launch of a BrainEEG and that all required keys are present in returned template dictionary
"""
sensors = TestFactory.get_entity(self.test_project, SensorsEEG())
time_series = self.datatypeFactory.create_timeseries(self.connectivity, 'EEG', sensors)
time_series.configure()
viewer = DualBrainViewer()
viewer.current_project_id = self.test_project.id
result = viewer.launch(time_series)
for key in TestBrainViewer.EXPECTED_KEYS + TestBrainViewer.EXPECTED_EXTRA_KEYS:
assert key in result and result[key] is not None
assert result['extended_view']