mne-tools / mne-gsoc2018-3d

Sandbox for GSoC 2018 3D Viz
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

The `add_data` method from `Brain` class doesn't seem to support the default value for `colormap` argument #38

Open Sentient07 opened 5 years ago

Sentient07 commented 5 years ago

This is the error I'm getting when I make a call to the above mentioned method,

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-57206a9e085d> in <module>()
----> 1 brain.add_data(sig1, fmin=4, fmax=30)
      2 brain.overlays["sig1"].pos_bar.lut_mode = "Reds"
      3 brain.overlays["sig1"].pos_bar.visible = False
      4 brain.show()

~/projects/mne-gsoc2018-3d/ipysurfer/viz/brain.py in add_data(self, array, fmin, fmax, thresh, colormap, alpha, vertices, smoothing_steps, time, time_label, colorbar, hemi, remove_existing, time_label_size, initial_time, scale_factor, vector_alpha, fmid, center, transparent, verbose)
    351         self._data['fmax'] = fmax
    352 
--> 353         lut = self.update_lut()
    354 
    355         # Create smoothing matrix if necessary

~/projects/mne-gsoc2018-3d/ipysurfer/viz/brain.py in update_lut(self, fmin, fmid, fmax)
    421 
    422         lut = _calculate_lut(colormap, alpha=alpha, fmin=fmin, fmid=fmid,
--> 423                              fmax=fmax, center=center)
    424         self._data['lut'] = lut
    425         return lut

~/projects/mne-gsoc2018-3d/ipysurfer/utils/colormap.py in _calculate_lut(lim_cmap, alpha, fmin, fmid, fmax, center)
     51         ctrl_pts = (fmin, fmid, fmax)
     52         scale_pts = ctrl_pts
---> 53         rgb_cmap = cm.get_cmap(lim_cmap)
     54         # take 60% of hot color map, so it will be consistent
     55         # with mayavi plots

~/anaconda2/envs/mne/lib/python3.6/site-packages/matplotlib/cm.py in get_cmap(name, lut)
    166         raise ValueError(
    167             "Colormap %s is not recognized. Possible values are: %s"
--> 168             % (name, ', '.join(sorted(cmap_d))))
    169 
    170 

ValueError: Colormap auto is not recognized. Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r

I am trying to recreate the fMRI example of PySurfer using IpySurfer. This error can be reproduced from jupyter lab on Python 3.6. I use anaconda and have installed the packages and dependencies from the environment.yml file. Will be thankful for any help. Also, I would like to work on a fix towards this if no one is presently on it.

Cheers,

larsoner commented 5 years ago

To mimic PySurfer the default should actually be 'hot' I think. But in any case a fix would be appreciated

Sentient07 commented 5 years ago

@larsoner Thank you for the input, I will send a patch soon

Sentient07 commented 5 years ago

My bad, the commit on this PR doesn't solve the issue. I think I figured out where I should make the change. I will push another commit now. Apologies for the mistake