Skip to content

Error in simplemixing_class #64

@xinyuewu21

Description

@xinyuewu21

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions