Code Duplication    Length = 32-34 lines in 2 locations

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):

pyspectral/tests/test_rayleigh.py 1 location

@@ 56-89 (lines=34) @@
53
54
# sys.modules['pyresample'] = MagicMock()
55
56
57
class RelativeSpectralResponseTestData(object):
58
59
    """RSR test data"""
60
61
    def __init__(self):
62
        """Making a testdata set of relative spectral responses"""
63
64
        self.rsr = {}
65
        channel_names = ['ch12', 'ch13', 'ch10', 'ch11', 'ch16', 'ch14',
66
                         'ch15', 'ch1', 'ch2', 'ch3', 'ch4', 'ch5', 'ch6',
67
                         'ch7', 'ch8', 'ch9']
68
        wvl = [9.6372744012936646, 10.407492196078628, 7.3468642293967275,
69
               8.5926867614178715, 13.280724258676756, 11.239642285822033,
70
               12.380741429961382, 0.47063607733748003, 0.5099976405799187,
71
               0.63914891611559055, 0.85668832355426627, 1.6100814361999056,
72
               2.2568056299864101, 3.8853663735353847, 6.2428987228916233,
73
               6.9411756334211789]
74
        ch3_wvl = np.array([0.55518544, 0.56779468, 0.58099002, 0.59481323, 0.60931027,
75
                            0.62453163, 0.64053291, 0.65737575, 0.67512828, 0.69386619,
76
                            0.71367401])
77
        ch3_resp = np.array([2.61000005e-05, 1.07899999e-04, 3.26119992e-03,
78
                             2.90650606e-01, 9.02460396e-01, 9.60878074e-01,
79
                             9.97266889e-01, 9.94823873e-01, 7.18220174e-01,
80
                             8.31819978e-03, 9.34999989e-05])
81
82
        idx = 0
83
        for chname in channel_names:
84
            self.rsr[chname] = {'det-1': {}}
85
            self.rsr[chname]['det-1']['central_wavelength'] = wvl[idx]
86
            idx = idx + 1
87
88
        chname = 'ch3'
89
        self.rsr[chname]['det-1']['wavelength'] = ch3_wvl
90
        self.rsr[chname]['det-1']['response'] = ch3_resp
91
92