当前位置: 首页>>代码示例>>Python>>正文


Python PythonTools.Debug类代码示例

本文整理汇总了Python中PythonTools.Debug的典型用法代码示例。如果您正苦于以下问题:Python Debug类的具体用法?Python Debug怎么用?Python Debug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_ft_axis

def make_ft_axis(length, dt, undersampling = 0, normalized_to_period = 0, zero_in_middle = False, flag_verbose = False):
    """
    fourier transform the time axis
    20101204/RB: started
    20130131/RB: now uses speed of light value from Crocodile.Resources.Constants

    INPUT:
    length: amount of samples
    dt: time between samples
    undersampling: 
    normalized_to_period: will normalize the spectrum to 1 for the specified period. If the number is 0, the spectrum will not be normalized.
    zero_in_middle: determines the frequency axes.

    OUTPUT:
    A frequency axis.     

    """
    DEBUG.verbose("make FT axis", flag_verbose)
    if normalized_to_period == 0:   
        resolution = 1 / ( CONST.wavenumberToInvFs * length * dt)
    else:
        resolution = normalized_to_period / (length * dt)

    array = numpy.arange((undersampling)*length/2, (undersampling+1)*length/2)*resolution

    if zero_in_middle == False:
        return numpy.concatenate((array,-numpy.flipud(array)))
    else:
        return numpy.concatenate((-numpy.flipud(array), array))
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:29,代码来源:Mathematics.py

示例2: execute

def execute(args):

    if args.skip1 == False:
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_setting_file_stuff)
        unittest.TextTestRunner(verbosity=1).run(suite) 
    else:
        DEBUG.verbose("Skipping: " + suite_list[0], True)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:7,代码来源:DataClassCol_Tests.py

示例3: execute

def execute(args):

    if args.skip1 == False:
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_find_axes)
        unittest.TextTestRunner(verbosity=1).run(suite)  
    else:
        DEBUG.verbose("Skipping: " + suite_list[0], True)


    if args.skip2 == False:
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_make_contours_2d)
        unittest.TextTestRunner(verbosity=1).run(suite)    
    else:
        DEBUG.verbose("Skipping: " + suite_list[1], True)   

    if args.skip3 == False:
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_find_axes_indices)
        unittest.TextTestRunner(verbosity=1).run(suite)    
    else:
        DEBUG.verbose("Skipping: " + suite_list[2], True)        

    if args.skip4 == False:
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_truncate_data)
        unittest.TextTestRunner(verbosity=1).run(suite)    
    else:
        DEBUG.verbose("Skipping: " + suite_list[3], True)  

    if args.skip5 == False:
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_find_subplots)
        unittest.TextTestRunner(verbosity=1).run(suite)    
    else:
        DEBUG.verbose("Skipping: " + suite_list[4], True)  
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:32,代码来源:Functions_test.py

示例4: truncate_data

def truncate_data(data, x_axis, y_axis, x_min_i, x_max_i, y_min_i, y_max_i, flag_verbose = False):
    """
    Truncate data in a non-default way. 
    x_axis = [1,2,3,4,5]
    x_min_i = 0
    if x_max_i == 2: x_axis = [1,2]
    if x_max_i == 4: x_axis = [1,2,3,4]
    if x_max_i == -1: x_axis = [1,2,3,4,5]
    
    CHANGELOG:
    20130213: was in Plotting.contourplot function, moved to Functions module, now handles x_max_i == -1
    """
    
    DEBUG.verbose("Truncate data", flag_verbose)

    if x_max_i == -1:
        DEBUG.verbose("  x_max == -1", flag_verbose)
        data = data[:,x_min_i:]
        x_axis = x_axis[x_min_i:]
    else:
        DEBUG.verbose("  x_max != -1", flag_verbose)
        data = data[:,x_min_i:x_max_i]
        x_axis = x_axis[x_min_i:x_max_i]        

    if y_max_i == -1:
        DEBUG.verbose("  y_max == -1", flag_verbose)
        data = data[y_min_i:,:]
        y_axis = y_axis[y_min_i:]   
    else:
        DEBUG.verbose("  y_max != -1", flag_verbose)
        data = data[y_min_i:y_max_i,:]
        y_axis = y_axis[y_min_i:y_max_i]         
        
    return data, x_axis, y_axis
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:34,代码来源:Functions.py

