zoukankan      html  css  js  c++  java
  • biological clock

    '''
    this application aimed to cauculate people's biological block about emotional(28), energy(23),intelligence(33)
    based on their birth date and the date you wanna analyse, current date will be used without another data applied
    '''

    import datetime
    import math
    import numpy as np
    import matplotlib.pyplot as plt

    def dtime(date1,date2=datetime.date.today()):
      #date1=datetime.date(1996,7,15) #随机填写一个值,有助于python明白你需要的数据类型
      delta=(date2-date1).days
      return(delta)

    def colour(delta): #delta是虚参,起什么名字都是可以的,后面调用的时候赋予实际意义
      emotion=delta % 28
      energy=delta % 23
      intelligence=delta % 33
      x_e=2*math.pi*emotion/28
      y_e=math.sin(x_e)
      x_en=2*math.pi*energy/23
      y_en=math.sin(x_en)
      x_inte=2*math.pi*intelligence/33
      y_inte=math.sin(x_inte)

      x=np.arange(0,2*np.pi,0.01)
      y=np.sin(x)

      plt.plot(x,y)
      plt.plot([0,2*math.pi],[0,0])
      plt.scatter(x_e,y_e,c=u'r')
      plt.scatter(x_en,y_en,c=u'g',marker=u'*')
      plt.scatter(x_inte,y_inte,c=u'b',marker=u'^')
      plt.xlabel('o-red:emotion,*-green:energy,^-blue:intelligence')
      plt.show()

    birthdate=datetime.date(1997,8,15)
    d=dtime(birthdate)
    colour(d) #第一个图,代表当天的状态
    adate=datetime.date(2019,6,1)
    bdate=birthdate+datetime.timedelta(days=100)
    d2=dtime(birthdate,bdate)
    colour(d2) #第二个图,代表第一百天的状态

  • 相关阅读:
    vbscript 过滤 特殊字符
    C#3.0新体验(五)Lambda表达式
    C#3.0新体验(三)对象与集合初始化器收
    C#3.0新体验(四)匿名类型
    郁闷啊
    9.15
    谈话是需要对手的
    中秋节啊
    照片
    回家的 感受
  • 原文地址:https://www.cnblogs.com/eleni/p/10942457.html
Copyright © 2011-2022 走看看