PyWifes的使用与试错过程

@Pywifes的使用

1. 旧版PyWifes

1.1 软件简介

  • PyWiefs是基于Python的为Wide Field Spectrograph (WiFeS)而编写的数据处理管线。其网址为:https://www.mso.anu.edu.au/pywifes/doku.php?id=start。网址内容如下(其中RASS的链接以及WiFeS Wiki已经失效,不知道是否需要ANU的校内网才可以查看):

在这里插入图片描述

1.2 旧版程序的Python环境创建

python环境创建,参考文章http://t.csdnimg.cn/lVlcj,该文章描述了miniconda虚拟环境的创建过程与基本使用过程。

  1. 利用conda搭建python3.10环境
    命令 conda create -n 2024_pywifes python=3.10
    2024_pywifes 为自定义的虚拟环境名称,3.10为需要的python版本号。

搭建结束出现:
To activate this environment, use conda activate 2024_pywifes
To deactivate an active environment, use conda deactivate

  1. 激活虚拟环境
    命令source activate 2024_pywifes
    即进入虚拟环境:(2024_pywifes) usr@cygnus:~/python_env$ python

1.3 旧版程序的内容与下载安装

  • 软件下载:

在这里插入图片描述
命令:

 git clone https://github.com/PyWiFeS/pipeline.git

该网页提示使用git进行安装,git是一个分布式版本控制系统(可自行百度),在服务器的虚拟环境中可以运行。该过程是从github上拉取PyWifes的程序包,运行完成后,在本地文件夹会有一个名为pipeline的程序包。

  • 软件安装:实际该软件不需要安装,只是需要进行环境变量的设置,具体设置如下:
export PYTHONPATH="/home/liujunhui2/pipeline/src:$PYTHONPATH"

export PYWIFES_DIR="/home/liujunhui2/pipeline/reference_data"

也可以将其写入~/.bashrc中,然后source ~/.bashrc,即可。

  • 安装后的验证:
    在虚拟环境中,进入python。
    输入:
In [1]: import pywifes
In [2]: pywifes.__version__
Out[2]: '0.7.2'

出现版本号即为安装成功,中间过程可能提示缺少某些安装包(比如,scipy),退出当前python,在虚拟环境中使用conda或pip进行正常的软件包安装即可。

Notes:

  • PyWifes的网址位置为:https://github.com/PyWiFeS/pipeline。注意该程序的文件实际被放在两个文件夹中,如下图所示:

在这里插入图片描述

  • 在运行pipeline时,如果提示非公共的安装包(例如,stellar_process)缺乏时,可以在tool中进行搜索,并将其放在调用程序相同的子目录下,即可。

2. 新版PyWifes

2.1 新版PyWifes 的下载与安装(虚拟环境安装如上,python>3.10即可)

新版的PyWifes是以旧版为基础,删除掉不能用的scripts后,进行改进获得的,可以一步进行Wifes数据处理的程序。我们使用的是28个程序分支中的一个,其名字为cml_twi_flats。

程序下载网址:https://github.com/PyWiFeS/pipeline/tree/cml_twi_flats
在这里插入图片描述

程序作者对新版程序的安装过程书写较为详细明了,可以直接按照他的提示进行程序下载和安装。
在这里插入图片描述
代码部分如下,可以直接复制粘贴:

git clone -b automation https://github.com/PyWiFeS/pipeline.git
pip install .
export PYWIFES_DIR=/Users/.../pipeline/reference_data
alias pywifes-reduce='/Users/.../pipeline/reduction_scripts/reduce_data.py'

后面这两条可以写在写入~/.bashrc中,然后source ~/.bashrc环境变量,即可。

2.2 新版PyWifes 的运行

运行过程如下所示,基本过程为:

  1. 将所有数据全部放在my_raw_data文件夹中;
  2. 然后运行pywifes-reduce my_raw_data即可。
    在这里插入图片描述

2.3 结果与报错

在这里插入图片描述

(2024_pywifes) liujunhui2@taurus:~/20240428_process_PyWifes/ep240309a/ep240309a/wifes$ pywifes-reduce my_raw_data_20240320/
Processing data in directory: /home/liujunhui2/20240428_process_PyWifes/ep240309a/ep240309a/wifes/my_raw_data_20240320/
Subtracting Overscan for OBK-704544-WiFeS-Blue-UT20240320T112234-9.fits
Subtracting Overscan for OBK-704544-WiFeS-Blue-UT20240320T113834-1.fits
Repairing blue bad pixels for OBK-704544-WiFeS-Blue-UT20240320T112234-9.p00.fits
Repairing blue bad pixels for OBK-704544-WiFeS-Blue-UT20240320T113834-1.p00.fits
Calculating Global Superbias
blue skipped, as an error occurred during processing: 'list index out of range'.
Subtracting Overscan for OBK-704544-WiFeS-Red--UT20240320T112234-9.fits
Subtracting Overscan for OBK-704544-WiFeS-Red--UT20240320T113834-1.fits
Repairing red bad pixels for OBK-704544-WiFeS-Red--UT20240320T112234-9.p00.fits
Repairing red bad pixels for OBK-704544-WiFeS-Red--UT20240320T113834-1.p00.fits
Calculating Global Superbias
red skipped, as an error occurred during processing: 'list index out of range'.
Traceback (most recent call last):
  File "/home/liujunhui2/pipeline/reduction_scripts/reduce_data.py", line 1182, in <module>
    main()
  File "/home/liujunhui2/pipeline/reduction_scripts/reduce_data.py", line 1102, in main
    matched_cubes = cube_matcher(reduced_cubes_paths)
  File "/home/liujunhui2/miniconda3/envs/2024_pywifes/lib/python3.10/site-packages/pywifes/data_classifier.py", line 215, in cube_matcher
    .tolist()
  File "/home/liujunhui2/miniconda3/envs/2024_pywifes/lib/python3.10/site-packages/pandas/core/generic.py", line 6299, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'tolist'

2.3 运行结果

按照程序所述,其运行结果,应该如下图所示:
在这里插入图片描述
实操结果如下:
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值