def autobounds(pars): """ if pars is an nexponential parameter vector, return bounds assuming the sign of the amplitude guess and positive rate contants. return value is a len(pars) list of (pmin, pmax) bounds """ pos = 0., None neg = None, 0. bounds = [] for a, alpha in cbook.pieces(pars): if a<0: abounds = neg else: abounds = pos bounds.append(abounds) # amplitude bounds bounds.append(pos) # alpha bounds strictly pos return bounds
def _set_gd_style(self, gc): color = self.get_gd_color( gc.get_rgb() ) offset, dashes = gc.get_dashes() if dashes is not None: pixels = self.points_to_pixels(dashes) style = [] for on, off in pieces(pixels): if on<1: on = 1 else: on = round(on) if off<1: off = 1 else: off = round(off) style.extend([color]*on) style.extend([gd.gdTransparent]*off) self.im.setStyle(style) return gd.gdStyled else: if gc.get_antialiased(): self.im.setAntiAliased(color) return gd.gdAntiAliased else: self.im.setStyle([color]) return gd.gdStyled
def _set_gd_style(self, gc): color = self.get_gd_color(gc.get_rgb()) offset, dashes = gc.get_dashes() if dashes is not None: pixels = self.points_to_pixels(dashes) style = [] for on, off in pieces(pixels): if on < 1: on = 1 else: on = round(on) if off < 1: off = 1 else: off = round(off) style.extend([color] * on) style.extend([gd.gdTransparent] * off) self.im.setStyle(style) return gd.gdStyled else: if gc.get_antialiased(): self.im.setAntiAliased(color) return gd.gdAntiAliased else: self.im.setStyle([color]) return gd.gdStyled