1 """
2 Alters SciPy 0.3.2 to look like version SciPy 0.5.1 as far as SloppyCell is
3 concerned.
4
5 See also addAssignmentRulesToFunctionBody in ReactionNetworks/Network_mod.py
6 """
7 import scipy
8
9 if int(scipy.__version__.split('.')[1]) < 4:
10
11 scipy.float_ = scipy.Float
12 scipy.float64 = scipy.Float64
13 scipy.int_ = scipy.Int
14 scipy.int32 = scipy.Int32
15
16
17
22
23
24 scipy.misc = Bunch(limits = scipy.limits)
25
26
27
28 scipy.stats.old_seed = scipy.stats.seed
30 if seed is None:
31 scipy.stats.old_seed()
32 return
33
34 try:
35 if len(seed) >= 2:
36 scipy.stats.old_seed(seed[0], seed[1])
37 else:
38 scipy.stats.old_seed(seed[0])
39 except TypeError:
40 scipy.stats.old_seed(seed, 0)
41 scipy.random = Bunch(seed = new_seed)
42
43
44 scipy.old_fft = scipy.fft
45 scipy.fft = Bunch(rfft = scipy.old_fft, irfft = scipy.ifft)
46
47
48 scipy.outer = scipy.outerproduct
49
50 scipy.old_sum = scipy.sum
51 - def new_sum(x, axis=None, dtype=None, out=None):
52 if (dtype is not None) or (out is not None):
53 raise ValueError, "This use of sum is incompatible with old scipy."
54 if (axis is not None):
55 return scipy.old_sum(x, axis)
56
57 output = x
58 for ax in range(len(x.shape)):
59 output = scipy.old_sum(output)
60 return output
61 scipy.sum = new_sum
62