PeTar
N-body code for collisional gravitational systems
galpy_pot_movie Namespace Reference

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)]
 

Function Documentation

◆ create_movie()

def galpy_pot_movie.create_movie (   filenames,
  fps,
  output_file 
)

◆ createImage()

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

◆ usage()

def galpy_pot_movie.usage ( )

Variable Documentation

◆ dt

galpy_pot_movie.dt

◆ dt_out

galpy_pot_movie.dt_out

◆ file_list

galpy_pot_movie.file_list = range(nstep+1)

◆ file_part

list galpy_pot_movie.file_part = [file_list[n_offset[i]:n_offset[i+1]] for i in range(n_cpu)]

◆ fp

galpy_pot_movie.fp = open(fpar, 'r')

◆ fpar

galpy_pot_movie.fpar = remainder[0]

◆ fps

galpy_pot_movie.fps = 30

◆ header

galpy_pot_movie.header = fp.readline()

◆ kwargs

galpy_pot_movie.kwargs = dict()

◆ log_flag

bool galpy_pot_movie.log_flag = False

◆ longargs

list galpy_pot_movie.longargs = ['help','vmax=','vmin=','format=','n-cpu=','log']

◆ n_cpu

galpy_pot_movie.n_cpu = 0

◆ n_files

int galpy_pot_movie.n_files = int(nstep)+1

◆ n_left

int galpy_pot_movie.n_left = n_files%n_cpu

◆ n_offset

galpy_pot_movie.n_offset = np.append([0],n_pieces.cumsum()).astype(int)

◆ n_pieces

galpy_pot_movie.n_pieces = np.ones(n_cpu)*int(n_files/n_cpu)

◆ nstep

galpy_pot_movie.nstep = int(nstep)

◆ nx

galpy_pot_movie.nx

◆ ny

galpy_pot_movie.ny

◆ nz

galpy_pot_movie.nz

◆ opts

galpy_pot_movie.opts

◆ output_file

galpy_pot_movie.output_file = 'pot_movie'

◆ plot_format

galpy_pot_movie.plot_format = 'mp4'

◆ png_list

list galpy_pot_movie.png_list = ['pot'+str(file_list[i])+'.png' for i in range(n_files)]

◆ pool

galpy_pot_movie.pool = mp.Pool(n_cpu)

◆ pot

galpy_pot_movie.pot = np.loadtxt('xy0', unpack=True, usecols=(10),skiprows=1)

◆ pot_max

galpy_pot_movie.pot_max = pot.max()

◆ pot_min

galpy_pot_movie.pot_min = pot.min()

◆ remainder

galpy_pot_movie.remainder

◆ results

list galpy_pot_movie.results = [None]*n_cpu

◆ shortargs

string galpy_pot_movie.shortargs = 'f:o:h'

◆ t0

galpy_pot_movie.t0

◆ xmax

int galpy_pot_movie.xmax = float(xmax)*1e-3

◆ xmin

int galpy_pot_movie.xmin = float(xmin)*1e-3

◆ xyscale

list galpy_pot_movie.xyscale = [[xmin,xmax,ymin,ymax],[xmin,xmax,zmin,zmax]]

◆ ymax

int galpy_pot_movie.ymax = float(ymax)*1e-3

◆ ymin

int galpy_pot_movie.ymin = float(ymin)*1e-3

◆ zmax

int galpy_pot_movie.zmax = float(zmax)*1e-3

◆ zmin

int galpy_pot_movie.zmin = float(zmin)*1e-3