# astroquery

23 views

### Ramin Bozorgi

Mar 1, 2024, 5:02:18 AMMar 1
to astropy-dev
Dear Frinds
i have this code

def get_star_info(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: