[Numpy-discussion] Combining Sigmoid Curves
Fri May 2 17:59:55 CDT 2008
Anne Archibald wrote:
> 2008/5/2 Rich Shepard <firstname.lastname@example.org>:
> No, no. You *want* scaled_x to range from -1 to 1.
Why not just scale to -pi to pi right there?
(The 0.998 is because you didn't include the endpoint, 100.)
Which is why you want linspace, rather than arange. Really, trust me on
If the cosine curve isn't right for you, a little create use of np.where
would let you do what you want in maybe another line or two of code.
y = np.where( x < 0 , Leftfun(x), Rightfun(x) )
or just compute one side and then flip it to make the other side:
y = np.zeros_like(x)
y[center:] = fun(x[center:])
y[:center] = y[center+1:][::-1] # don't want the center point twice
if it's symetric anyway.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the Numpy-discussion