Skip to content
Snippets Groups Projects
Unverified Commit 49607888 authored by James Graham's avatar James Graham Committed by GitHub
Browse files

Merge pull request #47 from jag1g13/release/1.0.2

Release/1.0.2
parents ecc3cf38 32bdd40e
No related branches found
No related tags found
No related merge requests found
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install project and dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt mdtraj
pip install pytest coverage
- name: Test with pytest
run: |
coverage run --source=pycgtool -m pytest
coverage report --skip-covered
# Data
/*.gro*
/*.itp*
/*.xtc*
/fftest.ff/
/gromacs/
*.offsets
# Dependencies and runtime
/.venv/
/env/
/minenv/
/venv/
*.pyc
poetry.toml
# Development and Testing
.cache
.coverage
.python-version
.tox/
/build/
/cover/
/dist/
/docs/_build/
/htmlcov/
/pycgtool.egg-info/
/tmp/
# IDE files
.idea/
.vscode/
settings.json
# Misc
.cache/
/*.gro
/*.itp
/fftest.ff
/env
/minenv
.coverage
/cover
/tmp
/doc/build
/nose2-junit.xml
/notes/
*.offsets
*.pkl
\ No newline at end of file
language: python
python:
- "3.3"
- "3.4"
- "3.5"
- "3.6"
cache:
directories:
- $HOME/.cache/pip
install:
- pip install --upgrade pip setuptools wheel
- pip install -r requirements.txt --only-binary=numpy
- pip install -r .requirements-test.txt --only-binary=scipy
script:
- py.test test/
......@@ -111,7 +111,7 @@ class Frame:
"""
Hold Atom data separated into Residues
"""
def __init__(self, gro=None, xtc=None, itp=None, frame_start=0, xtc_reader="simpletraj"):
def __init__(self, gro=None, xtc=None, itp=None, frame_start=0, xtc_reader=None):
"""
Return Frame instance having read Residues and Atoms from GRO if provided
......@@ -132,7 +132,7 @@ class Frame:
if gro is not None:
from .framereader import get_frame_reader
self._trajreader = get_frame_reader(gro, traj=xtc, frame_start=frame_start)
self._trajreader = get_frame_reader(gro, traj=xtc, frame_start=frame_start, name=xtc_reader)
self._trajreader.initialise_frame(self)
......
......@@ -227,7 +227,7 @@ class Progress:
self._dowhile = dowhile
self._quiet = quiet
self._its = -1
self._start_time = time.clock()
self._start_time = time.perf_counter()
def __len__(self):
"""
......@@ -298,13 +298,13 @@ class Progress:
def _stop(self):
if not self._quiet:
time_taken = int(time.clock() - self._start_time)
time_taken = int(time.perf_counter() - self._start_time)
print(self._bar + " took {0}s".format(time_taken))
raise StopIteration
def _display(self):
try:
time_remain = int((time.clock() - self._start_time) * ((self._maxits - self._its) / self._its))
time_remain = int((time.perf_counter() - self._start_time) * ((self._maxits - self._its) / self._its))
except ZeroDivisionError:
time_remain = "-"
print(self._bar + " {0}s left".format(time_remain), end="\r")
......@@ -270,11 +270,18 @@ def sliding(vals):
"""
it = iter(vals)
prev = None
current = next(it)
try:
current = next(it)
except StopIteration:
raise ValueError('Iterable contains no items')
for nxt in it:
yield (prev, current, nxt)
prev = current
current = nxt
yield (prev, current, None)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment