Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:johbackm/PySP2 into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
johbackm committed Jan 19, 2024
2 parents aa0a041 + 600c002 commit a57754c
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 173 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and Upload PySP2 Release to PyPI
on:
release:
types:
- published

jobs:
build-artifacts:
runs-on: ubuntu-latest
if: github.repository == 'ARM-DOE/PySP2'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm wheel twine check-manifest
- name: Build tarball and wheels
run: |
git clean -xdf
git restore -SW .
python -m build --sdist --wheel .
- name: Check built artifacts
run: |
python -m twine check dist/*
pwd
if [ -f dist/pysp2-0.0.0.tar.gz ]; then
echo "❌ INVALID VERSION NUMBER"
exit 1
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v3
with:
name: releases
path: dist

test-built-dist:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.x"
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- name: List contents of built dist
run: |
ls -ltrh
ls -ltrh dist
upload-to-pypi:
needs: test-built-dist
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
5 changes: 3 additions & 2 deletions docs/environment_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ channels:
dependencies:
- act-atmos
- xarray
- sphinx
- pydata-sphinx-theme
- pip:
- sphinx
- sphinx_gallery
- sphinx-copybutton
- pydata-sphinx-theme<0.9.0
- sphinx_design
- nbsphinx
- sphinxcontrib-applehelp<1.0.8
146 changes: 0 additions & 146 deletions docs/source/_static/default.css

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/_static/doc_shared.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const project = "ACT";
const project = "PySP2";

// Borrowed from Bokeh docs to look for a banner.html at the base of the docs repo and add that
// to the banner if present.
Expand Down
9 changes: 0 additions & 9 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,3 @@
</style>
{{ super() }}
{% endblock %}

{% block docs_navbar %}
<nav class="navbar navbar-dark navbar-expand-lg bg-arm fixed-top bd-navbar shadow" id="navbar-main">
{%- include "docs-navbar.html" %}
</nav>

{# Added to support a banner with an alert #}
<div class="container-fluid" id="banner"></div>
{% endblock %}
5 changes: 1 addition & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@
napoleon_include_init_with_doc = False
napoleon_use_param = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand All @@ -87,7 +84,7 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_css_files = ['default.css']
html_css_files = ['act-theme.css']

html_js_files = ['doc_shared.js']

Expand Down
2 changes: 1 addition & 1 deletion pysp2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
from . import vis
from . import testing

__version__ = "1.3.3"
__version__ = "1.4.0"
7 changes: 6 additions & 1 deletion pysp2/io/read_hk.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ def read_hk_file(file_name):
hk_df: pandas.DataFrame
The housekeeping information in a pandas DataFrame
"""
my_df = act.io.read_csv(file_name, sep="\t")

try:
my_df = act.io.csvfiles.read_csv(file_name, sep="\t")
except AttributeError:
my_df = act.io.text.read_csv(file_name, sep="\t")

# Parse time from filename
start_time = pd.Timestamp('1904-01-01')
my_df = my_df.rename({'index': 'time'})
Expand Down
4 changes: 2 additions & 2 deletions pysp2/vis/plot_wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def plot_wave(ds, record_no, chn, plot_fit=True,
if append_to_display is not False:
display = append_to_display
else:
display = act.plotting.HistogramDisplay(inp_data)
display = act.plotting.DistributionDisplay(inp_data)
else:
display = act.plotting.HistogramDisplay(inp_data, **init_kwargs)
display = act.plotting.DistributionDisplay(inp_data, **init_kwargs)
if 'subplot_index' in kwargs.keys():
ax = display.plot_size_distribution(
'Data_ch' + str(chn), bins,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
LICENSE = 'BSD'
PLATFORMS = "Linux, Windows, OSX"
MAJOR = 1
MINOR = 3
MICRO = 4
MINOR = 4
MICRO = 0

#SCRIPTS = glob.glob('scripts/*')
#TEST_SUITE = 'nose.collector'
Expand Down
9 changes: 4 additions & 5 deletions tests/test_gfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def test_psds():
my_binary['ScatDiaBC50'].values[ScatRejectKey == 0]) < 1000.
my_psds = pysp2.util.process_psds(my_binary, my_hk, my_ini)
np.testing.assert_almost_equal(my_psds['NumConcIncan'].max(), 0.95805343)
np.testing.assert_almost_equal(my_binary['DeadtimeRelativeBias'].mean(), -0.00023515)
coeff, beam_profile = pysp2.util.beam_shape(my_binary,beam_position_from='peak maximum',Globals=pysp2.util.DMTGlobals())



np.testing.assert_almost_equal(my_psds['ScatNumEnsemble'].sum(), 254.773995310)
np.testing.assert_almost_equal(my_psds['IncanNumEnsemble'].sum(), 32.22939087)
np.testing.assert_almost_equal(my_psds['ScatMassEnsemble'].sum(), 3.15026266)
np.testing.assert_almost_equal(my_psds['IncanMassEnsemble'].sum(), 0.08177226)

0 comments on commit a57754c

Please sign in to comment.