Code Duplication    Length = 32-34 lines in 2 locations

pyspectral/tests/test_rayleigh.py 1 location

@@ 43-76 (lines=34) @@
40
    TEST_RAYLEIGH_WVL_COORD)
41
42
43
TEST_RAYLEIGH_RESULT1 = np.array([10.40727436,   8.69775471], dtype='float32')
44
TEST_RAYLEIGH_RESULT2 = np.array([9.71695252,  8.51415601], dtype='float32')
45
TEST_RAYLEIGH_RESULT3 = np.array([5.61532271,  8.69267476], dtype='float32')
46
47
48
import os
49
from mock import patch
50
51
# Mock some modules, so we don't need them for tests.
52
53
# sys.modules['pyresample'] = MagicMock()
54
55
56
class RelativeSpectralResponseTestData(object):
57
58
    """RSR test data"""
59
60
    def __init__(self):
61
        """Making a testdata set of relative spectral responses"""
62
63
        self.rsr = {}
64
        channel_names = ['ch12', 'ch13', 'ch10', 'ch11', 'ch16', 'ch14',
65
                         'ch15', 'ch1', 'ch2', 'ch3', 'ch4', 'ch5', 'ch6',
66
                         'ch7', 'ch8', 'ch9']
67
        wvl = [9.6372744012936646, 10.407492196078628, 7.3468642293967275,
68
               8.5926867614178715, 13.280724258676756, 11.239642285822033,
69
               12.380741429961382, 0.47063607733748003, 0.5099976405799187,
70
               0.63914891611559055, 0.85668832355426627, 1.6100814361999056,
71
               2.2568056299864101, 3.8853663735353847, 6.2428987228916233,
72
               6.9411756334211789]
73
        ch3_wvl = np.array([0.55518544, 0.56779468, 0.58099002, 0.59481323, 0.60931027,
74
                            0.62453163, 0.64053291, 0.65737575, 0.67512828, 0.69386619,
75
                            0.71367401])
76
        ch3_resp = np.array([2.61000005e-05, 1.07899999e-04, 3.26119992e-03,
77
                             2.90650606e-01, 9.02460396e-01, 9.60878074e-01,
78
                             9.97266889e-01, 9.94823873e-01, 7.18220174e-01,
79
                             8.31819978e-03, 9.34999989e-05])

pyspectral/tests/test_utils.py 1 location

@@ 75-106 (lines=32) @@
72
    dtype='float32')
73
74
75
class RsrTestData(object):
76
77
    """Container for the RSR test datasets"""
78
79
    def __init__(self):
80
        self.rsr = {}
81
        channel_names = ['ch12', 'ch13', 'ch10', 'ch11', 'ch16', 'ch14',
82
                         'ch15', 'ch1', 'ch2', 'ch3', 'ch4', 'ch5', 'ch6',
83
                         'ch7', 'ch8', 'ch9']
84
        wvl = [9.6372744012936646, 10.407492196078628, 7.3468642293967275,
85
               8.5926867614178715, 13.280724258676756, 11.239642285822033,
86
               12.380741429961382, 0.47063607733748003, 0.5099976405799187,
87
               0.63914891611559055, 0.85668832355426627, 1.6100814361999056,
88
               2.2568056299864101, 3.8853663735353847, 6.2428987228916233,
89
               6.9411756334211789]
90
        ch3_wvl = np.array([0.55518544, 0.56779468, 0.58099002, 0.59481323, 0.60931027,
91
                            0.62453163, 0.64053291, 0.65737575, 0.67512828, 0.69386619,
92
                            0.71367401])
93
        ch3_resp = np.array([2.61000005e-05, 1.07899999e-04, 3.26119992e-03,
94
                             2.90650606e-01, 9.02460396e-01, 9.60878074e-01,
95
                             9.97266889e-01, 9.94823873e-01, 7.18220174e-01,
96
                             8.31819978e-03, 9.34999989e-05])
97
98
        idx = 0
99
        for chname in channel_names:
100
            self.rsr[chname] = {'det-1': {}}
101
            self.rsr[chname]['det-1']['central_wavelength'] = wvl[idx]
102
            idx = idx + 1
103
104
        chname = 'ch3'
105
        self.rsr[chname]['det-1']['wavelength'] = ch3_wvl
106
        self.rsr[chname]['det-1']['response'] = ch3_resp
107
108
109
class TestUtils(unittest.TestCase):