source:
releases/mystic-0.2a1-patch1.diff
@
246
Revision 246, 2.5 KB checked in by mmckerns, 6 years ago (diff) |
---|
-
mystic-0.2a1/mystic/tools.py
132 132 self._y = [] 133 133 134 134 def __call__(self, x, y): 135 from numpy import ndarray 136 if isinstance(x,ndarray): x = list(x) 135 137 self._x.append(x) 136 138 self._y.append(y) 137 139 … … 153 155 """ 154 156 import numpy 155 157 def __init__(self, interval = 10, xinterval = numpy.inf): 156 Sow.__init__(self) 158 #Sow.__init__(self) 159 super(VerboseSow,self).__init__() 157 160 self._step = 0 158 161 self._yinterval = interval 159 162 self._xinterval = xinterval 160 163 return 161 164 def __call__(self, x, y): 162 165 from numpy import ndarray 163 Sow.__call__(self, x, y) 166 #Sow.__call__(self, x, y) 167 super(VerboseSow,self).__call__(x, y) 164 168 if isinstance(y,(list,ndarray)): 165 169 y = y[0] #XXX: get the "best" fit... which should be in y[0] 166 170 if isinstance(x[0],(list,ndarray)): #XXX: x should always be iterable … … 182 186 import numpy 183 187 def __init__(self, interval=1, filename='log.txt', new=False): 184 188 import datetime 185 Sow.__init__(self) 189 #Sow.__init__(self) 190 super(LoggingSow,self).__init__() 186 191 self._filename = filename 187 192 self._step = 0 188 193 self._yinterval = interval … … 197 202 def __call__(self, x, y): 198 203 self._file = open(self._filename,'a') 199 204 from numpy import ndarray 200 Sow.__call__(self, x, y) 205 #Sow.__call__(self, x, y) 206 super(LoggingSow,self).__call__(x, y) 201 207 if isinstance(y,(list,ndarray)): 202 208 y = y[0] #XXX: get the "best" fit... which should be in y[0] 203 209 if isinstance(x[0],(list,ndarray)): #XXX: x should always be iterable -
mystic-0.2a1/examples/test_mogi.py
114 114 # 115 115 desol, dstepmon = de_solve() 116 116 print "desol: ", desol 117 print "dstepmon 10: ", dstepmon.x[50]118 print "dstepmon 20: ", dstepmon.x[100]117 print "dstepmon 50: ", dstepmon.x[50] 118 print "dstepmon 100: ", dstepmon.x[100] 119 119 # 120 120 # this will try to use nelder_mean from a relatively "near by" point (very sensitive) 121 121 point = [1234., -500., 10., 0.001] # both cg and nm does fine
Note: See TracBrowser
for help on using the repository browser.