def __new__(cls, data, unit=None,
                x0=None, dx=None, xindex=None, xunit=None,
                y0=None, dy=None, yindex=None, yunit=None, **kwargs):
        """Define a new `Array2D`
        """

        # create new object
        new = super(Array2D, cls).__new__(cls, data, unit=unit, xindex=xindex,
                                          xunit=xunit, x0=x0, dx=dx, **kwargs)

        # set y-axis metadata from yindex
        if yindex is not None:
            # warn about duplicate settings
            if dy is not None:
                warn("yindex was given to %s(), dy will be ignored"
                     % cls.__name__)
            if y0 is not None:
                warn("yindex was given to %s(), y0 will be ignored"
                     % cls.__name__)
            # get unit
            if yunit is None and isinstance(yindex, Quantity):
                yunit = yindex.unit
            elif yunit is None:
                yunit = cls._default_yunit
            new.yindex = Quantity(yindex, unit=yunit)
        # or from y0 and dy
        else:
            if yunit is None and isinstance(dy, Quantity):
                yunit = dy.unit
            elif yunit is None and isinstance(y0, Quantity):
                yunit = y0.unit
            elif yunit is None:
                yunit = cls._default_yunit
            if dy is not None:
                new.dy = Quantity(dy, yunit)
            if y0 is not None:
                new.y0 = Quantity(y0, yunit)

        return new
def __new__ ( cls , data , unit = None , x0 = None , dx = None , xindex = None , xunit = None , y0 = None , dy = None , yindex = None , yunit = None , ** kwargs ) : new = super ( Array2D , cls ) . __new__ ( cls , data , unit = unit , xindex = xindex , xunit = xunit , x0 = x0 , dx = dx , ** kwargs ) if yindex is not None : if dy is not None : warn ( "yindex was given to %s(), dy will be ignored" % cls . __name__ ) if y0 is not None : warn ( "yindex was given to %s(), y0 will be ignored" % cls . __name__ ) if yunit is None and isinstance ( yindex , Quantity ) : yunit = yindex . unit elif yunit is None : yunit = cls . _default_yunit new . yindex = Quantity ( yindex , unit = yunit ) else : if yunit is None and isinstance ( dy , Quantity ) : yunit = dy . unit elif yunit is None and isinstance ( y0 , Quantity ) : yunit = y0 . unit elif yunit is None : yunit = cls . _default_yunit if dy is not None : new . dy = Quantity ( dy , yunit ) if y0 is not None : new . y0 = Quantity ( y0 , yunit ) return new
Define a new `Array2D`