'''
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. Rebus消息总线

    这里主要讲一下我基于Rebus写的一个ABP框架的模块   目录结构 对于Rebus网上的资料很少,其实我对于服务总线也不是很理解 ..个人理解的就是像ABP中的EventBus那样的,但是集成了一些 ...

  2. Cookie认证

    Cookie认证 由于HTTP协议是无状态的,但对于认证来说,必然要通过一种机制来保存用户状态,而最常用,也最简单的就是Cookie了,它由浏览器自动保存并在发送请求时自动附加到请求头中.尽管在现代W ...

  3. java课后思考问题(八)

    1.请阅读并运行AboutException.java示例,然后通过后面的几页PPT了解Java中实现异常处理的基础知识. (1)import javax.swing.*; class AboutEx ...

  4. jsfiddle.net上的记录

    1.JQuery: http://jsfiddle.net/uryc1908/ 2.e-chart: http://jsfiddle.net/8fq96a7s/ 3.easyUI http://jsf ...

  5. 教你如何在 IDEA 远程 Debug ElasticSearch

    前提 之前在源码阅读环境搭建文章中写过我遇到的一个问题迟迟没有解决,也一直困扰着我.问题如下,在启动的时候解决掉其他异常和报错后,最后剩下这个错误一直解决不了: [2018-08-01T09:44:2 ...

  6. SpringMVC简介01

    SpringMVC也叫Spring Web mvc,属于表现层的框架.SpringMVC是Spring框架的一部分,是在Spring3.0后发布的. Spring结构图: SpringMVC架构: S ...

  7. MySQL 查看表大小

    当遇到数据库占用空间很大的情况下,可以用以下语句查找大数据量的表 SELECT TABLE_NAME ,),) 'DATA_SIZE(M)' ,),) 'INDEX_SIZE(M)' ,AVG_ROW ...

  8. C语言中的static和extern

    c语言中,全局变量是一个非常重要的概念.全局变量定义在函数外,可以被所有的函数共同使用. #include <iostream> ; void display() { printf(&qu ...

  9. T-SQL查询高级—SQL Server索引中的碎片和填充因子

        写在前面:本篇文章需要你对索引和SQL中数据的存储方式有一定了解.标题中高级两个字仅仅是因为本篇文章需要我的T-SQL进阶系列文章的一些内容作为基础. 简介 在SQL Server中,存储数据 ...

  10. javaSe-反射2

    //创建实体类 package com.java.chap07.sec03; public class Student { private String name; private Integer a ...