예제 #1
0
 def __init__(self, *x, **data_dict):
     if len(x) == 0:
         # Just passing named arguments
         self._data = data_dict["data"]
         label = self._data['label']
     else:
         if len(x) == 1:  # Assume we got a label
             label = x[0]
             parts = x[0].split(".")
             base = "%s.%s.%s.%s" % tuple(parts[j] for j in (0, 1, 2, 3))
             if len(parts) < 5:  # Galois orbit
                 conjindex = 1
             else:
                 conjindex = letters2num(parts[4])
         elif len(x) == 2:  # base and gorb index
             base = x[0]
             conjindex = x[1]
             label = "%s.%s" % (str(x[0]), num2letters(x[1]))
         else:
             raise ValueError("Invalid number of positional arguments")
         self._data = db.artin_reps.lucky({'Baselabel': str(base)})
         conjs = self._data["GaloisConjugates"]
         conj = [xx for xx in conjs if xx['GalOrbIndex'] == conjindex]
         self._data['label'] = label
         self._data.update(conj[0])
예제 #2
0
def label_sortkey(label):
    L = []
    for piece in label.split("."):
        for i, x in enumerate(re.split(r"(\D+)", piece)):
            if x:
                if i%2:
                    x = letters2num(x)
                else:
                    x = int(x)
                L.append(x)
    return L