pencil.calc.part_to_grid

Functions

part_to_grid(xp, yp[, zp, quantity, Nbins, sim, ...])

Bins quantity based on position data xp and yp to 1024^2 bins like a histrogram.

Module Contents

pencil.calc.part_to_grid.part_to_grid(xp, yp, zp=False, quantity=False, Nbins=[1024, 1024, 1024], sim=False, extent=False, fill_gaps=False)

Bins quantity based on position data xp and yp to 1024^2 bins like a histrogram. This method is not using TSC.

Parameters:
  • xp (-) – array of x and y positions

  • yp – array of x and y positions

  • zp (-) – specify if 3D run, set False to have zp == 0

  • quantity (-) – array of same shape as xp and yp, but with quantity to bin, set it False to count number of occurrences/histrogram2d

  • Nbins (-) – number of histrogram bins for each direction. if 2d only the first two entries in Nbins are used

  • sim (-) – to extract extent from by loading ghostzone-free grid

  • extent (-) – [[xmin, xmax],[ymin, ymax]] or set false and instead give a sim set extent manually e.g. if you want to include ghost zones

  • cells (- fill_gaps interpolate empty grid)

Returns: arr, xgrid, ygrid
  • arr: 2d array with binned values

  • x-/ygrid: linspace of used x/y grid

  • zgrid: if zp != False

Example

vpx = part_to_grid_2d(pvar.xp, pvar.yp, pvar.vpx), notice that this will execute pc.get_sim() internally to get the extent