Skip to content

Commit

Permalink
Merge pull request #129 from lucarossi147/main
Browse files Browse the repository at this point in the history
ABF loading optimization and improved support for variable-length sweeps
  • Loading branch information
swharden committed Sep 27, 2022
2 parents 81d011d + be6121c commit aa79309
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ on:

jobs:
test:
name: Test on ${{ matrix.os }}
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

python-version: ["3.7", "3.x"]

runs-on: ${{ matrix.os }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: 🐍 Get Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: 🚚 Get Dependencies
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: 🐍 Get Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: 🛠️ Setup Build
run: python -m pip install build --user
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: ✨ Setup Hugo
env:
Expand Down
2 changes: 1 addition & 1 deletion src/pyabf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Documentation and code examples, and more can be found at:
https://github.com/swharden/pyABF
"""
__version__ = '2.3.6'
__version__ = '2.3.7'

import sys
import os
Expand Down
9 changes: 4 additions & 5 deletions src/pyabf/abf.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ def _loadAndScaleData(self, fb: BufferedReader):
nRows = self.channelCount
nCols = int(self.dataPointCount/self.channelCount)
raw = np.reshape(raw, (nCols, nRows))
raw = np.rot90(raw)
raw = raw[::-1]
raw = np.transpose(raw)

# if data is int, scale it to float32 so we can scale it
self.data = raw.astype(np.float32)
Expand Down Expand Up @@ -642,9 +641,9 @@ def setSweep(self,
pointCount = self.sweepPointCount
else:
pointStart = 0
for i in range(1, sweepNumber):
pointStart += self._synchArraySection.lLength[i-1]
pointCount = self._synchArraySection.lLength[sweepNumber]
for i in range(sweepNumber):
pointStart += self._synchArraySection.lLength[i]//self.channelCount
pointCount = self._synchArraySection.lLength[sweepNumber]//self.channelCount
pointEnd = pointStart + pointCount

# load the actual sweep data
Expand Down
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# standard pypi stuff
setup(
name='pyabf',
version='2.3.6',
version='2.3.7',
author='Scott W Harden',
author_email='SWHarden@gmail.com',
python_requires='>=3.6',
Expand Down
8 changes: 4 additions & 4 deletions tests/test_sweepHashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,11 +1275,11 @@
knownAbfSweepValues["2020_03_02_0000.abf SW15 CH1"] = "20000, 9.46044922, -0.30517578, 259.74499512"

knownAbfSweepValues["2020_06_16_0000.abf SW0 CH0"] = "3540, 0.91552734, 0.00000000, 0.34947360"
knownAbfSweepValues["2020_06_16_0000.abf SW1 CH0"] = "70040, 0.91552734, 0.61035156, 0.34824026"
knownAbfSweepValues["2020_06_16_0000.abf SW2 CH0"] = "16040, -0.30517578, 0.61035156, 0.35196608"
knownAbfSweepValues["2020_06_16_0000.abf SW1 CH0"] = "70040, -0.30517578, 0.30517578, 0.34824499"
knownAbfSweepValues["2020_06_16_0000.abf SW2 CH0"] = "16040, 0.61035156, 0.30517578, 0.35050380"

knownAbfSweepValues["2020_06_16_0001.abf SW0 CH0"] = "22040, 0.61035156, 0.00000000, 0.34784842"
knownAbfSweepValues["2020_06_16_0001.abf SW1 CH0"] = "11040, 0.61035156, 0.61035156, 0.34771526"
knownAbfSweepValues["2020_06_16_0001.abf SW1 CH0"] = "11040, -0.30517578, 0.91552734, 0.35148475"

knownAbfSweepValues["abf1_with_tags.abf SW0 CH0"] = "18000000, -34.54589462, -80.74950409, 6.65401363"

Expand Down Expand Up @@ -2659,4 +2659,4 @@
knownAbfSweepValues["test_0001.abf SW0 CH12"] = "12896, -0.00122070, -0.00122070, 0.00017642"
knownAbfSweepValues["test_0001.abf SW0 CH13"] = "12896, 0.00152588, 0.00183105, 0.00016845"
knownAbfSweepValues["test_0001.abf SW0 CH14"] = "12896, -0.21362305, -0.18310547, 0.01735568"
knownAbfSweepValues["test_0001.abf SW0 CH15"] = "12896, 0.00000000, 0.00000000, 0.00191588"
knownAbfSweepValues["test_0001.abf SW0 CH15"] = "12896, 0.00000000, 0.00000000, 0.00191588"

0 comments on commit aa79309

Please sign in to comment.