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 ...
随机推荐
- java颜色代码对照表
LightPink 浅粉色 #FFB6C1 255,182,193 Pink 粉红 #FFC0CB 255,192,203 Crimson 猩红 #DC143C 220,20,60 LavenderB ...
- Android Bitmap(位图)详解
一.背景 在Android开发中,任何一个APP都离不开图片的加载和显示问题.这里的图片来源分为三种:项目图片资源文件(一般为res/drawable目录下的图片文件).手机本地图片文件.网络图片资源 ...
- 日历插件:Bootstrap的datetimepicker插件
注意:可以选择性引入 bootstrap.min.css和bootstrap.min.js,引入样式更好控制 option选项 0-hour 1-day 2-month 3-year 4-all ye ...
- ios 各种锁的使用性能比较
iOS开发中常用的锁有如下几种 来比较一下遇到加锁的情况: 1. @synchronized 关键字加锁 2. NSLock 对象锁 3. NSCondition 4. NSConditionLoc ...
- 键盘各键对应的ASCII码值(包括鼠标和键盘所有的键)
ESC键 VK_ESCAPE (27)回车键: VK_RETURN (13)TAB键: VK_TAB (9)Caps Lock键: VK_CAPITAL (20)Shift键: VK_SHIFT ($ ...
- get_user
Name get_user -- Get a simple variable from user space. Synopsis get_user ( x, ptr); Arguments x ...
- 判断JS数据类型的几种方法
原文转自http://www.cnblogs.com/onepixel/p/5126046.html! 说到数据类型,我们先说一下JavaScript 中常见的几种数据类型: 基本类型:string, ...
- equals()方法详解
Java语言中equals()方法的使用可以说比较的频繁,但是如果轻视equals()方法,一些意想不到的错误就会产生.哈哈,说的有点严重了~ 先谈谈equals()方法的出身.equals()方法在 ...
- Java中protected方法访问权限的问题
先看Test.java 此时出现上文提到的错误:The method clone from the type Object is not visiuable. 我们已经清楚Object.clone() ...
- allure使用简介
#安装依赖包pip install requests_toolbeltpip install pyyamlpip install pytest-allure-adaptor #安装allure2 说明 ...