carlson-lab / lpne-data-analysis

1 stars 0 forks source link

Review grid plot code #3

Closed neil-gallagher closed 3 years ago

neil-gallagher commented 3 years ago

The main function, factor_gridplot, is meant to generate an 'upper triangular' plot mirroring one of the ways we have traditionally visualized CSFA factors. Please review for usability.

We mentioned @jackgoffinet reviewing this code at neurostats meeting a couple of weeks ago.

jackgoffinet commented 3 years ago

Hey @neil-gallagher , I made some edits to plot_tools.py that I hope will make things more readable. I've got a couple specific comments in the file docstring under "to do."

neil-gallagher commented 3 years ago

cool, I'll try to get to these tomorrow

neil-gallagher commented 3 years ago

Made the updates. Can you give it one more look over @jackgoffinet, then merge in if good?

jackgoffinet commented 3 years ago

Hey @neil-gallagher , it looks like you may have forgotten to commit your changes?

neil-gallagher commented 3 years ago

Good catch. How about now?

jackgoffinet commented 3 years ago

@neil-gallagher , I put the new smallish dataset in testData and then run plot_tools.py and get the following error:

Traceback (most recent call last): File "plot_tools.py", line 218, in feature_list=['power', 'causality'], f_bounds=(1,50)) File "data_tools.py", line 69, in load_data features.append(list(file[ft])) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "/Users/jack/anaconda3/lib/python3.7/site-packages/h5py/_hl/group.py", line 262, in getitem oid = h5o.open(self.id, self._e(name), lapl=self._lapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5o.pyx", line 190, in h5py.h5o.open KeyError: "Unable to open object (object 'causality' doesn't exist)"

It looks like the only keys in TeST.mat are: ['#refs#', '#subsystem#', 'X', 'coherence', 'data', 'dataOpts', 'granger', 'instant', 'labels', 'power'], so no causality (linear directionality?). I tried replacing 'causality' in the __main__ block, but got a different error, where the key 'causFeatures' is expected in the labels variable:

version saveFeatures_1.5 used to calcuate power features data_tools.py:141: UserWarning: Raw Granger causality values loaded; if you want exponentiated or capped features, you must do that yourself warnings.warn("Raw Granger causality values loaded; if you want exponentiated or capped features, you must do that yourself") version saveFeatures_1.5 used to calcuate granger features Using data that was preprocessed with unknown preprocessing version. Please make sure all datasets in the same project were preprocessed the same way. ['allWindows', 'channel', 'channelArea', 'fsRaw', 'windowLength', 'windows', 'area', 's', 'fs', 'f', 'powerFeatures', 'cohFeatures', 'gcFeatures', 'instFeatures', 'powVersion', 'cohVersion', 'gcVersion'] Traceback (most recent call last): File "plottools.py", line 221, in X, = feature_mat(labels, power, ld) File "/Users/jack/Desktop/lpne-data-analysis/data_tools.py", line 360, in feature_mat pair_id = [cl.split()[0] for cl in labels['causFeatures']] KeyError: 'causFeatures'

neil-gallagher commented 3 years ago

I've uploaded a new version of the 'smallish' test data. Try it now.

jackgoffinet commented 3 years ago

@neil-gallagher , awesome. This works for me now. I made a couple small edits and I'll merge.