def render_fd_plot(level, info, **kwds): group = None grouptype = None if ('group' in info): group = info['group'] # we only allow standard groups if 'grouptype' in info: grouptype = int(info['grouptype']) if info['grouptype'] == 0: group = 'Gamma0' elif info['grouptype'] == 1: group = 'Gamma1' if (group not in ['Gamma0', 'Gamma', 'Gamma1']): group = 'Gamma0' grouptype = int(0) else: if grouptype is None: if group == 'Gamma': grouptype = int(-1) elif group == 'Gamma0': grouptype = int(0) else: grouptype = int(1) db_name = 'SL2Zsubgroups' collection = 'groups' C = lmfdb.base.getDBConnection() emf_logger.debug("C={0}, level={1}, grouptype={2}".format( C, level, grouptype)) if not C: emf_logger.critical("Could not connect to Database! C={0}".format(C)) if not db_name in C.database_names(): emf_logger.critical( "Incorrect database name {0}. \n Available databases are:{1}". format(db_name, C.database_names())) if not collection in C[db_name].collection_names(): emf_logger.critical( "Incorrect collection {0} in database {1}. \n Available collections are:{2}" .format(collection, db_name, C[db_name].collection_names())) find = C[db_name][collection].find_one({ 'level': int(level), 'type': int(grouptype) }) if find: if find.get('domain'): # domain=loads(str(find['domain'])) domain = find['domain'] emf_logger.debug('Found fundamental domain in database') else: emf_logger.debug( 'Drawing fundamental domain for group {0}({1})'.format( group, level)) domain = draw_fundamental_domain(level, group, **kwds) # G=Gamma0(level) # C[db_name][collection].insert({'level':int(level), 'type':type, 'index':int(G.index), 'G':bson.binary.Binary(dumps(G)), 'domain': bson.binary.Binary(dumps(domain))}) # emf_logger.debug('Inserting group and fundamental domain in database') return domain
def render_fd_plot(level, info, **kwds): group = None grouptype = None if('group' in info): group = info['group'] # we only allow standard groups if 'grouptype' in info: grouptype = int(info['grouptype']) if info['grouptype'] == 0: group = 'Gamma0' elif info['grouptype'] == 1: group = 'Gamma1' if (group not in ['Gamma0', 'Gamma', 'Gamma1']): group = 'Gamma0' grouptype = int(0) else: if grouptype is None: if group == 'Gamma': grouptype = int(-1) elif group == 'Gamma0': grouptype = int(0) else: grouptype = int(1) db_name = 'SL2Zsubgroups' collection = 'groups' C = lmfdb.base.getDBConnection() emf_logger.debug("C={0}, level={1}, grouptype={2}".format(C, level, grouptype)) if not C: emf_logger.critical("Could not connect to Database! C={0}".format(C)) if not db_name in C.database_names(): emf_logger.critical("Incorrect database name {0}. \n Available databases are:{1}".format( db_name, C.database_names())) if not collection in C[db_name].collection_names(): emf_logger.critical("Incorrect collection {0} in database {1}. \n Available collections are:{2}".format(collection, db_name, C[db_name].collection_names())) find = C[db_name][collection].find_one({'level': int(level), 'type': int(grouptype)}) if find: if find.get('domain'): # domain=loads(str(find['domain'])) domain = find['domain'] emf_logger.debug('Found fundamental domain in database') else: emf_logger.debug('Drawing fundamental domain for group {0}({1})'.format(group, level)) domain = draw_fundamental_domain(level, group, **kwds) # G=Gamma0(level) # C[db_name][collection].insert({'level':int(level), 'type':type, 'index':int(G.index), 'G':bson.binary.Binary(dumps(G)), 'domain': bson.binary.Binary(dumps(domain))}) # emf_logger.debug('Inserting group and fundamental domain in database') return domain