Функция:
Код: Выделить всё
def CKT(f, Rs, Ls, Cs, Lm, Cm, Rm):
TPF = 2*f*np.pi
L0 = 1e-6*Ls; C1 = 1e-12*Cs;
L2 = 1e-6*Lm; C2 = 1e-12*Cm;
X0 = TPF*L0
X1 = -1/(TPF*C1)
X2 = TPF*L2 - 1/(TPF*C2)
Denom = Rm**2 + (X1+X2)**2
return np.log(np.sqrt((X0 + (X1*X2**2 + X2*X1**2 + X1*Rm**2)/Denom)**2 + ((Rm*X1**2)/Denom + Rs)**2))
Код: Выделить всё
def generateParameterBounds():
parameterBounds = []
parameterBounds.append([400,500])
parameterBounds.append([0,10])
parameterBounds.append([100,200])
parameterBounds.append([500,700])
parameterBounds.append([10,50])
parameterBounds.append([230,270])
result = differential_evolution(sumOfSquaredError, parameterBounds, popsize=30, init='sobol', polish=False, workers=2, seed=3)
return result.x
Код: Выделить всё
geneticParameters, pcov = curve_fit(CKT, xdata, ydata, ParameterRanges, maxfev=1000000)
Ошибка:
Код: Выделить всё
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
Код: Выделить всё
if __name__ == '__main__':
Подробнее здесь: https://stackoverflow.com/questions/793 ... t-is-added
Мобильная версия