nbodykit.io.tools

Functions

get_file_slice(sizes, start, stop)

Return the list of file numbers that must be accessed to return data between start and slice, where these indices are defined in terms of the global catalog indexing

get_slice_size(start, stop, step)

Utility function to return the size of an array slice

global_to_local_slice(sizes, start, stop, fnum)

Convert a global slice, specified by start and stop to the corresponding local indices of the file specified by fnum

nbodykit.io.tools.get_file_slice(sizes, start, stop)[source]

Return the list of file numbers that must be accessed to return data between start and slice, where these indices are defined in terms of the global catalog indexing

Parameters
  • sizes (array_like) – the sizes of each file in the file stack

  • start (int) – the global index to begin the slice

  • stop (int) – the global index to stop the slice

Returns

fnums – the list of integers specifying the relevant file numbers that must be accessed

Return type

list

nbodykit.io.tools.get_slice_size(start, stop, step)[source]

Utility function to return the size of an array slice

Parameters
  • start (int) – the beginning of the slice

  • stop (int) – the end of the slice

  • step (int) – the slice step size

Returns

N – the total size of the slice

Return type

int

nbodykit.io.tools.global_to_local_slice(sizes, start, stop, fnum)[source]

Convert a global slice, specified by start and stop to the corresponding local indices of the file specified by fnum

Parameters
  • sizes (array_like) – the sizes of each file in the file stack

  • start (int) – the global index to begin the slice

  • stop (int) – the global index to stop the slice

  • fnum (int) – the file number that defines the desired local indexing

Returns

local_start, local_stop – the local start and stop slice values

Return type

int