BouchardLab / nsds_lab_to_nwb

Python package to convert NSDS Lab data to NWB files.
https://nsds-lab-to-nwb.readthedocs.io/en/latest/
0 stars 4 forks source link

ArrayMemoryError while running resampling #93

Closed jihyunbak closed 3 years ago

jihyunbak commented 3 years ago

At the end of PR #92 , output from running pytest --basetemp=tmp -sv test_catscan.py:

With RESAMPLE_DATA=True (which is our default setting) in the updated test_catscan.py, getting some memory errors. This was on n0001, and I think it was pretty empty… although not very sure.

==================================== short test summary info =====================================
FAILED test_catscan.py::test_nwb_builder[RVG16_B07] - numpy.core._exceptions._ArrayMemoryError:...
FAILED test_catscan.py::test_nwb_builder[RVG16_B08] - MemoryError
FAILED test_catscan.py::test_nwb_builder[RVG16_B10] - numpy.core._exceptions._ArrayMemoryError:...
====================== 3 failed, 9 passed, 1 warning in 7126.49s (1:58:46) =======================

The actual error message looks like this:

../nsds_lab_to_nwb/nwb_builder.py:186: in build
    self.neural_data_originator.make(nwb_content, electrode_table_regions)
../nsds_lab_to_nwb/components/neural_data/neural_data_originator.py:77: in make
    data = self.resample(data)
../nsds_lab_to_nwb/components/neural_data/neural_data_originator.py:50: in resample
    new_data = resample(data, new_freq, rate)
../../process_nwb/process_nwb/resample.py:125: in resample
    Xds = resample_func(X, new_n_time, npad=npad, real=real)
../../process_nwb/process_nwb/resample.py:72: in resample_func
    X = _smart_pad(X, npads, pad)
../../process_nwb/process_nwb/utils.py:134: in _smart_pad
    2 * X[[-1]] - X[-2:-npads[1] - 2:-1], r_z_pad], axis=0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ([array([], shape=(0, 64), dtype=float64), array([[ 6.51078757e-04,  1.12702281e-03,  7.60252078e-04, ...,
         1....3375982e-04, ...,
        1.35831822e-04, 9.31597315e-05, 1.19574179e-04]]), array([], shape=(0, 64), dtype=float64)],)
kwargs = {'axis': 0}
relevant_args = [array([], shape=(0, 64), dtype=float64), array([[ 6.51078757e-04,  1.12702281e-03,  7.60252078e-04, ...,
         1.0....63375982e-04, ...,
        1.35831822e-04, 9.31597315e-05, 1.19574179e-04]]), array([], shape=(0, 64), dtype=float64)]

>   ???
E   numpy.core._exceptions._ArrayMemoryError: Unable to allocate 10.9 GiB for an array with shape (22833104, 64) and data type float64

<__array_function__ internals>:6: MemoryError

FYI, with RESAMPLE_DATA=False, all passing except TIMIT block (number of stim onsets mismatch)

==================================== short test summary info =====================================
FAILED test_catscan.py::test_nwb_builder[RVG16_B08] - AssertionError: Incorrect number of stimu...
====================== 1 failed, 11 passed, 1 warning in 339.06s (0:05:39) =======================

This error is coming from TIMIT tokenizer; see another issue for this.

JesseLivezey commented 3 years ago

I'm a bit surprised by this. 10 GB is large, but not that large for catscan. I can try and run it and see what happens to memory.

jthermiz commented 3 years ago

Resolved by looping through channels to resample