lundi 13 janvier 2020

Using IF statement for separating negative and positive values read from text file

In the following code I contains positive and negative values. I want to use just positive ones or negative ones. I defined an IF but it does not work and again in the final plot I have all negative and positive values. Any help, please?

n, t, I = np.genfromtxt('...Desktop/uf/Inu3.txt',unpack=True)
if (I>0).any():
        df=pd.DataFrame(data={'A':n,'B':t,'C':I})
        points = plt.scatter(df.A, df.B, c=df.C,cmap="jet", lw=0)#, norm=matplotlib.colors.LogNorm())
        plt.yscale('log')
        plt.xscale('log')

        plt.xlabel(r'$n_{g}$',fontsize=20)
        plt.ylabel(r'$T_{g}$',fontsize=20)
        cb = plt.colorbar()
        cb.ax.tick_params(labelsize=10)
        cb.set_label(label=r'$I_{\nu}[Jy/sr]$', size='15')
else:
    pass

Aucun commentaire:

Enregistrer un commentaire