From 411a29827bd20808b41544e0148a3310e885e753 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Mon, 3 Apr 2023 14:54:59 -0400 Subject: [PATCH 1/6] Update intanrawio.py updated to allow access to digital inputs and outputs from the IntanRawIO class. --- neo/rawio/intanrawio.py | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index b8c2ca097..7b5015b3e 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -27,7 +27,31 @@ class IntanRawIO(BaseRawIO): """ - + Intan reader can handle two file formats 'rhd' and 'rhs'. It will automatically + check for the file extension and will gather the header information based on the + extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0, + 3.0, and 3.1 files. + + Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D' + depending on the port in which they were recorded along with the following + additional channels. + + 1: 'RHD2000 auxiliary input channel', + 2: 'RHD2000 supply voltage channel', + 3: 'USB board ADC input channel', + 4: 'USB board digital input channel', + 5: 'USB board digital output channel' + + Due to the structure of the digital input and output + channels these can be accessed as one long vector where the `digital-in` channel + is given by the magnitude of the nonzero values (e.g. channel 1: array of 0s, 1s, + channel 2: array of 0s, 2s, etc). + + Parameters + =============== + filename: str of filename or full filepath + + """ extensions = ['rhd', 'rhs'] rawmode = 'one-file' @@ -543,10 +567,17 @@ def read_rhd(filename): # 4: USB board digital input channel # 5: USB board digital output channel for sig_type in [4, 5]: - # at the moment theses channel are not in sig channel list - # but they are in the raw memamp + # Now these are included so that user can obtain the + # dig signals and process them at the same time if len(channels_by_type[sig_type]) > 0: name = {4: 'DIGITAL-IN', 5: 'DIGITAL-OUT'}[sig_type] + chan_info = channels_by_type[sig_type] + chan_info['native_channel_name'] = name # overwite to allow memmap to work + chan_info['sampling_rate'] = sr + chan_info['units'] = 'TTL' # arbitrary units so I did TTL for the logic + chan_info['gain'] = 1.0 + chan_info['offset'] = 0.0 + ordered_channels.append(chan_info) data_dtype += [(name, 'uint16', BLOCK_SIZE)] if bool(global_info['notch_filter_mode']) and version >= V('3.0'): From 5b0c3077b2622883c3a39e184ee04920a5af2596 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:23:45 -0400 Subject: [PATCH 2/6] Update intanrawio.py needed to add index to grab one set of chan_info to add dig in/dig out to list --- neo/rawio/intanrawio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index 7b5015b3e..f29504cf5 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -571,7 +571,7 @@ def read_rhd(filename): # dig signals and process them at the same time if len(channels_by_type[sig_type]) > 0: name = {4: 'DIGITAL-IN', 5: 'DIGITAL-OUT'}[sig_type] - chan_info = channels_by_type[sig_type] + chan_info = channels_by_type[sig_type][0] chan_info['native_channel_name'] = name # overwite to allow memmap to work chan_info['sampling_rate'] = sr chan_info['units'] = 'TTL' # arbitrary units so I did TTL for the logic From 26cb2e12e2ac6289360d9ede0414cad1291d776e Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:58:26 -0400 Subject: [PATCH 3/6] fix docstring --- neo/rawio/intanrawio.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index f29504cf5..68c22b6b7 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -42,14 +42,13 @@ class IntanRawIO(BaseRawIO): 4: 'USB board digital input channel', 5: 'USB board digital output channel' - Due to the structure of the digital input and output - channels these can be accessed as one long vector where the `digital-in` channel - is given by the magnitude of the nonzero values (e.g. channel 1: array of 0s, 1s, - channel 2: array of 0s, 2s, etc). + Due to the structure of the digital input and output channels these can be accessed + as one long vector, which must be post-processed. Parameters - =============== - filename: str of filename or full filepath + ---------- + filename: str + name of the 'rhd' or 'rhs' data file """ From b78b2ab59322834e2633595a92628a6c88e6f03c Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:06:02 -0400 Subject: [PATCH 4/6] pep8speaks --- neo/rawio/intanrawio.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index 68c22b6b7..aef6bf333 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -29,19 +29,16 @@ class IntanRawIO(BaseRawIO): """ Intan reader can handle two file formats 'rhd' and 'rhs'. It will automatically check for the file extension and will gather the header information based on the - extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0, - 3.0, and 3.1 files. - - Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D' + extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0, + 3.0, and 3.1 files. + Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D' depending on the port in which they were recorded along with the following additional channels. - 1: 'RHD2000 auxiliary input channel', 2: 'RHD2000 supply voltage channel', 3: 'USB board ADC input channel', 4: 'USB board digital input channel', 5: 'USB board digital output channel' - Due to the structure of the digital input and output channels these can be accessed as one long vector, which must be post-processed. @@ -49,8 +46,6 @@ class IntanRawIO(BaseRawIO): ---------- filename: str name of the 'rhd' or 'rhs' data file - - """ extensions = ['rhd', 'rhs'] rawmode = 'one-file' @@ -566,14 +561,14 @@ def read_rhd(filename): # 4: USB board digital input channel # 5: USB board digital output channel for sig_type in [4, 5]: - # Now these are included so that user can obtain the + # Now these are included so that user can obtain the # dig signals and process them at the same time if len(channels_by_type[sig_type]) > 0: name = {4: 'DIGITAL-IN', 5: 'DIGITAL-OUT'}[sig_type] chan_info = channels_by_type[sig_type][0] - chan_info['native_channel_name'] = name # overwite to allow memmap to work + chan_info['native_channel_name'] = name # overwite to allow memmap to work chan_info['sampling_rate'] = sr - chan_info['units'] = 'TTL' # arbitrary units so I did TTL for the logic + chan_info['units'] = 'TTL' # arbitrary units so I did TTL for the logic chan_info['gain'] = 1.0 chan_info['offset'] = 0.0 ordered_channels.append(chan_info) From fff0e841e1e8d3ad010cc5d64417490883d416a0 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:07:12 -0400 Subject: [PATCH 5/6] hopefully final pep8 fixes --- neo/rawio/intanrawio.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index aef6bf333..a3fd53c3e 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -31,6 +31,7 @@ class IntanRawIO(BaseRawIO): check for the file extension and will gather the header information based on the extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0, 3.0, and 3.1 files. + Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D' depending on the port in which they were recorded along with the following additional channels. @@ -39,7 +40,8 @@ class IntanRawIO(BaseRawIO): 3: 'USB board ADC input channel', 4: 'USB board digital input channel', 5: 'USB board digital output channel' - Due to the structure of the digital input and output channels these can be accessed + + Due to the structure of the digital input and output channels these can be accessed as one long vector, which must be post-processed. Parameters From dc5beb943cdef324859ebc5545b36a526ad78d94 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:09:40 -0400 Subject: [PATCH 6/6] pep8 wants no spaces from github so here it is. --- neo/rawio/intanrawio.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index a3fd53c3e..68b94f7c0 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -31,7 +31,6 @@ class IntanRawIO(BaseRawIO): check for the file extension and will gather the header information based on the extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0, 3.0, and 3.1 files. - Intan files contain amplifier channels labeled 'A', 'B' 'C' or 'D' depending on the port in which they were recorded along with the following additional channels. @@ -40,10 +39,8 @@ class IntanRawIO(BaseRawIO): 3: 'USB board ADC input channel', 4: 'USB board digital input channel', 5: 'USB board digital output channel' - Due to the structure of the digital input and output channels these can be accessed as one long vector, which must be post-processed. - Parameters ---------- filename: str