当前位置: 首页>>代码示例>>Python>>正文


Python Catalogue.load_from_array方法代码示例

本文整理汇总了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))
开发者ID:GEMScienceTools,项目名称:hmtk,代码行数:10,代码来源:catalogue_test.py

示例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))
开发者ID:julgp,项目名称:hmtk,代码行数:10,代码来源:catalogue_test.py

示例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)))
开发者ID:julgp,项目名称:hmtk,代码行数:11,代码来源:catalogue_test.py

示例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)
开发者ID:GEMScienceTools,项目名称:hmtk,代码行数:12,代码来源:catalogue_test.py

示例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))
     
开发者ID:juliogarciagem,项目名称:hmtk,代码行数:13,代码来源:catalogue_test.py

示例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))
开发者ID:matley,项目名称:hmtk,代码行数:16,代码来源:catalogue_test.py

示例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)
开发者ID:GEMScienceTools,项目名称:hmtk,代码行数:8,代码来源:catalogue_test.py


注:本文中的hmtk.seismicity.catalogue.Catalogue.load_from_array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。