Ejemplo n.º 1
0
    #print(url)
    dates, mags = get_mags_from_AAVSO_V(url)
    print(dates, mags)
    all_dates1 = np.concatenate((all_dates1, dates))
    all_mags1 = np.concatenate((all_mags1, mags))
    
days_ago1 = np.max(all_dates1) - all_dates1
print(all_dates1, all_mags1)



# Pull the last 10 pages from AAVSO and collate the dates and mags
plot_file = 'plot20d.png'
url_base = 'https://www.aavso.org/apps/webobs/results/?star=betelgeuse&num_results=200&obs_types=vis&page='
pages = np.arange(1, 10, 1)
all_dates = np.array([])
all_mags = np.array([])
for page in pages:
    url = url_base + str(page)
    print(url)
    dates, mags = get_mags_from_AAVSO(url)
    all_dates = np.concatenate((all_dates, dates))
    all_mags = np.concatenate((all_mags, mags))
dates = all_dates
mags = all_mags
days_ago = np.max(dates) - dates
text = build_string(days_ago, mags)
if text is not None:
    make_plot(days_ago, dates, mags)
    tweet(text, plot_file)
Ejemplo n.º 2
0
dates = all_dates
mags = all_mags
days_ago = np.max(dates) - dates
make_plot(days_ago, dates, mags)

# Make animation
frames = []
files = glob.glob('*.png')
files.sort()
for file in files:
    print('Appending file', file)
    new_frame = PIL.Image.open(file, mode='r')
    frames.append(new_frame)

# Make last frame last longer
for i in range(5):
    frames.append(new_frame)

# Save gif
frames[0].save('betel_video.gif',
               format='GIF',
               append_images=frames,
               save_all=True,
               duration=500,
               loop=0)  # forever

for file in files:
    os.remove(file)

tweet("Updated #Betelgeuse forecast", 'betel_video.gif')