def RV_RMSgrid(self,ts,res=<NUM_LIT:20>,mres=None,Pres=None,conf=<NUM_LIT>,measured_rms=None,drv=<NUM_LIT:0>,<EOL>plot=True,fig=None,contour=True,sigma=<NUM_LIT:1>):
RVs = self.RV_timeseries(ts)<EOL>RVs += rand.normal(size=np.size(RVs)).reshape(RVs.shape)*drv<EOL>rms = RVs.std(axis=<NUM_LIT:0>)<EOL>if mres is None:<EOL><INDENT>mres = res<EOL><DEDENT>if Pres is None:<EOL><INDENT>Pres = res<EOL><DEDENT>mbins = np.linspace(self.M2.min(),self.M2.max(),mres+<NUM_LIT:1>)<EOL>Pbins = np.logspace(np.log10(self.P.min()),np.log10(self.P.max()),Pres+<NUM_LIT:1>)<EOL>logPbins = np.log10(Pbins)<EOL>mbin_centers = (mbins[:-<NUM_LIT:1>] + mbins[<NUM_LIT:1>:])/<NUM_LIT><EOL>logPbin_centers = (logPbins[:-<NUM_LIT:1>] + logPbins[<NUM_LIT:1>:])/<NUM_LIT><EOL>minds = np.digitize(self.M2,mbins)<EOL>Pinds = np.digitize(self.P,Pbins)<EOL>pctiles = np.zeros((mres,Pres))<EOL>ns = np.zeros((mres,Pres))<EOL>for i in np.arange(mres):<EOL><INDENT>for j in np.arange(Pres):<EOL><INDENT>w = np.where((minds==i+<NUM_LIT:1>) & (Pinds==j+<NUM_LIT:1>))<EOL>these = rms[w]<EOL>n = size(these)<EOL>ns[i,j] = n<EOL>if measured_rms is not None:<EOL><INDENT>pctiles[i,j] = (these > sigma*measured_rms).sum()/float(n)<EOL><DEDENT>else:<EOL><INDENT>inds = np.argsort(these)<EOL>pctiles[i,j] = these[inds][int((<NUM_LIT:1>-conf)*n)]<EOL><DEDENT><DEDENT><DEDENT>Ms,logPs = np.meshgrid(mbin_centers,logPbin_centers)<EOL>if plot:<EOL><INDENT>setfig(fig)<EOL>if contour:<EOL><INDENT>mbin_centers = (mbins[:-<NUM_LIT:1>] + mbins[<NUM_LIT:1>:])/<NUM_LIT><EOL>logPbins = np.log10(Pbins)<EOL>logPbin_centers = (logPbins[:-<NUM_LIT:1>] + logPbins[<NUM_LIT:1>:])/<NUM_LIT><EOL>if measured_rms is not None:<EOL><INDENT>levels = [<NUM_LIT>,<NUM_LIT>,<NUM_LIT>]<EOL><DEDENT>else:<EOL><INDENT>levels = np.arange(<NUM_LIT:0>,<NUM_LIT:20>,<NUM_LIT:2>)<EOL><DEDENT>c = plt.contour(logPbin_centers,mbin_centers,pctiles,levels=levels,colors='<STR_LIT:k>')<EOL>plt.clabel(c, fontsize=<NUM_LIT:10>, inline=<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>extent = [np.log10(self.P.min()),np.log10(self.P.max()),self.M2.min(),self.M2.max()]<EOL>im = plt.imshow(pctiles,cmap='<STR_LIT>',extent=extent,aspect='<STR_LIT>')<EOL>fig = plt.gcf()<EOL>ax = plt.gca()<EOL>if measured_rms is None:<EOL><INDENT>cbarticks = np.arange(<NUM_LIT:0>,<NUM_LIT>,<NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>cbarticks = np.arange(<NUM_LIT:0>,<NUM_LIT>,<NUM_LIT:0.1>)<EOL><DEDENT>cbar = fig.colorbar(im, ticks=cbarticks)<EOL><DEDENT>plt.xlabel('<STR_LIT>')<EOL>plt.ylabel('<STR_LIT>')<EOL><DEDENT>return mbins,Pbins,pctiles,ns<EOL>
Writes a grid of RV RMS values, assuming observations at given times.

        Hasn't really been tested