Giter Club home page Giter Club logo

ephyspy's People

Contributors

jnsbck avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jnsbck

ephyspy's Issues

Merge `SweepFeature` and `SweepSetFeature`

The dream would be to somehow merge SweepFeature and SweepSetFeature. This would enable the following:

  • Features could have the same name, i.e. 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.
  • only one feature class would need to be defined for every feature containing _compute, _select and _aggregate methods.
  • Then calling value on a sweep feature only calls _compute, while calling it on a sweepset also calls _select and _aggregate afterwards
from 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:

  • features are currently stored as objects in 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)
  • broadcasting is not trivial, since not all functions can be equally applied across all sweeps individually, i.e. _select or _data_init.
  • initialising self for every sweep does not work.
  • Should a sweep be handled as a sweepset with only one index? I think this is not ideal.

Ideas and drafts for this proposal are welcome. This is work in progress.

Feasability is questionable at this point.

Potential idea for new API

idea sketch for new API

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()}

bug in burst feature?

Hey,
two points for the Sweep_Burstiness feature:

  • it often does not identify bursts. But is there a more detailed documentation what it should do?
  • running my pipeline it worked for some voltage traces but then I got the following error:
  "[...]/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 AllenSDK fts

mark features that are computed mostly via AllenSDK.
probably best to add it to descriptions of features.

Prepare for first release

  • Check how to deal with clipped features and loc vs iloc!
  • Add diagnostic plotting functions
    • spike ft diagnostics
    • sweep ft diagnostics
    • sweepset ft diagnostics
  • add convenience function to plot diagnostic summary for sweep / sweepset
  • Check carefully if features make sense for a few examples and hardcode tests for those (fts should be in a given range)
  • Crosscheck with old pipeline
  • (? make compound features that automatically satisfy dependencies! (or try to calculate them in the get_feature function))
  • Add more documentation
  • Fix remainder of failing tests!
  • add github actions (include pyright, black, isort)
  • add other stimulus modalities (ramp, short square) and change current features to long square
  • #5
  • #6
  • #8

get rid of hand-modified `allensdk`

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.