OTO - Ohshima Tamashima Observatory- - bsc5db_rb Diff
- Added parts are displayed like this.
- Deleted parts are displayed
like this.
Bright Star Catalogue 5をMySQLでデータベース化するために
準備としてテキストファイル"bdc5db.txt"を作るRubyプログラム(ファイル名を"bsc2db.rb"とする)。
使い方:
bsc2db.rb <bsc5 >bsc5db.txt
なお、"bdc5db.txt"のフィールドはタブ"\t"区切り、行は"\n"区切りにした。
<<<
#!/usr/local/bin/ruby
while line=gets
lng=line.length
# print "length=",lng
if lng<198 then(
# print line
line[lng-1..197]=" "*(198-lng)+"\n"
# print(line, "\n")
)
else
line[197]="\n"
end
hr=line[0..3]
name=line[4..13]
dm=line[14..24]
hd=line[25..30]
sao=line[31..36]
fk5=line[37..40]
irfrag=line[41]
r_irfrag=line[42]
mult=line[43]
ads=line[44..48]
adsComp=line[49..50]
var=line[51..59]
rah19=line[60..61]
ram19=line[62..63]
ras19=line[64..67]
deSgn19=line[68]
ded19=line[69..70]
dem19=line[71..72]
des19=line[73..74]
rah=line[75..76]
ram=line[77..78]
ras=line[79..82]
deSgn=line[83]
ded=line[84..85]
dem=line[86..87]
des=line[88..89]
# data=line[name_n+1..line_n]
# ra=Math::PI*(data[0].to_f+data[1].to_f/60.0+data[2].to_f/3600.0)/12.0
# dec_d=data[3]
# dec_sgn=dec_d[0..0]
# dec_d=dec_d[1..2]
# dec=Math::PI*(dec_d.to_f+data[4].to_f/60.0+data[5].to_f/3600.0)/180.0
ra=Math::PI*(rah.to_f+ram.to_f/60.0+ras.to_f/3600.0)/12.0
dec=Math::PI*(ded.to_f+dem.to_f/60.0+des.to_f/3600.0)/180.0
dec=-1.0*dec if deSgn=="-"
glon=line[90..95]
glat=line[96..101]
v=line[102..106]
n_v=line[107]
u_v=line[108]
bv=line[109..113]
u_bv=line[114]
ub=line[115..119]
u_ub=line[120]
ri=line[121..125]
n_ri=line[126]
sp=line[127..146]
n_sp=line[147]
pmRA=line[148..153]
pmDE=line[154..159]
n_Par=line[160]
para=line[161..165]
radv=line[166..169]
n_rv=line[170..173]
l_rotv=line[174..175]
rotv=line[176..178]
u_rotv=line[179]
dmag=line[180..183]
sep=line[184..189]
mult_id=line[190..193]
mult_cnt=line[194..195]
noteFlag=line[196]
printf("%4d\t%10s\t%11s\t%6d\t%6d\t%4d\t",hr.to_i,name,dm,hd.to_i,sao.to_i,fk5.to_i)
printf("%c\t%c\t%c\t%5s\t%2s\t%9s\t",irfrag,r_irfrag,mult,ads,adsComp,var)
# printf("%2d\t%2d\t%4.1f\t%c\t%2d\t%2d\t%2d\t",rah19.to_i,ram19.to_i,ras19.to_f,deSgn19,ded19.to_i,dem19.to_i,des19.to_i)
# printf("%2d\t%2d\t%4.1f\t%c\t%2d\t%2d\t%2d\t",rah.to_i,ram.to_i,ras.to_f,deSgn,ded.to_i,dem.to_i,des.to_i)
printf("%10.8f\t%10.8f\t",ra,dec)
printf("%6.2f\t%6.2f\t",glon.to_f,glat.to_f)
printf("%5.2f\t%c\t%c\t%5.2f\t%c\t%5.2f\t%c\t",v.to_f,n_v,u_v,bv.to_f,u_bv,ub.to_f,u_ub)
printf("%5.2f\t%c\t%20s\t%c\t",ri.to_f,n_ri,sp,n_sp)
printf("%6.3f\t%6.3f\t%c\t%5.3f\t",pmRA.to_f,pmDE.to_f,n_Par,para.to_f)
printf("%4d\t%4s\t%2s\t%3d\t%c\t",radv.to_i,n_rv,l_rotv,rotv.to_i,u_rotv)
# printf("%4.1f\t%6.1f\t%4s\t%2d\t",dmag.to_f,sep.to_f,mult_id,mult_cnt.to_i)
# printf("%c\n", noteFlag)
printf("%4.1f\t%6.1f\t%4s\t%2d\t%c\n",dmag.to_f,sep.to_f,mult_id,mult_cnt.to_i,noteFlag)
end
>>>
なお、元のBSC52ファイルは、次のような固定長フォーマットである。
<<<
Byte-per-byte Description of file: catalog
-------------------------------------------------------------------------------
Bytes Format Units Label Explanations
-------------------------------------------------------------------------------
1- 4 I4 --- HR [1/9110]+ Harvard Revised Number
= Bright Star Number
5- 14 A10 --- Name Name, generally Bayer and/or Flamsteed name
15- 25 A11 --- DM Durchmusterung Identification (zone in
bytes 17-19)
26- 31 I6 --- HD Henry Draper Catalog Number
32- 37 I6 --- SAO SAO Catalog Number
38- 41 I4 --- FK5 FK5 star Number
42 A1 --- IRflag [I] I if infrared source
43 A1 --- r_IRflag [ ':] Coded reference for infrared source:
Blank if from NASA merged Infrared
Catalogue, Schmitz et al., 1978;
' if from Engles et al. 1982
: if uncertain identification
44 A1 --- Multiple [AWDIRS] Double or multiple-star code:
A = Astrometric binary
D = Duplicity discovered by occulation;
I = Innes, Southern Double Star Catalogue
(1927)
R = Rossiter, Michigan Publ. 9, 1955
S = Duplicity discovered by
speckle interferometry.
W = Worley (1978) update of the IDS;
45- 49 A5 --- ADS Aitken's Double Star Catalog (ADS) designation
50- 51 A2 --- ADS_Comp ADS number components
52- 60 A9 --- Var_ID Variable star identification
61- 62 I2 h RAh_1900 Hours RA, equinox B1900, epoch 1900.0
63- 64 I2 min RAm_1900 Minutes RA, equinox B1900, epoch 1900.0
65- 68 F4.1 s RAs_1900 Seconds RA, equinox B1900, epoch 1900.0
69 A1 --- DE-_1900 Sign Dec, equinox B1900, epoch 1900.0
70- 71 I2 deg DEd_1900 Degrees Dec, equinox B1900, epoch 1900.0
72- 73 I2 arcmin DEm_1900 Minutes Dec, equinox B1900, epoch 1900.0
74- 75 I2 arcsec DEs_1900 Seconds Dec, equinox B1900, epoch 1900.0
76- 77 I2 h RAh Hours RA, equinox J2000, epoch 2000.0
78- 79 I2 min RAm Minutes RA, equinox J2000, epoch 2000.0
80- 83 F4.1 s RAs Seconds RA, equinox J2000, epoch 2000.0
84 A1 --- DE- Sign Dec, equinox J2000, epoch 2000.0
85- 86 I2 deg DEd Degrees Dec, equinox J2000, epoch 2000.0
87- 88 I2 arcmin DEm Minutes Dec, equinox J2000, epoch 2000.0
89- 90 I2 arcsec DEs Seconds Dec, equinox J2000, epoch 2000.0
91- 96 F6.2 deg GLON Galactic longitude
97-102 F6.2 deg GLAT Galactic latitude
103-107 F5.2 mag V Visual magnitude
108 A1 --- n_V [ HR] Visual magnitude code
blank = V on UBV Johnson system;
R = HR magnitudes reduced to the
UBV system;
H = original HR magnitude.
109 A1 --- u_V [ :?] Uncertainty flag on V
110-114 F5.2 mag B-V B-V color in the UBV system
115 A1 --- u_B-V [ :?] Uncertainty flag on B-V
116-120 F5.2 mag U-B U-B color in the UBV system
121 A1 --- u_U-B [ :?] Uncertainty flag on U-B
122-126 F5.2 mag R-I R-I in system specified by n_R-I
127 A1 --- n_R-I [CE:?D] Code for R-I system (Cousin, Eggen)
128-147 A20 --- SpType Spectral type
148 A1 --- n_SpType [evt] Spectral type code
149-154 F6.3 arcsec/yr pmRA Annual proper motion in RA J2000, FK5 system
155-160 F6.3 arcsec/yr pmDE Annual proper motion in Dec J2000, FK5 system
161 A1 --- n_Parallax [D] D indicates a dynamical parallax,
otherwise a trigonometric parallax
162-166 F5.3 arcsec Parallax Trigonometric parallax (unless n_Parallax)
167-170 I4 km/s RadVel Heliocentric Radial Velocity
171-174 A4 --- n_RadVel [V?SB123O ] Radial velocity comments:
V = variable radial velocity;
V? = suspected variable radial velocity;
SB, SB1, SB2, SB3 = spectroscopic binaries,
single, double or triple lined spectra;
O = orbital data available.
175-176 A2 --- l_RotVel [<=> ] Rotational velocity limit chararacters
177-179 I3 km/s RotVel Rotational velocity, v sin i
180 A1 --- u_RotVel [ :v] uncertainty and variability flag on
RotVel
181-184 F4.1 mag Dmag Magnitude difference of double,
or brightest multiple
185-190 F6.1 arcsec Sep Separation of components in Dmag
if occultation binary.
191-194 A4 --- Mult_ID Identifications of components in Dmag
195-196 I2 --- Mult_Cnt Number of components assigned to a multiple
197 A1 --- Note_Flag [*] a star indicates that there is a note
(file notes)
-------------------------------------------------------------------------------
>>>
----
[[技術的な覚書き]]へ戻る
[[OTO-Ohshima Tamashima Observatory-]]トップへ戻る
{{counter}}
準備としてテキストファイル"bdc5db.txt"を作るRubyプログラム(ファイル名を"bsc2db.rb"とする)。
使い方:
bsc2db.rb <bsc5 >bsc5db.txt
なお、"bdc5db.txt"のフィールドはタブ"\t"区切り、行は"\n"区切りにした。
<<<
#!/usr/local/bin/ruby
while line=gets
lng=line.length
# print "length=",lng
if lng<198 then(
# print line
line[lng-1..197]=" "*(198-lng)+"\n"
# print(line, "\n")
)
else
line[197]="\n"
end
hr=line[0..3]
name=line[4..13]
dm=line[14..24]
hd=line[25..30]
sao=line[31..36]
fk5=line[37..40]
irfrag=line[41]
r_irfrag=line[42]
mult=line[43]
ads=line[44..48]
adsComp=line[49..50]
var=line[51..59]
rah19=line[60..61]
ram19=line[62..63]
ras19=line[64..67]
deSgn19=line[68]
ded19=line[69..70]
dem19=line[71..72]
des19=line[73..74]
rah=line[75..76]
ram=line[77..78]
ras=line[79..82]
deSgn=line[83]
ded=line[84..85]
dem=line[86..87]
des=line[88..89]
# data=line[name_n+1..line_n]
# ra=Math::PI*(data[0].to_f+data[1].to_f/60.0+data[2].to_f/3600.0)/12.0
# dec_d=data[3]
# dec_sgn=dec_d[0..0]
# dec_d=dec_d[1..2]
# dec=Math::PI*(dec_d.to_f+data[4].to_f/60.0+data[5].to_f/3600.0)/180.0
ra=Math::PI*(rah.to_f+ram.to_f/60.0+ras.to_f/3600.0)/12.0
dec=Math::PI*(ded.to_f+dem.to_f/60.0+des.to_f/3600.0)/180.0
dec=-1.0*dec if deSgn=="-"
glon=line[90..95]
glat=line[96..101]
v=line[102..106]
n_v=line[107]
u_v=line[108]
bv=line[109..113]
u_bv=line[114]
ub=line[115..119]
u_ub=line[120]
ri=line[121..125]
n_ri=line[126]
sp=line[127..146]
n_sp=line[147]
pmRA=line[148..153]
pmDE=line[154..159]
n_Par=line[160]
para=line[161..165]
radv=line[166..169]
n_rv=line[170..173]
l_rotv=line[174..175]
rotv=line[176..178]
u_rotv=line[179]
dmag=line[180..183]
sep=line[184..189]
mult_id=line[190..193]
mult_cnt=line[194..195]
noteFlag=line[196]
printf("%4d\t%10s\t%11s\t%6d\t%6d\t%4d\t",hr.to_i,name,dm,hd.to_i,sao.to_i,fk5.to_i)
printf("%c\t%c\t%c\t%5s\t%2s\t%9s\t",irfrag,r_irfrag,mult,ads,adsComp,var)
# printf("%2d\t%2d\t%4.1f\t%c\t%2d\t%2d\t%2d\t",rah19.to_i,ram19.to_i,ras19.to_f,deSgn19,ded19.to_i,dem19.to_i,des19.to_i)
# printf("%2d\t%2d\t%4.1f\t%c\t%2d\t%2d\t%2d\t",rah.to_i,ram.to_i,ras.to_f,deSgn,ded.to_i,dem.to_i,des.to_i)
printf("%10.8f\t%10.8f\t",ra,dec)
printf("%6.2f\t%6.2f\t",glon.to_f,glat.to_f)
printf("%5.2f\t%c\t%c\t%5.2f\t%c\t%5.2f\t%c\t",v.to_f,n_v,u_v,bv.to_f,u_bv,ub.to_f,u_ub)
printf("%5.2f\t%c\t%20s\t%c\t",ri.to_f,n_ri,sp,n_sp)
printf("%6.3f\t%6.3f\t%c\t%5.3f\t",pmRA.to_f,pmDE.to_f,n_Par,para.to_f)
printf("%4d\t%4s\t%2s\t%3d\t%c\t",radv.to_i,n_rv,l_rotv,rotv.to_i,u_rotv)
# printf("%4.1f\t%6.1f\t%4s\t%2d\t",dmag.to_f,sep.to_f,mult_id,mult_cnt.to_i)
# printf("%c\n", noteFlag)
printf("%4.1f\t%6.1f\t%4s\t%2d\t%c\n",dmag.to_f,sep.to_f,mult_id,mult_cnt.to_i,noteFlag)
end
>>>
なお、元のBSC52ファイルは、次のような固定長フォーマットである。
<<<
Byte-per-byte Description of file: catalog
-------------------------------------------------------------------------------
Bytes Format Units Label Explanations
-------------------------------------------------------------------------------
1- 4 I4 --- HR [1/9110]+ Harvard Revised Number
= Bright Star Number
5- 14 A10 --- Name Name, generally Bayer and/or Flamsteed name
15- 25 A11 --- DM Durchmusterung Identification (zone in
bytes 17-19)
26- 31 I6 --- HD Henry Draper Catalog Number
32- 37 I6 --- SAO SAO Catalog Number
38- 41 I4 --- FK5 FK5 star Number
42 A1 --- IRflag [I] I if infrared source
43 A1 --- r_IRflag [ ':] Coded reference for infrared source:
Blank if from NASA merged Infrared
Catalogue, Schmitz et al., 1978;
' if from Engles et al. 1982
: if uncertain identification
44 A1 --- Multiple [AWDIRS] Double or multiple-star code:
A = Astrometric binary
D = Duplicity discovered by occulation;
I = Innes, Southern Double Star Catalogue
(1927)
R = Rossiter, Michigan Publ. 9, 1955
S = Duplicity discovered by
speckle interferometry.
W = Worley (1978) update of the IDS;
45- 49 A5 --- ADS Aitken's Double Star Catalog (ADS) designation
50- 51 A2 --- ADS_Comp ADS number components
52- 60 A9 --- Var_ID Variable star identification
61- 62 I2 h RAh_1900 Hours RA, equinox B1900, epoch 1900.0
63- 64 I2 min RAm_1900 Minutes RA, equinox B1900, epoch 1900.0
65- 68 F4.1 s RAs_1900 Seconds RA, equinox B1900, epoch 1900.0
69 A1 --- DE-_1900 Sign Dec, equinox B1900, epoch 1900.0
70- 71 I2 deg DEd_1900 Degrees Dec, equinox B1900, epoch 1900.0
72- 73 I2 arcmin DEm_1900 Minutes Dec, equinox B1900, epoch 1900.0
74- 75 I2 arcsec DEs_1900 Seconds Dec, equinox B1900, epoch 1900.0
76- 77 I2 h RAh Hours RA, equinox J2000, epoch 2000.0
78- 79 I2 min RAm Minutes RA, equinox J2000, epoch 2000.0
80- 83 F4.1 s RAs Seconds RA, equinox J2000, epoch 2000.0
84 A1 --- DE- Sign Dec, equinox J2000, epoch 2000.0
85- 86 I2 deg DEd Degrees Dec, equinox J2000, epoch 2000.0
87- 88 I2 arcmin DEm Minutes Dec, equinox J2000, epoch 2000.0
89- 90 I2 arcsec DEs Seconds Dec, equinox J2000, epoch 2000.0
91- 96 F6.2 deg GLON Galactic longitude
97-102 F6.2 deg GLAT Galactic latitude
103-107 F5.2 mag V Visual magnitude
108 A1 --- n_V [ HR] Visual magnitude code
blank = V on UBV Johnson system;
R = HR magnitudes reduced to the
UBV system;
H = original HR magnitude.
109 A1 --- u_V [ :?] Uncertainty flag on V
110-114 F5.2 mag B-V B-V color in the UBV system
115 A1 --- u_B-V [ :?] Uncertainty flag on B-V
116-120 F5.2 mag U-B U-B color in the UBV system
121 A1 --- u_U-B [ :?] Uncertainty flag on U-B
122-126 F5.2 mag R-I R-I in system specified by n_R-I
127 A1 --- n_R-I [CE:?D] Code for R-I system (Cousin, Eggen)
128-147 A20 --- SpType Spectral type
148 A1 --- n_SpType [evt] Spectral type code
149-154 F6.3 arcsec/yr pmRA Annual proper motion in RA J2000, FK5 system
155-160 F6.3 arcsec/yr pmDE Annual proper motion in Dec J2000, FK5 system
161 A1 --- n_Parallax [D] D indicates a dynamical parallax,
otherwise a trigonometric parallax
162-166 F5.3 arcsec Parallax Trigonometric parallax (unless n_Parallax)
167-170 I4 km/s RadVel Heliocentric Radial Velocity
171-174 A4 --- n_RadVel [V?SB123O ] Radial velocity comments:
V = variable radial velocity;
V? = suspected variable radial velocity;
SB, SB1, SB2, SB3 = spectroscopic binaries,
single, double or triple lined spectra;
O = orbital data available.
175-176 A2 --- l_RotVel [<=> ] Rotational velocity limit chararacters
177-179 I3 km/s RotVel Rotational velocity, v sin i
180 A1 --- u_RotVel [ :v] uncertainty and variability flag on
RotVel
181-184 F4.1 mag Dmag Magnitude difference of double,
or brightest multiple
185-190 F6.1 arcsec Sep Separation of components in Dmag
if occultation binary.
191-194 A4 --- Mult_ID Identifications of components in Dmag
195-196 I2 --- Mult_Cnt Number of components assigned to a multiple
197 A1 --- Note_Flag [*] a star indicates that there is a note
(file notes)
-------------------------------------------------------------------------------
>>>
----
[[技術的な覚書き]]へ戻る
[[OTO-Ohshima Tamashima Observatory-]]トップへ戻る
{{counter}}