Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12, 3.13]
python-version: ['3.10', 3.11, 3.12, 3.13, 3.14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -41,5 +41,5 @@ jobs:
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
if: matrix.python-version == 3.13
if: matrix.python-version == 3.14

19 changes: 7 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
# Module name (lowercase)
name='syncropatch_export',
version=version,
description='Post-process high-throughput patch-clamp data',
description='Reads syncropatch data',
long_description=readme,
long_description_content_type="text/markdown",
author='Frankie Patten-Elliot, Joseph Shuttleworth, Chon Lok Lei',
long_description_content_type='text/markdown',
author='Frankie Patten-Elliot, Joseph Shuttleworth, Chon Lok Lei, Michael Clerx',
author_email='joseph.shuttleworth@nottingham.ac.uk',
maintainer='Joseph Shuttleworth',
maintainer_email='joseph.shuttleworth@nottingham.ac.uk',
# url='https://github.com/CardiacModelling/markov-builder',
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
'Programming Language :: Python :: 3',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
],

# Packages to include
Expand All @@ -41,23 +41,18 @@
include_package_data=True,

# Required Python version
python_requires='>=3.7',
python_requires='>=3.10',

# List of dependencies
install_requires=[
'scipy>=1.7',
'numpy>=1.21',
'matplotlib>=3.4',
'pandas>=1.3',
'regex>=2023.12.25'
],
extras_require={
'test': [
'pytest-cov>=2.10', # For coverage checking
'pytest>=4.6', # For unit tests
'flake8>=3', # For code style checking
'isort',
'mock>=3.0.5', # For mocking command line args etc.
'codecov>=2.1.3',
],
'docs': [
Expand Down
30 changes: 0 additions & 30 deletions syncropatch_export/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import string

import numpy as np
import pandas as pd

from .voltage_protocols import VoltageProtocol

Expand Down Expand Up @@ -319,32 +318,3 @@ def get_onboard_QC_values(self, sweeps=None):

return out_dict

def get_onboard_QC_df(self, sweeps=None):
"""
Create a Pandas DataFrame containing the seal resistance, membrane
capacitance, and series resistance for each well and sweep.

Returns:
A ``pandas.DataFrame`` with the onboard QC estimates.

"""

QC_dict = self.get_onboard_QC_values(sweeps)

if sweeps is None:
sweeps = list(range(self.NofSweeps))

df_rows = []
for sweep in sweeps:
for well in self.WELL_ID.flatten():
Rseal, Capacitance, Rseries = QC_dict[well][sweep]
df_row = {'Rseal': Rseal,
'Cm': Capacitance,
'Rseries': Rseries,
'well': well,
'sweep': sweep
}
df_rows.append(df_row)

return pd.DataFrame.from_records(df_rows)

46 changes: 0 additions & 46 deletions tests/test_trace_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import unittest

import numpy as np
import pandas as pd

from syncropatch_export.trace import Trace
from syncropatch_export.voltage_protocols import VoltageProtocol
Expand Down Expand Up @@ -89,10 +88,6 @@ def test_protocol_get_ramps(self):
def test_get_QC(self):
QC_values = self.trace.get_onboard_QC_values()
self.assertGreater(len(QC_values), 0)
df = self.trace.get_onboard_QC_df()

self.assertGreater(df.shape[0], 0)
self.assertGreater(df.shape[1], 0)

def test_get_traces(self):
v = self.trace.get_voltage()
Expand All @@ -119,47 +114,6 @@ def test_get_traces(self):
self.assertRaisesRegex(ValueError, 'Invalid sweep selection',
self.trace.get_trace_sweeps, [-3])

'''
# plot test output
if False:
d = 'test_output'
if not os.path.exists(d):
os.makedirs(d)

import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(2, 1)
ax1.set_title('Example Sweeps')
some_sweeps = self.trace.get_trace_sweeps([0])['A01']

ax1.plot(ts, np.transpose(some_sweeps), color='grey', alpha=0.5)
ax1.set_ylabel('Current')
ax1.set_xlabel('Time')
ax2.set_title('Voltage Protocol')
ax2.plot(ts, v)
ax2.set_ylabel('Voltage')
ax2.set_xlabel('Time')
plt.tight_layout()
plt.savefig(os.path.join(d, 'example_trace'))
plt.close(fig)
'''

def test_qc_df(self):
dfs = [self.trace.get_onboard_QC_df(sweeps=[0]),
self.trace.get_onboard_QC_df(sweeps=None)]
for res in dfs:
# Check res is a pd.DataFrame
self.assertIsInstance(res, pd.DataFrame)

# Check it contains data (number of rows>0)
self.assertGreater(res.shape[0], 0)

# Check it contains all quality control parameters
for qcParam in ['Rseal', 'Cm', 'Rseries', 'well', 'sweep']:
self.assertIn(qcParam, res)

# Check restricting number of sweeps returns less data
self.assertLess(dfs[0].shape[0], dfs[1].shape[0])


if __name__ == '__main__':
unittest.main() # pragma: no cover