Function adas.numlines

def numlines(ndim, llength)

Calculates how many lines in a text file are occupied by a vector given a fixed number of enteries per line.

Parameters

ndim : int
number of elements in the 1D array
llength : int
number of columns.

Returns

num : int
number of line taken.

Notes

Typically used to determine how many lines in a file are taken by a 1D arrray.

Version History

  • Martin O'Mullane, 20-08-2012

    • First version
  • Martin O'Mullane, 16-01-2014

    • Use floor division since python 3 give float for division with /.

Example

Say a vector of 25 elements in a file is arrange in 7 columns, 1 2 3 4 5 6 7 7 6 5 4 3 2 1 1 2 3 4 5 6 7 1 2 3 4

>>> import adas as adas
>>> adas.numlines(25, 7)
4