def add_default_fields(self, names, **kwargs):
        """
        Adds one or more empty default fields to self.

        Parameters
        ----------
        names : (list of) string(s)
            The names of the fields to add. Must be a field in self's default
            fields.

        Other keyword args are any arguments passed to self's default fields.

        Returns
        -------
        new array : instance of this array
            A copy of this array with the field added.
        """
        if isinstance(names, string_types):
            names = [names]
        default_fields = self.default_fields(include_virtual=False, **kwargs)
        # parse out any virtual fields
        arr = self.__class__(1, field_kwargs=kwargs)
        # try to perserve order
        sortdict = dict([[nm, ii] for ii,nm in enumerate(names)])
        names = list(get_needed_fieldnames(arr, names))
        names.sort(key=lambda x: sortdict[x] if x in sortdict
            else len(names))
        fields = [(name, default_fields[name]) for name in names]
        arrays = []
        names = []
        for name,dt in fields:
            arrays.append(default_empty(self.size, dtype=[(name, dt)]))
            names.append(name)
        return self.add_fields(arrays, names)
def add_default_fields ( self , names , ** kwargs ) : if isinstance ( names , string_types ) : names = [ names ] default_fields = self . default_fields ( include_virtual = False , ** kwargs ) arr = self . __class__ ( 1 , field_kwargs = kwargs ) sortdict = dict ( [ [ nm , ii ] for ii , nm in enumerate ( names ) ] ) names = list ( get_needed_fieldnames ( arr , names ) ) names . sort ( key = lambda x : sortdict [ x ] if x in sortdict else len ( names ) ) fields = [ ( name , default_fields [ name ] ) for name in names ] arrays = [ ] names = [ ] for name , dt in fields : arrays . append ( default_empty ( self . size , dtype = [ ( name , dt ) ] ) ) names . append ( name ) return self . add_fields ( arrays , names )
Adds one or more empty default fields to self.

        Parameters
        ----------
        names : (list of) string(s)
            The names of the fields to add. Must be a field in self's default
            fields.

        Other keyword args are any arguments passed to self's default fields.

        Returns
        -------
        new array : instance of this array
            A copy of this array with the field added.