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

biological clock--class的更多相关文章

  1. biological clock

    '''this application aimed to cauculate people's biological block about emotional(28), energy(23),int ...

  2. L325 如何睡觉

    Getting enough shut-eye is one of life’s biggest challenges. It’s recommended that the average perso ...

  3. 纪录片- 睡眠追踪(Chasing sleep) (共6集)

    传送门:https://www.bilibili.com/bangumi/play/ep120260/ 小贴士传送门:https://www.bilibili.com/video/av11887055 ...

  4. 修改Linux系统日期与时间date clock

    先设置日期 date -s 20080103 再设置时间 date -s 18:24:30 为了永久生效,需要将修改的时间写入CMOS. 查看CMOS的时间: #clock -r 将当前系统时间写到C ...

  5. 操作系统页面置换算法(opt,lru,fifo,clock)实现

    选择调出页面的算法就称为页面置换算法.好的页面置换算法应有较低的页面更换频率,也就是说,应将以后不会再访问或者以后较长时间内不会再访问的页面先调出. 常见的置换算法有以下四种(以下来自操作系统课本). ...

  6. Cesium应用篇:3控件(1)Clock

    创建 跟Clock相关的主要有Animation控件和Timeline控件,通常两者会放在一起使用. 在Cesium中,Viewer默认开启这两个控件,如果你想要不显示控件,可以在Viewer初始化中 ...

  7. get back to the slower clock rate that allows it to save more power

    http://www.howtogeek.com/177790/why-you-cant-use-cpu-clock-speed-to-compare-computer-performance/ Wh ...

  8. Clock rate

    https://en.wikipedia.org/wiki/Clock_rate The clock rate typically refers to the frequency at which a ...

  9. clock()、time()、clock_gettime()和gettimeofday()函数的用法和区别【转】

    转自:http://www.cnblogs.com/krythur/archive/2013/02/25/2932647.html 转自http://blog.sina.com.cn/s/blog_7 ...

  10. 最少clock

    var elClock = document.getElementById("clock");var getTime = function(){ var _ = ['00','01 ...

随机推荐

  1. net core 中间件管道

    net core 中间件管道 .net core 管道(Pipeline)是什么? 由上图可以看出,.net core 管道是请求抵达服务器到响应结果返回的中间的一系列的处理过程,如果我们简化一下成下 ...

  2. 转Keil 中使用 STM32F4xx 硬件浮点单元

    Keil 中使用 STM32F4xx 硬件浮点单元一.前言有工程师反应说 Keil 下无法使用 STM32F4xx 硬件浮点单元, 导致当运算浮点时运算时间过长,还有 一些人反应不知如何使用芯片芯片内 ...

  3. 作用域提升(Scope Hositing )是 Webpack 3 的标志性特征

    http://blog.csdn.net/playboyanta123/article/details/73533079

  4. LINUX中IPTABLES防火墙使用

    对于有公网IP的生产环境VPS,仅仅开放需要的端口,即采用ACL来控制IP和端口(Access Control List). 这里可以使用Linux防火墙netfilter的用户态工具 iptable ...

  5. 牛客网Java刷题知识点之关键字static、static成员变量、static成员方法、static代码块和static内部类

    不多说,直接上干货! 牛客网Java刷题知识点之关键字static static代表着什么 在Java中并不存在全局变量的概念,但是我们可以通过static来实现一个“伪全局”的概念,在Java中st ...

  6. Java基础学习_01 概述及环境配置

    一.概述 1.Java语言平台版本 1.1J2SE(Java 2 Platform Standard Edition)标准版 为开发普通桌面和商务应用程序提供的解决方案,该技术体系是其他两者的基础,可 ...

  7. [转]兼容各个浏览器的H.264播放: H.264+HTML5+FLOWPLAYER+WOWZA+RMTP

    一.方案确定 计划做视频播放,要求能够播放H264编码的mp4文件,各个浏览器,各种终端都能播放. 首先查找可行性方案, http://www.cnblogs.com/sink_cup/archive ...

  8. 集合(List、Set)

    第19天 集合 第1章 List接口 我们掌握了Collection接口的使用后,再来看看Collection接口中的子类,他们都具备那些特性呢? 接下来,我们一起学习Collection中的常用几个 ...

  9. 桉树IAAS云架构(转载)

    您可在 IaaS 云中建立和管理混合多虚拟机集群环境,并将现有 vSphere™. ESX™.ESXi™.KVM 和 XEN 虚拟环境作为 AWS 兼容 Eucalyptus桉树混合云管理.现在 Eu ...

  10. pc端常见布局---垂直居中布局 单元素不定高

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...