Repository navigation
Add Access to Intan Digital-In and Digital-Out from the RawIO API - #1249
Conversation
updated to allow access to digital inputs and outputs from the IntanRawIO class.
needed to add index to grab one set of chan_info to add dig in/dig out to list
|
One other possibility that I was thinking about would be to create a function like below: def _get_digitalsignal_chunk(self, i_start=None, i_stop=None):
digital_memmap = self._raw_data["DIGITAL-IN"]
dig_size = digital_memmap.size
dig_shape = digital_memmap.shape
if i_start is None:
i_start=0
if i_stop is None:
i_stop =dig_size
block_size = dig_shape[1]
block_start = i_start // block_size
block_stop = i_stop // block_size + 1
sl0 = i_start % block_size
sl1 = sl0 + (i_stop - i_start)
digital_data = np.squeeze(digital_memmap[block_start:block_stop].flatten()[sl0:sl1])
native_order = self._global_info['dig_native_order']
digital_chunk = np.zeros((len(native_order), (i_stop-i_start)), dtype='uint16')
for idx, value in enumerate(native_order):
digital_chunk[idx, :] = np.not_equal(np.bitwise_and(digital_data,(1 << value)),0,)
return digital_chunkThis would mirror the Let me know if you'd be willing to implement something like this Sam @samuelgarcia for Neo or whether you think it's out of scope. If you like this idea better (or hate it) I'm happy to tweak the PR. |
|
resolves #792 @JuliaSprenger @samuelgarcia anything holding up this PR? Do you need example data for it? |
|
Hi Zach. So maybethe best is to merge now and postpone a bit the writting of "digitalsignal" concept. |
|
That works for me. I have my workaround function already outside of neo, so I'm in good shape. This merging would at least allow me to stay in neo rather than hack the memory map structure. |
|
Hello @zm711! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2023-09-20 16:07:19 UTC |
|
I'll fix the pep8speaks. |
|
Sam so long as the tests pass, I'm good with this as is. Thanks. |
|
Ok. Thank you Zach. |
This might just be me, but I was hoping to also use Neo to obtain
digital ininformation from Intan recordings. The ADC stream worked great, so I tweaked the code to allow access to digital streams as well. Based on my local testing it worked fine and the dig-in channel is actually encoded by the height of the bar (so users could do their own post-processing to separate out into dig-1, dig-2 etc. --see attach figure with x-axis being given in samples). I don't have any files withdig-outthough .I also put up a first draft of a doc-string. Happy to receive any comments.
I know @samuelgarcia wrote the implementation so if there is a reason why you'd prefer to not include this just let me know.