try: df=df.ix[sp.x_min: sp.x_max] except Exception: lf.write('Parameters Error: unable to slice x_min and x_max range in directory %s\n\n'%folder) transfer_attr(df_full, df, speakup=False) df.columns.name=timeunit #Useful for plotting 2d-3d for autodetection, but not necessary ###### Polygon Plot spec_poly3d(df, title=options.rname+'3d Poly Spec') plt_clrsave(outdir, options.rname+'polygon') ##### Basic spectral and absorbance plots specplot(df, title=options.rname+'Full spectrum') plt_clrsave(outdir, options.rname+'full_spectrum') absplot(divby(df), title=options.rname+'Relative spectrum' ) plt_clrsave(outdir, options.rname+'relative') ### Look for uv-vis ranges in data, if not found, default to equally slicing spectrum by 7 try: uv_ranges=sp.uv_ranges if isinstance(uv_ranges, float) or isinstance(uv_ranges, int): uv_ranges=spec_slice(df.index, uv_ranges) except AttributeError: uv_ranges=spec_slice(df.index, 8) ### Time averaged plot, not scaled to 1 (relative intenisty dependson bin width and actual intensity)
) try: df = df.ix[sp.x_min : sp.x_max] except Exception: lf.write("Parameters Error: unable to slice x_min and x_max range in directory %s\n\n" % folder) transfer_attr(ts_full, df, speakup=False) df.columns.name = timeunit # Useful for plotting 2d-3d for autodetection, but not necessary ###### Polygon Plot spec_poly3d(df, title=options.rname + "3d Poly Spec") plt_clrsave(outdir, options.rname + "polygon") ##### Basic spectral and absorbance plots specplot(df, title=options.rname + "Full spectrum") plt_clrsave(outdir, options.rname + "full_spectrum") absplot(divby(df), title=options.rname + "Relative spectrum") plt_clrsave(outdir, options.rname + "relative") ### Look for uv-vis ranges in data, if not found, default to equally slicing spectrum by 7 try: uv_ranges = sp.uv_ranges if isinstance(uv_ranges, float) or isinstance(uv_ranges, int): uv_ranges = spec_slice(df.index, uv_ranges) except AttributeError: uv_ranges = spec_slice(df.index, 8) ### Time averaged plot, not scaled to 1 (relative intenisty dependson bin width and actual intensity)
#uv_ranges=spec_slice(df.index, 8) #### Time averaged plot, not scaled to 1 (relative intenisty dependson bin width and actual intensity) #dfsliced=wavelength_slices(df, ranges=uv_ranges, apply_fcn='mean') #range_timeplot(dfsliced, ylabel='Average Intensity', xlabel='Time ('+timeunit+')' ) #legstyle =1 for upper left #plt_clrsave(outdir, options.rname+'raw_time') #### Now scale curves to 1 for objective comparison #dfsliced_norm=dfsliced.apply(lambda x: x/x[0], axis=1) #range_timeplot(dfsliced_norm, title='Normalized Range Timeplot', ylabel='Scaled Average Intensity',\ #xlabel='Time ('+timeunit+')', legstyle=1 ) #plt_clrsave(outdir, options.rname+'norm_time') #### Area plot using simpson method of integration #dfarea=wavelength_slices(df, ranges=(min(df.index), max(df.index)), apply_fcn='simps') #range_timeplot(dfarea, ylabel='Power', xlabel='Time ('+timeunit+')', legend=False, #title='Spectral Power vs. Time (%i nm - %i nm)'% ## Eventually make nm a paremeter and class method #(min(df.index), max(df.index)), color='r') #plt_clrsave(outdir, options.rname+'full_area') if __name__=='__main__': print 'ya' df=DataFrame([1,2,3,4]) s=specplot(df) dfa=divby(df) a=absplot(dfa) plt.clf() quadplot(df, s, a)