def check(c=0): ''' Perform hygiene check on experiment c=0: check both EXT and Transmission c=1: check only Transmission c=2: check only EXT ''' print('#'*40) print('\t'+'\x1b[0;30;43m'+'Checking Stage'+'\x1b[0m') print('Target T780: %1.3f \t Tolerance %1.2f ~ %1.3f' %(Tref,tolerance,tolerance*Tref)) print('Target T810: %1.3f \t Tolerance %1.2f ~ %1.3f' %(Tref_810,tolerance_810,tolerance_810*Tref_810)) print('#'*40) print if c==0: result_lock_trans=lock_trans() result_lock_Ext=lock_Ext() elif c==1: result_lock_trans=lock_trans() result_lock_Ext=1 elif c==2: result_lock_trans=1 result_lock_Ext=lock_Ext() result=result_lock_trans*result_lock_Ext if (result_lock_trans*result_lock_Ext)==0: printstyle_warning('Fail locking') raise Errors.ExperimentalError() else: print('Succeed checking and locking') return result
def check(c=0, w=0, w810=0): ''' Perform hygiene check on experiment c=0: check both EXT and Transmission c=1: check only Transmission c=2: check only EXT Return result for c=1: result_lock_Ext===1(always) result =1: Lock T and Succeed =2: Do not need to lock T =3: Exceed maximum number of steps ''' print('#' * 40) print('\t' + '\x1b[0;30;43m' + 'Checking Stage' + '\x1b[0m') print('Target T780: %1.3f \t Tolerance %1.2f ~ %1.3f' % (Tref, tolerance, tolerance * Tref)) print('Target T810: %1.3f \t Tolerance %1.2f ~ %1.3f' % (Tref_810, tolerance_810, tolerance_810 * Tref_810)) print('#' * 40) print if c == 0: result_lock_trans = lock_trans(f=w, w810=w810) result_lock_Ext = lock_Ext() elif c == 1: result_lock_trans = lock_trans(f=w, w810=w810) result_lock_Ext = 1 elif c == 2: result_lock_trans = 1 result_lock_Ext = lock_Ext() result = result_lock_trans * result_lock_Ext if (result_lock_trans * result_lock_Ext) == 0: printstyle_warning('Fail locking') raise Errors.ExperimentalError() else: print('Succeed checking and locking') return result