跳转到主要内容

读取Gromacs EDR文件。

项目描述

Github Actions Build Status Coverage Status

此存储库托管了Pyedr和Panedr包的源文件。

pyedrpanedr 与Python 3.6及以上版本兼容。

Pyedr

Pyedr提供了一种读取Gromacs EDR二进制XDR文件并将其内容作为numpy数组字典返回的方法。Pyedr公开以下函数

  • edr_to_dict:从给定的EDR文件路径返回键为能量类型的numpy数组字典。

  • read_edr:解析EDR文件,并以嵌套列表的形式返回能量项

  • get_unit_dictionary:返回一个字典,其中包含在EDR文件中找到的每个能量项的单位。

Panedr

Panedr使用Pyedr库读取Gromacs EDR二进制能量XDR文件,并将其内容作为pandas数据框返回。Panedr公开以下功能

  • edr_to_df:获取EDR文件的路径并返回一个pandas数据框。

  • get_unit_dictionary:返回一个字典,其中包含在EDR文件中找到的每个能量项的单位。

示例

使用pyedr

import pyedr

# Read the EDR file
path = 'ener.edr'
dic = pyedr.edr_to_dict(path)

# The `verbose` optional parameter can be set to True to display the
# progress on stderr
dic = pyedr.edr_to_dict(path, verbose=True)

# Get the average pressure after the first 10 ns
pressure_avg = dic['Pressure'][dic['Time'] > 10000].mean()

# Get the units of the EDR entries
unit_dict = pyedr.get_unit_dictionary(path)
unit_dict["Temperature"]  # returns "K"

使用panedr

import panedr

# Read the EDR file
path = 'ener.edr'
df = panedr.edr_to_df(path)

# The `verbose` optional parameter can be set to True to display the
# progress on stderr
df = panedr.edr_to_df(path, verbose=True)

# Get the average pressure after the first 10 ns
pressure_avg = df['Pressure'][df['Time'] > 10000].mean()

# Get the units of the EDR entries
unit_dict = panedr.get_unit_dictionary(path)
unit_dict["Temperature"]  # returns "K"

安装

您可以使用pip安装pyedrpanedr

pip install pyedr

# installing panedr automatically installs pyedr
pip install panedr

如果您使用condaconda-forge,可以使用以下命令安装

conda install -c conda-forge pyedr

# install panedr automatically installs pyedr
conda install -c conda-forge panedr

测试

pyedrpanedr存储库包含一系列测试。如果您从存储库下载或克隆了代码,您可以运行测试。为此,安装pytest,然后在panedr源代码目录中运行

对于pyedr

pytest -v pyedr/pyedr/tests

对于panedr

pytest -v panedr/panedr/tests

许可协议

Pyedr和Panedr将Gromacs的部分源代码翻译成Python。因此,Panedr与Gromacs一样,采用GNU Lesser General Public License版本2.1进行分发。有关更多详细信息,请参阅许可证

项目详情


下载文件

下载适合您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源代码分发

pyedr-0.8.0.tar.gz (392.8 kB 查看散列)

上传时间: 源代码

构建分发

pyedr-0.8.0-py3-none-any.whl (397.0 kB 查看散列)

上传时间: Python 3

支持者:

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面