berenslab / ephyspy Goto Github PK
View Code? Open in Web Editor NEWA Python package for electrophysiological feature extraction for patch-clamp experiments.
Home Page: https://ephyspy.readthedocs.io/
License: GNU General Public License v3.0
A Python package for electrophysiological feature extraction for patch-clamp experiments.
Home Page: https://ephyspy.readthedocs.io/
License: GNU General Public License v3.0
some sweep and ap features are computed by relying on the selection of a representative sweep / ap. The use should be able to define how this is chosen.
The dream would be to somehow merge SweepFeature
and SweepSetFeature
. This would enable the following:
Num_AP
could exist on the sweep and sweepset level. Depending on if the input is a sweep or sweepset Num_AP either gets computed for only one sweep or the compute method gets broadcasted across the entire sweepset, i.e. applied to every sweep._compute
, _select
and _aggregate
methods.value
on a sweep feature only calls _compute
, while calling it on a sweepset also calls _select
and _aggregate
afterwardsfrom abc import ABC, abstractmethod
class Feature(ABC):
def __init__(self, data, **kwargs):
self.data_init(data)
self.feature_init()
# depending on isinstance(data, Sweep) or isinstance(data, SweepSet),
# methods get called on data directly or broadcasted.
@abstractmethod
def _compute(self):
# compute can be defined however and operate on both sweepsets and sweeps
if isinstance(data, Sweep):
# compute feature for sweep
elif isinstance(data, SweepSet)
# could operate on sweepset directly or just broadcast compute function to sweeps
return value
@abstractmethod
def _select(self, fts):
return fts
@abstractmethod
def _aggregate(self, fts):
return value
Issues with this approach that need to be solved:
sweep.features
and they + their methods/attrs can be accessed easily. If only one feature object is instantiated for all sweeps of a set this needs to be handled differently (only storing values / diagnostics potentially)_select
or _data_init
.self
for every sweep does not work.Ideas and drafts for this proposal are welcome. This is work in progress.
Feasability is questionable at this point.
it would be nice if each feature was a self contained class somehow. This would have the advantage that all feature related metadata could be initialised and stored in the object. However, will potentially lead to a lot of overhead and instantiations of object. Possible solution would be to instantiate each object only once and then passing it to SweepSetFeatureExtractor
which can call __call__
to compute the feature. feature would take the current job of get_[sweep/sweepset]_[feature_name]
. The diagnostic functionality could also be contained in the feature.
from abc import ABC, abstractmethod
class EphysFeature(ABC):
def __init__(self):
pass
@abstractmethod
def __call__(self, sweep):
pass
@abstractmethod
def plot(self, sweep):
pass
class SweepNumAPs(EphysFeature):
def __init__(self):
super().__init__()
def __call__(self, sweep):
pass
def plot(self, sweep):
pass
# instantiated once
{"num_ap": SweepNumAPs()}
Hey,
two points for the Sweep_Burstiness
feature:
"[...]/ephyspy/features/utils.py", line 122, in get_sweep_burst_metrics
burst_metrics = sweep._process_bursts()
"[...]/ephyspy/allen_sdk/ephys_extractor.py", line 368, in _process_bursts
bursts = ft.detect_bursts(
"[...]/ephyspy/allen_sdk/ephys_features.py", line 1048, in detect_bursts
isi_types[pauses] = "pauselike"
ValueError: could not convert string to float: 'pauselike'
No idea why what pauselike does....
Maybe you can have a look?
But in the meanwhile, I will skip this feature as it seems to be not very robust in my case.
mark features that are computed mostly via AllenSDK.
probably best to add it to descriptions of features.
add suitable software license
This should only be tackled after closing #4 . Should be part of v0.0.2 release.
Integrate the additional features and diagnostic functionality better with the AllenSDK package.
A lot of modifications were made to the ephys_extractor.py
and ephys_features.py
from the AllenSDK. These modifications should be moved / integrated with features.py
and added to the extractor via the add_sweep_feature
function.
pytest raises a multitude of warnings. Reduce them if possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.