Giter VIP home page Giter VIP logo

Comments (4)

magland avatar magland commented on July 17, 2024

It's possible there is a bug with p_mask_out_artifacts.py
Maybe it only happens when it is trying to mask out an artifact toward the end of the recording?
That would be this file: https://github.com/magland/ml_ephys/blob/master/ml_ephys/preprocessing/p_mask_out_artifacts.p

Perhaps you could take a look.

from mountainsort.

hazab avatar hazab commented on July 17, 2024

Thank you for your quick response! I've looked through that function and I know the the error is happening somewhere at/within mask_chunk (line 164) but I haven't been able to figure out why it's happening; I'm finding it hard to determine which chunk the code is failing on since processing is parallelized (python isn't my "native" language, so someone else might have better luck with this). I have managed to find a temporary fix for it, though; I just put the statement throwing the error in a try/except block:

Screenshot from 2019-11-18 14-20-39

The statement only throws that exception once and nothing looks very wonky in my data, so I'm using this for now. I'm not sure which variable is being used to index the chunks, so I wasn't able to tell which chunk it's failing for. Also, just FYI, I don't think this is an issue with data size; I took one of the datasets that threw this exception, split it into 3 equal parts, and ran the algorithm on each part separately; the function only failed on the latter 2 parts.

I hope this helps narrow things down!

from mountainsort.

magland avatar magland commented on July 17, 2024

Thanks. I think chunk_size on line 166 (of your snippet) should be replaced by t2-t1.

from mountainsort.

hazab avatar hazab commented on July 17, 2024

Mmm.. that actually led to many more exceptions, lol. But it did provide some useful information: chunk_size is always at 2,000, num_write_chunks is always 150, write_chunk_size is always at 300,000, and t2-t1 is at 300,000 except for the last chunk, which is smaller (201,166 in my case). You're right; the code is only failing for this last chunk. It seems that get_masked_indices is returning indices that are <300,000, but often larger than the size of the last chunk.

I tried changing 'write_chunk_size' (usually at 300,000 as well) to t2-t1, but that still didn't work (still throws an exception for the last block). It might have to do with num_write_chunks (set at 150), but I'm afraid I don't know how the code works well enough to fix that (I tried (t2-t1)/chunk_size instead, but that led to more errors). It seems like the function just needs an if-statement for exceptions with the last block..

Thanks for your help and feedback!

from mountainsort.

Related Issues (20)

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.