Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.5.3 #226

Merged
merged 17 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/docs-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
name: Docs test on push and PR


on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
workflow_dispatch:


jobs:
Expand Down Expand Up @@ -35,10 +44,12 @@ jobs:

- name: Get pip cache location
id: pip-cache
shell: bash
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Get date
id: date
shell: bash
run: >
python -c
"import datetime;
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
name: Unit test on push and PR


on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
workflow_dispatch:


jobs:
Expand All @@ -12,10 +21,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
exclude:
- os: ubuntu-latest
python-version: '3.6'
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

env:
OS: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![unit tests](https://github.com/midetechnology/endaq-python/actions/workflows/unit-tests.yml/badge.svg) [![codecov](https://codecov.io/gh/MideTechnology/endaq-python/branch/develop/graph/badge.svg)](https://codecov.io/gh/MideTechnology/endaq-python)
[![PyPI Latest Release](https://img.shields.io/pypi/v/endaq-python.svg)](https://pypi.org/project/endaq-python/) ![example workflow](https://github.com/MideTechnology/endaq-python/actions/workflows/unit-tests.yml/badge.svg)

# `endaq-python`: A comprehensive, user-centric Python API for working with enDAQ data and devices

Expand Down
5 changes: 5 additions & 0 deletions docs/endaq/ide_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ Summarizing IDE files: :py:func:`endaq.ide.get_channel_table()`
Once an IDE file has been loaded, :py:func:`~endaq.ide.get_channel_table()` will
retrieve basic summary information about its contents.

Some environments, such as `Jupyter Notebook <https://jupyter.org/>`_ or `Colab <https://colab.research.google.com/>`_,
will automatically render and display the channel table data. From inside the standard Python interactive interpreter,
use `get_channel_table(doc).data` to display the raw information, or to access the table's contents directly as a
Pandas `DataFrame`.

.. code:: python3

get_channel_table(doc)
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sphinx==4.2.0
Sphinx>=5.0.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
Expand All @@ -9,4 +9,4 @@ sphinxcontrib-serializinghtml==1.1.5
pydata-sphinx-theme==0.7.1
sphinx-plotly-directive==0.1.3
nbsphinx==0.8.8
ipython==8.1.0
ipython==8.10
2 changes: 1 addition & 1 deletion endaq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
import endaq.batch


__version__ = "1.5.2"
__version__ = "1.5.3"
9 changes: 3 additions & 6 deletions endaq/batch/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import sys
import warnings

if sys.version_info[:2] >= (3, 8):
from functools import cached_property
else:
from backports.cached_property import cached_property
from functools import cached_property

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -112,8 +109,8 @@ def to_pandas(self, time_mode="datetime"):
timedelta=(pd.TimedeltaIndex, "TimedeltaIndex"),
datetime=(pd.DatetimeIndex, "DatetimeIndex"),
seconds=(
(pd.Float64Index, pd.Int64Index, pd.UInt64Index, pd.RangeIndex),
"{Float64/Int64/UInt64/Range}Index",
(pd.Index, pd.RangeIndex),
"{Numeric/Range}Index",
),
)
if not isinstance(self.data.index, expected_index_types[time_mode][0]):
Expand Down
13 changes: 7 additions & 6 deletions endaq/batch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from functools import partial
import warnings
import os
import sys

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -207,13 +208,13 @@ def _make_peak_windows(ch_data_cache: analyzer.CalcCache, margin_len):
)

# Format results
result = (
aligned_peak_data.stack()
.stack()
.reorder_levels(["axis", "peak time", "peak offset"])
)

return result
# Use new implementation of future_stack if Python version >= 3.9
levels = ["axis", "peak time", "peak offset"]
if sys.version_info < (3, 9):
return aligned_peak_data.stack().stack().reorder_levels(levels)

return aligned_peak_data.stack(future_stack=True).stack().reorder_levels(levels)


def _make_vc_curves(ch_data_cache: analyzer.CalcCache):
Expand Down
2 changes: 1 addition & 1 deletion endaq/calc/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _integrate(
dt = utils.sample_spacing(df)

result = df.apply(
functools.partial(scipy.integrate.cumtrapz, dx=dt, initial=0),
functools.partial(scipy.integrate.cumulative_trapezoid, dx=dt, initial=0),
axis=0,
raw=True,
)
Expand Down
6 changes: 3 additions & 3 deletions endaq/ide/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import typing
from typing import Union, Tuple

from datetime import datetime
from datetime import datetime, timezone
import os
from pathlib import Path
import tempfile
Expand Down Expand Up @@ -249,7 +249,7 @@

session_start = doc.lastSession.utcStartTime
if session_start:
session_start = datetime.utcfromtimestamp(session_start)
session_start = datetime.fromtimestamp(session_start, tz=timezone.utc)

if start:
read_kwargs['startTime'] = parse_time(start, session_start)
Expand Down Expand Up @@ -303,7 +303,7 @@

session_start = doc.lastSession.utcStartTime
if session_start:
session_start = datetime.utcfromtimestamp(session_start)
session_start = datetime.fromtimestamp(session_start, tz=timezone.utc)

Check warning on line 306 in endaq/ide/files.py

View check run for this annotation

Codecov / codecov/patch

endaq/ide/files.py#L306

Added line #L306 was not covered by tests

if start:
kwargs['startTime'] = parse_time(start, session_start)
Expand Down
2 changes: 1 addition & 1 deletion endaq/ide/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def get_channel_table(dataset: typing.Union[idelib.dataset.Dataset, list],

data = source.getSession(session)
if data.session.utcStartTime:
session_start = datetime.datetime.utcfromtimestamp(data.session.utcStartTime)
session_start = datetime.datetime.fromtimestamp(data.session.utcStartTime, tz=datetime.timezone.utc)
start = parse_time(start, session_start)
end = parse_time(end, session_start)

Expand Down
4 changes: 2 additions & 2 deletions endaq/plot/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@


# Loop through each of the sub-channels, and their respective '0-height rectangle mask'
for subchannel_name, cur_min_max_equal in min_max_equal[channel_data.columns].iteritems():
for subchannel_name, cur_min_max_equal in min_max_equal[channel_data.columns].items():

traces = []
cur_color = colorway[subplot_num % len(colorway)]
Expand Down Expand Up @@ -396,7 +396,7 @@
else:
time = channel_data.index

for c_i, (subchannel_name, subchannel_data) in enumerate(channel_data.iteritems()):
for c_i, (subchannel_name, subchannel_data) in enumerate(channel_data.items()):

Check warning on line 399 in endaq/plot/dashboards.py

View check run for this annotation

Codecov / codecov/patch

endaq/plot/dashboards.py#L399

Added line #L399 was not covered by tests
for metric in rolling_metrics_to_plot:
if n == 0:
data = subchannel_data.values
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
backports.cached-property; python_version<'3.8'
ebmlite>=3.2.0
idelib>=3.2.3
idelib>=3.2.8
jinja2
numpy>=1.19.5
pandas>=1.3
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_version(rel_path):
INSTALL_REQUIRES = [
"backports.cached-property; python_version<'3.8'",
"ebmlite>=3.2.0",
"idelib>=3.2.3",
"idelib>=3.2.8",
"jinja2",
"numpy>=1.19.5",
"pandas>=1.3",
Expand Down Expand Up @@ -68,11 +68,11 @@ def get_version(rel_path):
classifiers=['Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering',
],
keywords='ebml binary ide mide endaq',
Expand Down
Loading