文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 使用IDL的12个小技巧
侵权投诉

使用IDL的12个小技巧

but idl can get confused trying to figure out if arr(5) is indexing into an array or a function call. the solution is to always use arr[5] for array indexing and to tell idl that you will be doing this with

compile_opt strictarr

at the beginning of each routine. (this is not a global setting since there is plenty of legacy code, including idl's library, that would not work with it.)

在你写的每个程序的开头键入compile_opt strictarr,这个解译起来有点不太好理解,但这样做有时会省去你一天的工作。这是源于arr(5)和arr[5]都可以索引数组,但idl尝试去识别arr(5)是索引一个数组还是调用一个函数的时会发生误解。解决的办法就是总是用arr[5]作为数组索引,通过程序开头的compile_opt strictarr告诉idl你要这样做。(这不是全球的设置,因为有很多传统代码,包括idl的库是不支持的。)

2 [转贴]使用IDL的12个小技巧

tip 5 learn to use where. any time you want to find the elements of an array that match a given condition (naively, you would have an if statement inside of a for loop), you should try to use where instead. (also, make sure to use the optional count parameter and check to make sure it's greater than zero before you index an array with the returned indices.)

学会用where。任何时候你想要找出符合给定条件的一个数组中的元素(你自然的会想到用for循环里的if表达式),你应该试着用where来代替。

tip 6 use keywords in routines you write. keywords are a useful feature that differentiate idl from many other languages. generally, keywords are optional inputs or outputs, though idl does not enforce it. also, learn how to use n_elements, arg_present, n_params correctly to check parameters.

在你写的程序中应用关键字。关键字是idl不同于其它很多语言的一个有用的特征,一般说来,关键字是可选的输入值或输出值,尽管idl没有作出这样的规定。还要学会正确使用n_elemens, arg_present, n_params来检查参数。

tip 7 use array operations. this is called vectorization and is key to writing efficient idl code. for example, if arr is an array, then

result = arr 1.0

will add 1.0 to each element of arr. almost all of idl's operators will handle array or scalar operands. it is much faster to use them with array operations than to loop over the elements and use the scalar version.

利用数组运算。这称之为向量化,它是有效编写idl代码的关键。例如,如果arr是一个数组,那么

result = arr 1.0

将为arr中的每个元素都加上1.0。几乎所有的idl运算都会处理到数组或标量操作数。利用数组运算要比循环元素和标量的方法快得多。

tip 8 use the online help. all the documentation is now online and nice looking on all platforms. it is accessible with ? from the idl prompt. it is particularly good

上一页第2页

热门文档

相关文档

  • 12个小技巧使你的书桌整齐有序,学习更加高效

    个小技巧使你的书桌整齐有序,学习更加高效》 《12 个小技巧使你的书桌整齐有序,学习更加高效》生活常识 2010-08-04 22:25:27 阅读 259 评论 9 字号:大中小...

  • 这里有12个小技巧帮你快速整理你的书桌

    这里有12个小技巧帮你快速整理你的书桌_其它_高等教育_教育专区。这里有12个...这是个共识, 但是按美观来整理书桌却比按使用性更容易操作,两者皆可,随 你...

  • 12个小技巧让你健健康康用电脑

    引导语:现在每天使用电脑的人时间越来越长,长时间用完电脑后,很多情况下都会感到头晕 天给大家分享 2 个小技巧,让大家从此健健康康地用电脑,再也不怕长时间用...

  • 12个小技巧让你健康用电脑

    编后语:以上12个小小的技巧,能帮助我们更加 健康的去用电脑,每一个需要长时间用电脑的朋友都 应该收藏一份,也可以将这些小小的技巧,告诉自己 的朋友或家人,让...

  • 12个小技巧使你的书桌整齐有序

    12个小技巧使你的书桌整齐有序_生产/经营管理_经管营销_专业资料。管理小技巧12 个小技巧使你的书桌整齐有序,学习更加高效 1. 拿走你不用的钢笔和铅笔 一般...

  • 12个小技巧让你健健康康用电脑,长时间用电脑必备

    12 个小技巧让你健健康康用电脑,长时间用电脑必备引导语:现在每天使用电脑的人时间越来越长,长时间用完电脑后,很多情况下都会感到头 晕,眼睛累等情况,那么,今天...

  • 12个小技巧帮你整理书桌

    12个小技巧帮你整理书桌_互联网_IT/计算机_专业资料。生活小常识12 个小技巧帮你整理书桌拿走你不用的钢笔和铅笔 博华一般写字只用一种钢笔,但是每个月我 都会...

  • IDL入门教程七(上)

    第七章 图形硬拷贝输出本章概要在使用 IDL 的时候,如何以硬拷贝形式再现屏幕中...有个技巧可以用于强制让 PostScript 文件前进一页,这就是使用 Erase 命令。如果...

  • IDL图像初学教程

    书中后面的几章编程教程是建 立在前面几章中讲过的概念和技巧的基础上的。 IDL 所需的版本希望读者在学习本书时使用的是最新的 IDL 版本。本书写作时使用的...

  • IDL入门教程05

    怎样在图形显示技巧中使用 Z 图形缓冲区 将光标用于图形显示数据可视化显示的原因...这种交互作用在 IDL 中用 Cursor 命令很容易完成。 用 LoadData 命令装入 Time...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email