python类ylim()的实例源码

figrc.py 文件源码 项目:tap 作者: mfouesneau 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def plot_density_map(x, y, xbins, ybins, Nlevels=4, cbar=True, weights=None):

    Z = np.histogram2d(x, y, bins=(xbins, ybins), weights=weights)[0].astype(float).T

    # central values
    lt = get_centers_from_bins(xbins)
    lm = get_centers_from_bins(ybins)
    cX, cY = np.meshgrid(lt, lm)
    X, Y = np.meshgrid(xbins, ybins)

    im = plt.pcolor(X, Y, Z, cmap=plt.cm.Blues)
    plt.contour(cX, cY, Z, levels=nice_levels(Z, Nlevels), cmap=plt.cm.Greys_r)

    if cbar:
        cb = plt.colorbar(im)
    else:
        cb = None
    plt.xlim(xbins[0], xbins[-1])
    plt.ylim(ybins[0], ybins[-1])

    try:
        plt.tight_layout()
    except Exception as e:
        print(e)
    return plt.gca(), cb
plotting.py 文件源码 项目:ugali 作者: DarkEnergySurvey 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def twoDimensionalScatter(title, title_x, title_y,
                          x, y,
                          lim_x = None, lim_y = None,
                          color = 'b', size = 20, alpha=None):
    """
    Create a two-dimensional scatter plot.

    INPUTS
    """
    pylab.figure()

    pylab.scatter(x, y, c=color, s=size, alpha=alpha, edgecolors='none')

    pylab.xlabel(title_x)
    pylab.ylabel(title_y)
    pylab.title(title)
    if type(color) is not str:
        pylab.colorbar()

    if lim_x:
        pylab.xlim(lim_x[0], lim_x[1])
    if lim_y:
        pylab.ylim(lim_y[0], lim_y[1])

############################################################
wordemb-vis-tsne.py 文件源码 项目:nn4nlp-code 作者: neubig 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def display_data(word_vectors, words, target_words=None):
  target_matrix = word_vectors.copy()
  if target_words:
    target_words = [line.strip().lower() for line in open(target_words)][:2000]
    rows = [words.index(word) for word in target_words if word in words]
    target_matrix = target_matrix[rows,:]
  else:
    rows = np.random.choice(len(word_vectors), size=1000, replace=False)
    target_matrix = target_matrix[rows,:]
  reduced_matrix = tsne(target_matrix, 2);

  Plot.figure(figsize=(200, 200), dpi=100)
  max_x = np.amax(reduced_matrix, axis=0)[0]
  max_y = np.amax(reduced_matrix, axis=0)[1]
  Plot.xlim((-max_x,max_x))
  Plot.ylim((-max_y,max_y))

  Plot.scatter(reduced_matrix[:, 0], reduced_matrix[:, 1], 20);

  for row_id in range(0, len(rows)):
      target_word = words[rows[row_id]]
      x = reduced_matrix[row_id, 0]
      y = reduced_matrix[row_id, 1]
      Plot.annotate(target_word, (x,y))
  Plot.savefig("word_vectors.png");
assess.py 文件源码 项目:ndparse 作者: neurodata 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def display_pr_curve(precision, recall):
    # following examples from sklearn

    # TODO:  f1 operating point

    import pylab as plt
    # Plot Precision-Recall curve
    plt.clf()
    plt.plot(recall, precision, label='Precision-Recall curve')
    plt.xlabel('Recall')
    plt.ylabel('Precision')
    plt.ylim([0.0, 1.05])
    plt.xlim([0.0, 1.0])
    plt.title('Precision-Recall example: Max f1={0:0.2f}'.format(max_f1))
    plt.legend(loc="lower left")
    plt.show()
