def __init__(self, **kwds): """ db -- a PostgresTable from lmfdb.db_backend """ MFDataTable.__init__(self, **kwds) self.maass_id = kwds.get('maass_id', None) if not self.maass_id: mwf_logger.critical("You must supply an id!")
def set_table(self, **kwds): self._name = kwds.get('name', '') self._table = dict() self._table = [] self._is_set = True for r in range(self._nrows): self._table.append([]) for k in range(self._ncols): self._table[r].append({}) rec_len = self._ncols * self._nrows skip = rec_len * self._skip_rec mwf_logger.debug("rows: {0}".format(self._nrows)) mwf_logger.debug("cols: {0}".format(self._ncols)) mwf_logger.debug("In mwf.set_table") mwf_logger.debug("skip: {0} rec_len:{1}".format(skip, rec_len)) limit = self._nrows skip = self._skip_rec mwf_logger.debug("limit: {0}, skip: {1}".format(limit, skip)) f = db.mwf_forms.lucky({'maass_id': self.maass_id}) # .skip(skip).limit(limit) if not f: mwf_logger.critical( "You did not supply a valid id! Got:{0}".format(self.maass_id)) return self._props['Eigenvalue'] = f['Eigenvalue'] self._props['Symmetry'] = f['Symmetry'] self._props['Weight'] = f['Weight'] try: self._props['Character'] = f['Character'] except: # Trivial charcter default self._props['Character'] = 0 self._props['Level'] = f['Level'] numc = len(f['Coefficient']) mwf_logger.debug("numc: {0}".format(numc)) self._props['numc'] = numc if numc == 0: self._table = [] return limit = min(numc, self._nrows) self._row_heads = range(limit) self._col_heads = ['n', 'C(n)'] row_min = self._nrows * skip mwf_logger.debug("numc: {0}".format(numc)) self._table = [] for n in range(limit): self._table.append([0]) for n in range(limit): self._row_heads[ n] = n + row_min + 1 # one is fbeacuse we have a cusp form c = f['Coefficient'][n + row_min] self._table[n][0] = {'value': c} self._table.append(list())
def set_table(self, **kwds): self._name = kwds.get('name', '') self._table = dict() self._table = [] self._is_set = True for r in range(self._nrows): self._table.append([]) for k in range(self._ncols): self._table[r].append({}) rec_len = self._ncols * self._nrows skip = rec_len * self._skip_rec mwf_logger.debug("rows: {0}".format(self._nrows)) mwf_logger.debug("cols: {0}".format(self._ncols)) mwf_logger.debug("In mwf.set_table") mwf_logger.debug("skip: {0} rec_len:{1}".format(skip, rec_len)) limit = self._nrows skip = self._skip_rec mwf_logger.debug("limit: {0}, skip: {1}".format(limit, skip)) f = db.mwf_forms.lucky({'maass_id': self.maass_id}) # .skip(skip).limit(limit) if not f: mwf_logger.critical("You did not supply a valid id! Got:{0}".format(self.maass_id)) return self._props['Eigenvalue'] = f['Eigenvalue'] self._props['Symmetry'] = f['Symmetry'] self._props['Weight'] = f['Weight'] try: self._props['Character'] = f['Character'] except: # Trivial charcter default self._props['Character'] = 0 self._props['Level'] = f['Level'] numc = len(f['Coefficient']) mwf_logger.debug("numc: {0}".format(numc)) self._props['numc'] = numc if numc == 0: self._table = [] return limit = min(numc, self._nrows) self._row_heads = range(limit) self._col_heads = ['n', 'C(n)'] row_min = self._nrows * skip mwf_logger.debug("numc: {0}".format(numc)) self._table = [] for n in range(limit): self._table.append([0]) for n in range(limit): self._row_heads[n] = n + row_min + 1 # one is fbeacuse we have a cusp form c = f['Coefficient'][n + row_min] self._table[n][0] = {'value': c} self._table.append(list())
def set_table(self, fnr=-1, cusp=0, prec=9): r""" Setup a table with coefficients for function nr. fnr in self, at cusp nr. cusp. If the real or imaginary parts are less than 1e-`prec`, then set them to zero. """ table = {'nrows': self.num_coeff} if fnr < 0: colrange = range(self.dim) table['ncols'] = self.dim + 1 elif fnr < self.dim: colrange = [fnr] table['ncols'] = 2 table['data'] = [] table['negc'] = 0 realnumc = 0 if self.num_coeff == 0: self.table = table return if self.symmetry != -1: for n in range(self.num_coeff): row = [n] for k in colrange: if self.dim == 1: c = None try: c = self.coeffs[k][cusp].get(n, None) except (KeyError, IndexError): mwf_logger.critical( "Got coefficient in wrong format for id={0}".format(self._maassid)) # mwf_logger.debug("{0},{1}".format(k,c)) if c is not None: realnumc += 1 row.append(pretty_coeff(c, prec=prec)) else: for j in range(self.dim): c = ((self.coeffs.get(j, {})).get(0, {})).get(n, None) if c is not None: row.append(pretty_coeff(c, prec=prec)) realnumc += 1 table['data'].append(row) else: table['negc'] = 1 # in this case we need to have coeffs as dict. if not isinstance(self.coeffs, dict): self.table = {} return for n in range(len(self.coeffs.keys() / 2)): row = [n] if self.dim == 1: for k in range(table['ncols']): #cpositive and cnegative cp = self.coeffs.get(n, 0) cn = self.coeffs.get(-n, 0) row.append((cp, cn)) realnumc += 1 else: for j in range(self.dim): c = (self.coeffs.get(j, {})).get(n, None) if c is not None: c1 = c.get(n, None) cn1 = c.get(-n, None) c1 = CC(c1) cn1 = CC(cn1) row.append((c1, cn1)) realnumc += 1 table['data'].append(row) self.table = table mwf_logger.debug("realnumc={0}".format(realnumc))
def set_table(self, **kwds): self._name = kwds.get('name', '') self._table = dict() self._table = [] self._is_set = True for r in range(self._nrows): self._table.append([]) for k in range(self._ncols): self._table[r].append({}) rec_len = self._ncols * self._nrows skip = rec_len * self._skip_rec mwf_logger.debug("rows: {0}".format(self._nrows)) mwf_logger.debug("cols: {0}".format(self._ncols)) mwf_logger.debug("In mwf.set_table: collections : {0}".format(self.collection())) mwf_logger.debug("skip: {0} rec_len:{1}".format(skip, rec_len)) # only have one collection here... c = self.collection()[0] mwf_logger.debug("collection: {0}".format(c)) limit = self._nrows skip = self._skip_rec mwf_logger.debug("limit: {0}, skip: {1}".format(limit, skip)) f = c.find_one({'_id': bson.objectid.ObjectId(self._id)}) # .skip(skip).limit(limit) if not f: mwf_logger.critical("You did not supply a valid id! Got:{0}".format(self._id)) return self._props['Eigenvalue'] = f['Eigenvalue'] self._props['Symmetry'] = f['Symmetry'] self._props['Weight'] = f['Weight'] try: self._props['Character'] = f['Character'] except: # Trivial charcter default self._props['Character'] = 0 self._props['Level'] = f['Level'] # self._props['prec'] = f['prec'] metadata = dict() MD = self._db['metadata'] mwf_logger.debug("metadata: {0}".format(MD)) mdfind = MD.find_one({'c_name': self._collection_name}) mwf_logger.debug("mdfind: {0}".format(mdfind)) for x in mdfind: metadata[x] = mdfind[x] self._props['metadata'] = metadata numc = len(f['Coefficient']) mwf_logger.debug("numc: {0}".format(numc)) self._props['numc'] = numc if numc == 0: self._table = [] return limit = min(numc, self._nrows) self._row_heads = range(limit) self._col_heads = ['n', 'C(n)'] row_min = self._nrows * skip mwf_logger.debug("numc: {0}".format(numc)) self._table = [] for n in range(limit): self._table.append([0]) for n in range(limit): self._row_heads[n] = n + row_min + 1 # one is fbeacuse we have a cusp form c = f['Coefficient'][n + row_min] self._table[n][0] = {'value': c} self._table.append(list())
def __init__(self, dbname='', **kwds): MFDataTable.__init__(self, dbname, **kwds) self._id = kwds.get('id', None) if not self._id: mwf_logger.critical("You must supply an id!")
def __init__(self, **kwds): MFDataTable.__init__(self, **kwds) self.maass_id = kwds.get('maass_id', None) if not self.maass_id: mwf_logger.critical("You must supply an id!")