1 / 28

IDL 语言在天文学中的应用 王凤飞 中科院国家天文台

Chinese Virtual Observatory. IDL 语言在天文学中的应用 王凤飞 中科院国家天文台. IDL 语言的特点,优势,局限性 IDL 语言与其他开发语言的比较 IDL 在天文学中的应用 IDL 的图像处理举例. IDL 语言的特点. IDL ( Interactive Data Language )是进行 数据分析 、 可视化表达 与 跨平台 应用开发的理想工具。可用于 数值计算、三维图形建模、科学数据读取等。 IDL 用户涵盖 NASA 、 ESA 、 NOAA 、 Siemens 、 GEMedical 等

abram
Download Presentation

IDL 语言在天文学中的应用 王凤飞 中科院国家天文台

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chinese Virtual Observatory IDL语言在天文学中的应用 王凤飞 中科院国家天文台

  2. IDL语言的特点,优势,局限性 • IDL语言与其他开发语言的比较 • IDL在天文学中的应用 • IDL的图像处理举例 China-VO, Guangzhou

  3. IDL语言的特点 • IDL(Interactive Data Language)是进行数据分析、可视化表达与跨平台应用开发的理想工具。可用于数值计算、三维图形建模、科学数据读取等。 • IDL用户涵盖NASA、ESA、NOAA、Siemens、GEMedical等 • 科学家利用IDL对“勇气号”和“机遇号”的数据进行数据分析和图像处理。 • SDSS一维、二维光谱处理软件也是IDL编写的。 China-VO, Guangzhou

  4. IDL语言的特点 • 1、IDL=VC 菜单的定制、消息的传递、类的定义与继承 • 2、IDL=VB 可视化界面的设计、语言的通俗易懂、编程的入门  • 3、IDL=JAVA从跨平台的移植来说 • 4、IDL=FORTRAN   从函数、子程序的调用、数据传递、语言风格、语言组织等来说 • 5、IDL=MATLAB   提供了大量封装和参数化了的数学函数 • 6、IDL=OPENGL IDL的提供了丰富的二维、三维图形图像类    此外,应用IDL可以快速的开发出功能强大的三维图形图像处理软件和三维GIS应用系统。 China-VO, Guangzhou

  5. IDL语言的特点 • 擅长于处理矢量或数组数据 有大量的IDL命令用于创建不同数据类型的矢量和数组。特别是,有许多创建各类数据类型的数组的函数,该数组的每个元素的初始值为零,而且还有许多创建各类数据类型的数组的函数,该数组的每个元素的初始值为其在数组中的索引位置。 • 动态改变变量的属性 IDL最强大的功能之一是大多数过程或函数都能在任何数据类型或组织结构上生效。这是因为IDL在运行时能改变变量的数据类型和组织结构(像世界上其他强大的事物一样,这种动态改变变量的属性的能力也有潜在的巨大危险!必须小心,确信知道正在使用哪种数据)。 China-VO, Guangzhou

  6. 天文中为什么使用IDL? • 节省时间,把更多的时间用在科学研究上 --采用IDL我们在三年项目进展中减少了超过一年的工作量。 —— Paul Scowen NASA哈勃望远镜修正小组成员 • 分享你的工作成果 --和使用IDL的你的同行分享代码. • 功能强大的天文库 --IDL Astronomy Users Library China-VO, Guangzhou

  7. IDL语言的局限性 • 它是一个商业软件。 (IRAF,CIAO,AIPS++ is free!) • IDL更像一个解释器,而不是一个编译器。 大型的idl程序在运行时比编译好的C、FORTRAN程序慢一些。 • 一次性处理数据500M以下效果好。 批处理大量数据时C、FORTRAN可能效果更好。 • 有些仪器的数据处理包无法使用: (e.g. CCD mosaic imagery, multi-object spectrographs, echelle spectra, etc.). China-VO, Guangzhou

  8. IDL与其他语言的比较 • FORTRAN,C,or C++ 不能满足交互式的数据分析要求(没有标准的交互环境) • IRAF, STSDAS, CIAO, and AIPS 是交互性的,但需要预编译;不方便改进和定制; 难以维护 • SUPERMONGO,PGPLOT画图 IDL集成了编程计算、数据操作和显示。 China-VO, Guangzhou

  9. IDL与其他语言的比较 • Mathematica, Matlab, Maple 强大的数学计算能力+可视化; 支持数学符号运算和方程求解; • IDL交互式地查看结果,有更强大的图像处理能力,更灵活的文件I/O(天文:Fits) China-VO, Guangzhou

  10. Matlab vs. IDL • IDL程序有四种形式: 批处理文件、子程序、函数、主程序。 IDL的函数可以有多个输入,但只能有一个输出。输入参数的值在函数中可以改变。子程序不返回值。 • Matlab程序可以是M-scripe file或者是一个函数。 Matlab函数可以有多个输入和输出。 China-VO, Guangzhou

  11. IDL在天文学中的应用 • 早期由Goddard Space Flight Center编写的IDL包,用于哈勃望远镜的GHRS和STIS项目的二维光谱的分析 China-VO, Guangzhou

  12. 获取IDL天文包和学习IDL • IDL Astronomy User's Library • http://idlastro.gsfc.nasa.gov/homepage.html • http://idlastro.gsfc.nasa.gov/ftp/astron.tar.gz • FITShttp://idlastro.gsfc.nasa.gov/fitsio.html • Solar Software • http://lmsal.com/solarsoft/sswdoc/index_menu.html • ftp://sohoftp.nascom.nasa.gov/solarsoft/offline/swmaint/tar/ • ssw_ssw_gen.tar.Z • Coyote’s Guide to IDL Programming • http://www.dfanning.com • ftp://ftp.dfanning.com/pub/dfanning/outgoing/coyote2nd/ • IDL Newsgroup (comp.lang.idl-pvwave) • http://groups.google.com/group/comp.lang.idl-pvwave • Markwardt IDL Library (Fitting) • http://cow.physics.wisc.edu/~craigm/idl/idl.html • JHUAPL IDL Library • http://fermi.jhuapl.edu/s1r/idl/s1rlib/local_idl.html • IDL + EMACShttp://www.idlwave.org/ • http://idlwave.org/download/idlwave-help.tar.bz2 China-VO, Guangzhou

  13. best way to read FITS data Hundreds of useful, and well-tested routines for math, statistics, and astronomical utilities Should already be on your path The Astronomy Links page is the source of IDL software used for astronomy NASA Astronomy Library(http://idlastro.gsfc.nasa.gov/homepage.html) China-VO, Guangzhou

  14. Contents of the IDL Astronomy Users Library Astronomical Utilities DAOPHOT-Type Photometry Procedures Database Procedures Disk I/O (MIDAS, IRAF files) FITS Astrometry and Calibration STSDAS Image manipulation FITS ASCII & Binary Table I/O FITS Binary Table Extensions I/O FITS I/O Image Manipulation Math and Statistics Plotting Procedures Robust Statistics Procedures IDL Structure procedures STSDAS (Binary) Table I/O Web Socket Procedures TV Display Procedures Miscellaneous (Non-Astronomy) Procedures China-VO, Guangzhou

  15. Astronomy utilities • The subdirectory astro includes about 80 mostly self-contained astronomy utilities. A_b Compute B band interstellar extinction according to the RC2. ADSTRING Return RA and Dec as character string(s) in sexigesimal format. AIRTOVAC Convert air wavelengths to vacuum wavelengths AITOFF Convert longitude, latitude to X,Y using an AITOFF projection. AITOFF_GRID Produce an overlay of latitude and longitude lines over a plot or image ARCBAR Draw an arc bar on an image showing the astronomical plate scale ARROWS To display "weathervane" directional arrows on an astronomical image ASTDISP Print astronomical and pixel coordinates in a standard format ASTRO Interactive utility for precession and coordinate conversion. China-VO, Guangzhou

  16. FITS I/O in the IDL Astronomy Library • MRDFITS()/MWRFITS :read any type of FITS ; Mapping an entire FITS table can incur extra CPU and virtual memory overhead (SDSS) • READFITS()/WRITEFITS :read Unix and bzip2 compressed files; cannot be used to read variable length binary tables • FX* Procedures :most complete and well-tested ;do not handle ASCII tables; use more loops,so slower. • FITS_* and FTAB_* Procedures :most efficient ;only to recognize the STScI Inheritance and Implicit Image Conventions; FITS files cannot be read from a Unix pipe or an internet socket. China-VO, Guangzhou

  17. Disk IO (IRAF, MIDAS, and WFPC2 data) • IDL procedures to read popular disk formats in astronomy: 1. IRAF image (.imh) files (read and write) 2. MIDAS (.BDF and .TBL)image and table files (read and update) 3. WFPC2 images (FITS or STSDAS) 几个子程序: MID_RD_IMAGE ... image (.BDF) read, MID_UP_IMAGE ... image (.BDF) update, MID_RD_TABLE ... table (.TBL) read, MID_UP_TABLE ... table (.TBL) update. China-VO, Guangzhou

  18. Plotting Procedures • The procedures in this directory are useful additions to the intrinsic IDL plotting capabilities. CLEANPLOT Reset all plotting system variables to their default (X) values LEGEND Create an annotation legend for a plot LEGENDTEST Demo program demonstrating the capabilities of LEGEND LINEID_PLOT Annotate the identified lines in a spectrum MULTIPLOT Create multiple plots with shared axes OPLOTERROR Overplot Y vs. X with optional X and Y error bars PLOTERROR Plot Y vs. X with optional X and Y error bars PLOTHIST Plot the histogram of an array PLOTSYM Define useful plotting symbols not in the standard PSYM definition PARTVELVEC Plot the velocity vectors of a set of particles RDPLOT Like intrinsic CURSOR procedure but with a full-screen cursor SUNSYMBOL() Return the character string to plot a subscripted Sun symbol VSYM Create "Mongo"-like rotationally symmetric polygon plotting symbols China-VO, Guangzhou

  19. Math and Statistics • This directory contains IDL mathematics and statistics procedures thought to be of interest in astronomy. Fifteen of the procedures, are adapted from algorithms in "Numerical Recipes 2nd Edition" • PCA Perform a principal component analysis (Karhunen-Loeve expansion) • GAUSSIAN() Evaluate a 1-d Gaussian and optionally its derivative China-VO, Guangzhou

  20. IDL的图像处理举例 • 创建曲面图 • 在IDL程序中,任何二维的数组都可以用Surface命令生成一个曲面图 • 创建阴影曲面图同样很简单: • IDL>Shade_Surf, peak China-VO, Guangzhou

  21. 消除图像噪声-Median • Median命令计算相邻像素的中间值,而不是平均值。这就有两个重要作用。第一,它能删除图像中的极端值。第二,它不使那些尺寸比邻域范围大的图像边缘或特征变模糊。 • IDL>TV, Median(noisy, 3), 340, 0 China-VO, Guangzhou

  22. 直方图均衡化- Histogram Equalization • 正常图像具有狭窄的像素值分布。这里的像素值集中在50-10之间 • 一幅直方图均衡化后的图像。象素分布扩展到了整个颜色范围 China-VO, Guangzhou

  23. 平滑图像 Smooth、 Convol • 通过将每个像素值与它周围相邻像素值进行平均来平滑图像。 • 用称为卷积的过程来平滑图像。这种技术中,一个方形滤波核和图像一起参与卷积计算。例如,可以创建如下的一个核心: • 1 2 1 • 2 8 2 • 1 2 1 • 图像平滑被应用在一种称作晕光蒙片的图像处理技术中。 • 通过Convol命令用上述滤波核对图像进行卷积处理,键入: • IDL>kernel=[[1,2,1], [2,8,2], [1,2,1]] • IDL>TV, image, 0, 0 • IDL>TV, Smooth(image, 3, /Edge_Truncate), 192, 0 • IDL>TV, Convol(image, kernel, Total(kernel), $ • /Edge_Truncate), 2*192, 0 China-VO, Guangzhou

  24. 增强图像边缘-Roberts和Sobel ,拉普拉斯算子 • 一幅图像可以通过锐化或微分来增强图像边缘。IDL提供了两个做好的边缘增强函数:Roberts和Sobel。还有一些其他方法也可用来增强图像边缘。例如,可以用拉普拉斯算子来对图像做卷积: • 1 1 1 • 1 -7 1 • 1 11 IDL>TV, Sobel(image), 0 IDL>TV, Roberts(image), 1 IDL>kernel=[[1,1,1], [1,-7,1], [1,1,1]] IDL>TV, Convol(image, kernel), 2 三种增强图像边缘的方式。左边用的是Sobel方法。中间用的是Roberts方法。右边是用拉普拉斯算子对图像做卷积. China-VO, Guangzhou

  25. FFT: removing corrugated effect China-VO, Guangzhou

  26. IDL的成就 • 目前应用IDL语言,已经开发出了ENVI、IMAGIS、RiverTools、医学等成熟产品。具体的应用实例也非常多,如在2000年澳大利亚悉尼奥运会综合预报系统、美国国家环境卫星数据和信息服务中心的厄尔尼诺现象分析等工作中得到了成功的应用。 • 天文中NASA,SDSS。。。 China-VO, Guangzhou

  27. SDSS光谱数据处理系统模块(IDL) China-VO, Guangzhou

  28. Thanks for your attention! China-VO, Guangzhou

More Related