rectify.py 文件源码 项目:facade-segmentation 作者: jfemiani 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def plot_rectified(self):
        import pylab
        pylab.title('rectified')
        pylab.imshow(self.rectified)

        for line in self.vlines:
            p0, p1 = line
            p0 = self.inv_transform(p0)
            p1 = self.inv_transform(p1)
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='green')

        for line in self.hlines:
            p0, p1 = line
            p0 = self.inv_transform(p0)
            p1 = self.inv_transform(p1)
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='red')

        pylab.axis('image');
        pylab.grid(c='yellow', lw=1)
        pylab.plt.yticks(np.arange(0, self.l, 100.0));
        pylab.xlim(0, self.w)
        pylab.ylim(self.l, 0)
rectify.py 文件源码 项目:facade-segmentation 作者: jfemiani 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def plot_original(self):
        import pylab
        pylab.title('original')
        pylab.imshow(self.data)

        for line in self.lines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='blue', alpha=0.3)

        for line in self.vlines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='green')

        for line in self.hlines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='red')

        pylab.axis('image');
        pylab.grid(c='yellow', lw=1)
        pylab.plt.yticks(np.arange(0, self.l, 100.0));
        pylab.xlim(0, self.w)
        pylab.ylim(self.l, 0)
megafacade.py 文件源码 项目:facade-segmentation 作者: jfemiani 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def _plot_background(self, bgimage):
        import pylab as pl
        # Show the portion of the image behind this facade
        left, right = self.facade_left, self.facade_right
        top, bottom = 0, self.mega_facade.rectified.shape[0]
        if bgimage is not None:
            pl.imshow(bgimage[top:bottom, left:right], extent=(left, right, bottom, top))
        else:
            # Fit the facade in the plot
            y0, y1 = pl.ylim()
            x0, x1 = pl.xlim()
            x0 = min(x0, left)
            x1 = max(x1, right)
            y0 = min(y0, top)
            y1 = max(y1, bottom)
            pl.xlim(x0, x1)
            pl.ylim(y1, y0)
transfer_functions.py 文件源码 项目:yt 作者: yt-project 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def plot(self, filename):
        r"""Save an image file of the transfer function.

        This function loads up matplotlib, plots the transfer function and saves.

        Parameters
        ----------
        filename : string
            The file to save out the plot as.

        Examples
        --------

        >>> tf = TransferFunction( (-10.0, -5.0) )
        >>> tf.add_gaussian(-9.0, 0.01, 1.0)
        >>> tf.plot("sample.png")
        """
        import matplotlib
        matplotlib.use("Agg")
        import pylab
        pylab.clf()
        pylab.plot(self.x, self.y, 'xk-')
        pylab.xlim(*self.x_bounds)
        pylab.ylim(0.0, 1.0)
        pylab.savefig(filename)
transfer_functions.py 文件源码 项目:yt 作者: yt-project 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def show(self):
        r"""Display an image of the transfer function

        This function loads up matplotlib and displays the current transfer function.

        Parameters
        ----------

        Examples
        --------

        >>> tf = TransferFunction( (-10.0, -5.0) )
        >>> tf.add_gaussian(-9.0, 0.01, 1.0)
        >>> tf.show()
        """
        import pylab
        pylab.clf()
        pylab.plot(self.x, self.y, 'xk-')
        pylab.xlim(*self.x_bounds)
        pylab.ylim(0.0, 1.0)
        pylab.draw()
RFfastestLap.py 文件源码 项目:f1_2017 作者: aflaisler 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def fastLapModel(xList, labels, names, multiple=0, full_set=0):
    X = numpy.array(xList)
    y = numpy.array(labels)
    featureNames = []
    featureNames = numpy.array(names)
    # take fixed holdout set 30% of data rows
    xTrain, xTest, yTrain, yTest = train_test_split(
        X, y, test_size=0.30, random_state=531)
    # for final model (no CV)
    if full_set:
        xTrain = X
        yTrain = y
    check_set(xTrain, xTest, yTrain, yTest)
    print "Fitting the model to the data set..."
    # train random forest at a range of ensemble sizes in order to see how the
    # mse changes
    mseOos = []
    m = 10 ** multiple
    nTreeList = range(500 * m, 1000 * m, 100 * m)
    # iTrees = 10000
    for iTrees in nTreeList:
        depth = None
        maxFeat = int(np.sqrt(np.shape(xTrain)[1])) + 1  # try tweaking
        RFmd = ensemble.RandomForestRegressor(n_estimators=iTrees, max_depth=depth, max_features=maxFeat,
                                              oob_score=False, random_state=531, n_jobs=-1)
        # RFmd.n_features = 5
        RFmd.fit(xTrain, yTrain)

        # Accumulate mse on test set
        prediction = RFmd.predict(xTest)
        mseOos.append(mean_squared_error(yTest, prediction))
    # plot training and test errors vs number of trees in ensemble
    plot.plot(nTreeList, mseOos)
    plot.xlabel('Number of Trees in Ensemble')
    plot.ylabel('Mean Squared Error')
    #plot.ylim([0.0, 1.1*max(mseOob)])
    plot.show()
    print("MSE")
    print(mseOos[-1])
    return xTrain, xTest, yTrain, yTest, RFmd
views.py 文件源码 项目:little-python 作者: JeffyLu 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def stat_personal(self):
        if not os.path.exists(self.file_path + self.ip.ip):
            os.mkdir(self.file_path + self.ip.ip)
            print('make dir %s' % self.ip.ip)
        try:
            items = self.ip.info_set.count()
        except:
            return 0
        my_info = Info.objects.filter(ip = self.ip).order_by('date')
        dates = list(range(len(my_info)))
        bmis = [info.get_bmi() for info in my_info]
        pl.figure('my', figsize = (5.2, 2.8), dpi = 100)
        pl.plot(dates, bmis, '*-', color = '#20b2aa', linewidth = 1.5)
        pl.ylabel(u'BMI?', fontproperties = zhfont)
        pl.ylim(0.0, 50.0)
        pl.savefig(self.file_path + self.ip.ip + '/my.jpg')
        pl.cla()
        return items
4(improved-7).py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def show_results(self):
        pl.plot(self.t1, self.n_A1, 'b--', label='A1: Time Step = 0.05')
        pl.plot(self.t1, self.n_B1, 'b', label='B1: Time Step = 0.05')
        pl.plot(self.t2, self.n_A2, 'g--', label='A2: Time Step = 0.1')
        pl.plot(self.t2, self.n_B2, 'g', label='B2: Time Step = 0.1')
        pl.plot(self.t1, self.n_A1_true, 'r--', label='True A1: Time Step = 0.05')
        pl.plot(self.t1, self.n_B1_true, 'r', label='True B1: Time Step = 0.05')
        pl.plot(self.t2, self.n_A2_true, 'c--', label='True A2: Time Step = 0.1')
        pl.plot(self.t2, self.n_B2_true, 'c', label='True B2: Time Step = 0.1')
        pl.title('Double Decay Probelm-Approximation Compared with True in Defferent Time Steps')
        pl.xlim(0.0, 0.1)
        pl.ylim(0.0, 100.0)
        pl.xlabel('time ($s$)')
        pl.ylabel('Number of Nuclei')
        pl.legend(loc='best', shadow=True, fontsize='small')
        pl.grid(True)
        pl.savefig("computational_physics homework 4(improved-7).png")
7 code plus.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def show(self):
#        pl.semilogy(self.theta, self.omega)
#                , label = '$L =%.1f m, $'%self.l + '$dt = %.2f s, $'%self.dt + '$\\theta_0 = %.2f radians, $'%self.theta[0] + '$q = %i, $'%self.q + '$F_D = %.2f, $'%self.F_D + '$\\Omega_D = %.1f$'%self.Omega_D)
        pl.plot(self.theta_phase ,self.omega_phase, '.', label = '$t \\approx 2\\pi n / \\Omega_D$')
        pl.xlabel('$\\theta$ (radians)')
        pl.ylabel('$\\omega$ (radians/s)')
        pl.legend()
#        pl.text(-1.4, 0.3, '$\\omega$ versus $\\theta$ $F_D = 1.2$', fontsize = 'x-large')
        pl.title('Chaotic Regime')
#        pl.show()
#        pl.semilogy(self.time_array, self.delta)
#        pl.legend(loc = 'upper center', fontsize = 'small')
#        pl.xlabel('$time (s)$')
#        pl.ylabel('$\\Delta\\theta (radians)$')
#        pl.xlim(0, self.T)
#        pl.ylim(float(input('ylim-: ')),float(input('ylim+: ')))
#        pl.ylim(1E-11, 0.01)
#        pl.text(4, -0.15, 'nonlinear pendulum - Euler-Cromer method')
#        pl.text(10, 1E-3, '$\\Delta\\theta versus time F_D = 0.5$')
#        pl.title('Simple Harmonic Motion')
        pl.title('Chaotic Regime')
7 code plus.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_log(self):
#        pl.subplot(121)
        pl.semilogy(self.time_array, self.delta, 'c')
        pl.xlabel('$time (s)$')
        pl.ylabel('$\\Delta\\theta$ (radians)')
        pl.xlim(0, self.T)
#        pl.ylim(1E-11, 0.01)
        pl.text(42, 1E-7, '$\\Delta\\theta$ versus time $F_D = 1.2$', fontsize = 'x-large')
        pl.title('Chaotic Regime')
        pl.show()

#    def show_log_sub122(self):
#        pl.subplot(122)
#        pl.semilogy(self.time_array, self.delta, 'g')
#        pl.xlabel('$time (s)$')
#        pl.ylabel('$\\Delta\\theta$ (radians)')
#        pl.xlim(0, self.T)
#        pl.ylim(1E-6, 100)
#        pl.text(20, 1E-5, '$\\Delta\\theta$ versus time $F_D = 1.2$', fontsize = 'x-large')
#        pl.title('Chaotic Regime')
#        pl.show()
7 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_log(self):
#        pl.subplot(121)
        pl.semilogy(self.time_array, self.delta, 'c')
        pl.xlabel('$time (s)$')
        pl.ylabel('$\\Delta\\theta$ (radians)')
        pl.xlim(0, self.T)
#        pl.ylim(1E-11, 0.01)
        pl.text(42, 1E-7, '$\\Delta\\theta$ versus time $F_D = 1.2$', fontsize = 'x-large')
        pl.title('Chaotic Regime')
        pl.show()

#    def show_log_sub122(self):
#        pl.subplot(122)
#        pl.semilogy(self.time_array, self.delta, 'g')
#        pl.xlabel('$time (s)$')
#        pl.ylabel('$\\Delta\\theta$ (radians)')
#        pl.xlim(0, self.T)
#        pl.ylim(1E-6, 100)
#        pl.text(20, 1E-5, '$\\Delta\\theta$ versus time $F_D = 1.2$', fontsize = 'x-large')
#        pl.title('Chaotic Regime')
#        pl.show()
6 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def show_complex(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 16,
        }
        pl.title('The Trajectory of Tageted Baseball\n with air flow in adiabatic model', fontdict = font)
        pl.plot(self.x, self.y, label = '$v_0 = %.5f m/s$'%self.v0 + ', ' + '$\\theta = %.4f \degree$'%self.theta)
        pl.xlabel('x $m$')
        pl.ylabel('y $m$')
        pl.xlim(0, 300)
        pl.ylim(-100, 20)
        pl.grid()
        pl.legend(loc = 'upper right', shadow = True, fontsize = 'small')
        pl.text(15, -90, 'scan to approach the minimum velocity and corresponding launching angle', fontdict = font)
        pl.show()
