hawc_hal.region_of_interest.healpix_roi_base   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A HealpixROIBase.from_dict() 0 3 1
A HealpixROIBase.display() 0 3 1
A HealpixROIBase.to_dict() 0 3 1
A HealpixROIBase._active_pixels() 0 3 1
A HealpixROIBase.active_pixels() 0 20 1
1
_EQUATORIAL = 'equatorial'
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
_GALACTIC = 'galactic'
3
4
_RING = 'RING'
5
_NESTED = 'NESTED'
6
7
8
class HealpixROIBase(object):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
9
10
    def active_pixels(self, nside, system=_EQUATORIAL, ordering=_RING):
11
        """
12
        Returns the non-zero elements, i.e., the pixels selected according to this Region Of Interest
13
14
        :param nside: the NSIDE of the healpix map
15
        :param system: the system of the Healpix map, either 'equatorial' or 'galactic' (default: equatorial)
16
        :param ordering: numbering scheme for Healpix. Either RING or NESTED (default: RING)
17
        :return: an array of pixels IDs (in healpix RING numbering scheme)
18
        """
19
20
        # Let's transform to lower case (so Equatorial will work, as well as EQuaTorial, or whatever)
21
        system = system.lower()
22
23
        assert system == _EQUATORIAL, "%s reference system not supported" % system
24
25
        assert ordering in [_RING, _NESTED], "Could not understand ordering %s. Must be %s or %s" % (ordering,
26
                                                                                                     _RING,
27
                                                                                                     _NESTED)
28
29
        return self._active_pixels(nside, ordering)
30
31
    # This is supposed to be overridden by child classes
32
    def _active_pixels(self, nside, ordering):  # pragma: no cover
33
34
        raise NotImplementedError("You need to implement this")
35
36
    def display(self):  # pragma: no cover
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
37
38
        raise NotImplementedError("You need to implement this")
39
40
    def to_dict(self):  # pragma: no cover
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
41
42
        raise NotImplementedError("You need to implement this")
43
44
    def from_dict(self, data):  # pragma: no cover
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
45
46
        raise NotImplementedError("You need to implement this")
47