def to_rgba(self, x, alpha=<NUM_LIT:1.0>, bytes=False):
try:<EOL><INDENT>if x.ndim == <NUM_LIT:3>:<EOL><INDENT>if x.shape[<NUM_LIT:2>] == <NUM_LIT:3>:<EOL><INDENT>if x.dtype == np.uint8:<EOL><INDENT>alpha = np.array(alpha*<NUM_LIT:255>, np.uint8)<EOL><DEDENT>m, n = x.shape[:<NUM_LIT:2>]<EOL>xx = np.empty(shape=(m,n,<NUM_LIT:4>), dtype = x.dtype)<EOL>xx[:,:,:<NUM_LIT:3>] = x<EOL>xx[:,:,<NUM_LIT:3>] = alpha<EOL><DEDENT>elif x.shape[<NUM_LIT:2>] == <NUM_LIT:4>:<EOL><INDENT>xx = x<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if bytes and xx.dtype != np.uint8:<EOL><INDENT>xx = (xx * <NUM_LIT:255>).astype(np.uint8)<EOL><DEDENT>return xx<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>x = ma.asarray(x)<EOL>x = self.norm(x)<EOL>x = self.cmap(x, alpha=alpha, bytes=bytes)<EOL>return x<EOL>
Return a normalized rgba array corresponding to *x*. If *x*
        is already an rgb array, insert *alpha*; if it is already
        rgba, return it unchanged. If *bytes* is True, return rgba as
        4 uint8s instead of 4 floats.