'''
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

class biological:
  def __init__(self,birth_day=datetime.date.today()):
    self.birthday=birth_day
    self.span=0
    self.age=0

  def dtime(self,date2=datetime.date.today()):
    self.span=(date2-self.birthday).days

  def colour(self):
    emotion=self.span % 28
    energy=self.span % 23
    intelligence=self.span % 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()

  def count_age(self):
    date2=datetime.date.today()
    days=(date2-self.birthday).days
    self.age=int(days/365)

def test():
b=biological() #类的实例化
birthdate=datetime.date(1997,7,17)
b.birthday=birthdate
b.dtime()
b.colour()

test()

#birthdate=datetime.date(2019,6,1)
#bdate=birthdate+datetime.timedelta(days=100)
#b.dtime(bdate)
#b.colour()
#colour(d2) #第二个图,代表第一百天的状态
#b.count_age()
#print(b.age)

最新文章

  1. 设计模式--享元模式Flyweight(结构型)
  2. linux驱动开发之块设备学习笔记
  3. $this-->name
  4. Hadoop map和reduce数量估算
  5. HDU 4819 Mosaic --二维线段树(树套树)
  6. Data Binding in WPF
  7. 把CSV文件导入到SQL Server表中
  8. 利用powershell进行远程服务器管理(命令行模式)
  9. Linux C 编程内存泄露检測工具(二):memwatch
  10. POJ 1002 487-3279 Trie解读
  11. java课程设计——猜数游戏
  12. 【Java基础】【21IO(字符流)&字符流其他内容&递归】
  13. H/s:哈希率单位转换
  14. 基于redis的分布式ID生成器
  15. hdu1890 splay维护区间翻转
  16. python实现的椭圆曲线加密
  17. sqlserver配置允许快照隔离
  18. Win10系列:UWP界面布局进阶7
  19. 从0开始学Python---01
  20. <Think Python>中斐波那契使用memo实现的章节

热门文章

  1. CSS标签大全
  2. MPlayer 常用操作和快捷键列表
  3. dede用户登录时,跳转到提示页时报404错误
  4. Vue2之页面 、js 、css分离
  5. 微信android手机中点击大图片会自动放大图片
  6. object flash
  7. Python3+Selenium3+webdriver学习笔记10(元素属性、页面源码)
  8. ADO.Net——防止SQL注入攻击
  9. 同步Windows 10与MIUI 9来完成你的日程安排
  10. lastlog命令