def generate_sublocal2_nn(L): filename = "sublocal2_nn_L" + str(L) if not exist(filename): separated2 = np.empty(L, np.ndarray) for x in range(L): separated2[x] = np.empty(4, np.ndarray) separated2[x] = basis_2qubit(L, x, (x + 1) % L) savedata(separated2, filename) separated2 = loaddata(filename) return separated2
def generate_sublocal(L): filename = "sublocal_L" + str(L) if not exist(filename): separated1 = np.empty(L, np.ndarray) for x in range(L): separated1[x] = np.empty(2, np.ndarray) separated1[x] = basis_1qubit(L, x) savedata(separated1, filename) separated1 = loaddata(filename) return separated1
def generate_sublocal2(L): filename = "sublocal2_L" + str(L) if not exist(filename): separated2 = np.empty([L, L], np.ndarray) for x1 in range(L): for x2 in range(x1 + 1, L): separated2[x1, x2] = np.empty(4, np.ndarray) separated2[x1, x2] = basis_2qubit(L, x1, x2) separated2[x2, x1] = separated2[x1, x2] savedata(separated2, filename) separated2 = loaddata(filename) return separated2
def delappointment(name): jsoncontent = files.readdata(datafilepath) #getting jsonfile contents appointment_location = "" #Getting the appointment location for weekday in jsoncontent["saved_schedules"]: for appointment in jsoncontent["saved_schedules"][weekday]: if appointment == name: appointment_location = weekday #Storing appointment location if appointment_location != "": #Verifying if the appointment actually exists jsoncontent["saved_schedules"][appointment_location].pop( name) #Deleting appointment print("[{}] deleted".format(name)) if appointment_location == "": print("\033[91m[ERROR] Appointment does not exist;\033[0m") files.savedata(datafilepath, jsoncontent) #Saving Changes
def addappointment(name, day, hour, colour="DEFAULT"): jsoncontent = files.readdata(datafilepath) if colour not in colours: print("\033[91m[ERROR] Non supported color;\033[0m") print("\033[91m[ERROR] ", end="[") for colour in colours: print(colour, end=" ") print("]\033[0m") if day in [ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" ]: jsoncontent["saved_schedules"][day][name] = { "name": name, "day": day, "hour": hour, "colour": colour } #changing json's file's dict contents else: print("\033[91m[ERROR] The day must be a week day;\033[0m") print( "\033[91m[ERROR] [\"monday\",\"tuesday\",\"wednesday\",\"thursday\",\"friday\",\"saturday\",\"sunday\"];\033[0m" ) files.savedata(datafilepath, jsoncontent) #Saving json file