biological clock--class
'''
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的更多相关文章
- biological clock
'''this application aimed to cauculate people's biological block about emotional(28), energy(23),int ...
- L325 如何睡觉
Getting enough shut-eye is one of life’s biggest challenges. It’s recommended that the average perso ...
- 纪录片- 睡眠追踪(Chasing sleep) (共6集)
传送门:https://www.bilibili.com/bangumi/play/ep120260/ 小贴士传送门:https://www.bilibili.com/video/av11887055 ...
- 修改Linux系统日期与时间date clock
先设置日期 date -s 20080103 再设置时间 date -s 18:24:30 为了永久生效,需要将修改的时间写入CMOS. 查看CMOS的时间: #clock -r 将当前系统时间写到C ...
- 操作系统页面置换算法(opt,lru,fifo,clock)实现
选择调出页面的算法就称为页面置换算法.好的页面置换算法应有较低的页面更换频率,也就是说,应将以后不会再访问或者以后较长时间内不会再访问的页面先调出. 常见的置换算法有以下四种(以下来自操作系统课本). ...
- Cesium应用篇:3控件(1)Clock
创建 跟Clock相关的主要有Animation控件和Timeline控件,通常两者会放在一起使用. 在Cesium中,Viewer默认开启这两个控件,如果你想要不显示控件,可以在Viewer初始化中 ...
- 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 ...
- Clock rate
https://en.wikipedia.org/wiki/Clock_rate The clock rate typically refers to the frequency at which a ...
- clock()、time()、clock_gettime()和gettimeofday()函数的用法和区别【转】
转自:http://www.cnblogs.com/krythur/archive/2013/02/25/2932647.html 转自http://blog.sina.com.cn/s/blog_7 ...
- 最少clock
var elClock = document.getElementById("clock");var getTime = function(){ var _ = ['00','01 ...
随机推荐
- hdu6070Dirt Ratio 多校题 套路二分
比赛中我看了一眼题目就觉得是二分的套路,跟miaom说,结果发现miaom开始碎觉 miaom醒来以后表示这是道凸包合并(%%%) 我&wzf2000:那您快写啊 miaom:我不会写啊 莫名 ...
- jQuery基础(2)
jQuery的属性操作,使用jQuery操作input的value值,jQuery的文档操作 零.昨日内容回顾 jQuery 宗旨:write less do more 就是js的库,它是javasc ...
- mysql8.0数据库忘记密码时进行修改方法
最近安装mysql8.0数据库,用以前的修改mysql方法,没有成功,所以参考网上前辈的做法,自己重新整理了下忘记密码时进行修改方法 1.安装mysql8.0后发现,在安装目中,是没有my.ini 和 ...
- TDH-search汇报理解
题目:海量数据查询开头:1.自我介绍:2.题目切入: 什么是海量数据查询?(海量数据,快速,符合要求) 几个常用场景(搜索引擎,百度:话单查询:影像平台,高铁)3.展示目录:架构,案例,平台规划 4. ...
- [luogu 1967]货车运输
货车运输 题目描述 A 国有 n 座城市,编号从 1 到 n,城市之间有 m 条双向道路.每一条道路对车辆都有重量限制,简称限重.现在有 q 辆货车在运输货物, 司机们想知道每辆车在不超过车辆限重的情 ...
- PHP正则表达式 - 元字符
下表包含了元字符的完整列表以及它们在正则表达式上下文中的行为: 字符 描述 \ 将下一个字符标记为一个特殊字符.或一个原义字符.或一个 向后引用.或一个八进制转义符.例如,'n' 匹配字符 " ...
- MS-SQL 时间的操作
1. 当前系统日期.时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值 例如:向日期加上2天 select dateadd ...
- Unity3d发布apk文件并在Android虚拟机中运行的操作流程
总的流程分为以下6个步骤: 1.安装java_jdk 2.配置java环境变量 3.更新android的sdk 4.从Unity3d中发布出apk文件 5.创建android虚拟机并运行 6.将apk ...
- c# 字符串的首字母大写转换 方法
方法1: s.Substring(0,1).ToUpper()+s.Substring(1); 方法2: s = System.Threading.Thread.CurrentThread.Curr ...
- 使用js获取复选框的值,并把数组传回后台处理,过程使用的是Ajax异步查询
这是界面代码: function shua(){ var id_array=new Array(); $('input[id="checkAll& ...