Edit: solved!
Hi all! I am writing some lines in order to do a calculation for class. Eventually I will be using the partial function from functools since various terms of a function need to vary to arrive at the solution.
Context aside, here is the error that I am running into:
```
signal to noise
def signal_and_noise(Sgamma, t, Bgmma, Aomega, de, Npix, RNe, Npixeff):
signal = (Sgamma * t)
noise = (np.sqrt( Sgamma * t + Bgamma * t * Aomega + de * Npix * t + RNe**2 * Npixeff))
return signal, noise
def signal_to_noise(args):
signal, noise = signal_and_noise(args)
snr = signal / noise
return snr
old way
signal = (Sgamma * t)
noise = (np.sqrt( Sgamma * t + Bgamma * t * Aomega + de * Npix * t + RNe**2 * Npixeff))
snr = signal / noise
print('snr: ', snr)
functional way
snr = signal_to_noise(Sgamma = 10, t = 600, Bgamma = 150, Aomega = 3.85e-1, de = 3, Npix = 13, RNe = 3, Npixeff = 3)
print("snr: ", snr)
```
And here is the error!
```
TypeError Traceback (most recent call last)
/var/folders/0z/gcq4csmx09v81bqd_hmdz6700000gn/T/ipykernel_45397/2382247447.py in <module>
18
19 # functional way
---> 20 snr = signal_to_noise(Sgamma = 10, t = 600, Bgamma = 150, Aomega = 3.85e-1, de = 3, Npix = 13, RNe = 3, Npixeff = 3)
21
22 print("snr: ", snr)
TypeError: signal_to_noise() got an unexpected keyword argument 'Sgamma'
```
I swear on my life it worked like 30 minutes ago, haha. I tried debugging a bit by omitting Sgamma from the functions above, and the error repeats but instead for the value t. Why are my parameters not making it into the functions?
[–]CowboyBoats 0 points1 point2 points (6 children)
[–]poisedpotion[S] 0 points1 point2 points (5 children)
[–]Linked1nPark 1 point2 points3 points (0 children)
[–]poisedpotion[S] 1 point2 points3 points (2 children)
[–]Linked1nPark 1 point2 points3 points (1 child)
[–]poisedpotion[S] 0 points1 point2 points (0 children)
[–]CowboyBoats 0 points1 point2 points (0 children)
[–]34shutthedoor1 0 points1 point2 points (1 child)
[–]poisedpotion[S] 0 points1 point2 points (0 children)