论文部分内容阅读
NumPy和SciPy这两个Python库是十分强大的数值处理和分析工具,适用于多种应用程序。我们开发了一个Python库ObsPy(http://obspy.org),目的是使地震学软件包和工作流程的发展更为便利,也利用这些功能为地震学进入更大的科学Python生态系统建桥铺路。许多领域的科学家希望转化他们现有的工具和程序,以便能够利用Python所提供的这类平台环境,但是经常遇到下述困扰,例如特殊的文件格式、未知的专业术语,以及找不到合适的办法来替代软件中的某一个重要功能。我们提出一种方案,即在科学的NumPy包上层实现特定领域的时间序列库。据此,我们显示了一个时间序列数据的内部抽象表现的具体化实现,它能支持各种不同文件格式的读写。随后我们仔细描述了已充分发挥作用的旧代码的集成与改造,使它们能够在Python编写的现代工作流程之中继续发挥作用。最后我们举例研究如何将科研代码整合到ObsPy中,使其受众更为广泛。虽然本文给出的例子针对的是地震学,但是其中许多概念和抽象方法都可以直接应用于其他学科,特别是那些重点放在时间序列分析上的学科。
NumPy and SciPy these two Python library is a very powerful numerical processing and analysis tools, suitable for a variety of applications. We developed ObsPy, a Python library (http://obspy.org) that aims to make the development of seismological software packages and workflows more convenient and also leverage these capabilities to build bridges into the larger scientific Python ecosystem for seismology paving. Scientists in many fields want to transform their existing tools and procedures so that they can take advantage of the platform environments provided by Python, but often suffer the following pitfalls, such as special file formats, unknown terminology, and the inability to find suitable Approach to replace one of the important features of the software. We propose a solution to achieve a specific area of time series libraries above the scientific NumPy package. Accordingly, we show the concrete realization of an internal abstract representation of time series data, which can support reading and writing in various file formats. We then carefully described the integration and reworking of well-functioning old code so that it can continue to function within modern workflows written in Python. Finally, we give an example of how to integrate research code into ObsPy to make it more widely available. Although the examples presented here are for seismology, many of these concepts and abstractions can be directly applied to other disciplines, especially those focusing on time series analysis.