def query(self, sample_audio, mode="sample"): '''Different settings based on whether a recording or a songs snippet. Returns matching song if one is found, else 'no match was found' and the closely related songs @param string location of sample file @param string used to determine which search mode to use (for internal use only) @return tuple''' global freq_num global max_match if mode == "record": freq_num = 100 max_match_tol = 0.9 else: freq_num = 40 max_match_tol = 0.9 '''initiates search algo specified in paper''' sample_fp = fingerprint.Fingerprint(sample_audio) filt_list = self._filter_library(sample_fp) match = self._best_match(filt_list, sample_fp) if match: if match[0] is None: return ("No match was found", ["No close matches"]) else: # return (match[0].split("/")[1].strip(), match[1]) return match[0].strip(), match[1] else: return "No match was found", ["No close matches"]
def on_add_clicked(self, widget): entry_text = self.__entry.get_text() fingerprint_file = const.DB_PATH + entry_text + const.FILE_EXTENSION shutil.copy2(self.__file_name, fingerprint_file) self.__fingerprint = fingerprint.Fingerprint(fingerprint_file) self.tts.speak(self.messages.add.tts_add_new_fingerprint) self.destroy()
def makeFprints(self, fprintDef=None): ''' Initiate the creation of fprints for all the conformations stored in self.conformations dictionary ''' print("\nGenerating ligand/protein interaction fingerprints:") total = len(self.conformations) for i, confName in enumerate(self.conformations): # Get the dictionary associated with this conformation conformationDict = self.conformations[confName] # Get the molecular complex of that conformation molComplex = conformationDict['complex'] # Apply the fingerprint on that complex fprint = fingerprint.Fingerprint(molComplex, fprintDef) # Populate the molComplex object with the fprints fprint.generateFprint() # Store this fprint object into the corresponding confDict dict conformationDict['fprint'] = fprint print("fprint: " + str(i + 1) + "/" + str(total))
import RPi.GPIO as gpio import I2C_LCD_driver import socket import fcntl import struct import time import menu_lcd import fingerprint import threading f = fingerprint.Fingerprint() finger_flag = True #Inicializa display LCD I2C lcdi2c = I2C_LCD_driver.lcd() #Exibe informacoes iniciais lcdi2c.lcd_display_string(" SMART LOCK", 1, 1) lcdi2c.lcd_display_string("Security System", 2, 1) time.sleep(3) def finger_thread_function(): global finger_flag while True: if (f.valida_digital() and finger_flag == True): menu_lcd.open_door() if (finger_flag == False): return time.sleep(1)