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) #第二个图,代表第一百天的状态

  • 相关阅读:
    My 1st webUI try
    option(recompile)
    Add&Delete WindowService
    powershell
    bootstrap模态框,等待遮盖层
    spring-boot通过@Scheduled配置定时任务
    bootstrap-table的一些参数配置
    $('xx')[0].files[0]的意思
    Go国内镜像
    基础语法-defer使用(12)
  • 原文地址:https://www.cnblogs.com/eleni/p/10942457.html
Copyright © 2011-2022 走看看