예제 #1
0
 def test_r_2(self):
     """
     for 1 object, r has a different size
     no zeropad warning because it is not set
     """
     self.mess[0].r[0] = numpy.ones((20,20))
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertEqual(mer.r, [0,0])     
예제 #2
0
 def test_2p_1m(self):
     """
     mess[0].s = 1 + [1].s: 2 - [2].s: 3
     (1 + 2) / 2 - 3 = -1.5
     """
     DEBUG.verbose("\nWarning about zeropad intentional", True)
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0], self.mess[1]], class_min = [self.mess[2]], flag_verbose = self.flag_verbose)
     self.assertTrue(numpy.all(mer.s == -1.5))
예제 #3
0
 def test_r_1(self):
     """
     for 1 object, only s exists: r is still as initialized: [0]
     no zeropad warning because it is not set
     """
     self.mess[0].r = [0]
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertEqual(mer.r, [0,0])           
예제 #4
0
 def test_s_2(self):
     """
     for 1 object, s has a different size
     no zeropad warning because the s is not set and there is no need
     """
     self.mess[0].s = numpy.ones((20,20))
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertEqual(mer.s, [0])      
예제 #5
0
 def test_s_1(self):
     """
     for 1 object s is still as initialized: [0]
     no zeropad warning because the s is not set and there is no need
     """
     self.mess[0].s = [0]
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertEqual(mer.s, [0])        
예제 #6
0
 def test_rs_1(self):
     """
     This should work correct
     r and s exist
     """
     DEBUG.verbose("\nTwo intentional zeropad warnings", True)
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertTrue(numpy.all(mer.s))
예제 #7
0
 def test_phase_degrees_uninit_1(self):
     """
     mess[0].phase_degrees = None
     s=[0] to suppress zeropad warning
     """
     self.mess[0].s = [0]
     DEBUG.verbose("\nIntentional phase warning", True)
     self.mess[0].phase_degrees = None
     DEBUG.verbose("\nIntentional phase warning", True)
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertEqual(mer.phase_degrees, None)  
예제 #8
0
 def test_phase_degrees_uninit_2(self):
     """
     mess[1].phase_degrees = None
     s=[0] to suppress zeropad warning
     Tests if the order makes a difference. It shouldn't
     """
     self.mess[0].s = [0]
     DEBUG.verbose("\nIntentional phase warning", True)
     self.mess[1].phase_degrees = None
     DEBUG.verbose("\nError is intentional", True)
     mer = PEME.pe_merge("Test", class_plus = [self.mess[0]], class_min = [self.mess[1]], flag_verbose = self.flag_verbose)
     self.assertEqual(mer.phase_degrees, None)  
예제 #9
0
def generate_pickle(pickle_path_and_filename, flag_verbose = False):

    DEBUG.verbose("Generating pickle", flag_verbose)

    aha = PETW.pe_LV("aha", "PI99aha", 1626, 300)
    aha.path = "/Users/robbert/Developer/Crocodile/Tests/Test_resources/PI99aha_1626_T300/"
    aha.import_data()
    aha.zeropad_by = 4
    aha.absorptive()
    aha.r = [0,0]

    buf = PETW.pe_LV("buf", "PI99buf", 1617, 300)
    buf.path = "/Users/robbert/Developer/Crocodile/Tests/Test_resources/PI99buf_1617_T300/"
    buf.import_data()
    buf.zeropad_by = 4
    buf.absorptive()  
    buf.r = [0,0]

    m = PEME.pe_merge("merge", class_plus = [aha], class_min = [buf])  

    oa = OA.objectarray("merge")
    oa.add_object(m)
    oa.save_objectarray(pickle_path_and_filename, flag_overwrite = True)
예제 #10
0
 def test_list_not_equal_1(self):  
     index = 1
     self.A.var_list = [1,1] 
     PEME.check_value_set_key(self.A, self.B, "var_list", index, flag_verbose = self.flag_verbose)  
     self.assertTrue(numpy.isnan(self.A.var_list))
예제 #11
0
 def test_list_equal_1(self): 
     index = 1
     self.A.var_list = [0,0] 
     PEME.check_value_set_key(self.A, self.B, "var_list", index, flag_verbose = self.flag_verbose)    
     self.assertEqual(self.A.var_list, [0,0])
예제 #12
0
 def test_list_uninit_1(self): 
     index = 1
     PEME.check_value_set_key(self.A, self.B, "var_list", index, flag_verbose = self.flag_verbose)    
     self.assertEqual(self.A.var_list, False)
예제 #13
0
 def test_int_not_equal_0(self):
     index = 0    
     self.A.var_int = 2  
     PEME.check_value_set_key(self.A, self.B, "var_int", index, flag_verbose = self.flag_verbose)    
     self.assertTrue(numpy.isnan(self.A.var_int))
예제 #14
0
 def test_int_equal_1(self): 
     index = 1  
     self.A.var_int = 1 
     PEME.check_value_set_key(self.A, self.B, "var_int", index, flag_verbose = self.flag_verbose)    
     self.assertEqual(self.A.var_int, 1)
예제 #15
0
 def test_int_uninit_0(self):      
     index = 0
     PEME.check_value_set_key(self.A, self.B, "var_int", index, flag_verbose = self.flag_verbose)    
     self.assertEqual(self.A.var_int, 1)
예제 #16
0
        oar = False
        
    #########
    # MERGE #
    #########
    if activity == "mess_s_to_sub_s" or activity == "merge" or activity == "all":
        if len(sub_type_plus) > 0 and len(sub_type_min) > 0:
        
            if not oas:
                oas = OA.objectarray(str(mess_date) + "_s", flag_verbose = flag_verbose)
                import_pickle(oas, pickle_paf_s, mess_array, flag_verbose = flag_verbose)        
            
            # select object with sub_types
            class_plus = oas.objects_with_sub_type(sub_type_plus, flag_verbose = flag_verbose)
            class_min = oas.objects_with_sub_type(sub_type_min, flag_verbose = flag_verbose)        
            mess = PEME.pe_merge(str(mess_date), class_plus, class_min, flag_verbose = flag_verbose)
            
            # make a merged object
            oam = OA.objectarray(str(mess_date) + "_m", flag_verbose = flag_verbose)
            oam.add_object(mess, flag_verbose = flag_verbose)
            oam.save_objectarray(pickle_paf_m, flag_overwrite = True, flag_verbose = flag_verbose)

    #######################
    # PLOT MERGED SPECTRA #
    #######################
    if activity == "plot_m" or activity == "all":
        if not oam:
            oam = OA.objectarray(str(mess_date) + "_m", flag_verbose = flag_verbose)
            import_pickle(oam, pickle_paf_m, flag_verbose = flag_verbose)   
        
        # plot all - usually only one