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

博文

按标题搜索
Python随机数生成中的“陷阱”
2021-3-7 12:23
原则上,只要把随机数种子固定,随机数序列就可以复现。但是由于python中有些命令本身不可复现,与之相关的随机数生成过程也可能改变随机数生成过程,从而使得结果不可复现,比如把如下命令写入脚本a.py: -------------------------------------------------- import numpy as np np.random.seed(0) a = { ...
个人分类: Python编程|1768 次阅读|没有评论
reproject vs montage_wrapper
2021-2-21 00:50
reproject can accept header objects directly for reporjection, while mw needs txt files converted from headers. reproject.reproject_interp can handle PPV cubes properly, while mw.reproject_cube can’t re-project correctly along the velocity axis. No significant differences in the o ...
个人分类: 天文软件|1164 次阅读|没有评论
Recall historical commands in the terminal
2020-1-10 05:48
In csh: bindkey ^[[A history-search-backward bindkey ^[[B history-search-forward write into ~/.cshrc In bash: e[A: history-search-backward e[B: history-search-forward set show-all-if ambiguous on set completion-ignore-case on write into ~/.inputrc ...
个人分类: Linux系统|1223 次阅读|没有评论
坑爹的复制语法
2019-8-11 03:19
尝试以下程序 a, b = ]*2 a =2 发现b ==2. 这个命令的意思是给“ ”贴上两个标签a, b,既然 变了,标签a, b的内容都跟着变了。 如果是 a, b = , ] 则不会。
个人分类: Python编程|1501 次阅读|没有评论
Writing BZERO & BSCALE cards to fits headers using astropy
2019-7-30 11:06
Found a strange thing that theBZERO BSCALE cards can't be written to the header by the code below hdu = fits.open(fits_file) h = hdu .header img = hdu .data h = 0. h = 1. fits.writeto(fits_file,img,h) This will cause problems when using getsources, since it ...
个人分类: 天文软件|1596 次阅读|没有评论
Python格式化字符串的两种形式
2018-10-7 12:06
1. %格式,如 ‘%.2f’%(a) 2. .format格式,如 '{:.2f}.format(a)' 其中.format更强大些。比如输出给定精度 precision 的浮点数a,可写为 '{:.{:d}f}.format(a,precision)' 但是%格式做不到。
个人分类: Python编程|2053 次阅读|没有评论
Python faster [不定期更新]
2018-9-13 15:37
1. 大量计算时不用astropy.units,使用纯数,时间减少1-2个数量级。
个人分类: Python编程|1521 次阅读|没有评论
Planck数据分析
2018-9-12 12:59
下载了Planck single frequency fits, 发现投影方式是healpix。我需要转成通常投影的2D fits,可以用python包reproject: from reproject import reproject_from_healpix 也可以安装healpix相关软件,详见 https://healpix.sourceforge.io/ 。另外,python包healpy对处理healpix fits也有些用处。
个人分类: 天文数据分析|2032 次阅读|没有评论
利用天文图像计算flux注意事项
2018-9-12 12:55
对于bolometer的观测数据,有些未做绝对流量定标,zero offset不准(如Herschel PACS/SPIRE),这时需要用有定标的数据定标(如Planck数据)。详见AA 518, L88 (2010)。 对于连续谱数据,带宽相较中心频率大小不可忽略时,需要做color correction。
个人分类: 天文数据分析|2097 次阅读|没有评论
天文数据处理:大fits裁剪时的注意事项
2018-9-2 15:35
大fits是指fits的coverage足够大,天空投影效应的非线性项不可忽略的fits。 用montage.mSubimage裁剪大fits,如果裁剪区域远离投影中心,裁剪生成的fits的形状会有畸变,比如fits的格点不能对向正北。这是因为,新 fits继承了老 fits的投影中心,对于新fits来说,此投影中心往往远远偏离fits image的几何中心, ...
个人分类: 天文软件|2523 次阅读|没有评论

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

GMT+8, 2024-5-1 04:18

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部