def custom_functions(self, data, vials, elapsed_time): # load user script from custom_script.py if OPERATION_MODE == 'turbidostat': custom_script.turbidostat(self, data, vials, elapsed_time, options) elif OPERATION_MODE == 'chemostat': custom_script.chemostat(self, data, vials, elapsed_time, options) elif OPERATION_MODE == 'morbidostat': custom_script.morbidostat(self, data, vials, elapsed_time, options) elif OPERATION_MODE == 'timed_morbidostat': custom_script.timed_morbidostat( self, data, vials, elapsed_time, options) elif OPERATION_MODE == 'old_morbidostat': custom_script.old_morbidostat( self, data, vials, elapsed_time, options) else: # try to load the user function # if failing report to user logger.info('user-defined operation mode %s' % OPERATION_MODE) try: func = getattr(custom_script, OPERATION_MODE) func(self, data, vials, elapsed_time) except AttributeError: logger.error('could not find function %s in custom_script.py' % OPERATION_MODE) print('Could not find function %s in custom_script.py ' '- Skipping user defined functions' % OPERATION_MODE)
def custom_functions(elapsed_time): global OD_data, temp_data if OD_data == 'empty': print("UDP Empty, did not execute program!") else: ###load script from another python file if custom_script.OPERATION_MODE == 'turbidostat': custom_script.turbidostat(OD_data, temp_data, vials, elapsed_time) if custom_script.OPERATION_MODE == 'chemostat': custom_script.chemostat(OD_data, temp_data, vials, elapsed_time)