示例5: test_time_stamp_False

 def test_time_stamp_False(self):
     """
     This is correct
     """
     DEBUG.verbose("\nWarning is intentional", True)
     self.dc.time_stamp = False
     self.assertEqual(self.dc.time_stamp, "False")
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:7,代码来源:DataClass_tests.py

示例6:

 def test_time_stamp_5_int(self):
     """
     This is correct
     """
     DEBUG.verbose("\nWarning is intentional", True)
     self.dc.time_stamp = 12345
     self.assertEqual(self.dc.time_stamp, "12345")
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:7,代码来源:DataClass_tests.py

示例7: test_import_data_no_data

 def test_import_data_no_data(self):
     """
     folder exists, LV_file_format.1 exists and is correct, but contains no other data
     """
     self.mess.path = "Test_resources/petw_test_folder_2/"
     DEBUG.verbose("\nError about importing is intentional", True)
     res = self.mess.import_data(flag_verbose = self.flag_verbose)
     self.assertFalse(res)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:Pe_tw_tests.py

示例8: test_phase_rad_nan

 def test_phase_rad_nan(self):
     """
     None sets phase_degrees to init value
     """
     DEBUG.verbose("\nWarning is intentional", True)
     self.dc.phase_rad = None
     self.assertEqual(self.dc.phase_degrees, None)
     self.assertEqual(self.dc.phase_rad, None)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:DataClass_tests.py

示例9:

 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))
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:Pe_merge_tests.py

示例10: test_phase_rad_true

 def test_phase_rad_true(self):
     """
     True should be interpreted as 1
     """
     DEBUG.verbose("\nWarning is intentional", True)
     self.dc.phase_rad = True
     self.assertAlmostEqual(self.dc.phase_degrees, 1 * 180 / numpy.pi)
     self.assertEqual(self.dc.phase_rad, 1)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:DataClass_tests.py

示例11: test_phase_rad_false

 def test_phase_rad_false(self):
     """
     False should be interpreted as 0
     """
     DEBUG.verbose("\nWarning is intentional", True)
     self.dc.phase_rad = False
     self.assertEqual(self.dc.phase_degrees, 0)
     self.assertEqual(self.dc.phase_rad, 0)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:DataClass_tests.py

示例12: test_phase_degrees_none

 def test_phase_degrees_none(self):
     """
     None should will reset phase_degrees to init value
     """
     DEBUG.verbose("\nWarning is intentional", True)
     self.dc.phase_degrees = None
     self.assertEqual(self.dc.phase_degrees, None)
     self.assertEqual(self.dc.phase_rad, None)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:DataClass_tests.py

示例13: test_import_data_incorrect_path

 def test_import_data_incorrect_path(self):
     """
     Path is incorrect, no data imported. Returns False
     """
     self.mess.path = "Test_resources/FolderDoesNotExist/"
     DEBUG.verbose("\nError that directory can't found is intentional", True)
     res = self.mess.import_data(flag_verbose = self.flag_verbose)
     self.assertFalse(res)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:Pe_tw_tests.py

示例14: test_zeropad_to_r_uninit

 def test_zeropad_to_r_uninit(self):
     """
     without r set, it should give an error
     """
     DEBUG.verbose("\nError is intentional", True)
     self.dc.zeropad_to = 40
     self.assertEqual(self.dc.zeropad_to, None)
     self.assertEqual(self.dc.zeropad_by, 1.0)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:DataClass_tests.py

示例15: test_import_data_wrong_file_format

 def test_import_data_wrong_file_format(self):
     """
     LV_file_format.666 should not be recognized.
     """
     self.mess.path = "Test_resources/petw_test_folder_1/"
     DEBUG.verbose("\nError about unknown file format is intentional", True)
     res = self.mess.import_data(flag_verbose = self.flag_verbose)
     self.assertFalse(res)
开发者ID:robbertbloem,项目名称:Crocodile,代码行数:8,代码来源:Pe_tw_tests.py


注:本文中的PythonTools.Debug类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。