HolyLab / ImagineInterface.jl

Read and write Imagine analog and digital recordings and commands
Other
2 stars 2 forks source link

Question about di. #65

Closed mdhe1248 closed 6 years ago

mdhe1248 commented 6 years ago

Is the sampling rate of .di half of that of .ai?

Cody-G commented 6 years ago

It's the same sampling rate, but the samples are stored as 8-bit bool values rather than 16 bit int like the .ai file

On Dec 9, 2017 11:28 PM, "donghoon" notifications@github.com wrote:

Is the sampling rate of .di half of that of .ai?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HolyLab/ImagineInterface/issues/65, or mute the thread https://github.com/notifications/unsubscribe-auth/AE78hBfTfTcc7YeBWLPr54eif7sqxChkks5s-2wMgaJpZM4Q8YR1 .

mdhe1248 commented 6 years ago

Thanks!

Cody-G commented 6 years ago

Oh sorry, I just realized I answered that incorrectly. The samples of the (up to 8) digital input channels are "bit-packed", meaning that there are 8 samples (one from each channel) compressed into a single 8-bit value. In Julia this can be manipulated easily using BitArrays. See this line for how it's done when we parse the .di file: https://github.com/HolyLab/ImagineInterface/blob/master/src/parse.jl#L183

mdhe1248 commented 6 years ago

This is helpful Cody. Thanks!

mdhe1248 commented 6 years ago
A = Mmap.mmap(f, BitArray, (8,nsamples))` #we need all 8 bits even if the user didn't ask for 8 channels of DI

What does it happen if I change the number 8 into other values?

Cody-G commented 6 years ago

What does it happen if I change the number 8 into other values?

Then the sample array will be mapped incorrectly and samples will be mixed across channels. It's similar to what happens if you memory map the .ai file with the wrong number of channels.

mdhe1248 commented 6 years ago

Does it apply to OCPI1 too?

Cody-G commented 6 years ago

If you are using the new version of Imagine then yes.

On Mon, Dec 11, 2017 at 11:11 AM, donghoon notifications@github.com wrote:

Does it apply to OCPI1 too?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/HolyLab/ImagineInterface/issues/65#issuecomment-350771625, or mute the thread https://github.com/notifications/unsubscribe-auth/AE78hEheMWlP46OByXzb8dVeBNxhvkG7ks5s_VRKgaJpZM4Q8YR1 .

mdhe1248 commented 6 years ago

Okay. Thanks!