def plot_all(velocity, width, name, name_width, path, log): path_save = path # Normal - W_50 for all plt.figure(figsize=(12, 8)) plt.scatter(velocity, width, s=2, alpha=0.5, c=mass_galaxies) plt.plot(velocity, velocity, linestyle=':', linewidth=0.2) plt.nipy_spectral() cbar = plt.colorbar() cbar.ax.set_title('$(M_{*}$ $M_{0})$', size=10) #plt.xlim(0, 100) #plt.ylim(0,100) #plt.xlim(0.5*10**2,0.5*10**3) #plt.ylim(0.5*10**2,0.5*10**3) if log == 1: plt.xscale('log') plt.yscale('log') plt.xlabel('$Velocity_{%s}$ km/s' % (name)) plt.ylabel('$%s/2$ km/s' % (name_width)) plt.title('$%s/2$ vs $Velocity_{%s}$' % (name_width, name)) #plt.savefig(path_save + name + name_width + 'log' + '.png') plt.show() else: plt.xlabel('$Velocity_{%s}$ km/s' % (name)) plt.ylabel('$%s/2$ km/s' % (name_width)) plt.title('$%s/2$ vs $Velocity_{%s}$' % (name_width, name)) #plt.savefig(path_save + name + name_width + '.png') plt.show()
def plot_mass_BT(): plt.figure(figsize=(12, 8)) plt.scatter(B_T_central[B_T_central > 0], np.log10(mass_gas[B_T_central > 0]), s=2, alpha=0.5, c=mass_galaxies[B_T_central > 0]) plt.nipy_spectral() cbar = plt.colorbar() cbar.ax.set_title('$M_{*}$ $M_{0}$', size=10) plt.show()
for k in np.arange(h): y = y1 + k * dy for j in np.arange(w): x = x1 + j * dx C[k, j] = mandelbrot(x, y, maxit) M = C toc = time.time() print('wall clock time: %8.2f seconds' % (toc-tic)) # eye candy (requires matplotlib) if 1: try: from matplotlib import pyplot as plt plt.imshow(M, aspect='equal') try: plt.nipy_spectral() except AttributeError: plt.spectral() try: import signal def action(*args): raise SystemExit signal.signal(signal.SIGALRM, action) signal.alarm(2) except: pass plt.show() except: pass
from numpy import abs, fft, zeros, shape, copy, loadtxt #from cv2 import imread import glob import matplotlib.pyplot as plt import scipy.ndimage as img import argparse parser = argparse.ArgumentParser(description='deconvolve images') parser.add_argument('image', help='image number, ex. 0') parser.add_argument('length', help='last image number, ex. 100') parser.add_argument('width', help='last image number, ex. 20') parser.add_argument('theta', help='last image number, ex. 50') args = parser.parse_args() plt.nipy_spectral() def makePSF(length, width, theta, array): """ Returns a linear point spread function INPUT: length of x and y blurs, blurry image (to copy shape of array) OUTPUT: array of same size as input that defines PSF """ # initialize gaussian array of same size as input array psf = zeros(shape(array)) rows = len(psf[0]) # store dimensions cols = len(psf) psf[cols // 2 - width // 2:cols // 2 + width // 2, rows // 2:rows // 2 + length] = 1. # make linear psf psf = img.rotate(psf, theta, reshape=False) # rotate by theta # transform to corners because of the weird fft indexing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 3 19:19:55 2018 @author: verdu """ from numpy import abs, fft, zeros, shape, copy, savetxt from cv2 import imread import glob from matplotlib.pyplot import figure, imshow, nipy_spectral, close, tick_params from random import randint import scipy.ndimage as img nipy_spectral() def makePSF(length, width, theta, array): """ Returns a linear point spread function INPUT: length of x and y blurs, blurry image (to copy shape of array) OUTPUT: array of same size as input that defines PSF """ # initialize gaussian array of same size as input array psf = zeros(shape(array)) rows = len(psf[0]) # store dimensions cols = len(psf) psf[cols // 2 - width // 2:cols // 2 + width // 2, rows // 2:rows // 2 + length] = 1. # make linear psf psf = img.rotate(psf, theta, reshape=False) # rotate by theta
if sys.argv[1:] == ['winter']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.winter()) elif sys.argv[1:] == ['cool']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.cool()) elif sys.argv[1:] == ['viridis']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.viridis()) elif sys.argv[1:] == ['plasma']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.plasma()) elif sys.argv[1:] == ['inferno']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.inferno()) elif sys.argv[1:] == ['jet']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.jet()) elif sys.argv[1:] == ['gist_ncar']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.gist_ncar()) elif sys.argv[1:] == ['rainbow']: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.nipy_spectral()) else: p = ax2.scatter(x1, x2, x3, c=y, cmap=plt.nipy_spectral()) fig.colorbar(p) ax2.set_xlabel('X1') ax2.set_ylabel('X2') ax2.set_zlabel('X3') plt.show() maxy = int(round(max(y))) m = np.zeros((1, maxy)) for i in range(maxy):