Test mpcorbfile for use with pyephem¶
[1]:
import mpcorbfile
import ephem
[2]:
# Cargar el archivo MPCORB.DAT
archivo_mpcorb = "MPCORB_TEST.DAT"
f = mpcorbfile.mpcorb_file(archivo_mpcorb)
reading: 100%|██████████| 13.2k/13.2k [00:00<00:00, 135k bodies/s]
[3]:
f.colnames
[3]:
['packed_designation',
'H',
'G',
'Epoch',
'M',
'Peri',
'Node',
'i',
'e',
'n',
'a',
'U',
'Ref',
'Num_obs',
'Num_opps',
'Arc_length',
'rms',
'Perturbers',
'Perturbers_2',
'Computer',
'Hex_flags',
'Number',
'Name',
'Last_obs',
'epochJD',
'designation',
'discover_date',
'orbit_type']
[4]:
eleptical_body = ephem.EllipticalBody()
for body in f.bodies:
# calculate nowdays position
asteroid = mpcorbfile.set_elliptical_body_elements(
eleptical_body, body
) # return the elliptical body
asteroid.compute(ephem.now())
#print the last one
print(f"{body['Name']} RA:{asteroid.a_ra} DEC:{asteroid.a_dec}")
1997 CW RA:5:01:24.14 DEC:26:35:45.8
[ ]:
#Some plot to be used as a cover in documentation
import matplotlib.pyplot as plt
plt.plot(asteroid.a_ra, asteroid.a_dec, 'ro')
[<matplotlib.lines.Line2D at 0x76d0697dc920>]
[ ]: