Issues (58)

scripts/transform.py (11 issues)

1
#!/usr/bin/env python2.7
2
"""Apply transformation to pointcloud.
3
4
The transformations (if given) are applied in the following order:
5
1. rotation
6
2. scaling
7
3. offset
8
9
Usage:
10
  transform.py [-o <origin>] [-r <rot>] [-t <translate>] [-s <scaling>] <source> <target>
0 ignored issues
show
This line is too long as per the coding-style (89/79).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
11
12
Positional arguments:
13
  source            Source pointcloud file
14
  target            Target pointcloud file
15
16
Options:
17
  -r <rot>          CSV file of a 4x4 transformation matrix, assumed to be
18
                    normalized.
19
  -o <rot_origin>   CSV file with a 3d point of the origin for the
20
                    rotation and scaling
21
  -s <scaling>      CSV file with a single scaling multiplication factor.
22
  -t <translate>    CSV file with a 3d vector to translate the pointcloud with.
23
"""
24
25
from __future__ import print_function
26
from docopt import docopt
27
28
import numpy as np
29
from patty.utils import load, save
30
31
32
def csv_read(path):
33
    return np.genfromtxt(path, dtype=float, delimiter=',')
34
35
36
if __name__ == '__main__':
37
    args = docopt(__doc__)
0 ignored issues
show
Coding Style Naming introduced by
The name args does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
38
39
    pc = load(args['<source>'])
0 ignored issues
show
Coding Style Naming introduced by
The name pc does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
40
41
    try:
42
        offset = csv_read(args['-o'])
0 ignored issues
show
Coding Style Naming introduced by
The name offset does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
43
    except:
44
        offset = None
0 ignored issues
show
Coding Style Naming introduced by
The name offset does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
45
46
    try:
47
        matrix = csv_read(args['-r'])
0 ignored issues
show
Coding Style Naming introduced by
The name matrix does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
48
        pc.rotate(matrix, origin=offset)
49
    except Exception as e:
0 ignored issues
show
Coding Style Naming introduced by
The name e does not conform to the variable naming conventions ([a-z_][a-z0-9_]{1,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
50
        print('Problem with rotate: ', e)
51
52
    try:
53
        factor = csv_read(args['-s'])
0 ignored issues
show
Coding Style Naming introduced by
The name factor does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
54
        pc.scale(factor, origin=offset)
55
    except Exception as e:
0 ignored issues
show
Coding Style Naming introduced by
The name e does not conform to the variable naming conventions ([a-z_][a-z0-9_]{1,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
56
        print('Problem with scale: ', e)
57
58
    try:
59
        vector = csv_read(args['-t'])
0 ignored issues
show
Coding Style Naming introduced by
The name vector does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
60
        pc.translate(vector)
61
    except Exception as e:
0 ignored issues
show
Coding Style Naming introduced by
The name e does not conform to the variable naming conventions ([a-z_][a-z0-9_]{1,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
62
        print('Problem with translate: ', e)
63
64
    save(pc, args['<target>'])
65