Skip to content

detect_bad_channels is really slow #2869

Closed

Description

@WeissShahaf

the longest part of preprocessing is the detect_bad_channels part. even if i slice the recording to just 30 seconds (384 channels)
can it be optimized? perhaps using parallelization?

thanks

Activity

  1. h-mayorquin commented on May 17, 2024

    @h-mayorquin
    Contributor

    I took a brief look a the function and that makes sense.

    Which method are you using? Are all of them equally slow?

    https://github.com/h-mayorquin/spikeinterface/blob/bc0cbd9f74f30cfed9376f984091cd57f3634169/src/spikeinterface/preprocessing/detect_bad_channels.py#L124-L125

    Also, if you could investigate what is the bottleneck with a profiler we could come up with a lan.

  2. added
    preprocessing
    performance
    on May 17, 2024
  3. WeissShahaf commented on May 20, 2024

    @WeissShahaf
    Author

    i run this script: (attached results files

    import cProfile
    import pstats

    def function_to_profile():

    bad_channel_ids, channel_labels = si.detect_bad_channels(slic_rec)
    pass
    

    List of methods to profile

    methods = ["coherence+psd", "std", "mad", "neighborhood_r2"]
    for method in methods:
    # Create a Profile object
    profiler = cProfile.Profile()

    # Start profiling
    profiler.enable()
    
    # Run the function you want to profile
    function_to_profile()
    
    # Stop profiling
    profiler.disable()
    
    # Save the profiling results to a file in the correct format
    profiler.dump_stats(f"profile_{method}_results.prof")
    
    # Create a Stats object from the saved .prof file
    stats = pstats.Stats(f"profile_{method}_results.prof")
    
    # Print the stats to the console
    stats.print_stats()
    

    profiling.zip

  4. alejoe91 commented on May 20, 2024

    @alejoe91
    Member

    Thanks! I'll give it a stab to parallelize it soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancepreprocessing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions