def _as_interval(timespectra, unit): # , unit=None): """ Return columns as intervals as computed by datetime_convert function. Not an instance method for calls from objects other than self.""" ### If current columns is DatetimeIndex, convert if timespectra._interval == False: return Index(datetime_convert(timespectra.columns, return_as=unit, cumsum=True)) # , unit=unit) ### If currently already intervals, convert to datetime, then convert that to new units else: newcols = _as_datetime(timespectra) return Index(datetime_convert(newcols, return_as=unit, cumsum=True)) # , unit=unit)
from pyuvvis.core.spec_utilities import boxcar, wavelength_slices, divby from pyuvvis.pyplots.spec_aesthetics import specplot, timeplot, absplot, range_timeplot, _df_colormapper from pyuvvis.IO.gwu_interfaces import from_gwu_chem_IR, from_timefile_datafile, get_files_in_dir if __name__=='__main__': df_stream=pkgutil.get_data('pyuvvis', 'data/example_data/spectra.pickle') df=df_loads(df_stream) ### subtract the dark spectrum df=df.sub(df.darkseries, axis='index') df.columns=datetime_convert(df.columns, return_as='seconds') #df=boxcar(df, 2.0) dfsliced=wavelength_slices(df, ranges=((350.0,370.0), (450.0,500.0), (550.0,570.0), (650.0,680.0), (680.0,700.0)),\ apply_fcn='simps') # apply_fcn=np.histogram, bins=3) dfarea=wavelength_slices(df, ranges=(min(df.index), max(df.index)), apply_fcn='simps') df=df.ix[400.0:700.0] # colormapper=_df_colormapper(df, axis=0, vmin=300.0, vmax=700.0, cmap=cm.gist_heat) #specplot(df, colors=colormapper) #plt.show() # timeplot(df, colors=_df_colormapper(df, axis=1,cmap=cm.autumn))