本文整理汇总了Python中hmtk.seismicity.catalogue.Catalogue.load_from_array方法的典型用法代码示例。如果您正苦于以下问题:Python Catalogue.load_from_array方法的具体用法?Python Catalogue.load_from_array怎么用?Python Catalogue.load_from_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hmtk.seismicity.catalogue.Catalogue
的用法示例。
在下文中一共展示了Catalogue.load_from_array方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_from_array
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_load_from_array(self):
# Tests the creation of a catalogue from an array and a key list
cat = Catalogue()
cat.load_from_array(['year', 'magnitude'], self.data_array)
np.testing.assert_allclose(cat.data['magnitude'],
self.data_array[:, 1])
np.testing.assert_allclose(cat.data['year'],
self.data_array[:, 0].astype(int))
示例2: test_load_to_array
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_load_to_array(self):
"""
Tests the creation of a catalogue from an array and a key list
"""
cat = Catalogue()
cat.load_from_array(['year','magnitude'], self.data_array)
data = cat.load_to_array(['year','magnitude'])
self.assertTrue(np.allclose(data, self.data_array))
示例3: test_load_from_array
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_load_from_array(self):
"""
Tests the creation of a catalogue from an array and a key list
"""
cat = Catalogue()
cat.load_from_array(['year','magnitude'], self.data_array)
self.assertTrue(np.allclose(cat.data['magnitude'],self.data_array[:,1]))
self.assertTrue(np.allclose(cat.data['year'],
self.data_array[:,0].astype(int)))
示例4: test_catalogue_mt_filter
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_catalogue_mt_filter(self):
# Tests the catalogue magnitude-time filter
cat = Catalogue()
cat.load_from_array(['year', 'magnitude'], self.data_array)
cat.data['eventID'] = np.arange(0, 7)
cat.catalogue_mt_filter(self.mt_table)
mag = np.array([7.0, 5.5, 5.01, 6.99])
yea = np.array([1920, 1970, 1960, 1960])
np.testing.assert_allclose(cat.data['magnitude'], mag)
np.testing.assert_allclose(cat.data['year'], yea)
示例5: test_catalogue_mt_filter
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_catalogue_mt_filter(self):
"""
Tests the catalogue magnitude-time filter
"""
cat = Catalogue()
cat.load_from_array(['year','magnitude'], self.data_array)
cat.catalogue_mt_filter(self.mt_table)
mag = np.array([7.0, 5.5, 5.01, 6.99])
yea = np.array([1920, 1970, 1960, 1960])
self.assertTrue(np.allclose(cat.data['magnitude'],mag))
self.assertTrue(np.allclose(cat.data['year'],yea))
示例6: test_catalogue_mt_filter_with_flag
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_catalogue_mt_filter_with_flag(self):
'''
Tests the catalogue magnitude-time filter when an input boolean vector
is also defined
'''
cat = Catalogue()
cat.load_from_array(['year','magnitude'], self.data_array)
cat.data['eventID'] = np.arange(0, len(cat.data['magnitude']), 1)
flag = np.array([1, 1, 1, 1, 1, 0, 1], dtype=bool)
cat.catalogue_mt_filter(self.mt_table, flag)
mag = np.array([7.0, 5.5, 6.99])
yea = np.array([1920, 1970, 1960])
self.assertTrue(np.allclose(cat.data['magnitude'],mag))
self.assertTrue(np.allclose(cat.data['year'],yea))
示例7: test_load_to_array
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import load_from_array [as 别名]
def test_load_to_array(self):
# Tests the creation of a catalogue from an array and a key list
cat = Catalogue()
cat.load_from_array(['year', 'magnitude'], self.data_array)
data = cat.load_to_array(['year', 'magnitude'])
np.testing.assert_allclose(data, self.data_array)