'Maps domain into window for a polynomial model which has these
attributes.'

def _map_domain_window(self, model, x, y=None):

    if (y is None):
        if (hasattr(model, u'domain') and (model.domain is None)):
            model.domain = [x.min(), x.max()]
        if (hasattr(model, u'window') and (model.window is None)):
            model.window = [(-1), 1]
        return poly_map_domain(x, model.domain, model.window)
    else:
        if (hasattr(model, u'x_domain') and (model.x_domain is None)):
            model.x_domain = [x.min(), x.max()]
        if (hasattr(model, u'y_domain') and (model.y_domain is None)):
            model.y_domain = [y.min(), y.max()]
        if (hasattr(model, u'x_window') and (model.x_window is None)):
            model.x_window = [(-1.0), 1.0]
        if (hasattr(model, u'y_window') and (model.y_window is None)):
            model.y_window = [(-1.0), 1.0]
        xnew = poly_map_domain(x, model.x_domain, model.x_window)
        ynew = poly_map_domain(y, model.y_domain, model.y_window)
        return (xnew, ynew)
