def debug_params() : para_list =['electrodes resistivity 1','electrodes resistivity 2','NA power','calibration','Added Resistivity '] for par in par_list: lc = CurveDB.objects.filter_param(str(par)) for curve in lc: curve.params['temp '+str(par)]=float(curve.params[str(par)]) del(curve.params[str(par)]) curve.save() models.clear_unused_columns()
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()])
def _clear_unused_columns(self): models.clear_unused_columns() #at each startup