Skip to content

Commit

Permalink
ci template
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 15, 2018
1 parent dae443a commit 57eee16
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 83 deletions.
13 changes: 0 additions & 13 deletions .coveragerc

This file was deleted.

38 changes: 21 additions & 17 deletions .travis.yml
@@ -1,30 +1,34 @@
language: python
fast_finish: true

python:
- 3.6

os:
- linux


env: FC=gfortran

sudo: required
dist: xenial
group: travis_latest


git:
depth: 3
quiet: true

python:
- 3.6
- 3.7

os:
- linux

addons:
apt:
packages:
- gfortran

- gfortran

install: python -m pip install -e .[tests]
install: pip install -e .[tests]

script: coverage run tests/test_all.py -v
script:
- pytest -rsv
- flake8
- mypy . --ignore-missing-imports

after_success: coveralls
after_success:
- if [[ $TRAVIS_PYTHON_VERSION == 3.6* ]]; then
pytest --cov --cov-config=setup.cfg;
coveralls;
fi

49 changes: 28 additions & 21 deletions RunGRwave.py
Expand Up @@ -2,29 +2,36 @@
"""Simple groundwave example, assuming uniform ground parameters"""
from matplotlib.pyplot import figure, show
from pygrwave import run_grwave
import seaborn as sns
sns.set_context('talk', 1.)
try:
import seaborn as sns
sns.set_context('talk', 1.)
except ImportError:
pass


wls = {'freqMHz': 0.89,
'sigma': 2e-3,
'epslon': 4,
'dmax': 400,
'hrr': 3,
'htt': 100,
'dstep': 10,
'txwatt': 50e3, }
def main():
wls = {'freqMHz': 0.89,
'sigma': 2e-3,
'epslon': 4,
'dmax': 400,
'hrr': 3,
'htt': 100,
'dstep': 10,
'txwatt': 50e3, }

data = run_grwave(wls)
# %%
d_km = data.index.values.astype(float)

data = run_grwave(wls)
# %%
d_km = data.index.values.astype(float)
ax = figure().gca()
ax.plot(d_km, data['fs'].values)
ax.set_xlabel('distance [km]')
ax.set_ylabel('field strength mV/m')
ax.axhline(4, color='red', linestyle='--')
ax.grid(True)
# ax.set_ylim((0,25))
show()

ax = figure().gca()
ax.plot(d_km, data['fs'].values)
ax.set_xlabel('distance [km]')
ax.set_ylabel('field strength mV/m')
ax.axhline(4, color='red', linestyle='--')
ax.grid(True)
# ax.set_ylim((0,25))
show()

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion pygrwave/__init__.py → grwave/__init__.py
Expand Up @@ -21,7 +21,7 @@ def run_grwave(wls: dict) -> pd.DataFrame:
f'dstep {wls["dstep"]}\n'
'GO')

out = subprocess.check_output('./grwave', input=strin, universal_newlines=True, cwd=root)
out = subprocess.check_output('./grwave.exe', input=strin, universal_newlines=True, cwd=root)
# %%
data = pd.read_csv(io.StringIO(out), sep='\s+', index_col=0,
skiprows=31, names=['fs', 'pathloss'])
Expand Down
72 changes: 69 additions & 3 deletions setup.cfg
@@ -1,7 +1,73 @@
[metadata]
name = grwave
version = 0.1.1
author = Michael Hirsch, Ph.D.
description = Groundwave per ITU P.368 10 kHz - 30 MHz
url = https://github.com/scivision/grwave
keywords =
groundwave
longwave radio
HF radio
classifiers =
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Science/Research
Operating System :: OS Independent
Programming Language :: Fortran
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Scientific/Engineering :: Atmospheric Science
license_file = LICENSE
long_description = file: README.md
long_description_content_type = text/markdown

[options]
python_requires = >= 3.6
setup_requires =
setuptools >= 38.6
pip >= 10
twine >= 1.11
include_package_data = True
packages = find:
install_requires =
numpy
pandas

[options.extras_require]
tests =
pytest
pytest-cov
coveralls
flake8
mypy
plot =
matplotlib

[options.entry_points]
console_scripts =


[flake8]
max-line-length = 132
exclude = .git,__pycache__,doc/,docs/,build/,dist/,archive/
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/

[metadata]
description-file = README.md
[coverage:run]
cover_pylib = false
omit =
/home/travis/virtualenv/*
*/site-packages/*
*/bin/*

[coverage:report]
exclude_lines =
pragma: no cover
def __repr__
except RuntimeError
except NotImplementedError
except ImportError
except FileNotFoundError
except CalledProcessError
logging.warning
logging.error
logging.critical
if __name__ == .__main__.:
27 changes: 3 additions & 24 deletions setup.py
@@ -1,27 +1,6 @@
#!/usr/bin/env python
import subprocess
from setuptools import setup, find_packages
install_requires = ['numpy', 'pandas']
tests_require = ['pytest', 'pytest-cov', 'coveralls', 'flake8', 'mypy']
from setuptools import setup
setup()


setup(name='pygrwave',
packages=find_packages(),
description='Groundwave per ITU P.368 10 kHz - 30 MHz',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
version='0.1.1',
url='https://github.com/scivision/python-grwave',
classifiers=[
'Intended Audience :: Science/Research',
'Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3', ],
install_requires=install_requires,
tests_require=tests_require,
extras_require={'tests': tests_require,
'plot': ['matplotlib', 'seaborn', ],
'io': ['folium', ]},
python_requires='>=3.6',
)

subprocess.check_call(['gfortran', 'fortran/grwave.for', '-o', 'grwave'])
subprocess.check_call(['gfortran', 'fortran/grwave.for', '-o', 'grwave.exe'])
8 changes: 4 additions & 4 deletions tests/test_all.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import pytest
from pygrwave import run_grwave
import numpy.testing
from grwave import run_grwave
from pytest import approx


def test_grwave():
Expand All @@ -16,8 +16,8 @@ def test_grwave():

data = run_grwave(wls)

numpy.testing.assert_allclose(data.loc[100., 'fs'], 119.996021)
assert data.loc[100., 'fs'] == approx(119.996021)


if __name__ == '__main__':
pytest.main()
pytest.main(['-x', __file__])

0 comments on commit 57eee16

Please sign in to comment.