def plot_curves(cmap_start=0.0, cmap_max=1.0): # TODO: implement this # cmap = plt.get_cmap('coolwarm') ncurves = len(spectra) for i, pattern, curve in zip(range(len(spectra)), pattern_list, spectra): # plt.plot(*curve, label = pattern, color = cmap(cmap_start + i * (cmap_max - cmap_start)/ncurves)) plt.plot(*curve, label=pattern) plt.legend() # ax.set_xlabel('Angle (rad)') # ax.set_ylabel('Intensity (arb)') plt.xlabel("Angle (rad)") plt.ylabel("Intensity (arb)")
def plot_curves(cmap_start=0., cmap_max=1.0): # TODO: implement this #cmap = plt.get_cmap('coolwarm') ncurves = len(spectra) for i, pattern, curve in zip(range(len(spectra)), pattern_list, spectra): #plt.plot(*curve, label = pattern, color = cmap(cmap_start + i * (cmap_max - cmap_start)/ncurves)) plt.plot(*curve, label=pattern) plt.legend() # ax.set_xlabel('Angle (rad)') # ax.set_ylabel('Intensity (arb)') plt.xlabel('Angle (rad)') plt.ylabel('Intensity (arb)')
def rescale_data(label): r, intensity = radial_distribution #intensity -= bgsub orig_intensity = intensity.copy() intensity = intensity - bgsub(r, intensity)(r) if normalization == "peak": intensity /= np.max(intensity) elif isinstance(normalization, (int, long, float)): interpolated = interp1d(r, intensity) orig_interpolated = interp1d(r, orig_intensity) intensity *= normalization if scale == 'q': qq = 2 * PHOTON_ENERGY * np.sin(np.deg2rad(r / 2)) / HBARC if plot: plt.plot(qq, gaussian_filter(intensity, smooth), label=label) return qq, intensity if scale == 'angle': if plot: plt.plot(r, gaussian_filter(intensity, smooth), label=label) return r, intensity else: raise ValueError("invalid key: " + str(scale))
def rescale_data(label): r, intensity = radial_distribution # intensity -= bgsub orig_intensity = intensity.copy() intensity = intensity - bgsub(r, intensity)(r) if normalization == "peak": intensity /= np.max(intensity) elif isinstance(normalization, (int, long, float)): interpolated = interp1d(r, intensity) orig_interpolated = interp1d(r, orig_intensity) intensity *= normalization if scale == "q": qq = 2 * PHOTON_ENERGY * np.sin(np.deg2rad(r / 2)) / HBARC if plot: plt.plot(qq, gaussian_filter(intensity, smooth), label=label) return qq, intensity if scale == "angle": if plot: plt.plot(r, gaussian_filter(intensity, smooth), label=label) return r, intensity else: raise ValueError("invalid key: " + str(scale))