Changeset 641


Ignore:
Timestamp:
Apr 30, 2012, 3:51:36 PM (13 years ago)
Author:
tnavarro
Message:

correction for histogram of difference

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot.py

    r640 r641  
    581581                        if ope == '-' and nplot == numplot: # this should work as long as ope is '-' guarantees 3 plots for 4 panels without contour
    582582                            subplot(subv,subh,nplot+1)
    583                             latmin = -50.; latmax = 50. # latitude range for histogram of difference
    584                             if indexlat is None: # a bit dirty, if field is not reduced along latitude, we assume lat is along the y axis
     583                            if indexlat is None:
     584                                latmin = -50.; latmax = 50. # latitude range for histogram of difference
    585585                                zeindexlat = (lat<latmax)*(lat>latmin)
    586                                 what_I_plot_frame = what_I_plot_frame[zeindexlat,:]
     586                                if (len(lat) == len(x)) and (len(lat) == len(y)): errormess('PLANETOPLOT.PY: I cant find which axis is lat for histogram.')
     587                                elif len(lat) == len(x) : what_I_plot_frame = what_I_plot_frame[:,zeindexlat]
     588                                elif len(lat) == len(y) : what_I_plot_frame = what_I_plot_frame[zeindexlat,:]
     589                                else: errormess('PLANETOPLOT.PY: indexlat is None, but I cant find the lat axis.')
    587590                            toplot = np.ravel(what_I_plot_frame[np.isnan(what_I_plot_frame)==False])
    588                             zebins = np.linspace(minop,maxop,num=30)
     591                            zebins = np.linspace(zevmin,zevmax,num=30)
    589592                            hist(toplot,bins=zebins,histtype='step',linewidth=2,color='k',normed=True)
    590593                            zestd = np.std(toplot)
    591594                            zemean = np.mean(toplot)
    592                             zebins = np.linspace(minop,maxop,num=300)
     595                            zebins = np.linspace(zevmin,zevmax,num=300)
    593596                            zegauss = (1./(zestd * np.sqrt(2 * np.pi)) * np.exp( - (zebins - zemean)**2 / (2 * zestd**2) ) )
    594597                            text(zebins[2],np.max(zegauss),'mean: '+str(zemean)[0:5]+'\nstd: '+str(zestd)[0:5],fontsize = 12)
Note: See TracChangeset for help on using the changeset viewer.