C++读取二进制文件,以读取UCAC星表为例
2009年12月15日 15:11
UCAC(USNO CCD Astrograph Catalog)是美国海军天文台出的一个星表,现在最新的是3.0,用一个双面DVD存储,约7.9G,数据格式为二进制。DVD中有Fortran例子读取文件,本文给出一个C++的实现方式,这也是用C++的方式进行二进制文件读取的例子。
二进制数据格式:
num item fmt unit explanation remark
------------------------------------------------------------------------
1 ra I*4 mas right ascension at epoch J2000.0 (ICRS) (1)
2 spd I*4 mas south pole distance epoch J2000.0 (ICRS) (1)
3 im1 I*2 millimag UCAC fit model magnitude (2)
4 im2 I*2 millimag UCAC aperture magnitude (2)
5 sigmag I*2 millimag UCAC error on magnitude (larger of sc.mod)(3)
6 objt I*1 object type (4)
7 dsf I*1 double star flag (5)
16
8 sigra I*2 mas s.e. at central epoch in RA (*cos Dec)
9 sigdc I*2 mas s.e. at central epoch in Dec
10 na1 I*1 total # of CCD images of this star
11 nu1 I*1 # of CCD images used for this star (6)
12 us1 I*1 # catalogs (epochs) used for proper motions
13 cn1 I*1 total numb. catalogs (epochs) initial match
8
14 cepra I*2 0.01 yr central epoch for mean RA, minus 1900
15 cepdc I*2 0.01 yr central epoch for mean Dec,minus 1900
16 pmrac I*4 0.1 mas/yr proper motion in RA*cos(Dec)
17 pmdc I*4 0.1 mas/yr proper motion in Dec
18 sigpmr I*2 0.1 mas/yr s.e. of pmRA * cos Dec
19 sigpmd I*2 0.1 mas/yr s.e. of pmDec
16
20 id2m I*4 2MASS pts_key star identifier
21 jmag I*2 millimag 2MASS J magnitude
22 hmag I*2 millimag 2MASS H magnitude
23 kmag I*2 millimag 2MASS K_s magnitude
24 icqflg I*1 * 3 2MASS cc_flg*10 + phot.qual.flag (7)
25 e2mpho I*1 * 3 2MASS error photom. (1/100 mag) (8)
16
26 smB I*2 millimag SuperCosmos Bmag
27 smR2 I*2 millimag SC R2mag (9)
28 smI I*2 millimag SC Imag
29 clbl I*1 SC star/galaxy classif./quality flag (10)
30 qfB I*1 SC quality flag Bmag (11)
31 qfR2 I*1 SC quality flag R2mag (11)
32 qfI I*1 SC quality flag Imag (11)
10
33 catflg I*1 * 10 mmf flag for 10 major catalogs matched (12)
34 g1 I*1 Yale SPM object type (g-flag) (13)
35 c1 I*1 Yale SPM input cat. (c-flag) (14)
36 leda I*1 LEDA galaxy match flag (15)
37 x2m I*1 2MASS extend.source flag (16)
38 rn I*4 MPOS star number; identifies HPM stars (17)
18
------------------------------------------------------------------------
Windows 下使用GNU开发环境
2005年4月22日 08:15
GNU/UNIX下面有大量的有意思的工具使用,而且功能强大,其中之一就是强大的GNU编译器GCC (GNU Compilers Collection),它包含有多个编译器。GTK+是Gnome环境下标准的图形库,也是一个比较强大的开发集,GTKMM则是GTK+的C++包装,可以使用标准的C++来开发Linux下的图形界面程序。
那么本文将介绍这几个开发环境如何在Windows下使用,好东西嘛,那就是应该在多个平台下都可以使用。
GNU科学计算函数库 GSL - GNU Scientific Library
2004年7月16日 19:12
GNU科学计算函数库GSL(GNU Scientific Library)是一个强大的C/C++数值计算函数库,它是一个自由软件,是GNU项目软件的一个部分,遵循GPL协议。目前GSL的最新版本是1.5,发布于2004年6月25日。

