Ramin Bozorgi
unread,Mar 1, 2024, 5:02:18 AMMar 1Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to astropy-dev
Dear Frinds
i have this code
from astroquery.simbad import Simbad
def get_star_info(star_name):
custom_simbad = Simbad()
custom_simbad.add_votable_fields('ra(epoch=J2000)', 'dec(epoch=J2000)','ra(epoch=FK4)', 'dec(epoch=FK4)', 'ra(epoch=B1950)', 'dec(epoch=B1950)', 'pmra', 'pmdec', 'rv_value', 'plx', 'flux(V)', 'flux(B)')
result_table = custom_simbad.query_object(star_name)
if result_table is not None:
ra_j2000 = result_table['RA_epoch_J2000'][0]
dec_j2000 = result_table['DEC_epoch_J2000'][0]
ra_fk4 = result_table['RA_epoch_FK4'][0]
dec_fk4 = result_table['DEC_epoch_FK4'][0]
ra_b1950 = result_table['RA_epoch_B1950'][0]
dec_b1950 = result_table['DEC_epoch_B1950'][0]
pmra = result_table['PMRA'][0]
pmdec = result_table['PMDEC'][0]
velocity = result_table['RV_VALUE'][0]
parallax = result_table['PLX_VALUE'][0]
apparent_magnitude_V = result_table['FLUX_V'][0]
apparent_magnitude_B = result_table['FLUX_B'][0]
# Calculate absolute magnitude
absolute_magnitude = apparent_magnitude_V - 5 * (1 + 0.2) * (parallax / 1000)
# Calculate distance in parsecs
distance_parsecs = 1 / (parallax / 1000)
# Calculate distance in light-years
distance_ly = distance_parsecs * 3.26
info = {
"RA_J2000": ra_j2000,
"Dec_J2000": dec_j2000,
"RA_FK4": ra_fk4,
"Dec_FK4": dec_fk4,
"RA_B1950": ra_b1950,
"Dec_B1950": dec_b1950,
"ProperMotion_RA": pmra,
"ProperMotion_Dec": pmdec,
"Velocity": velocity,
"Parallax": parallax,
"ApparentMagnitude_V": apparent_magnitude_V,
"AbsoluteMagnitude": absolute_magnitude,
"Distance_parsecs": distance_parsecs,
"Distance_ly": distance_ly
}
return info
else:
return None
# Example star names
star_names = ["Sirius", "Alpha Centauri A", "Betelgeuse", "Vega"]
for star_name in star_names:
star_info = get_star_info(star_name)
if star_info:
print(f"Star: {star_name}")
print(f" RA (J2000): {star_info['RA_J2000']}")
print(f" Dec (J2000): {star_info['Dec_J2000']}")
print(f" RA (FK4): {star_info['RA_FK4']}")
print(f" Dec (FK4): {star_info['Dec_FK4']}")
print(f" RA (B1950): {star_info['RA_B1950']}")
print(f" Dec (B1950): {star_info['Dec_B1950']}")
print(f" Proper Motion in RA: {star_info['ProperMotion_RA']}")
print(f" Proper Motion in Dec: {star_info['ProperMotion_Dec']}")
print(f" Velocity: {star_info['Velocity']}")
print(f" Parallax: {star_info['Parallax']}")
print(f" Apparent Magnitude (V): {star_info['ApparentMagnitude_V']}")
print(f" Absolute Magnitude: {star_info['AbsoluteMagnitude']}")
print(f" Distance (parsecs): {star_info['Distance_parsecs']}")
print(f" Distance (light-years): {star_info['Distance_ly']}")
print()
else:
print(f"Star: {star_name} not found in SIMBAD database.")
and in result Ra and Dec of 1950 is equal Ra dec of 2000
i want to take hd and hip and tyc number and bayer code of this stars in output and i dont know how can i do that