1- from multiprocessing .sharedctypes import Value
21import numpy as np
32import h5py
43import pytest
54import os
65from datetime import datetime , timedelta
76
8- from RadClass .RadClass import RadClass
7+ from RadClass .Processor import Processor
98import tests .test_data as test_data
109
1110# initialize sample data
@@ -40,9 +39,9 @@ def test_analysis():
4039 integration = int (test_data .timesteps / 10 )
4140
4241 # run handler script
43- classifier = RadClass (stride , integration , test_data .datapath ,
44- test_data .filename , analysis = NullAnalysis (),
45- store_data = False )
42+ classifier = Processor (stride , integration , test_data .datapath ,
43+ test_data .filename , analysis = NullAnalysis (),
44+ store_data = False )
4645 classifier .run_all ()
4746
4847 np .testing .assert_equal (True , classifier .analysis .changed )
@@ -55,11 +54,11 @@ def test_init():
5554 cache_size = 10000
5655 stop_time = 2e9
5756
58- classifier = RadClass (stride = stride , integration = integration ,
59- datapath = test_data .datapath ,
60- filename = test_data .filename , store_data = store_data ,
61- cache_size = cache_size , stop_time = stop_time ,
62- labels = test_data .labels )
57+ classifier = Processor (stride = stride , integration = integration ,
58+ datapath = test_data .datapath ,
59+ filename = test_data .filename , store_data = store_data ,
60+ cache_size = cache_size , stop_time = stop_time ,
61+ labels = test_data .labels )
6362
6463 np .testing .assert_equal (stride , classifier .stride )
6564 np .testing .assert_equal (integration , classifier .integration )
@@ -75,8 +74,8 @@ def test_integration():
7574 integration = int (test_data .timesteps / 10 )
7675
7776 # run handler script
78- classifier = RadClass (stride , integration , test_data .datapath ,
79- test_data .filename , store_data = True )
77+ classifier = Processor (stride , integration , test_data .datapath ,
78+ test_data .filename , store_data = True )
8079 classifier .run_all ()
8180
8281 # the resulting 1-hour observation should be:
@@ -94,9 +93,9 @@ def test_cache():
9493 cache_size = 100
9594
9695 # run handler script
97- classifier = RadClass (stride , integration , test_data .datapath ,
98- test_data .filename , store_data = True ,
99- cache_size = cache_size )
96+ classifier = Processor (stride , integration , test_data .datapath ,
97+ test_data .filename , store_data = True ,
98+ cache_size = cache_size )
10099 classifier .run_all ()
101100
102101 # the resulting 1-hour observation should be:
@@ -113,8 +112,8 @@ def test_stride():
113112 integration = 5
114113
115114 # run handler script
116- classifier = RadClass (stride , integration , test_data .datapath ,
117- test_data .filename )
115+ classifier = Processor (stride , integration , test_data .datapath ,
116+ test_data .filename )
118117 classifier .run_all ()
119118
120119 # the resulting 1-hour observation should be:
@@ -137,8 +136,8 @@ def test_write():
137136 filename = 'test_results'
138137
139138 # run handler script
140- classifier = RadClass (stride , integration , test_data .datapath ,
141- test_data .filename )
139+ classifier = Processor (stride , integration , test_data .datapath ,
140+ test_data .filename )
142141 classifier .run_all ()
143142 classifier .write (filename )
144143
@@ -184,9 +183,9 @@ def test_start():
184183 start_time = timestamps [integration ]
185184
186185 # run handler script
187- classifier = RadClass (stride , integration , test_data .datapath ,
188- test_data .filename , store_data = True ,
189- cache_size = cache_size , start_time = start_time )
186+ classifier = Processor (stride , integration , test_data .datapath ,
187+ test_data .filename , store_data = True ,
188+ cache_size = cache_size , start_time = start_time )
190189 classifier .run_all ()
191190
192191 integration_val = (((2 * integration )* (2 * integration - 1 )/ 2 ) -
@@ -212,9 +211,9 @@ def test_stop():
212211 stop_time = timestamps [integration * (periods - 1 )+ 1 ]
213212
214213 # run handler script
215- classifier = RadClass (stride , integration , test_data .datapath ,
216- test_data .filename , store_data = True ,
217- cache_size = cache_size , stop_time = stop_time )
214+ classifier = Processor (stride , integration , test_data .datapath ,
215+ test_data .filename , store_data = True ,
216+ cache_size = cache_size , stop_time = stop_time )
218217 classifier .run_all ()
219218
220219 integration_val = (((integration * (periods - 1 )) *
@@ -238,9 +237,9 @@ def test_max_stop():
238237 stop_time = timestamps [- 1 ]+ 1000.0
239238
240239 # run handler script
241- classifier = RadClass (stride , integration , test_data .datapath ,
242- test_data .filename , store_data = True ,
243- stop_time = stop_time )
240+ classifier = Processor (stride , integration , test_data .datapath ,
241+ test_data .filename , store_data = True ,
242+ stop_time = stop_time )
244243 classifier .run_all ()
245244
246245 # the resulting 1-hour observation should be:
@@ -259,23 +258,23 @@ def test_bad_start_stop():
259258 # Checks if start_time > stop_time
260259 start_time = timestamps [1 ]
261260 stop_time = timestamps [0 ]
262- classifier = RadClass (stride , integration , test_data .datapath ,
263- test_data .filename , start_time = start_time ,
264- stop_time = stop_time )
261+ classifier = Processor (stride , integration , test_data .datapath ,
262+ test_data .filename , start_time = start_time ,
263+ stop_time = stop_time )
265264 with pytest .raises (ValueError ):
266265 classifier .queue_file ()
267266
268267 # checks if start_time > last timestamp
269268 start_time = timestamps [- 1 ] + 1000.0
270- classifier = RadClass (stride , integration , test_data .datapath ,
271- test_data .filename , start_time = start_time )
269+ classifier = Processor (stride , integration , test_data .datapath ,
270+ test_data .filename , start_time = start_time )
272271 with pytest .raises (ValueError ):
273272 classifier .queue_file ()
274273
275274 # checks if stop_time < first timestamp
276275 stop_time = timestamps [0 ] - 1000.0
277- classifier = RadClass (stride , integration , test_data .datapath ,
278- test_data .filename , stop_time = stop_time )
276+ classifier = Processor (stride , integration , test_data .datapath ,
277+ test_data .filename , stop_time = stop_time )
279278 with pytest .raises (ValueError ):
280279 classifier .queue_file ()
281280
@@ -287,8 +286,8 @@ def test_equal_start_stop():
287286 # Checks if start_time = stop_time
288287 start_time = timestamps [0 ]
289288 stop_time = timestamps [0 ]
290- classifier = RadClass (stride , integration , test_data .datapath ,
291- test_data .filename , start_time = start_time ,
292- stop_time = stop_time )
289+ classifier = Processor (stride , integration , test_data .datapath ,
290+ test_data .filename , start_time = start_time ,
291+ stop_time = stop_time )
293292 with pytest .raises (RuntimeWarning ):
294293 classifier .queue_file ()
0 commit comments