Fix count, allow point-cloud without feature
This commit is contained in:
parent
39ba87c0e9
commit
3dcf9bec74
@ -143,6 +143,9 @@ def load_txt(fname, header, delimiter=' ', dtype=None):
|
|||||||
for i in ('x', 'y', 'z'):
|
for i in ('x', 'y', 'z'):
|
||||||
header_c.remove(i)
|
header_c.remove(i)
|
||||||
|
|
||||||
|
if not header_c:
|
||||||
|
return spatial
|
||||||
|
|
||||||
log.debug('Create feature recarray')
|
log.debug('Create feature recarray')
|
||||||
feature = raw_txt[header_c]
|
feature = raw_txt[header_c]
|
||||||
|
|
||||||
|
|||||||
@ -237,7 +237,9 @@ def insight(grid, feature=None, method='density', mem_limit=None, verbose=False)
|
|||||||
print('\n'.join(lines))
|
print('\n'.join(lines))
|
||||||
|
|
||||||
if mem_limit and mem_usage > mem_limit:
|
if mem_limit and mem_usage > mem_limit:
|
||||||
msg = 'The memory requirement is higher than allowed memory usage.'
|
msg = 'The memory requirement is higher than\
|
||||||
|
maximum authorized memory usage ({} GB needed).'.format(
|
||||||
|
humanize.naturalsize(mem_usage, binary=True))
|
||||||
log.error(msg)
|
log.error(msg)
|
||||||
raise MemoryError(msg)
|
raise MemoryError(msg)
|
||||||
|
|
||||||
@ -249,7 +251,7 @@ def _print_insight(grid, mem_usage, mem_limit):
|
|||||||
'Grid shape: \t{}'.format([x.size - 1 for x in grid]),
|
'Grid shape: \t{}'.format([x.size - 1 for x in grid]),
|
||||||
'Number of cells:\t{}'.format(humanize.intword(_bin_insight(grid))),
|
'Number of cells:\t{}'.format(humanize.intword(_bin_insight(grid))),
|
||||||
'Predicted RAM usage:\t{}'.format(humanize.naturalsize(mem_usage, binary=True)),
|
'Predicted RAM usage:\t{}'.format(humanize.naturalsize(mem_usage, binary=True)),
|
||||||
'Allowed max RAM usage:\t{}'.format(humanize.naturalsize(mem_limit, binary=True) if mem_limit else 'Not set'),
|
'Max allowed RAM usage:\t{}'.format(humanize.naturalsize(mem_limit, binary=True) if mem_limit else 'Not set'),
|
||||||
'--------------------',]
|
'--------------------',]
|
||||||
return print_lines
|
return print_lines
|
||||||
|
|
||||||
@ -326,7 +328,7 @@ def squash(voxel_grid, method='top', axis=-1):
|
|||||||
if method in ('top', 'center', 'bottom'):
|
if method in ('top', 'center', 'bottom'):
|
||||||
return _squash_position(voxel_grid, method, axis)
|
return _squash_position(voxel_grid, method, axis)
|
||||||
elif method == 'count':
|
elif method == 'count':
|
||||||
return ~voxel_grid.mask.sum(axis=axis)
|
return np.sum(~voxel_grid.mask, axis=axis)
|
||||||
elif method == 'mean':
|
elif method == 'mean':
|
||||||
return voxel_grid.mean(axis=axis)
|
return voxel_grid.mean(axis=axis)
|
||||||
elif method == 'median':
|
elif method == 'median':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user