Hey there!
I am trying to phase a spectrum. In order to do that, I need to minimize following function of phi: - import numpy as np
-
from scipy.optimize import minimize
-
-
intgr = np.array([-73.53, -174.06, -156.59, -221.12, -219.65, -252.18, -289.71, -260.24, -271.77, -302.3 , -314.83, -358.36, -320.89, -280.42, -295.95, -338.48, -230.01, -234.54, -263.07, -248.6 , -249.13, -325.66, -329.19, -327.72, -326.25, -165.78, 30.69, 384.16, 871.63, 1341.1 , 1733.57, 2123.04, 2234.51, 2281.98, 2364.45, 2312.92, 2216.39, 2153.86, 2068.33, 2003.8 , 1929.27, 1992.74, 2024.21, 2025.68, 2015.15, 2068.62, 2110.09, 2167.56, 2234.03, 2335.5 , 2355.97])
-
intgi = np.array([94.09, 146.18, 160.27, 126.36, 98.45, 128.54, 174.63, 159.72, 153.81, 174.9, 157.99, 155.08, 213.17, 219.26, 218.35, 207.44, 196.53, 179.62, 158.71, 143.8, 119.89, 17.98, -91.93, -168.84, -341.75, -573.66, -749.57, -928.48, -985.39, -959.3, -895.21, -768.12, -485.03, -396.94, -313.85, -113.76, -56.67, -56.58, -46.49, -21.4, -9.31, 33.78, 62.87, 112.96, 115.05, 96.14, 95.23, 126.32, 99.41, 120.5, 0.])
-
-
def intf(phi):
-
return intgi*np.sin(phi) - intgr*np.cos(phi)
-
-
phi0 = 0.
-
res = minimize(intf, phi0, method='nelder-mead', options={'xtol': 1e-8, 'disp': True})
I have seen this done on numerous examples on the internet, but it doesn't work for me, and I can't figure out why... Here is the error I get:
Traceback (most recent call last):
File "./test", line 13, in <module>
res = minimize(intf, phi0, method='nelder-mead', options={'xtol': 1e-8, 'disp': True})
File "/usr/lib64/python2.7/site-packages/scipy/optimize/_minimize.py", line 342, in minimize
return _minimize_neldermead(fun, x0, args, callback, **options)
File "/usr/lib64/python2.7/site-packages/scipy/optimize/optimize.py", line 415, in _minimize_neldermead
fsim[0] = func(x0)
ValueError: setting an array element with a sequence.
Thanks!
0 2093 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Abhi |
last post by:
Hi all,
I am using .net for C++ and I would like to write some variable values
to some files.
I will be using that file in many member functions of the class. So I
declared the file variable...
|
by: Samie |
last post by:
Hi
I have declared a structure that contains pointer to a function. The
code goes like this:
typedef struct lcd_funs lcd_funs;
struct lcd_funs {
void (*decode_image)(cyg_uint32 imageWidth,...
|
by: sck10 |
last post by:
Hello,
I am calling a function using vb and want to convert it to c#. When moving
from vb 1.1 to vb 2.0, I can use the following: text='<%#
AddBlankRowMenu(Eval("strMenuType")) %>' to call the...
|
by: ambikadevi |
last post by:
What is the function to call the Postgres stored procedures function using ADODB? PrepareSP() function is used to call the Oracle Stored Procedure. For PHP application.
Waiting for the response!
|
by: =?Utf-8?B?VmljdG9yIExhaQ==?= |
last post by:
Hi,
I wrote an simple application using VS2005 C#. I am trying to call some
functions in my other dll file. This dll is written in EVC for running on
Windows CE 5.0.
This dll file has the...
|
by: ravitunk |
last post by:
hi..i have a javascript function which uses window.open() function to open another window... as below...
<script language ="JavaScript">
function openWin(url)
{
...
|
by: pankaj17 |
last post by:
hello,
Is it possible to communicate with another domain javascript function using ajax.
Suppose i have a iframe and domain is different and in the iframe i have some links. If user clicks on...
|
by: visweswaran2830 |
last post by:
Hi,
I have a function in aspx.vb (code behind fucntion). Now I want to call this function using javascript... How can I call?
|
by: vbdotnet |
last post by:
I want to retrieve a value from a function using return.
Like this:
Sub Main()
dim x as integer = 10
getX(x)
'how do I get z in here?
End Sub
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |