'''
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. A.DongDong破密码

    链接:https://ac.nowcoder.com/acm/contest/904/A 题意: DongDong是一个喜欢密码学的女孩子,她养的萨摩耶叼着一张带着加密信息的纸条交给了她,如果她不能破 ...

  2. 重置 linux系统后要配置的基本组件操作

    1.安装jdk https://www.cnblogs.com/shihaiming/p/5809553.html 2.安装mysql 3.安装tomcat

  3. h5复制粘贴板,打开APP功能

    <div class="container"> <img src="../themes/mall/img/i_red_ad4.jpg"> ...

  4. 通用的ashx调用

    直接上代码 还是有一定通用性的 <%@ WebHandler Language="C#" Class="MyService" %> using Sy ...

  5. css3背景与边框相关样式

    background-attachment          背景图像是否固定或者随着页面的其余部分滚动 background-color                    设置元素的背景颜色 b ...

  6. bootstrap中container和container-fluid的区别与用法

    对bootstrap框架有一定了解的朋友都知道,一般页面布局中的开头会使用到container或container-fluid类,那么它们有什么区别呢?不急!下面为您讲解. 我们先来看看官方对这两个类 ...

  7. [总结] min-25筛

    再不写总结我又会忘掉啊啊啊啊啊啊啊啊啊 这个\(min-25\)筛主要用来求一个积性函数的前缀和,就像这样\[\sum_{i=1}^n f(i)\] 不过这个积性函数要满足两个条件:质数\(p\)的函 ...

  8. 洛谷 P1903 【模板】分块/带修改莫队(数颜色)

    题目描述 墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成一排,你需要回答墨墨的提问.墨墨会像你发布如下指令: 1. Q L R代表询问你从第L支画笔到第R支画笔中共有几种不同颜色的画笔. 2 ...

  9. 爬去酷狗top500的数据

    import requests from bs4 import BeautifulSoup import time headers={ #'User-Agent':'Nokia6600/1.0 (3. ...

  10. python爬虫之路——初识基本页面构造原理

    通过chrome浏览器的使用简单介绍网页构成 360浏览器使用右键审查元素,Chrome浏览器使用右键检查,都可查看网页代码. 网页代码有两部分:HTML文件和CSS样式.其中有<script& ...