gausspyplus
gausspyplus copied to clipboard
amps, FWHMs, means Dimensions is different
ValueError Traceback (most recent call last) Cell In[3], line 24 20 train.training() 23 if name == "main": ---> 24 main()
Cell In[3], line 20, in main() 18 train.alpha2_initial = 6. 19 # 开始训练 ---> 20 train.training()
File ~/.local/lib/python3.8/site-packages/gausspyplus-0.2.dev0-py3.8.egg/gausspyplus/training.py:73, in GaussPyTraining.training(self) 71 self.initialize() 72 self.getting_ready() ---> 73 self.gausspy_train_alpha()
File ~/.local/lib/python3.8/site-packages/gausspyplus-0.2.dev0-py3.8.egg/gausspyplus/training.py:90, in GaussPyTraining.gausspy_train_alpha(self) 88 g.set('phase', 'two') # Set GaussPy parameters 89 # Train AGD starting with initial guess for alpha ---> 90 g.train(alpha1_initial=self.alpha1_initial, alpha2_initial=self.alpha2_initial, 91 logger=self.logger) 92 else: 93 g.set('phase', 'one')
File ~/.local/lib/python3.8/site-packages/gausspyplus-0.2.dev0-py3.8.egg/gausspyplus/gausspy_py3/gp.py:50, in GaussianDecomposer.train(self, alpha1_initial, alpha2_initial, plot, verbose, mode, learning_rate, eps, MAD, logger)
46 return
47 print('Training...')
49 self.p['alpha1'], self.p['alpha2'], self.p['training_results'] =
---> 50 gradient_descent.train(alpha1_initial=alpha1_initial,
51 alpha2_initial=alpha2_initial,
52 training_data=self.p['training_data'],
53 phase=self.p['phase'],
54 SNR_thresh=self.p['SNR_thresh'],
55 SNR2_thresh=self.p['SNR2_thresh'],
56 plot=plot, eps=eps,
57 verbose=verbose, mode=mode,
58 learning_rate=learning_rate, MAD=MAD,
59 logger=logger)
File ~/.local/lib/python3.8/site-packages/gausspyplus-0.2.dev0-py3.8.egg/gausspyplus/gausspy_py3/gradient_descent.py:221, in train(objective_function, training_data, alpha1_initial, alpha2_initial, iterations, MAD, eps, learning_rate, p, window_size, iterations_for_convergence, plot, phase, SNR2_thresh, SNR_thresh, verbose, mode, improve_fitting_dict, logger) 219 FWHMs = training_data['fwhms'] 220 amps = training_data['amplitudes'] --> 221 true_params = np.append(amps, np.append(FWHMs, means)) 223 # Initialize book-keeping object 224 gd = gradient_descent(iterations)
File <array_function internals>:200, in append(*args, **kwargs)
File ~/.local/lib/python3.8/site-packages/numpy/lib/function_base.py:5493, in append(arr, values, axis) 5444 @array_function_dispatch(_append_dispatcher) 5445 def append(arr, values, axis=None): 5446 """ 5447 Append values to the end of an array. 5448 (...) 5491 5492 """ -> 5493 arr = asanyarray(arr) 5494 if axis is None: 5495 if arr.ndim != 1:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (73,) + inhomogeneous part. my python is 3.8.10, lmfit 12.2. ,numpy 1.24.4, scipy 1.10.1