Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in simplemixing_class #64

Open
xinyuewu21 opened this issue Jan 28, 2022 · 0 comments
Open

Error in simplemixing_class #64

xinyuewu21 opened this issue Jan 28, 2022 · 0 comments

Comments

@xinyuewu21
Copy link

In In[4] cell of the notebook simplemixing_class, a TypeError appears. Two plots can't be made. Running at git hash ec1024d.

The code is

fig, axes = plt.subplots(1, 3, figsize=(13,3.5), sharex=True, sharey=True)

ax1, ax2, ax3 = axes
t = np.linspace(-0.1, 1, 201) * u.s

# UNMIXED
for ls, flavor in zip(["-", "--", "-.", ":"], Flavor):
    flux = ccsn.get_flux(t, flavor)
    
    ax1.plot(t, flux, ls, lw=2, label=flavor.to_tex(), alpha=0.7)
    ax1.set_title("Unmixed")
# plt.yscale('log')
# plt.ylim(3e51, 5e53)
ax1.set(xlabel='time - $t_{bounce}$ [s]',
        ylabel='flux')
ax1.legend()

# NORMAL MIXING
nu_list1 = []
i = 0
for flavor in Flavor:
    flux = ccsn.get_flux(t, flavor)
    nu_list1.append(flux)
    
nu_new1 = mix.normal_mixing(nu_list1)

for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new1)), Flavor):
    new_flux1 = nu_new1[i]
    ax2.plot(t, new_flux1, ls, lw=2, alpha=0.7, label=flavor.to_tex())
    ax2.set_title(label="Normal Mixing")

ax2.set(xlabel='time - $t_{bounce}$ [s]',
        ylabel='flux')

ax2.legend()

# INVERTED MIXING
nu_list2 = []
i = 0
for flavor in Flavor:
    flux = ccsn.get_flux(t, flavor)
    nu_list2.append(flux)
    
nu_new2 = mix.inverted_mixing(nu_list1)

for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new2)), Flavor):
    new_flux2 = nu_new2[i]
    ax3.plot(t, new_flux2, ls, lw=2, alpha=0.7, label=flavor.to_tex())
    ax3.set_title(label="Inverted Mixing")

ax3.set(xlabel='time - $t_{bounce}$ [s]',
        ylabel='flux')
ax3.legend()


fig.tight_layout();

The error is:

TypeError                                 Traceback (most recent call last)
<ipython-input-4-5875f39c7122> in <module>
     25 nu_new1 = mix.normal_mixing(nu_list1)
     26 
---> 27 for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new1)), Flavor):
     28     new_flux1 = nu_new1[i]
     29     ax2.plot(t, new_flux1, ls, lw=2, alpha=0.7, label=flavor.to_tex())

TypeError: object of type 'function' has no len()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant