Calculate row heights.
492965
function recalculateRowHeights(tableGrid, heights) {
        var allRows = tableGrid.getAllRows();
        return Tools.map(allRows, function (row, i) {
          return {
            element: row.element,
            height: heights[i]
          };
        });
      }
1227278
def eight_neighbors(self, row, col):
        
        ans = []
        if row > 0:
            ans.append((row - 1, col))
        if row < self.grid_height - 1:
            ans.append((row + 1, col))
        if col > 0:
            ans.append((row, col - 1))
        if col < self.grid_width - 1:
            ans.append((row, col + 1))
        if (row > 0) and (col > 0):
            ans.append((row - 1, col - 1))
        if (row > 0) and (col < self.grid_width - 1):
            ans.append((row - 1, col + 1))
        if (row < self.grid_height - 1) and (col > 0):
            ans.append((row + 1, col - 1))
        if (row < self.grid_height - 1) and (col < self.grid_width - 1):
            ans.append((row + 1, col + 1))
        return ans
963767
def rowcol(x, y, affine, op=math.floor):
    
    r = int(op((y - affine.f) / affine.e))
    c = int(op((x - affine.c) / affine.a))
    return r, c
240727
private function calculateSizes()
    {
        // For each row...
        foreach ($this->data as $rowPosition => $rowContent) {
            // ... cycle each column to get its content ...
            foreach ($rowContent as $columnName => $cellContent) {
                // If we don't already know the height of this row...
                if (false === isset($this->rowsHeights[$rowPosition])) {
                    // ... we save the current calculated height
                    $this->rowsHeights[$rowPosition] = count($cellContent);
                }

                // Set the min_width if it is set
                if (isset($this->options['columns'][$columnName]['min_width'])) {
                    $this->columnsWidths[$columnName] = $this->options['columns'][$columnName]['min_width'];
                }

                // At this point we have the heigth for sure: on each cycle, we need the highest height
                if (count($cellContent) > $this->rowsHeights[$rowPosition]) {
                    /*
                     * The height of this row is the highest found: use this to set the height of the entire row.
                     */
                    $this->rowsHeights[$rowPosition] = count($cellContent);
                }

                // ... and calculate the length of each line to get the max length of the column
                foreach ($cellContent as $lineNumber => $lineContent) {
                    // Get the length of the cell
                    $contentLength = iconv_strlen($lineContent);

                    // If we don't already have a length for this column...
                    if (false === isset($this->columnsWidths[$columnName])) {
                        // ... we save the current calculated length
                        $this->columnsWidths[$columnName] = $contentLength;
                    }

                    // At this point we have a length for sure: on each cycle we need the longest length
                    if ($contentLength > $this->columnsWidths[$columnName]) {
                        /*
                         * The length of the content of this cell is longer than the value we already have.
                         * So we need to use this new value as length for the current column.
                         */
                        $this->columnsWidths[$columnName] = $contentLength;
                    }
                }
            }
        }
    }
53585
def calculate_columns(sequence):
    
    columns = {}

    for row in sequence:
        for key in row.keys():
            if key not in columns:
                columns[key] = len(key)

            value_length = len(str(row[key]))
            if value_length > columns[key]:
                columns[key] = value_length

    return columns
1043081
protected function calculateRowHeight($row)
    {
        $rowsPerCell = array_map(function ($size, $columnWidth) {
            if (is_array($columnWidth)) {
                $rows = 0;
                foreach ($columnWidth as $width) {
                    $rows += ceil($width / ($size - 2));
                }

                return $rows;
            }

            return ceil($columnWidth / ($size - 2));
        }, $this->_columnWidths, array_map(function ($val) {
            if (is_array($val)) {
                $encodings = array_fill(0, count($val), $this->app->encoding);
                return array_map('mb_strwidth', $val, $encodings);
            }

            return mb_strwidth($val, $this->app->encoding);
        }, $row)
        );

        return max($rowsPerCell);
    }
187671
def row(self, fields):
        """"""

        d = self.dict

        row = [None] * len(fields)

        for i, f in enumerate(fields):
            if f in d:
                row[i] = d[f]

        return row
531225
function(rows){
			arrUnits = rows.map(function(row) { return row.unit; });
			profiler.stop('mc-wc-descendants-initial');
			goDown([objEarlierUnitProps.unit]);
		}
466313
def _xls2row_heights(self, worksheet, tab):
        """"""

        for row in xrange(worksheet.nrows):
            try:
                height_points = worksheet.rowinfo_map[row].height / 20.0
                height_inches = height_points / 72.0
                height_pixels = height_inches * get_dpi()[1]

                self.code_array.row_heights[row, tab] = height_pixels

            except KeyError:
                pass
551541
def set_row_min_height(self, y: int, min_height: int):
        """"""
        if y < 0:
            raise IndexError('y < 0')
        self._min_heights[y] = min_height
26955
def count_rows_with_nans(X):
    """"""
    if X.ndim == 2:
        return np.where(np.isnan(X).sum(axis=1) != 0, 1, 0).sum()
476047
function getHeightValue(data, recordIndex, heightIndex) {
  if (recordIndex > 720) {
    recordIndex = 720;
  } else if (recordIndex < 0) {
    recordIndex = 0;
  }

  if (heightIndex > 1439) {
    heightIndex -= 1440;
  } else if (heightIndex < 0) {
    heightIndex += 1440;
  }

  return data[recordIndex * 1440 + heightIndex];
}
1212361
def compute_column_width_and_height(self):
        '''
        
        '''
        # skip tables with no row
        if not self.rows:
            return

        # determine row height
        for row in self.rows:
            max_row_height = max((len(cell.get_cell_lines()) for cell in row.columns)) if row.columns else 1
            for cell in row.columns:
                cell.height = max_row_height

        # determine maximum number of columns
        max_columns = max([len(row.columns) for row in self.rows])

        for column_idx in range(max_columns):
            # determine max_column_width
            row_cell_lines = [row.get_cell_lines(column_idx) for row in self.rows]
            max_column_width = max((len(line) for line in chain(*row_cell_lines)))

            # set column width in all rows
            for row in self.rows:
                if len(row.columns) > column_idx:
                    row.columns[column_idx].width = max_column_width
447383
protected function _calculateWidths($rows)
    {
        $widths = [];
        foreach ($rows as $line) {
            foreach (array_values($line) as $k => $v) {
                $columnLength = $this->_cellWidth($v);
                if ($columnLength >= (isset($widths[$k]) ? $widths[$k] : 0)) {
                    $widths[$k] = $columnLength;
                }
            }
        }

        return $widths;
    }
610694
public void fixRowsAndCols() {
        rows = (int) Math.round((n - s) / ns_res);
        if (rows < 1)
            rows = 1;
        cols = (int) Math.round((e - w) / we_res);
        if (cols < 1)
            cols = 1;
    }
228870
def check_params(num_rows, num_cols, padding):
    """"""

    num_rows = check_int(num_rows, 'num_rows', min_value=1)
    num_cols = check_int(num_cols, 'num_cols', min_value=1)
    padding = check_int(padding, 'padding', min_value=0)

    return num_rows, num_cols, padding
325144
def get_columns_rows(filenames):
    """"""
    tiles = []
    for filename in filenames:
        row, column = os.path.splitext(filename)[0][-5:].split('_')
        tiles.append((int(row), int(column)))
    rows = [pos[0] for pos in tiles]; columns = [pos[1] for pos in tiles]
    num_rows = max(rows); num_columns = max(columns)
    return (num_columns, num_rows)