6 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_simple(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 16,
        }
        pl.title('The Trajectory of Tageted Baseball\n with air flow in adiabatic model', fontdict = font)
        pl.plot(self.x, self.y, label ='$\\alpha = %.0f \degree$'%self.alpha)
        pl.xlabel('x $m$')
        pl.ylabel('y $m$')
        pl.xlim(0, 400)
        pl.ylim(-100, 200)
        pl.grid()
        pl.legend(loc = 'upper right', shadow = True, fontsize = 'medium')
        pl.text(5, -80, 'trojectories varing with angles of wind', fontdict = font)
        pl.show()
5 code 1.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 14,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(41, 16, 'Only with air drag', fontdict = font)
        pl.show()
5 code 2.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34, 16, '       With both air drag and \n reduced air density-isothermal', fontdict = font)
        pl.show()
5 code 3.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34.5, 16, '       With both air drag and \n reduced air density-adiabatic', fontdict = font)
        pl.show()
final code3.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def plot(self):
        fig = pl.figure(figsize=(8,8))
        pl.plot(self.n,self.x2ave,'.c')
        pl.plot(self.n,self.x2ave_fit,'k')
        pl.ylim(0,100)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code18.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.r2ave,'.c')
        pl.plot(self.n,self.r2ave_fit,'k')
#        pl.ylim(0,100)
        pl.ylim(0,40)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code16.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.r2ave,'.c')
        pl.plot(self.n,self.r2ave_fit,'k')
        pl.ylim(0,100)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code20.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.r2ave,'.c')
        pl.plot(self.n,self.r2ave_fit,'k')
        pl.ylim(0,100)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code22.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.r2ave,'.c')
        pl.plot(self.n,self.r2ave_fit,'k')
        pl.ylim(0,5000)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code24.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.r2ave,'.c')
        pl.plot(self.n,self.r2ave_fit,'k')
        pl.ylim(0,100)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code10.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.r2ave,'.c')
        pl.plot(self.n,self.r2ave_fit,'k')
        pl.ylim(0,40)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code2.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def plot(self):
        pl.plot(self.n,self.x2ave,'.c')
        pl.plot(self.n,self.x2ave_fit,'k')
        pl.ylim(0,40)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
final code1.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def plot(self):
        fig = pl.figure(figsize=(8,8))
        pl.plot(self.n,self.xave,'.c')
        pl.plot(self.n,self.xave_fit,'k')
        pl.ylim(-1,1)
#        for i in range(self.M):
#            self.x = 0
#            for j in range(self.N):
#                for k in range(j):
#                    rnd = random.random()        

#                rnd = random.random()
#                if rnd > 0.5:
#                    self.x +=1
#                else:
#                    self.x -=1
##            print(self.x)
#            self.x2 += math.pow(self.x,2)
##            print(self.x2)
#        self.x2ave = self.x2/self.M
#        print(self.x2ave)
##        return self.x2ave
diagnostic_plots.py 文件源码 项目:ugali 作者: DarkEnergySurvey 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def starPlot(targ_ra, targ_dec, data, iso, g_radius, nbhd):
    """Star bin plot"""

    mag_g = data[mag_g_dred_flag]
    mag_r = data[mag_r_dred_flag]

    filter = star_filter(data)

    iso_filter = (iso.separation(mag_g, mag_r) < 0.1)

    # projection of image
    proj = ugali.utils.projector.Projector(targ_ra, targ_dec)
    x, y = proj.sphereToImage(data[filter & iso_filter]['RA'], data[filter & iso_filter]['DEC'])

    plt.scatter(x, y, edgecolor='none', s=3, c='black')
    plt.xlim(0.2, -0.2)
    plt.ylim(-0.2, 0.2)
    plt.gca().set_aspect('equal')
    plt.xlabel(r'$\Delta \alpha$ (deg)')
    plt.ylabel(r'$\Delta \delta$ (deg)')

    plt.title('Stars')


问题


面经


文章

微信
公众号

扫码关注公众号