DataAnalysisBin.name()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
import pandas as pd
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
3
4
class DataAnalysisBin(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...
best-practice introduced by
Too many instance attributes (8/7)
Loading history...
5
6
    def __init__(self, name, observation_hpx_map, background_hpx_map, active_pixels_ids, n_transits, scheme='RING'):
0 ignored issues
show
best-practice introduced by
Too many arguments (7/5)
Loading history...
7
8
        # Get nside
9
        self._nside = observation_hpx_map.nside
10
11
        nside_bkg = background_hpx_map.nside
12
13
        assert self._nside == nside_bkg, "Observation and background maps have " \
14
                                         "different nside (%i vs %i)" % (self._nside, nside_bkg)
15
16
        self._npix = observation_hpx_map.npix
17
18
        # Store healpix maps
19
        self._observation_hpx_map = observation_hpx_map
20
21
        self._background_hpx_map = background_hpx_map
22
23
        # Store the active pixels (i.e., the pixels that are within the selected ROI)
24
        self._active_pixels_ids = active_pixels_ids
25
26
        # Store name and scheme
27
        self._name = str(name)
28
29
        assert scheme in ['RING', 'NEST'], "Scheme must be either RING or NEST"
30
31
        self._scheme = scheme
32
33
        self._n_transits = n_transits
34
35
    def to_pandas(self):
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...
36
37
        # Make a dataframe
38
        df = pd.DataFrame.from_dict({'observation': self._observation_hpx_map.to_pandas(),
0 ignored issues
show
Coding Style Naming introduced by
Variable name "df" doesn't conform to snake_case naming style ('(([a-z_][a-z0-9_]2,30)|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$' pattern)

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...
39
                                     'background': self._background_hpx_map.to_pandas()})
40
41
        if self._active_pixels_ids is not None:
42
            # We are saving only a subset
43
            df.set_index(self._active_pixels_ids, inplace=True)
44
45
        # Some metadata
46
        meta = {'scheme': 0 if self._scheme == 'RING' else 1,
47
                'n_transits': self._n_transits,
48
                'nside': self._nside}
49
50
        return df, meta
51
52
    @property
53
    def name(self):
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...
54
55
        return self._name
56
57
    @property
58
    def n_transits(self):
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...
59
60
        return self._n_transits
61
62
    @property
63
    def scheme(self):
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...
64
65
        return self._scheme
66
67
    @property
68
    def nside(self):
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...
69
70
        return self._nside
71
72
    @property
73
    def npix(self):
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...
74
        return self._npix
75
76
    @property
77
    def observation_map(self):
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...
78
79
        return self._observation_hpx_map
80
81
    @property
82
    def background_map(self):
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...
83
84
        return self._background_hpx_map
85