zgyin的个人博客分享 http://blog.sciencenet.cn/u/zgyin

博文

pywip的使用方法

已有 2960 次阅读 2013-1-23 02:03 |个人分类:pywip的用法|系统分类:科研笔记

[root@localhost ~]# cd /root/pywip_examples
[root@localhost pywip_examples]# source /root/miriad/miriad_start.sh
[root@localhost pywip_examples]# export PYTHONPATH=/root/miriad/borrow/wip/pyWip
[root@localhost pywip_examples]# ./example1.py
Could not open user's WIP initialization file /root/.wipinit
Setting up default device [plot-ex1.ps/vcps]
Reading commands from [/root/pywip_examples/tmpmCDL86.wip]....
[root@localhost pywip_examples]#
命令解析:
cd /root/pywip_examples 切换当前目录到/root/pywip_examples
source /root/miriad/miriad_start.sh 告诉计算机miriad的程序在哪里
export PYTHONPATH=/root/miriad/borrow/wip/pyWip 告诉计算机pywip模块在哪里
./example1.py              运行程序
可以在目录/root/pywip_examples下画出来的图plot-ex1.ps



当然啦也可以把example1.py中的命令一行行的输入到中端进行画图
[root@localhost ~]# cd /root/pywip_examples
[root@localhost pywip_examples]# source /root/miriad/miriad_start.sh
[root@localhost pywip_examples]# export PYTHONPATH=/root/miriad/borrow/wip/pyWip

[root@localhost pywip_examples]# python
Python 2.4.4 (#1, Jan 22 2013, 01:39:36)
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> from pywip import *
>>>
>>> viewport(0.2,0.8,0.3,0.9)             # Set the location of the window
>>> default(size=1.2)                     # Set the character size
>>> lims = [0,10,0,100]                   # Set the world coordinate limits
>>> rect(7,9,80,90,limits=lims)           # Draw a filled rectangle
>>> arc(4,80,2,10,fill='h')               # Draw a ellipse
>>> arrow([5,2],[80,40],style='-',width=2) # Draw a thick solid line
>>> plot([9,6],[80,40],style='--')        # Draw a dashed line of normal thickness
>>> plot([2],[20],style='+')              # Draw a plus sign
>>> plot([3],[20],style='*')              # Draw an asterisks
>>> plot([4],[20],style='o')              # Draw an open circle
>>> plot([5],[20],style='x')              # Draw an x
>>> plot([6],[20],style='s')              # Draw a square
>>> plot([7],[20],style='^')              # Draw a triangle
>>> plot([8],[20],style='o+')             # Draw an open plus sign
>>> axis(verticaly=True)                  # Draw a box with numbers and tick marks
>>> savefig('plot-ex1.ps')                # Save plot to a file
Could not open user's WIP initialization file /root/.wipinit
Setting up default device [plot-ex1.ps/vcps]
Reading commands from [/root/pywip_examples/tmp9v1-ik.wip]....
>>>

同样可以在目录/root/pywip_examples下画出来的图plot-ex1.ps

另外可以参考http://www.astro.umd.edu/~chapman/python_tutorial.html 认识和了解python
以及参考http://docs.python.org/2/tutorial/modules.html 学习python的模块

对于/root/pywip_examples中的run_examples.csh建议修改为
#!/bin/csh -f
# script to make all the plots

./example1.py
./example2.py
./example3.py
./example4.py
./example5.py
./example6.py
./example7.py
./example8.py
./example9.py
./example10.py
./example11.py
./example12.py
./example13.py
./example14.py
[root@localhost ~]# source /root/miriad/miriad_start.sh
[root@localhost ~]# export PYTHONPATH=/root/miriad/borrow/wip/pyWip
[root@localhost ~]# cd /root/pywip_examples
[root@localhost pywip_examples]# /root/pywip_examples/run_examples.csh
可以在/root/pywip_examples看到生成的图片,根据图片可以判断/root/pywip_examples中,具体每个程序的用法

如果自己写的程序要 属性—权限—允许以程序执行文件(E)

如果要处理fits文件可能要用到http://www.stsci.edu/institute/software_hardware/pyfits 把fits修改为wip可以处理



https://wap.sciencenet.cn/blog-783377-655630.html

上一篇:PyWIP使用方法的探索
下一篇:坐标转换为hh:mm:ss, dd:mm:ss
收藏 IP: 202.101.72.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-19 08:55

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部