rms-starcat 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rms-starcat might be problematic. Click here for more details.
- rms_starcat-0.0.1.dist-info/LICENSE +201 -0
- rms_starcat-0.0.1.dist-info/METADATA +39 -0
- rms_starcat-0.0.1.dist-info/RECORD +11 -0
- rms_starcat-0.0.1.dist-info/WHEEL +5 -0
- rms_starcat-0.0.1.dist-info/top_level.txt +1 -0
- starcat/__init__.py +12 -0
- starcat/_version.py +16 -0
- starcat/spice.py +97 -0
- starcat/starcatalog.py +414 -0
- starcat/ucac4.py +1075 -0
- starcat/ybsc.py +510 -0
starcat/ybsc.py
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
################################################################################
|
|
2
|
+
# starcat/ybsc.py
|
|
3
|
+
################################################################################
|
|
4
|
+
|
|
5
|
+
# The Bright Star Catalogue, 5th Revised Ed. (Preliminary Version)
|
|
6
|
+
# Hoffleit D., Warren Jr W.H.
|
|
7
|
+
# <Astronomical Data Center, NSSDC/ADC (1991)>
|
|
8
|
+
# =1964BS....C......0H
|
|
9
|
+
# From ftp://cdsarc.u-strasbg.fr/cats/V/50/1
|
|
10
|
+
|
|
11
|
+
from __future__ import print_function
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from starcatalog import *
|
|
15
|
+
except:
|
|
16
|
+
from .starcatalog import *
|
|
17
|
+
import numpy as np
|
|
18
|
+
import os.path
|
|
19
|
+
import struct
|
|
20
|
+
|
|
21
|
+
YBSC_IR_NASA = 0
|
|
22
|
+
YBSC_IR_ENGLES = 1
|
|
23
|
+
YBSC_IR_UNCERTAIN = 2
|
|
24
|
+
|
|
25
|
+
YBSC_MULTIPLE_NONE = ' '
|
|
26
|
+
YBSC_MULTIPLE_ASTROMETRIC = 'A'
|
|
27
|
+
YBSC_MULTIPLE_DUPLICITY_OCCULTATION = 'D'
|
|
28
|
+
YBSC_MULTIPLE_INNES = 'I'
|
|
29
|
+
YBSC_MULTIPLE_ROSSITER = 'R'
|
|
30
|
+
YBSC_MULTIPLE_DUPLICITY_SPECKLE = 'S'
|
|
31
|
+
YBSC_MULTIPLE_WORLEY = 'W'
|
|
32
|
+
|
|
33
|
+
YBSC_VMAG_UNCERTAINTY_V = ' '
|
|
34
|
+
YBSC_VMAG_UNCERTAINTY_HR_REDUCED = 'R'
|
|
35
|
+
YBSC_VMAG_UNCERTAINTY_HR = 'H'
|
|
36
|
+
|
|
37
|
+
# WE SHOULD ADD MORE DEFINITIONS HERE
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class YBSCStar(Star):
|
|
41
|
+
"""A holder for star attributes.
|
|
42
|
+
|
|
43
|
+
This class includes attributes unique to the YBSC catalog."""
|
|
44
|
+
|
|
45
|
+
def __init__(self):
|
|
46
|
+
# Initialize the standard fields
|
|
47
|
+
Star.__init__(self)
|
|
48
|
+
|
|
49
|
+
# Initialize the YBSC-specific fields
|
|
50
|
+
self.name = None
|
|
51
|
+
self.durchmusterung_id = None
|
|
52
|
+
self.draper_number = None
|
|
53
|
+
self.sao_number = None
|
|
54
|
+
self.fk5_number = None
|
|
55
|
+
self.ir_source = None
|
|
56
|
+
self.ir_source_ref = None
|
|
57
|
+
self.double_star_code = None
|
|
58
|
+
self.aitken_designation = None
|
|
59
|
+
self.ads_components = None
|
|
60
|
+
self.variable_star_id = None
|
|
61
|
+
self.galactic_longitude = None
|
|
62
|
+
self.galactic_latitude = None
|
|
63
|
+
self.vmag_code = None
|
|
64
|
+
self.vmag_uncertainty_flag = None
|
|
65
|
+
self.b_v = None
|
|
66
|
+
self.u_b = None
|
|
67
|
+
self.r_i = None
|
|
68
|
+
self.spectral_class = None
|
|
69
|
+
self.spectral_class_code = None
|
|
70
|
+
self.parallax_type = None
|
|
71
|
+
self.parallax = None
|
|
72
|
+
self.radial_velocity = None
|
|
73
|
+
self.radial_velocity_comments = None
|
|
74
|
+
self.rotational_velocity_limit = None
|
|
75
|
+
self.rotational_velocity = None
|
|
76
|
+
self.rotational_velocity_uncertainty_flag = None
|
|
77
|
+
self.double_mag_diff = None
|
|
78
|
+
self.double_mag_sep = None
|
|
79
|
+
self.double_mag_components = None
|
|
80
|
+
self.multiple_num_components = None
|
|
81
|
+
self.temperature = None
|
|
82
|
+
|
|
83
|
+
def __str__(self):
|
|
84
|
+
ret = Star.__str__(self)
|
|
85
|
+
|
|
86
|
+
ret += 'Name "' + str(self.name) + '"'
|
|
87
|
+
ret += ' | Durch "' + str(self.durchmusterung_id) + '"'
|
|
88
|
+
ret += ' | Draper ' + str(self.draper_number)
|
|
89
|
+
ret += ' | SAO ' + str(self.sao_number)
|
|
90
|
+
ret += ' | FK5 ' + str(self.fk5_number)
|
|
91
|
+
ret += '\n'
|
|
92
|
+
|
|
93
|
+
ret += 'IR ' + str(self.ir_source) + ' Ref ' + str(self.ir_source_ref)
|
|
94
|
+
ret += ' | Double "' + str(self.double_star_code) + '"'
|
|
95
|
+
ret += ' | Aitken ' + str(self.aitken_designation) + ' '
|
|
96
|
+
ret += str(self.ads_components)
|
|
97
|
+
ret += ' | Variable ' + str(self.variable_star_id)
|
|
98
|
+
ret += '\n'
|
|
99
|
+
|
|
100
|
+
if self.temperature is None:
|
|
101
|
+
ret += 'TEMP None'
|
|
102
|
+
else:
|
|
103
|
+
ret += 'TEMP %5d' % (self.temperature)
|
|
104
|
+
ret += ' | SCLASS %2s' % (self.spectral_class)
|
|
105
|
+
ret += ' ' + str(self.spectral_class_code)
|
|
106
|
+
|
|
107
|
+
ret += ' | Galactic LON '
|
|
108
|
+
if self.galactic_longitude is None:
|
|
109
|
+
ret += 'None'
|
|
110
|
+
else:
|
|
111
|
+
ret += str(self.galactic_longitude*DPR)
|
|
112
|
+
ret += ' LAT '
|
|
113
|
+
if self.galactic_latitude is None:
|
|
114
|
+
ret += 'None'
|
|
115
|
+
else:
|
|
116
|
+
ret += str(self.galactic_latitude*DPR)
|
|
117
|
+
ret += '\n'
|
|
118
|
+
|
|
119
|
+
ret += 'B-V ' + str(self.b_v)
|
|
120
|
+
ret += ' | U-B ' + str(self.u_b)
|
|
121
|
+
ret += ' | R-I ' + str(self.r_i)
|
|
122
|
+
ret += '\n'
|
|
123
|
+
|
|
124
|
+
ret += 'Parallax "' + str(self.parallax_type) + '"'
|
|
125
|
+
ret += ' ' + str(self.parallax)
|
|
126
|
+
ret += ' | RadVel ' + str(self.radial_velocity)
|
|
127
|
+
ret += ' ' + str(self.radial_velocity_comments)
|
|
128
|
+
ret += ' ' + str(self.rotational_velocity_limit)
|
|
129
|
+
ret += ' | RotVel ' +str(self.rotational_velocity)
|
|
130
|
+
ret += ' ' + str(self.rotational_velocity_uncertainty_flag)
|
|
131
|
+
ret += '\n'
|
|
132
|
+
|
|
133
|
+
ret += 'Double mag diff ' + str(self.double_mag_diff)
|
|
134
|
+
ret += ' Sep ' + str(self.double_mag_sep)
|
|
135
|
+
ret += ' Components ' + str(self.double_mag_components)
|
|
136
|
+
ret += ' Num components ' + str(self.multiple_num_components)
|
|
137
|
+
ret += '\n'
|
|
138
|
+
|
|
139
|
+
return ret
|
|
140
|
+
|
|
141
|
+
# TODO
|
|
142
|
+
# star.cat_match = None
|
|
143
|
+
# star.num_img_total = None
|
|
144
|
+
# star.num_img_used = None
|
|
145
|
+
# star.num_cat_pm = None
|
|
146
|
+
# star.ra_mean_epoch = None
|
|
147
|
+
# star.dec_mean_epoch = None
|
|
148
|
+
# star.id_str = None
|
|
149
|
+
# star.id_str_ucac2 = None
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# --------------------------------------------------------------------------------
|
|
153
|
+
# Bytes Format Units Label Explanations
|
|
154
|
+
# --------------------------------------------------------------------------------
|
|
155
|
+
# 1- 4 I4 --- HR [1/9110]+ Harvard Revised Number
|
|
156
|
+
# = Bright Star Number
|
|
157
|
+
# 5- 14 A10 --- Name Name, generally Bayer and/or Flamsteed name
|
|
158
|
+
# 15- 25 A11 --- DM Durchmusterung Identification (zone in
|
|
159
|
+
# bytes 17-19)
|
|
160
|
+
# 26- 31 I6 --- HD [1/225300]? Henry Draper Catalog Number
|
|
161
|
+
# 32- 37 I6 --- SAO [1/258997]? SAO Catalog Number
|
|
162
|
+
# 38- 41 I4 --- FK5 ? FK5 star Number
|
|
163
|
+
# 42 A1 --- IRflag [I] I if infrared source
|
|
164
|
+
# 43 A1 --- r_IRflag *[ ':] Coded reference for infrared source
|
|
165
|
+
# 44 A1 --- Multiple *[AWDIRS] Double or multiple-star code
|
|
166
|
+
# 45- 49 A5 --- ADS Aitken's Double Star Catalog (ADS) designation
|
|
167
|
+
# 50- 51 A2 --- ADScomp ADS number components
|
|
168
|
+
# 52- 60 A9 --- VarID Variable star identification
|
|
169
|
+
# 61- 62 I2 h RAh1900 ?Hours RA, equinox B1900, epoch 1900.0 (1)
|
|
170
|
+
# 63- 64 I2 min RAm1900 ?Minutes RA, equinox B1900, epoch 1900.0 (1)
|
|
171
|
+
# 65- 68 F4.1 s RAs1900 ?Seconds RA, equinox B1900, epoch 1900.0 (1)
|
|
172
|
+
# 69 A1 --- DE-1900 ?Sign Dec, equinox B1900, epoch 1900.0 (1)
|
|
173
|
+
# 70- 71 I2 deg DEd1900 ?Degrees Dec, equinox B1900, epoch 1900.0 (1)
|
|
174
|
+
# 72- 73 I2 arcmin DEm1900 ?Minutes Dec, equinox B1900, epoch 1900.0 (1)
|
|
175
|
+
# 74- 75 I2 arcsec DEs1900 ?Seconds Dec, equinox B1900, epoch 1900.0 (1)
|
|
176
|
+
# 76- 77 I2 h RAh ?Hours RA, equinox J2000, epoch 2000.0 (1)
|
|
177
|
+
# 78- 79 I2 min RAm ?Minutes RA, equinox J2000, epoch 2000.0 (1)
|
|
178
|
+
# 80- 83 F4.1 s RAs ?Seconds RA, equinox J2000, epoch 2000.0 (1)
|
|
179
|
+
# 84 A1 --- DE- ?Sign Dec, equinox J2000, epoch 2000.0 (1)
|
|
180
|
+
# 85- 86 I2 deg DEd ?Degrees Dec, equinox J2000, epoch 2000.0 (1)
|
|
181
|
+
# 87- 88 I2 arcmin DEm ?Minutes Dec, equinox J2000, epoch 2000.0 (1)
|
|
182
|
+
# 89- 90 I2 arcsec DEs ?Seconds Dec, equinox J2000, epoch 2000.0 (1)
|
|
183
|
+
# 91- 96 F6.2 deg GLON ?Galactic longitude (1)
|
|
184
|
+
# 97-102 F6.2 deg GLAT ?Galactic latitude (1)
|
|
185
|
+
# 103-107 F5.2 mag Vmag ?Visual magnitude (1)
|
|
186
|
+
# 108 A1 --- n_Vmag *[ HR] Visual magnitude code
|
|
187
|
+
# 109 A1 --- u_Vmag [ :?] Uncertainty flag on V
|
|
188
|
+
# 110-114 F5.2 mag B-V ? B-V color in the UBV system
|
|
189
|
+
# 115 A1 --- u_B-V [ :?] Uncertainty flag on B-V
|
|
190
|
+
# 116-120 F5.2 mag U-B ? U-B color in the UBV system
|
|
191
|
+
# 121 A1 --- u_U-B [ :?] Uncertainty flag on U-B
|
|
192
|
+
# 122-126 F5.2 mag R-I ? R-I in system specified by n_R-I
|
|
193
|
+
# 127 A1 --- n_R-I [CE:?D] Code for R-I system (Cousin, Eggen)
|
|
194
|
+
# 128-147 A20 --- SpType Spectral type
|
|
195
|
+
# 148 A1 --- n_SpType [evt] Spectral type code
|
|
196
|
+
# 149-154 F6.3 arcsec/yr pmRA *?Annual proper motion in RA J2000, FK5 system
|
|
197
|
+
# 155-160 F6.3 arcsec/yr pmDE ?Annual proper motion in Dec J2000, FK5 system
|
|
198
|
+
# 161 A1 --- n_Parallax [D] D indicates a dynamical parallax,
|
|
199
|
+
# otherwise a trigonometric parallax
|
|
200
|
+
# 162-166 F5.3 arcsec Parallax ? Trigonometric parallax (unless n_Parallax)
|
|
201
|
+
# 167-170 I4 km/s RadVel ? Heliocentric Radial Velocity
|
|
202
|
+
# 171-174 A4 --- n_RadVel *[V?SB123O ] Radial velocity comments
|
|
203
|
+
# 175-176 A2 --- l_RotVel [<=> ] Rotational velocity limit characters
|
|
204
|
+
# 177-179 I3 km/s RotVel ? Rotational velocity, v sin i
|
|
205
|
+
# 180 A1 --- u_RotVel [ :v] uncertainty and variability flag on
|
|
206
|
+
# RotVel
|
|
207
|
+
# 181-184 F4.1 mag Dmag ? Magnitude difference of double,
|
|
208
|
+
# or brightest multiple
|
|
209
|
+
# 185-190 F6.1 arcsec Sep ? Separation of components in Dmag
|
|
210
|
+
# if occultation binary.
|
|
211
|
+
# 191-194 A4 --- MultID Identifications of components in Dmag
|
|
212
|
+
# 195-196 I2 --- MultCnt ? Number of components assigned to a multiple
|
|
213
|
+
# 197 A1 --- NoteFlag [*] a star indicates that there is a note
|
|
214
|
+
# (see file notes)
|
|
215
|
+
# --------------------------------------------------------------------------------
|
|
216
|
+
# Note (1): These fields are all blanks for stars removed from
|
|
217
|
+
# the Bright Star Catalogue (see notes).
|
|
218
|
+
# Note on r_IRflag:
|
|
219
|
+
# Blank if from NASA merged Infrared Catalogue, Schmitz et al., 1978;
|
|
220
|
+
# ' if from Engles et al. 1982
|
|
221
|
+
# : if uncertain identification
|
|
222
|
+
# Note on Multiple:
|
|
223
|
+
# A = Astrometric binary
|
|
224
|
+
# D = Duplicity discovered by occultation;
|
|
225
|
+
# I = Innes, Southern Double Star Catalogue (1927)
|
|
226
|
+
# R = Rossiter, Michigan Publ. 9, 1955
|
|
227
|
+
# S = Duplicity discovered by speckle interferometry.
|
|
228
|
+
# W = Worley (1978) update of the IDS;
|
|
229
|
+
# Note on n_Vmag:
|
|
230
|
+
# blank = V on UBV Johnson system;
|
|
231
|
+
# R = HR magnitudes reduced to the UBV system;
|
|
232
|
+
# H = original HR magnitude.
|
|
233
|
+
# Note on pmRA:
|
|
234
|
+
# As usually assumed, the proper motion in RA is the projected
|
|
235
|
+
# motion (cos(DE).d(RA)/dt), i.e. the total proper motion is
|
|
236
|
+
# sqrt(pmRA^2^+pmDE^2^)
|
|
237
|
+
# Note on n_RadVel:
|
|
238
|
+
# V = variable radial velocity;
|
|
239
|
+
# V? = suspected variable radial velocity;
|
|
240
|
+
# SB, SB1, SB2, SB3 = spectroscopic binaries,
|
|
241
|
+
# single, double or triple lined spectra;
|
|
242
|
+
# O = orbital data available.
|
|
243
|
+
# --------------------------------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
class YBSCStarCatalog(StarCatalog):
|
|
246
|
+
def __init__(self, dir=None):
|
|
247
|
+
if dir is None:
|
|
248
|
+
self.dirname = os.environ["YBSC_DIR"]
|
|
249
|
+
else:
|
|
250
|
+
self.dirname = dir
|
|
251
|
+
|
|
252
|
+
self.stars = []
|
|
253
|
+
|
|
254
|
+
fp = open(os.path.join(self.dirname, 'catalog'), 'r')
|
|
255
|
+
while True:
|
|
256
|
+
record = fp.readline().rstrip()
|
|
257
|
+
if record == '':
|
|
258
|
+
break
|
|
259
|
+
if record[102:107].strip() == '': # No VMAG
|
|
260
|
+
continue
|
|
261
|
+
star = self._record_to_star(record)
|
|
262
|
+
self.stars.append(star)
|
|
263
|
+
fp.close()
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _find_stars(self, ra_min, ra_max, dec_min, dec_max, **kwargs):
|
|
267
|
+
"""Yield the results for all stars.
|
|
268
|
+
|
|
269
|
+
Optional arguments: DEFAULT
|
|
270
|
+
ra_min, ra_max 0, 2PI RA range in radians
|
|
271
|
+
dec_min, dec_max -PI, PI DEC range in radians
|
|
272
|
+
vmag_min, vmag_max ALL Magnitude range
|
|
273
|
+
allow_double False Allow double stars
|
|
274
|
+
"""
|
|
275
|
+
|
|
276
|
+
vmag_min = kwargs.get('vmag_min', None)
|
|
277
|
+
vmag_max = kwargs.get('vmag_max', None)
|
|
278
|
+
allow_double = kwargs.get('allow_double', False)
|
|
279
|
+
|
|
280
|
+
for star in self.stars:
|
|
281
|
+
if not ra_min <= star.ra <= ra_max:
|
|
282
|
+
continue
|
|
283
|
+
if not dec_min <= star.dec <= dec_max:
|
|
284
|
+
continue
|
|
285
|
+
if vmag_min and star.vmag < vmag_min:
|
|
286
|
+
continue
|
|
287
|
+
if vmag_max and star.vmag > vmag_max:
|
|
288
|
+
continue
|
|
289
|
+
if not allow_double and star.double_star_code != ' ':
|
|
290
|
+
continue
|
|
291
|
+
|
|
292
|
+
yield star
|
|
293
|
+
|
|
294
|
+
@staticmethod
|
|
295
|
+
def _record_to_star(record):
|
|
296
|
+
star = YBSCStar()
|
|
297
|
+
|
|
298
|
+
###################
|
|
299
|
+
# CATALOG NUMBERS #
|
|
300
|
+
###################
|
|
301
|
+
|
|
302
|
+
# 1- 4 I4 --- HR [1/9110]+ Harvard Revised Number
|
|
303
|
+
# = Bright Star Number
|
|
304
|
+
# 5- 14 A10 --- Name Name, generally Bayer and/or Flamsteed name
|
|
305
|
+
# 15- 25 A11 --- DM Durchmusterung Identification (zone in
|
|
306
|
+
# bytes 17-19)
|
|
307
|
+
# 26- 31 I6 --- HD [1/225300]? Henry Draper Catalog Number
|
|
308
|
+
# 32- 37 I6 --- SAO [1/258997]? SAO Catalog Number
|
|
309
|
+
# 38- 41 I4 --- FK5 ? FK5 star Number
|
|
310
|
+
|
|
311
|
+
star.unique_number = int(record[0:4].strip())
|
|
312
|
+
star.name = record[4:14].strip()
|
|
313
|
+
star.durchmusterung_id = record[14:25].strip()
|
|
314
|
+
if record[25:31].strip() != '':
|
|
315
|
+
star.draper_number = int(record[25:31].strip())
|
|
316
|
+
if record[31:37].strip() != '':
|
|
317
|
+
star.sao_number = int(record[31:37].strip())
|
|
318
|
+
if record[37:41].strip() != '':
|
|
319
|
+
star.fk5_number = int(record[37:41].strip())
|
|
320
|
+
|
|
321
|
+
################
|
|
322
|
+
# SOURCE FLAGS #
|
|
323
|
+
################
|
|
324
|
+
|
|
325
|
+
# 42 A1 --- IRflag [I] I if infrared source
|
|
326
|
+
# 43 A1 --- r_IRflag *[ ':] Coded reference for infrared source
|
|
327
|
+
# 44 A1 --- Multiple *[AWDIRS] Double or multiple-star code
|
|
328
|
+
# 45- 49 A5 --- ADS Aitken's Double Star Catalog (ADS) designation
|
|
329
|
+
# 50- 51 A2 --- ADScomp ADS number components
|
|
330
|
+
# 52- 60 A9 --- VarID Variable star identification
|
|
331
|
+
|
|
332
|
+
star.ir_source = (record[41] == 'I')
|
|
333
|
+
if record[42] == ' ':
|
|
334
|
+
star.ir_source_ref = YBSC_IR_NASA
|
|
335
|
+
elif record[42] == '\'':
|
|
336
|
+
star.ir_source_ref = YBSC_IR_ENGLES
|
|
337
|
+
elif record[42] == ':':
|
|
338
|
+
star.ir_source_ref = YBSC_IR_UNCERTAIN
|
|
339
|
+
|
|
340
|
+
star.double_star_code = record[43]
|
|
341
|
+
if record[44:49].strip() != '':
|
|
342
|
+
star.aitken_designation = record[44:49]
|
|
343
|
+
if record[49:51].strip() != '':
|
|
344
|
+
star.ads_components = record[49:51].strip()
|
|
345
|
+
if record[51:60].strip() != '':
|
|
346
|
+
star.variable_star_id = record[51:60].strip()
|
|
347
|
+
|
|
348
|
+
###########
|
|
349
|
+
# RA, DEC #
|
|
350
|
+
###########
|
|
351
|
+
|
|
352
|
+
# 76- 77 I2 h RAh ?Hours RA, equinox J2000, epoch 2000.0 (1)
|
|
353
|
+
# 78- 79 I2 min RAm ?Minutes RA, equinox J2000, epoch 2000.0 (1)
|
|
354
|
+
# 80- 83 F4.1 s RAs ?Seconds RA, equinox J2000, epoch 2000.0 (1)
|
|
355
|
+
# 84 A1 --- DE- ?Sign Dec, equinox J2000, epoch 2000.0 (1)
|
|
356
|
+
# 85- 86 I2 deg DEd ?Degrees Dec, equinox J2000, epoch 2000.0 (1)
|
|
357
|
+
# 87- 88 I2 arcmin DEm ?Minutes Dec, equinox J2000, epoch 2000.0 (1)
|
|
358
|
+
# 89- 90 I2 arcsec DEs ?Seconds Dec, equinox J2000, epoch 2000.0 (1)
|
|
359
|
+
|
|
360
|
+
ra_hr = float(record[75:77])
|
|
361
|
+
ra_min = float(record[77:79])
|
|
362
|
+
ra_sec = float(record[79:83])
|
|
363
|
+
dec_deg = float(record[83:86])
|
|
364
|
+
dec_min = float(record[86:88])
|
|
365
|
+
dec_sec = float(record[88:90])
|
|
366
|
+
|
|
367
|
+
sign = 1
|
|
368
|
+
if dec_deg < 0:
|
|
369
|
+
dec_deg = -dec_deg
|
|
370
|
+
sign = -1
|
|
371
|
+
|
|
372
|
+
star.ra = (ra_hr/24. + ra_min/24./60 + ra_sec/24./60/60)*360 * RPD
|
|
373
|
+
star.dec = sign*(dec_deg + dec_min/60. + dec_sec/3600.) * RPD
|
|
374
|
+
|
|
375
|
+
########################
|
|
376
|
+
# GALACTIC COORDINATES #
|
|
377
|
+
########################
|
|
378
|
+
|
|
379
|
+
# 91- 96 F6.2 deg GLON ?Galactic longitude (1)
|
|
380
|
+
# 97-102 F6.2 deg GLAT ?Galactic latitude (1)
|
|
381
|
+
|
|
382
|
+
star.galactic_longitude = float(record[90:96]) * RPD
|
|
383
|
+
star.galactic_latitude = float(record[96:102]) * RPD
|
|
384
|
+
|
|
385
|
+
##############
|
|
386
|
+
# MAGNITUDES #
|
|
387
|
+
##############
|
|
388
|
+
|
|
389
|
+
# 103-107 F5.2 mag Vmag ?Visual magnitude (1)
|
|
390
|
+
# 108 A1 --- n_Vmag *[ HR] Visual magnitude code
|
|
391
|
+
# 109 A1 --- u_Vmag [ :?] Uncertainty flag on V
|
|
392
|
+
# 110-114 F5.2 mag B-V ? B-V color in the UBV system
|
|
393
|
+
# 115 A1 --- u_B-V [ :?] Uncertainty flag on B-V
|
|
394
|
+
# 116-120 F5.2 mag U-B ? U-B color in the UBV system
|
|
395
|
+
# 121 A1 --- u_U-B [ :?] Uncertainty flag on U-B
|
|
396
|
+
# 122-126 F5.2 mag R-I ? R-I in system specified by n_R-I
|
|
397
|
+
# 127 A1 --- n_R-I [CE:?D] Code for R-I system (Cousin, Eggen)
|
|
398
|
+
|
|
399
|
+
star.vmag = float(record[102:107])
|
|
400
|
+
star.vmag_code = record[107]
|
|
401
|
+
star.vmag_uncertainty_flag = record[108]
|
|
402
|
+
if record[109:114].strip() != '':
|
|
403
|
+
star.b_v = float(record[109:114])
|
|
404
|
+
if record[115:120].strip() != '':
|
|
405
|
+
star.u_b = float(record[115:120])
|
|
406
|
+
if record[121:126].strip() != '':
|
|
407
|
+
star.r_i = float(record[121:126])
|
|
408
|
+
|
|
409
|
+
##################
|
|
410
|
+
# SPECTRAL CLASS #
|
|
411
|
+
##################
|
|
412
|
+
|
|
413
|
+
# 128-147 A20 --- SpType Spectral type
|
|
414
|
+
# 148 A1 --- n_SpType [evt] Spectral type code
|
|
415
|
+
|
|
416
|
+
star.spectral_class = record[127:147].strip()
|
|
417
|
+
star.spectral_class_code = record[147]
|
|
418
|
+
|
|
419
|
+
#######################
|
|
420
|
+
# MOTION AND PARALLAX #
|
|
421
|
+
#######################
|
|
422
|
+
|
|
423
|
+
# 149-154 F6.3 arcsec/yr pmRA *?Annual proper motion in RA J2000, FK5 system
|
|
424
|
+
# 155-160 F6.3 arcsec/yr pmDE ?Annual proper motion in Dec J2000, FK5 system
|
|
425
|
+
# 161 A1 --- n_Parallax [D] D indicates a dynamical parallax,
|
|
426
|
+
# otherwise a trigonometric parallax
|
|
427
|
+
# 162-166 F5.3 arcsec Parallax ? Trigonometric parallax (unless n_Parallax)
|
|
428
|
+
# 167-170 I4 km/s RadVel ? Heliocentric Radial Velocity
|
|
429
|
+
# 171-174 A4 --- n_RadVel *[V?SB123O ] Radial velocity comments
|
|
430
|
+
# 175-176 A2 --- l_RotVel [<=> ] Rotational velocity limit characters
|
|
431
|
+
# 177-179 I3 km/s RotVel ? Rotational velocity, v sin i
|
|
432
|
+
# 180 A1 --- u_RotVel [ :v] uncertainty and variability flag on
|
|
433
|
+
# RotVel
|
|
434
|
+
|
|
435
|
+
star.pm_rac = float(record[148:154]) * AS_TO_RAD * YEAR_TO_SEC
|
|
436
|
+
star.pm_ra = star.pm_rac / np.cos(star.dec)
|
|
437
|
+
star.pm_dec = float(record[154:160]) * AS_TO_RAD * YEAR_TO_SEC
|
|
438
|
+
|
|
439
|
+
star.parallax_type = record[160:161]
|
|
440
|
+
if record[161:166].strip() != '':
|
|
441
|
+
star.parallax = float(record[161:166]) * AS_TO_RAD
|
|
442
|
+
if record[166:170].strip() != '':
|
|
443
|
+
star.radial_velocity = float(record[166:170])
|
|
444
|
+
star.radial_velocity_comments = record[170:174].strip()
|
|
445
|
+
star.rotational_velocity_limit = record[174:176]
|
|
446
|
+
if record[176:179].strip() != '':
|
|
447
|
+
star.rotational_velocity = float(record[176:179])
|
|
448
|
+
star.rotational_velocity_uncertainty_flag = record[179:180]
|
|
449
|
+
|
|
450
|
+
# 181-184 F4.1 mag Dmag ? Magnitude difference of double,
|
|
451
|
+
# or brightest multiple
|
|
452
|
+
# 185-190 F6.1 arcsec Sep ? Separation of components in Dmag
|
|
453
|
+
# if occultation binary.
|
|
454
|
+
# 191-194 A4 --- MultID Identifications of components in Dmag
|
|
455
|
+
# 195-196 I2 --- MultCnt ? Number of components assigned to a multiple
|
|
456
|
+
# 197 A1 --- NoteFlag [*] a star indicates that there is a note
|
|
457
|
+
# (see file notes)
|
|
458
|
+
|
|
459
|
+
if record[180:184].strip() != '':
|
|
460
|
+
star.double_mag_diff = float(record[180:184])
|
|
461
|
+
if record[184:190].strip() != '':
|
|
462
|
+
star.double_mag_sep = float(record[184:190]) * AS_TO_RAD
|
|
463
|
+
star.double_mag_components = record[190:194]
|
|
464
|
+
if record[194:196].strip() != '':
|
|
465
|
+
star.multiple_num_components = int(record[194:196])
|
|
466
|
+
|
|
467
|
+
##################################################
|
|
468
|
+
# COMPUTE SPECTRAL CLASS AND SURFACE TEMPERATURE #
|
|
469
|
+
##################################################
|
|
470
|
+
|
|
471
|
+
sclass = star.spectral_class
|
|
472
|
+
if sclass[0] == 'g':
|
|
473
|
+
sclass = sclass[1:]
|
|
474
|
+
sclass = sclass[0:2]
|
|
475
|
+
star.temperature = StarCatalog.temperature_from_sclass(sclass)
|
|
476
|
+
|
|
477
|
+
return star
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
#===============================================================================
|
|
481
|
+
# UNIT TESTS
|
|
482
|
+
#===============================================================================
|
|
483
|
+
|
|
484
|
+
import unittest
|
|
485
|
+
|
|
486
|
+
class Test_YBSCStarCatalog(unittest.TestCase):
|
|
487
|
+
|
|
488
|
+
def runTest(self):
|
|
489
|
+
cat = YBSCStarCatalog('/seti/external/YBSC')
|
|
490
|
+
|
|
491
|
+
self.assertEqual(len(cat.stars), 9096)
|
|
492
|
+
self.assertEqual(cat.count_stars(), 7519)
|
|
493
|
+
self.assertEqual(cat.count_stars(allow_double=True), 9096)
|
|
494
|
+
|
|
495
|
+
# Look up Vega
|
|
496
|
+
ra_vega = 279.2333 * RPD
|
|
497
|
+
dec_vega = 38.7836 * RPD
|
|
498
|
+
|
|
499
|
+
vega_list = list(cat.find_stars(ra_min=ra_vega-0.1*RPD,
|
|
500
|
+
ra_max=ra_vega+0.1*RPD,
|
|
501
|
+
dec_min=dec_vega-0.1*RPD,
|
|
502
|
+
dec_max=dec_vega+0.1*RPD))
|
|
503
|
+
self.assertEqual(len(vega_list), 1)
|
|
504
|
+
|
|
505
|
+
vega = vega_list[0]
|
|
506
|
+
self.assertEqual(vega.vmag, 0.03)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
if __name__ == '__main__':
|
|
510
|
+
unittest.main(verbosity=2)
|