Closed ZoeChen96 closed 1 year ago
BTW, I checked the .h5 file writing code, it can run for many times without giving errors.
Hi @ZoeChen96
You shouldn't save on the same file! What does spike_data
contain? Can't you make another file instead?
Hi Alessio, I wanted to test if I can do this overwrite correctly or not...
e.g. I generated 3 datasets with mearec, one is spike_data
with spikes, one is noise_data
, and another random thing which I called it Test_data
(which I use as recording_Test.h5
). And I want to verify whether I can overwrite the data correctly. So I tried to write spike_data
's trace inside recording_Test.h5
, trying to get_traces()
and compare with spike_data
, and then I want to write noise_data
trace inside to compare again for the whole verification.
Actually, you are correct: I can make another file. But my first thought was to verify using the method above, so I can be sure that I can overwrite the file properly. But in actual use I will take care of different datasets.
But is there any possibility to close the MEArecRecordingExtractor?
Hi @ZoeChen96
The file gets closed if you do del recording_manual
but again you should NOT overwrite the file that way! MEArec has a complex API/file format itself, so you can check its documentation if you really want to overwrite a field of the h5 file.
I'll close this for now!
Hi Alessio, thanks for the information!
I tried the del recording_manual
before but the problem still exists. It seems recording_manual disappears, but the file opening is still somewhere else.
Actually I already checked the structure of MEArec .h5 file, and that's the only method I can think of to do some customized preprocessing... 😟but maybe that's because of I am not very familiar with python.
So I want to ask a little question here: can I do some customized preprocessing besides the available preprocessing?
numpyrecording
to create a new recording from numpy, and add the probe/freq information manually, like in the tutorial https://spikeinterface.readthedocs.io/en/latest/modules_gallery/core/plot_1_recording_extractor.html#sphx-glr-modules-gallery-core-plot-1-recording-extractor-py but I think the dumpable attribute is a problem there, as it requires me to save() which will lead me to a second copy of the dataset.@ZoeChen96 what kind of preprocessing do you need?
Anyways, the best approach is to use a NumpyRecording
and then save()
(you need to use n_jobs=1
).
That returns a new binary recording extractor. Note that the data is not duplicated: the NumpyRecording
is in-memory (on your RAM), while the saved recording is dumped to a file.
An alternative method would be to write a spikeinterface.preprocessing
class + function (see a simple example here), but this would require some more advanced coding skills.
@alejoe91 Hi Alessio, as for the preprocessing, I need to include some BCI recording-systems' non-ideality features (e.g. quantization, ...).
Anyway, your information is very useful (as usual), I will have a look at it. Thanks a lot!
Let me point out that you can use the adc_bit_depth
, lsb
, or gain
to control quantization:
https://github.com/alejoe91/MEArec/blob/master/MEArec/default_params/recordings_params.yaml#L55-L57
Sorry this is not well documented, I need to add all these new features to the MEArec docs! It should be relatively easy to understand what they do if you're familiar with the concept
Hi Alessio, that is sooo helpful! I did not realize that before. Thanks a lot!!!
Hi,
I wanted to modify the .h5 MEArec file by some customized preprocessing, so I have to overwrite the 'recordings' in .h5 MEArec file. And I found a problem: after I use
MEArecRecordingExtractor
for a file (sayrecording_Test.h5
), I can't access to that file again. It shows the error thatOSError: Unable to synchronously open file (file is already open for read-only)
. Is there any method to close the recording? You can find the details below:The whole error looks like: