Skip to content

Commit

Permalink
[#83] Introduce abstractions for signals and fast5 files (#84)
Browse files Browse the repository at this point in the history
* [#83] Introduce abstractions for signals and fast5 files

* Removed class method from FractionalizedSignal

* Architecting signal and fast5 data organization

Co-authored-by: Jessica Dunstan <[email protected]>
Co-authored-by: Katie Doroschak <[email protected]>
  • Loading branch information
3 people authored and Jessica Dunstan committed Mar 3, 2021
1 parent 7eb26ee commit 2fde341
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions poretitioner/fast5s.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Classes for reading, writing and validating fast5 files.
"""

from dataclasses import dataclass
from os import PathLike
from pathlib import Path, PurePosixPath
from typing import List, NewType, Optional, Union
Expand All @@ -21,14 +20,14 @@
RawSignal,
VoltageSignal,
)

from .utils.classify import (
NULL_CLASSIFICATION_RESULT,
ClassificationResult,
ClassifierConfiguration,
ClassifierDetails,
NullClassificationResult,
)
from .utils.core import NumpyArrayLike

__all__ = ["BulkFile", "CaptureFile", "channel_path_for_read_id", "signal_path_for_read_id"]

Expand Down Expand Up @@ -348,7 +347,7 @@ def get_voltage(self, start=None, end=None) -> VoltageSignal:
Returns
-------
NumpyArrayLike[int]
VoltageSignal[int]
Voltage(s) in millivolts (mV).
"""
bias_voltage_multiplier = 5 # Signal changes in increments of 5 mV.
Expand Down
6 changes: 6 additions & 0 deletions tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ def can_serialize_test(self):
class TestPicoampereSignal:
def signal_converts_to_fractionalized_test(self):
pico = PicoampereSignal(PICO_SIGNAL, CHANNEL_NUMBER, CALIBRATION)
median = np.median(pico)

expected = compute_fractional_blockage(pico, median)
frac = raw.to_fractionalized()
assert np.isclose(frac, expected), "Fractionalized current should match expected."


class PicoampereSignalTest:
def __init__(self):
Expand Down

0 comments on commit 2fde341

Please sign in to comment.