SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Pytables等应用	
  

Hdf5,numpy,matplotlib	
  
需求	
  
•    可实时序列化的字典,无类型信息丢失	
  
•    要有>	
  2GB的存储体积	
  
•    要有矩阵(numpy)方式的存储接口	
  
•    要有GUI工具方便增、删、查、改	
  
•    快、免费、开源	
  
其他数据库	
  
• bsddb	
  Berkeley	
  DB	
  类型信息丢失	
  
• Sqllite	
  sql接口不方便,类型信息与效率冲突	
  
• Nosql	
  多余的服务器,实时序列不方便	
  
Pytables 	
  
  •  流畅性能的坚实基础 上层numpy下层hdf5	
  
  •  简单、快捷的存取接口	
  
total=sum(row['energy']	
  for	
  row	
  in	
  mytable.where('(pressure>10)&(count<1e7)')])	
  
  •  强劲运算	
  
  •  I/O速度超强优化	
  
  •  重复/回退	
  
  •  超大数据容量	
  
  •  数据分层,	
  
  	
  	
  	
  	
  数据项多维数组	
  
pytables结构	
  




class	
  ParScle(IsDescripSon):	
  
	
  	
  	
  	
  idenSty	
  =	
  StringCol(itemsize=22,	
  dflt="	
  ",	
  pos=0)	
  	
  #	
  character	
  String	
  
	
  	
  	
  	
  。。。	
  
fileh	
  =	
  openFile("objec]ree.h5",	
  mode	
  =	
  "w")	
  
group1	
  =	
  fileh.createGroup(fileh.root,	
  "group1")	
  
array1	
  =	
  fileh.createArray(fileh.root,	
  "array1",	
  ["string",	
  "array"],	
  "String	
  array")	
  
table1	
  =	
  fileh.createTable(group1,	
  "table1",	
  ParScle)	
  
class	
  
•    File:内存表征文件	
  
•    Group:逻辑分组	
  
•    Table: 结构化数据hdf5表征	
  
•    Array	
  :	
  数组化hdf5,	
  CArrayEArray	
  
•    Link	
  
•    A]ributeSet:h5f.root._v_a]rs.obj	
  =	
  myObject	
  	
  
•    Expr:tb.Expr("2*a+b*c ).eval()	
  #	
  array([14,	
  24,	
  
     36])	
  
HDF5	
  
•  NCSA研制,美国国家高级计算应用中心,风云
                卫星使用	
  
•  6种数据类型,栅格图像、调色板、多维数据、注
                释、数据表、数据组	
  
•  类似一个文件系统,	
  
	
  	
  	
  	
  分层结构	
  
工具	
  
•  GUI工具:java编写	
  
•  ptdump:	
  观察结构、数据	
  
•  ptrepack:不同文件间拷贝、合并、删除等	
  
numpy	
  
创建:np.arange(0,	
  60,	
  10).reshape(-­‐1,	
  1)	
  +	
  np.arange(0,	
  6)	
  
Numpy结构化数组	
  
import	
  numpy	
  as	
  np	
  
	
  
persontype	
  =	
  np.dtype({	
  
           	
  'names':['name',	
  'age',	
  'weight'],	
  
           	
  'formats':['S32','i',	
  'f']})	
  
a	
  =	
  np.array([	
  
           	
  ("Zhang",32,75.5),("Wang",24,65.2)],	
  
           	
  dtype=persontype)	
  
Matplotlib图库	
  
Matplotlib例	
  
import	
  matplotlib.pyplot	
  as	
  plt	
  
	
  
f,	
  ax	
  =	
  plt.subplots()	
  
ax.plot(x[],	
  y[], r-­‐ ,	
  label= xxx )	
  
ax.grid()	
  
ax.set_Slte( example )	
  
ax.legend()	
  
plt.show()	
  
谢谢	
  

Weitere ähnliche Inhalte

Was ist angesagt?

Shell奇技淫巧
Shell奇技淫巧Shell奇技淫巧
Shell奇技淫巧David Xie
 
The ruby way iii
The ruby way iiiThe ruby way iii
The ruby way iiiDeng Peng
 
realtime-twitter-search
realtime-twitter-searchrealtime-twitter-search
realtime-twitter-search亚军 汪
 
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2Yang FaFa
 
大话redis设计实现
大话redis设计实现大话redis设计实现
大话redis设计实现rfyiamcool
 
scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎Ping Yin
 
NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析iammutex
 
Javascript 培训第四节 深入了解
Javascript 培训第四节 深入了解Javascript 培训第四节 深入了解
Javascript 培训第四节 深入了解liziqi7
 
Distributed Data Analytics at Taobao
Distributed Data Analytics at TaobaoDistributed Data Analytics at Taobao
Distributed Data Analytics at TaobaoMin Zhou
 
MapReduce 簡單介紹與練習
MapReduce 簡單介紹與練習MapReduce 簡單介紹與練習
MapReduce 簡單介紹與練習孜羲 顏
 
Spark 巨量資料處理基礎教學
Spark 巨量資料處理基礎教學Spark 巨量資料處理基礎教學
Spark 巨量資料處理基礎教學NUTC, imac
 

Was ist angesagt? (14)

Glider
GliderGlider
Glider
 
Shell奇技淫巧
Shell奇技淫巧Shell奇技淫巧
Shell奇技淫巧
 
The ruby way iii
The ruby way iiiThe ruby way iii
The ruby way iii
 
realtime-twitter-search
realtime-twitter-searchrealtime-twitter-search
realtime-twitter-search
 
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
 
大话redis设计实现
大话redis设计实现大话redis设计实现
大话redis设计实现
 
Redis use cases
Redis use casesRedis use cases
Redis use cases
 
scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎
 
Linq 入门
Linq 入门Linq 入门
Linq 入门
 
NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析
 
Javascript 培训第四节 深入了解
Javascript 培训第四节 深入了解Javascript 培训第四节 深入了解
Javascript 培训第四节 深入了解
 
Distributed Data Analytics at Taobao
Distributed Data Analytics at TaobaoDistributed Data Analytics at Taobao
Distributed Data Analytics at Taobao
 
MapReduce 簡單介紹與練習
MapReduce 簡單介紹與練習MapReduce 簡單介紹與練習
MapReduce 簡單介紹與練習
 
Spark 巨量資料處理基礎教學
Spark 巨量資料處理基礎教學Spark 巨量資料處理基礎教學
Spark 巨量資料處理基礎教學
 

Andere mochten auch

真蝦意外接到的Case
真蝦意外接到的Case真蝦意外接到的Case
真蝦意外接到的CaseTom Chen
 
Live Performance Effects
Live Performance EffectsLive Performance Effects
Live Performance EffectsTom Chen
 
Command line 初級寶典
Command line 初級寶典Command line 初級寶典
Command line 初級寶典Tom Chen
 
Two scoops of Django - Deployment
Two scoops of Django - DeploymentTwo scoops of Django - Deployment
Two scoops of Django - Deploymentflywindy
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro outputTom Chen
 
Two scoops of django Introduction
Two scoops of django IntroductionTwo scoops of django Introduction
Two scoops of django Introductionflywindy
 
AngularJS Sharing
AngularJS SharingAngularJS Sharing
AngularJS SharingTom Chen
 
Working with the django admin
Working with the django admin Working with the django admin
Working with the django admin flywindy
 
愛樂工程師
愛樂工程師愛樂工程師
愛樂工程師Tom Chen
 
Django 實戰 - 自己的購物網站自己做
Django 實戰 - 自己的購物網站自己做Django 實戰 - 自己的購物網站自己做
Django 實戰 - 自己的購物網站自己做flywindy
 
Integrating tornado and webpack
Integrating tornado and webpackIntegrating tornado and webpack
Integrating tornado and webpackTom Chen
 
Learning django step 1
Learning django step 1Learning django step 1
Learning django step 1永昇 陳
 
那些年,我用 Django Admin 接的案子
那些年,我用 Django Admin 接的案子那些年,我用 Django Admin 接的案子
那些年,我用 Django Admin 接的案子flywindy
 
Django workshop homework 3
Django workshop homework 3Django workshop homework 3
Django workshop homework 3flywindy
 
解密解密
解密解密解密解密
解密解密Tom Chen
 
Django sharing
Django sharingDjango sharing
Django sharingTom Chen
 
Django best practices for logging and signals
Django best practices for logging and signals Django best practices for logging and signals
Django best practices for logging and signals flywindy
 

Andere mochten auch (20)

Xmas
XmasXmas
Xmas
 
真蝦意外接到的Case
真蝦意外接到的Case真蝦意外接到的Case
真蝦意外接到的Case
 
Live Performance Effects
Live Performance EffectsLive Performance Effects
Live Performance Effects
 
Command line 初級寶典
Command line 初級寶典Command line 初級寶典
Command line 初級寶典
 
Two scoops of Django - Deployment
Two scoops of Django - DeploymentTwo scoops of Django - Deployment
Two scoops of Django - Deployment
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro output
 
Two scoops of django Introduction
Two scoops of django IntroductionTwo scoops of django Introduction
Two scoops of django Introduction
 
AngularJS Sharing
AngularJS SharingAngularJS Sharing
AngularJS Sharing
 
Django step0
Django step0Django step0
Django step0
 
Gitlab
GitlabGitlab
Gitlab
 
Working with the django admin
Working with the django admin Working with the django admin
Working with the django admin
 
愛樂工程師
愛樂工程師愛樂工程師
愛樂工程師
 
Django 實戰 - 自己的購物網站自己做
Django 實戰 - 自己的購物網站自己做Django 實戰 - 自己的購物網站自己做
Django 實戰 - 自己的購物網站自己做
 
Integrating tornado and webpack
Integrating tornado and webpackIntegrating tornado and webpack
Integrating tornado and webpack
 
Learning django step 1
Learning django step 1Learning django step 1
Learning django step 1
 
那些年,我用 Django Admin 接的案子
那些年,我用 Django Admin 接的案子那些年,我用 Django Admin 接的案子
那些年,我用 Django Admin 接的案子
 
Django workshop homework 3
Django workshop homework 3Django workshop homework 3
Django workshop homework 3
 
解密解密
解密解密解密解密
解密解密
 
Django sharing
Django sharingDjango sharing
Django sharing
 
Django best practices for logging and signals
Django best practices for logging and signals Django best practices for logging and signals
Django best practices for logging and signals
 

Ähnlich wie Pytables

Log collection
Log collectionLog collection
Log collectionFEG
 
MongoDB for C# developer
MongoDB for C# developerMongoDB for C# developer
MongoDB for C# developerdianming.song
 
Java 開發者的函數式程式設計
Java 開發者的函數式程式設計Java 開發者的函數式程式設計
Java 開發者的函數式程式設計Justin Lin
 
Python面向对象开发基础篇
Python面向对象开发基础篇Python面向对象开发基础篇
Python面向对象开发基础篇modou li
 
[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀
[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀
[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀Shengyou Fan
 
python 實戰資料科學工作坊
python 實戰資料科學工作坊python 實戰資料科學工作坊
python 實戰資料科學工作坊David Chiu
 
Coreseek/Sphinx 全文检索实践指南
Coreseek/Sphinx 全文检索实践指南Coreseek/Sphinx 全文检索实践指南
Coreseek/Sphinx 全文检索实践指南HonestQiao
 
Python 脚本入门基础
Python 脚本入门基础Python 脚本入门基础
Python 脚本入门基础wklken
 
My scala learning note for TWJUG
My scala learning note for TWJUGMy scala learning note for TWJUG
My scala learning note for TWJUGIan Tsai
 
使用 Eloquent ORM
使用 Eloquent ORM使用 Eloquent ORM
使用 Eloquent ORMShengyou Fan
 
線上埋碼資料收集實作
線上埋碼資料收集實作線上埋碼資料收集實作
線上埋碼資料收集實作FEG
 
R統計軟體 -安裝與使用
R統計軟體 -安裝與使用R統計軟體 -安裝與使用
R統計軟體 -安裝與使用Person Lin
 
百度系统部分布式系统介绍 马如悦 Sacc2010
百度系统部分布式系统介绍 马如悦 Sacc2010百度系统部分布式系统介绍 马如悦 Sacc2010
百度系统部分布式系统介绍 马如悦 Sacc2010Chuanying Du
 
Java8 lambda
Java8 lambdaJava8 lambda
Java8 lambdakoji lin
 
NoSQL-MongoDB介紹
NoSQL-MongoDB介紹NoSQL-MongoDB介紹
NoSQL-MongoDB介紹國昭 張
 
Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫
Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫
Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫Justin Lin
 

Ähnlich wie Pytables (20)

Log collection
Log collectionLog collection
Log collection
 
Python 温故
Python 温故Python 温故
Python 温故
 
MongoDB for C# developer
MongoDB for C# developerMongoDB for C# developer
MongoDB for C# developer
 
Java 開發者的函數式程式設計
Java 開發者的函數式程式設計Java 開發者的函數式程式設計
Java 開發者的函數式程式設計
 
Python面向对象开发基础篇
Python面向对象开发基础篇Python面向对象开发基础篇
Python面向对象开发基础篇
 
Study research in April
Study research in AprilStudy research in April
Study research in April
 
[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀
[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀
[Effective Kotlin 讀書會] 第八章 Efficient collection processing 導讀
 
python 實戰資料科學工作坊
python 實戰資料科學工作坊python 實戰資料科學工作坊
python 實戰資料科學工作坊
 
Coreseek/Sphinx 全文检索实践指南
Coreseek/Sphinx 全文检索实践指南Coreseek/Sphinx 全文检索实践指南
Coreseek/Sphinx 全文检索实践指南
 
Python 脚本入门基础
Python 脚本入门基础Python 脚本入门基础
Python 脚本入门基础
 
Spark tutorial
Spark tutorialSpark tutorial
Spark tutorial
 
Scala+spark 2nd
Scala+spark 2ndScala+spark 2nd
Scala+spark 2nd
 
My scala learning note for TWJUG
My scala learning note for TWJUGMy scala learning note for TWJUG
My scala learning note for TWJUG
 
使用 Eloquent ORM
使用 Eloquent ORM使用 Eloquent ORM
使用 Eloquent ORM
 
線上埋碼資料收集實作
線上埋碼資料收集實作線上埋碼資料收集實作
線上埋碼資料收集實作
 
R統計軟體 -安裝與使用
R統計軟體 -安裝與使用R統計軟體 -安裝與使用
R統計軟體 -安裝與使用
 
百度系统部分布式系统介绍 马如悦 Sacc2010
百度系统部分布式系统介绍 马如悦 Sacc2010百度系统部分布式系统介绍 马如悦 Sacc2010
百度系统部分布式系统介绍 马如悦 Sacc2010
 
Java8 lambda
Java8 lambdaJava8 lambda
Java8 lambda
 
NoSQL-MongoDB介紹
NoSQL-MongoDB介紹NoSQL-MongoDB介紹
NoSQL-MongoDB介紹
 
Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫
Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫
Java SE 8 的 Lambda 連鎖效應 - 語法、風格與程式庫
 

Mehr von gowell

Lua 语言介绍
Lua 语言介绍Lua 语言介绍
Lua 语言介绍gowell
 
Kernel init
Kernel initKernel init
Kernel initgowell
 
Logging develop
Logging developLogging develop
Logging developgowell
 
Logging introduce
Logging introduceLogging introduce
Logging introducegowell
 
Script meta
Script metaScript meta
Script metagowell
 
Script binding
Script bindingScript binding
Script bindinggowell
 
使用Lua提高开发效率
使用Lua提高开发效率使用Lua提高开发效率
使用Lua提高开发效率gowell
 
Casing3d opengl
Casing3d openglCasing3d opengl
Casing3d openglgowell
 
从动态说开去
从动态说开去从动态说开去
从动态说开去gowell
 

Mehr von gowell (9)

Lua 语言介绍
Lua 语言介绍Lua 语言介绍
Lua 语言介绍
 
Kernel init
Kernel initKernel init
Kernel init
 
Logging develop
Logging developLogging develop
Logging develop
 
Logging introduce
Logging introduceLogging introduce
Logging introduce
 
Script meta
Script metaScript meta
Script meta
 
Script binding
Script bindingScript binding
Script binding
 
使用Lua提高开发效率
使用Lua提高开发效率使用Lua提高开发效率
使用Lua提高开发效率
 
Casing3d opengl
Casing3d openglCasing3d opengl
Casing3d opengl
 
从动态说开去
从动态说开去从动态说开去
从动态说开去
 

Pytables

  • 2. 需求   •  可实时序列化的字典,无类型信息丢失   •  要有>  2GB的存储体积   •  要有矩阵(numpy)方式的存储接口   •  要有GUI工具方便增、删、查、改   •  快、免费、开源  
  • 3. 其他数据库   • bsddb  Berkeley  DB  类型信息丢失   • Sqllite  sql接口不方便,类型信息与效率冲突   • Nosql  多余的服务器,实时序列不方便  
  • 4. Pytables   •  流畅性能的坚实基础 上层numpy下层hdf5   •  简单、快捷的存取接口   total=sum(row['energy']  for  row  in  mytable.where('(pressure>10)&(count<1e7)')])   •  强劲运算   •  I/O速度超强优化   •  重复/回退   •  超大数据容量   •  数据分层,          数据项多维数组  
  • 5. pytables结构   class  ParScle(IsDescripSon):          idenSty  =  StringCol(itemsize=22,  dflt="  ",  pos=0)    #  character  String          。。。   fileh  =  openFile("objec]ree.h5",  mode  =  "w")   group1  =  fileh.createGroup(fileh.root,  "group1")   array1  =  fileh.createArray(fileh.root,  "array1",  ["string",  "array"],  "String  array")   table1  =  fileh.createTable(group1,  "table1",  ParScle)  
  • 6. class   •  File:内存表征文件   •  Group:逻辑分组   •  Table: 结构化数据hdf5表征   •  Array  :  数组化hdf5,  CArrayEArray   •  Link   •  A]ributeSet:h5f.root._v_a]rs.obj  =  myObject     •  Expr:tb.Expr("2*a+b*c ).eval()  #  array([14,  24,   36])  
  • 7. HDF5   •  NCSA研制,美国国家高级计算应用中心,风云 卫星使用   •  6种数据类型,栅格图像、调色板、多维数据、注 释、数据表、数据组   •  类似一个文件系统,          分层结构  
  • 8. 工具   •  GUI工具:java编写   •  ptdump:  观察结构、数据   •  ptrepack:不同文件间拷贝、合并、删除等  
  • 9. numpy   创建:np.arange(0,  60,  10).reshape(-­‐1,  1)  +  np.arange(0,  6)  
  • 10. Numpy结构化数组   import  numpy  as  np     persontype  =  np.dtype({    'names':['name',  'age',  'weight'],    'formats':['S32','i',  'f']})   a  =  np.array([    ("Zhang",32,75.5),("Wang",24,65.2)],    dtype=persontype)  
  • 12. Matplotlib例   import  matplotlib.pyplot  as  plt     f,  ax  =  plt.subplots()   ax.plot(x[],  y[], r-­‐ ,  label= xxx )   ax.grid()   ax.set_Slte( example )   ax.legend()   plt.show()