hughesadam87 / scikit-spectra

Python pandas-based toolkit for explorative spectroscopy, in particular UVVis spectroscopic data.
Other
94 stars 41 forks source link

ts[ts.columns[0]].plot() and ts.columns in general #86

Closed hughesadam87 closed 10 years ago

hughesadam87 commented 10 years ago
ts[ts.columns[0]].plot() 

fails, but

ts._df[ts.columns[0]].plot()

works. Also failing is syntax of iloc[:, 0] and iloc[:, 0:1], both of which produce something at least with _df.

Issue seems to be in the colormapper actually.

ERROR:pyuvvis.core.timespectra:AuNPs Glass (good).plot() failed {See trace below}

Traceback (most recent call last): File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/logger.py", line 228, in _wraps return fcn(_args, _kwargs) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/core/timespectra.py", line 1092, in plot return specplot(self, _args, _kwargs) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/plotting/basic_plots.py", line 183, in specplot return _genplot(ts, xlabel, ylabel, title, **pltkwds) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/plotting/basic_plots.py", line 81, in _genplot pltkwargs['color'] = put._df_colormapper(ts, pltcolor, axis=0)#put.cmget(pltkwargs['color']) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/plotting/plot_utils.py", line 140, in _df_colormapper vmin=min(df.min(axis=axis)) TypeError: 'numpy.float64' object is not iterable An exception has occurred, use %tb to see the full traceback.

LogExit

hughesadam87 commented 10 years ago

Actually, this seems to be an indexing error. ts.columns[0] returns a timespectra, but it doesn't have columns (ie treated like a series or something)

a=ts[ts.columns[0]] a.columns

06-14 17:49:47 ERROR pyuvvis.core.timespectra: Gold Nanoparticles in Water.plot() failed {See trace below}

Traceback (most recent call last): File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/logger.py", line 228, in _wraps return fcn(_args, _kwargs) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/core/timespectra.py", line 1092, in plot return specplot(self, _args, _kwargs) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/plotting/basic_plots.py", line 183, in specplot return _genplot(ts, xlabel, ylabel, title, pltkwds) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/plotting/basic_plots.py", line 81, in _genplot pltkwargs['color'] = put._df_colormapper(ts, pltcolor, axis=0)#put.cmget(pltkwargs['color']) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/plotting/plot_utils.py", line 153, in _df_colormapper print "FUCK YOU", df.columns, type(df) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/pandas_utils/metadframe.py", line 107, in getattr raise AttributeError('Could not find attribute "%s" in %s or its underlying DataFrame'%(attr, self.class.name*)) AttributeError: Could not find attribute "columns" in TimeSpectra or its underlying DataFrame Traceback (most recent call last): File "/usr/lib/wingide4.1/src/debug/tserver/_sandbox.py", line 1539, in File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/logger.py", line 267, in wraps return _wraps(fcn_name, fcn, _args, _kwargs) File "/home/glue/Desktop/PYUVVIS/pyuvvis/pyuvvis/logger.py", line 250, in _wraps raise LogExit pyuvvis.exceptions.LogExit:

hughesadam87 commented 10 years ago

If ts.columns[0] fix does not correct plotting, just use colormap from pandas instead of our own...

hughesadam87 commented 10 years ago

Fixed, now that Spectrum is being returned.