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


Python CurveDB.save方法代码示例

本文整理汇总了Python中pyinstruments.curvestore.models.CurveDB.save方法的典型用法代码示例。如果您正苦于以下问题:Python CurveDB.save方法的具体用法?Python CurveDB.save怎么用?Python CurveDB.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyinstruments.curvestore.models.CurveDB的用法示例。


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

示例1: test_save_params_only

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_save_params_only(self):
     from curve import Curve
     models.PROFILE_SAVE = True
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     
     print_and_log("================================")
     
     for i in range(5):
         curve = CurveDB()
         curve.set_data(pandas.Series([1,4,6]))
         for j in range(100):
             curve.params['coucou' + str(j)] = i*j
         tic = time.time()
         curve.save_params()
         print_and_log("time for saving 100 parameters in db only, new curve each time: " + str(time.time() - tic))
     print_and_log("================================")
     for i in range(5):
         curve = CurveDB()
         curve.set_data(pandas.Series([1,4,6]))
         for j in range(100):
             curve.params['coucou' + str(j)] = i*j
         tic = time.time()
         curve.save()
         print_and_log("time for saving 1 curve with 100 parameters, new curve each time: " + str(time.time() - tic))
     models.PROFILE_SAVE = False
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:30,代码来源:tests.py

示例2: test_import_export_with_childs

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
    def test_import_export_with_childs(self):
        from pyinstruments import CurveDB
        c = CurveDB()
        s = pandas.Series([1,2,1])
        c.set_data(s)
        c.name = 'to_be_exported'
        c.save()
        
        c2 = CurveDB()
        s2 = pandas.Series([1,3,1])
        c2.set_data(s2)
        c2.name = 'to_be_exported_child'
        c2.move(c)
        
        queryset = CurveDB.objects.filter(id__in=[c.id, c2.id])
        from pyinstruments.curvestore.export import export_zip, import_zip
        export_zip(queryset, osp.dirname(__file__) + '/tests/temp_files/' +\
                    'test_export1.zip')
        c.delete()
        import_zip(osp.dirname(__file__) + '/tests/temp_files/' + \
                    'test_export1.zip')
        q = CurveDB.objects.filter_param('name', value='to_be_exported_child')

        self.assertEqual(q.count(), 1)
        self.assertLess((q[0].data - s2).abs().max(), 0.001)
开发者ID:tjzhaomengyi,项目名称:pyinstruments,代码行数:27,代码来源:tests.py

示例3: test_insert

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_insert(self):
     print_and_log("================================")
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     tic = time.time()
     for i in range(100):
         curve.save()
     print_and_log("time for saving 100 times the same simple dummy curve: " , time.time() - tic)
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:12,代码来源:tests.py

示例4: test_insert3

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_insert3(self):
     print_and_log("================================")
     
     for i in range(3):
         curve = CurveDB()
         curve.set_data(pandas.Series([1,4,6]))
         for j in range(100):
             curve.params['coucou' + str(j)] = i*j
         tic = time.time()
         curve.save()
         print_and_log("time for saving 1 curve with 100 parameters (new curve each time): " + str(time.time() - tic))
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:13,代码来源:tests.py

示例5: test_remove_param

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_remove_param(self):
     curve = CurveDB()
     curve.params['hello'] = 4
     curve.save()
     curve = CurveDB.objects.get(id=curve.id)
     self.assertTrue('hello' in curve.get_all_params_db())
     del curve.params['hello']
     curve.save()
     self.assertTrue('hello' not in curve.get_all_params_db())
     curve = CurveDB.objects.get(id=curve.id)
     self.assertTrue('hello' not in curve.get_all_params_db())
开发者ID:tjzhaomengyi,项目名称:pyinstruments,代码行数:13,代码来源:tests.py

示例6: test_delete

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_delete(self):
     from curve import Curve
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.params["dummy"] = 24.5
     for j in range(100):
         curve.params['coucou' + str(j)] = j
     curve.save()
     tic = time.time()
     curve.delete()
     print_and_log("time for deleting one curve: ", time.time() - tic)
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:13,代码来源:tests.py

