BUG: Dipole.data attribute not created when using `read_dipole()` for certain files
Found when trying to reproduce HNN-GUI tutorials. Reproduced via:
from urllib.request import urlretrieve
from hnn_core import read_dipole
data_url = ('https://raw.githubusercontent.com/jonescompneurolab/hnn/master/data/MEG_detection_data/S1_ongoing.txt')
urlretrieve(data_url, 'S1_ongoing.txt')
exp_dpl = read_dipole('S1_ongoing.txt')
exp_dpl.plot()
or...
data_url = ('https://raw.githubusercontent.com/jonescompneurolab/hnn/master/data/MEG_detection_data/no_trial_S1_ERP_all_avg.txt')
urlretrieve(data_url, 'no_trial_S1_ERP_all_avg.txt')
exp_dpl = read_dipole('no_trial_S1_ERP_all_avg.txt')
exp_dpl.plot()

Indeed for some reason the attribute is not created for this object.
I'm guessing this has to do with the fact that this dipole file only has 2 columns
@jasmainak @rythorpe can I work on this?
I tried to reproduce the error using the first snippet mentioned in the discussion
from urllib.request import urlretrieve
from hnn_core import read_dipole
data_url = ('https://raw.githubusercontent.com/jonescompneurolab/hnn/master/data/MEG_detection_data/S1_ongoing.txt')
urlretrieve(data_url, 'S1_ongoing.txt')
exp_dpl = read_dipole('S1_ongoing.txt')
exp_dpl.plot()
The file that is being fetched and the data that we are sending to the Dipole class to create an object out of it is of size (600, 1000). While the second code snippet seems to run properly without any problems as it has a size of (103,1).
You're sure the data array used to instantiate the Dipole object has shape (600, 1000)? That's a huge array and somewhat surprising....
Also, @aritrasinha108 let's get your other PR completed first before starting another.
You're sure the data array used to instantiate the Dipole object has shape
(600, 1000)? That's a huge array and somewhat surprising....
@rythorpe I tried to print the shape dpl_data that is being read inside the read_dipole() method from the file.

And then ran the first script mentioned above in the description

Got this as the output. The shape is given to be (600, 1001)

Also, @aritrasinha108 let's get your other PR completed first before starting another.
Yeah, sure, I'll finish up my previous PR and then only look into it.
Sure enough. I don't think I've worked with the S1_ongoing.txt data file before which turns out to be quite larger than the others. The problem is that the data getting passed to the Dipole constructor doesn't meet any of expected shape requirements. We should add appropriate checks that throw an error when the expected read-in data shape is violated and discuss reformating the S1_ongoing.txt data file.
@rythorpe can the checks be added as a fix for this issue? please let me know if its something I can work on
First we'll need to decide how to handle the current S1_ongoing.txt file, since it's formatting is an outlier among the other experimental dipole .txt files and represents a rare use-case that we probably don't want to support. I'd wait on this until @jasmainak @ntolley @chenghuzi can weigh in.
I would suggest starting with the other file no_trial_S1_ERP_all_avg.txt in the PR description since that is the usual format I have seen. Which tutorial has the S1_ongoing.txt file @ntolley ?
close issue?
Closing in favor of #617