|
PeTar
N-body code for collisional gravitational systems
|
Functions | |
| def | create_movie (filenames, fps, output_file) |
| def | createImage (index_list, xyscale, plot_format, log_flag, **kwargs) |
| def | usage () |
Variables | |
| int | fps = 30 |
| string | output_file = 'pot_movie' |
| string | plot_format = 'mp4' |
| int | n_cpu = 0 |
| bool | log_flag = False |
| kwargs = dict() | |
| string | shortargs = 'f:o:h' |
| list | longargs = ['help','vmax=','vmin=','format=','n-cpu=','log'] |
| opts | |
| remainder | |
| fpar = remainder[0] | |
| fp = open(fpar, 'r') | |
| header = fp.readline() | |
| t0 | |
| dt | |
| nstep = int(nstep) | |
| dt_out | |
| xmin = float(xmin)*1e-3 | |
| xmax = float(xmax)*1e-3 | |
| nx | |
| ymin = float(ymin)*1e-3 | |
| ymax = float(ymax)*1e-3 | |
| ny | |
| zmin = float(zmin)*1e-3 | |
| zmax = float(zmax)*1e-3 | |
| nz | |
| list | xyscale = [[xmin,xmax,ymin,ymax],[xmin,xmax,zmin,zmax]] |
| pot = np.loadtxt('xy0', unpack=True, usecols=(10),skiprows=1) | |
| pot_min = pot.min() | |
| pot_max = pot.max() | |
| pool = mp.Pool(n_cpu) | |
| int | n_files = int(nstep)+1 |
| file_list = range(nstep+1) | |
| n_pieces = np.ones(n_cpu)*int(n_files/n_cpu) | |
| int | n_left = n_files%n_cpu |
| n_offset = np.append([0],n_pieces.cumsum()).astype(int) | |
| list | file_part = [file_list[n_offset[i]:n_offset[i+1]] for i in range(n_cpu)] |
| list | results = [None]*n_cpu |
| list | png_list = ['pot'+str(file_list[i])+'.png' for i in range(n_files)] |
| def galpy_pot_movie.create_movie | ( | filenames, | |
| fps, | |||
| output_file | |||
| ) |
| def galpy_pot_movie.createImage | ( | index_list, | |
| xyscale, | |||
| plot_format, | |||
| log_flag, | |||
| ** | kwargs | ||
| ) |
index_list: file index list xyscale: plot x, y scale plot_format: plot format log_flag: if true, color is in logscale kwargs: vmin, vmax
| def galpy_pot_movie.usage | ( | ) |
| galpy_pot_movie.dt |
| galpy_pot_movie.dt_out |
| galpy_pot_movie.file_list = range(nstep+1) |
| galpy_pot_movie.fp = open(fpar, 'r') |
| galpy_pot_movie.fpar = remainder[0] |
| galpy_pot_movie.fps = 30 |
| galpy_pot_movie.header = fp.readline() |
| galpy_pot_movie.kwargs = dict() |
| bool galpy_pot_movie.log_flag = False |
| list galpy_pot_movie.longargs = ['help','vmax=','vmin=','format=','n-cpu=','log'] |
| galpy_pot_movie.n_cpu = 0 |
| int galpy_pot_movie.n_files = int(nstep)+1 |
| galpy_pot_movie.n_offset = np.append([0],n_pieces.cumsum()).astype(int) |
| galpy_pot_movie.nstep = int(nstep) |
| galpy_pot_movie.nx |
| galpy_pot_movie.ny |
| galpy_pot_movie.nz |
| galpy_pot_movie.opts |
| galpy_pot_movie.output_file = 'pot_movie' |
| galpy_pot_movie.plot_format = 'mp4' |
| galpy_pot_movie.pool = mp.Pool(n_cpu) |
| galpy_pot_movie.pot = np.loadtxt('xy0', unpack=True, usecols=(10),skiprows=1) |
| galpy_pot_movie.pot_max = pot.max() |
| galpy_pot_movie.pot_min = pot.min() |
| galpy_pot_movie.remainder |
| list galpy_pot_movie.results = [None]*n_cpu |
| string galpy_pot_movie.shortargs = 'f:o:h' |
| galpy_pot_movie.t0 |
| int galpy_pot_movie.xmax = float(xmax)*1e-3 |
| int galpy_pot_movie.xmin = float(xmin)*1e-3 |
| int galpy_pot_movie.ymax = float(ymax)*1e-3 |
| int galpy_pot_movie.ymin = float(ymin)*1e-3 |
| int galpy_pot_movie.zmax = float(zmax)*1e-3 |
| int galpy_pot_movie.zmin = float(zmin)*1e-3 |