I'm getting an error message trying to run a script in Python for repeated irradiation-cooling times of gold foil. This is the error:
Traceback (most recent call last):
File "C:/Users/wolfk/PycharmProjects/Reactor Phys In-House/iterations.py", line 26, in <module>
cr_tot /= math.e ** (-2.98256E-6 * out_times[l])
ValueError: operands could not be broadcast together with shapes (7,) (6,) (7,)
The code is pretty messy since I used number values instead of variables for the most part, but the math isn't important, I can verify it later. What I need to do is get this thing to run! So you know, the vectors for in- and out-times are different lengths by design, and I tried making them the same length so that wasn't the issue. Here's the code:
import numpy as np
import math
import matplotlib.pyplot as plt
in_times = np.array([[697800, 603840, 74460, 161520, 428880, 75960, 62760]])
out_times = np.array([[248880, 3960, 9240, 5400, 5880, 8760]])
cr_tot = 0
cr_fast = 0
i = 1
j = 1
k = 0
l = 0
while i < 13:
if j == 1:
cr_tot /= math.e ** (-2.98256E-6 * in_times[k])
cr_fast /= math.e ** (-2.98256E-6 * in_times[k])
cr_tot += ((2.98256E-6 * 4950377) / 0.021554) / (1 - math.e ** (-2.98256E-6 * in_times[k]))
cr_fast += ((2.98256E-6 * 2141114) / 0.043109) / (1 - math.e ** (-2.98256E-6 * in_times[k]))
j -= 1
k += 1
else:
cr_tot /= math.e ** (-2.98256E-6 * out_times[l])
cr_fast /= math.e ** (-2.98256E-6 * out_times[l])
j += 1
l += 1
i += 1
xi_tot = (2.98256E-6 * 4950377) / (0.021554 * cr_tot)
xi_fast = (2.98256E-6 * 2141114) / (0.043109 * cr_fast)
cr_tot *= (2.98256E-6 * 4950377) / (0.021554 * xi_tot * math.e ** (-2.98256E-6 * 660) * (1 - math.e ** (-2.98256E-6 * 1000)))
cr_fast *= (2.98256E-6 * 2141114) / (0.043109 * xi_fast * math.e ** (-2.98256E-6 * 660) * (1 - math.e ** (-2.98256E-6 * 2000)))
print(cr_tot)
print(cr_fast)
I'd appreciate any help I can get. :)