'''
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. [TCP/IP]TCP的三次握手和四次挥手

    概述 总结一下TCP中3次握手过程,以及其原生的缺陷 引起的SYN Flood的介绍 1.TCP连接建立--三次握手 几个概念: seq:序号,占4个字节,范围[0,4284967296],由于TCP ...

  2. 2017 ACM/ICPC Asia Regional Shenyang Online cable cable cable

    Problem Description Connecting the display screen and signal sources which produce different color s ...

  3. 简单记录下SpringCloud的微服务架构和一些概念

    一.微服务的注册与发现——Eureka 和许多分布式设计一样,分布式的应用一般都会有一个服务中心,用于记录各个机器的信息.微服务架构也一样,我们把一个大的应用解耦成这么多个那么多个服务,那么在想要调用 ...

  4. jQuery 数字滚动插件

    这几天闲来没事写的,有不对的地方还请多多指点 CSS: ; padding:0 2px;} .digital-beating i {;; background:url(../images/icon_0 ...

  5. 如何更改Linux yum源?

    centos下可以通过yum很方便快捷的安装所需的软件和库,如果yum的源不好,安装速度会非常慢,centos默认官方源似乎都是国外的,所以速度无法保证,我一直使用163的源,感觉速度不错.下面就说说 ...

  6. 网络文件系统(NFS)的使用

    一.简介 NFS--Network FileSystem,即网络文件系统,主要功能是让网络上的不同操作系统之间共享数据. 远程服务器端共享出文件或目录,然后远羰共享出来的文件或目录就可通过挂 载的方式 ...

  7. iOS - runtime 常用方法举例说明

    使用的自定义类,如下: #import <Foundation/Foundation.h> @interface Person : NSObject @property(nonatomic ...

  8. ios 11 12以后下拉刷新不回位的解决方法

    原因:  iOS11弃用了automaticallyAdjustsScrollViewInsets属性,新增contentInsetAdjustmentBehavior来替代它 //解决方案 添加如下 ...

  9. Cordova for iOS

    Cordova,对这个名字大家可能比较陌生,大家肯定听过 PhoneGap 这个名字,Cordova 就是 PhoneGap 被 Adobe 收购后所改的名字. Cordova 是一个可以让 JS 与 ...

  10. 微软Coco Blockchain Framework:一键解决企业级区块链三大难题

    近年来,异军突起的“区块链”受到全行业的广泛关注,众多企业级用户在积极拥抱新技术的过程中却面临三大难题:性能.隐私和组织管理.如果不能很好地解决这些“顽固分子”,区块链技术就相对局限,很难发挥出应有的 ...