Closed swharden closed 6 years ago
Once the core ABF reading (and interacting) features are finalized, I wanted to implement event detection code (for action potentials and spontaneous post-synaptic currents) and membrane test code (to determine membrane resistance and cell capacitance from hyperpolarizing voltage steps). Membrane test theory is already documented here, here, and here so I'm just waiting until the pyABF core features are finalized before I start building on them. Ultimately this will pose the question, "how should we interact with pyABF to get membrane test results?"
I like the idea of feeding classes ABF objects, so something like this may work well:
import pyabf
abf = pyabf.ABF("someFile.abf")
mt = pyabf.MemTests(abf)
print(mt.Rm) # membrane resistance by sweep
print(mt.Ra) # access resistance by sweep
print(mt.Cm) # capacitance by sweep
import pyabf
abf = pyabf.ABF("someFile.abf")
ev = pyabf.Events(abf, downward=false, threshold=20, thresholdDeriv=10)
print(ev.bySweep.frequency) # average event frequency by sweep
print(ev.times) # times (absolute) of all detected events
# AP-specific or IPSC/EPSC or IPSP/EPSP-specific functionality would (somehow) exist
It may be of value to continue to focus on simplifying the ABF class. Pulling non-essential functionality from the ABF
class and merging ABFcore
into it may be a good place to start...
In contemplating this issue I made pyABF design goals and also attempted justification for the two-class (ABF/ABFcore) model in pyABF. In doing so, I came to agree with @t-b that the ABF/ABFcore classes do not need to be separated, and the use of a single class is ideal. Over the next few days I'll work toward integrating these two classes into a single ABF
class.
While doing so I will also review each line of the code with an eye toward improving ABF format version checking (https://github.com/swharden/pyABF/issues/24) and including better logging (https://github.com/swharden/pyABF/issues/25) and warning messages throughout the class. I'll also consider where I can make the ABF class simpler and more readable where possible, potentially moving a few functions into other files (i.e., generation of HTML webpages). Finally, I'll ensure that custom stimulus waveforms can can be easily loaded from both ATF files and ABF files (https://github.com/swharden/pyABF/issues/30).
This will also be a final opportunity to ensure the object model in use will be simple to translate to other programming languages (namely C# and PHP, briefly discussed in pull https://github.com/swharden/pyABF/pull/29)
I made a new branch to track changes related to this overall: https://github.com/swharden/pyABF/tree/simplified
abfFileFormat
with something smarter
The spirit of the ABF class is to read ABF files... not to analyze them.
Currently things like baseline subtraction and averaging are in the ABF class. These "advanced" features might best be moved outside the core ABF class. Perhaps an "analysis" class which you could feed ABF objects would be a better way to approach analytical processes which lie outside the scope of ABF file reading (and hence the ABF class). This ticket notes on these ideas.