Return the active scalar's field and name: [field, name]
172127
def active_vectors_info(self):
        """"""
        if not hasattr(self, '_active_vectors_info'):
            self._active_vectors_info = [POINT_DATA_FIELD, None] # field and name
        _, name = self._active_vectors_info

        # rare error where scalar name isn't a valid scalar
        if name not in self.point_arrays:
            if name not in self.cell_arrays:
                name = None

        return self._active_vectors_info
1028516
def elementTypeName(self):
        
        if self._array is None:
            return super(FieldRti, self).elementTypeName
        else:
            fieldName = self.nodeName
            return str(self._array.dtype.fields[fieldName][0])
1036643
def derive_fields(self):
        
        if self.fields:
            return self.fields

        else:
            fields = []
            for field in self.object_list.model._meta.fields:
                if field.name != 'id':
                    fields.append(field.name)
            return fields
868966
def select(self, *fields, **kw):
        
        if len(fields) == 1 and isinstance(fields[0], list):
            fields = fields[0]
        else:
            fields = list(fields)
        if kw:
            def handle(it):
                it = self._defunc(it)
                if not isinstance(it, Expr):
                    it = Scalar(it)
                return it
            fields.extend([handle(f).rename(new_name)
                           for new_name, f in six.iteritems(kw)])

        return self._project(fields)
97155
def fields(self):
        '''
        
        '''
        return (
            self.locus, self.offset_start, self.offset_end, self.alignment_key)
1143412
def get_field_mapping(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.get_field_mapping(index=self._name, **kwargs)
1286861
def find_field_name(field, model=DEFAULT_MODEL, app=DEFAULT_APP, fuzziness=.5):
    
    return find_field_names(field, model, app, score_cutoff=int((1-fuzziness)*100), pad_with_none=True)[0]
1332242
def get_scalar(self, name, preference='cell', info=False):
        
        return get_scalar(self, name, preference=preference, info=info)
1123422
def get_field_names(self):
        
        col_model = self.request.get("colModel", None)
        if not col_model:
            return ["UID",]

        names = []
        col_model = json.loads(_u(col_model))
        if isinstance(col_model, (list, tuple)):
            names = map(lambda c: c.get("columnName", "").strip(), col_model)

        # UID is used by reference widget to know the object that the user
        # selected from the popup list
        if "UID" not in names:
            names.append("UID")

        return filter(None, names)
333765
def p_static_scalar_namespace_name(p):
    ''''''
    if len(p) == 2:
        p[0] = ast.Constant(p[1], lineno=p.lineno(1))
    elif len(p) == 3:
        p[0] = ast.Constant(p[1] + p[2], lineno=p.lineno(1))
    else:
        p[0] = ast.Constant(p[1] + p[2] + p[3], lineno=p.lineno(1))
546149
def _get_scalar_names(self, limit=None):
        """"""
        names = []
        if limit == 'point':
            inpnames = list(self.input_dataset.point_arrays.keys())
        elif limit == 'cell':
            inpnames = list(self.input_dataset.cell_arrays.keys())
        else:
            inpnames = self.input_dataset.scalar_names
        for name in inpnames:
            arr = self.input_dataset.get_scalar(name)
            rng = self.input_dataset.get_data_range(name)
            if arr is not None and arr.size > 0 and (rng[1]-rng[0] > 0.0):
                names.append(name)
        try:
            self._last_scalars = names[0]
        except IndexError:
            pass
        return names
1276951
def get_displayable_field_names(self):
        
        return [
            f.name
            for f in self.model._meta.get_fields()
            if not f.one_to_many
        ]
1096621
def scalars(self, name_or_idx=None, datatype="point"):
        
        poly = self.polydata(False)

        if name_or_idx is None:  # get mode behaviour
            ncd = poly.GetCellData().GetNumberOfArrays()
            npd = poly.GetPointData().GetNumberOfArrays()
            nfd = poly.GetFieldData().GetNumberOfArrays()
            arrs = []
            for i in range(npd):
                print(i, "PointData", poly.GetPointData().GetArrayName(i))
                arrs.append(["PointData", poly.GetPointData().GetArrayName(i)])
            for i in range(ncd):
                print(i, "CellData", poly.GetCellData().GetArrayName(i))
                arrs.append(["CellData", poly.GetCellData().GetArrayName(i)])
            for i in range(nfd):
                print(i, "FieldData", poly.GetFieldData().GetArrayName(i))
                arrs.append(["FieldData", poly.GetFieldData().GetArrayName(i)])
            return arrs
        else:  # set mode
            if "point" in datatype.lower():
                data = poly.GetPointData()
            elif "cell" in datatype.lower():
                data = poly.GetCellData()
            elif "field" in datatype.lower():
                data = poly.GetFieldData()
            else:
                colors.printc("~times Error in scalars(): unknown datatype", datatype, c=1)
                exit()

            if isinstance(name_or_idx, int):
                name = data.GetArrayName(name_or_idx)
                if name is None:
                    return None
                data.SetActiveScalars(name)
                return vtk_to_numpy(data.GetArray(name))
            elif isinstance(name_or_idx, str):
                arr = data.GetArray(name_or_idx)
                if arr is None:
                    return None
                data.SetActiveScalars(name_or_idx)
                return vtk_to_numpy(arr)

            return None
1121730
def field_(self, name):
    
    try:
        field = self.fields[name]
    except KeyError:
        raise KeyError("Key %r not found in '%s'" % (name, self.__class__.__name__))
    return BoundField(self, field, name)
534063
def fieldnames(self):
        ''' 
        '''
        if not self._fields:
            if self._item_class is not None:
                for m in inspect.getmembers(self._item_class):
                    if m[0] == 'fields' and isinstance(m[1], dict):
                        self._fields = m[1]
                if not self._fields:
                    raise RuntimeError('Unknown item type, no fields: %s' % self._item_class)
            else:
                raise RuntimeError('Item class is not defined, %s' % self._item_class)
        return self._fields.keys()
727056
def normal_fields(self):
        """"""
        return {f:v for f, v in self.fields.items() if not f.startswith('_')}
954175
def _get_fieldnames(item):
        """"""
        if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord
            return item.get_prtflds_all()
        if hasattr(item, "_fields"): # Is a namedtuple
            return item._fields