示例7: test_save_curve_only

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_save_curve_only(self):
     from curve import Curve
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     print_and_log("================================")
     for i in range(3):
         for j in range(100):
             curve.params['coucou' + str(j)] = i*j
         tic = time.time()
         Curve.save(curve, curve.get_full_filename())
         print_and_log("time for saving 1 curve with 100 parameters in h5: " + str(time.time() - tic))
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:14,代码来源:tests.py

示例8: test_insert2

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_insert2(self):
     print_and_log("================================")
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     for i in range(3):
         for j in range(100):
             curve.params['coucou' + str(j)] = i*j
         tic = time.time()
         curve.save()
         print_and_log("time for saving 1 curve with 100 parameters (always same curve, values changing): " + str(time.time() - tic))
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:14,代码来源:tests.py

示例9: test_insert_bad_param_string

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_insert_bad_param_string(self):
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.params['some_string_param'] = 'coucou'
     curve.save()
     def do_some_crap():
         curve.params['some_string_param'] = 15.
         curve.save()
     self.assertRaises(ValueError, do_some_crap)
     def do_other_crap():
         curve = CurveDB()
         curve.params['some_string_param'] = 15.
         curve.save()
     self.assertRaises(ValueError, do_other_crap)
开发者ID:tjzhaomengyi,项目名称:pyinstruments,代码行数:16,代码来源:tests.py

示例10: test_alter_params_only

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_alter_params_only(self):
     from curve import Curve
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.params["dummy"] = 24.5
     for j in range(100):
         curve.params['coucou' + str(j)] = j
     curve.save()
     tic = time.time()
     curve.params["dummy"] = 25.5
     models.PROFILING = True
     curve.save_params()
     print_and_log("================================")
     print_and_log("time for altering just one value: ", time.time() - tic)
     models.PROFILING = False
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:17,代码来源:tests.py

示例11: test_save_altered_curve

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_save_altered_curve(self):
     from curve import Curve
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     
     print_and_log("================================")
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     for i in range(5):
         for j in range(100):
             curve.params['coucou' + str(j)] = i*j
         tic = time.time()
         curve.save_params()
         print_and_log("time for saving 100 parameters in db only, same curve each time: " + str(time.time() - tic))
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:18,代码来源:tests.py

示例12: test_insert_param

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_insert_param(self):
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     for i in range(100):
         curve.params['coucou' + str(i)] = i
     curve.save()
     cu = CurveDB.objects.get(id=curve.id)
     self.assertTrue(cu.params['coucou12']==12)
     
     cu.params['coucou12'] = 45.
     cu.save()
     cu2 = CurveDB.objects.get(id=curve.id)
     self.assertTrue(cu2.params['coucou12']==45.)
     
     search = CurveDB.objects.filter_param('coucou12', value__gte=44)
     self.assertTrue(cu2 in search)
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:20,代码来源:tests.py

示例13: test_remove_param

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_remove_param(self):
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     for i in range(20):
         curve.params['coucou' + str(i)] = i
     curve.save()
     curve = CurveDB.objects.get(id=curve.id)
     curve.params.pop("coucou12")
     curve.save()
     curve = CurveDB.objects.get(id=curve.id)
     self.assertTrue("coucou12" not in curve.params)
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:15,代码来源:tests.py

示例14: test_clear_columns

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def test_clear_columns(self):
     curve = CurveDB()
     curve.set_data(pandas.Series([1,4,6]))
     curve.save()
     
     curve.params['dummy_name'] = 89
     curve.save()
     curve = CurveDB.objects.get(id=curve.id)
     self.assertTrue("dummy_name" in [o.name for o in ParamColumn.objects.all()])
     
     curve.params.pop('dummy_name')
     curve.save()
     self.assertTrue("dummy_name" in [o.name for o in ParamColumn.objects.all()])
     clear_unused_columns()
     self.assertFalse("dummy_name" in [o.name for o in ParamColumn.objects.all()])
开发者ID:vsteinmetz,项目名称:pyinstruments,代码行数:17,代码来源:tests.py

示例15: do_other_crap

# 需要导入模块: from pyinstruments.curvestore.models import CurveDB [as 别名]
# 或者: from pyinstruments.curvestore.models.CurveDB import save [as 别名]
 def do_other_crap():
     curve = CurveDB()
     curve.params['some_float_param'] = 'coucou'
     curve.save()
开发者ID:tjzhaomengyi,项目名称:pyinstruments,代码行数:6,代码来源:tests.py


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