# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
# %matplotlib inline
import matplotlib.pyplot as plt
import h5py

archive = h5py.File('hmi_twospots/archive.hdf5', 'r')
dset = archive['images']
# -

from astropy.constants import R_jup, R_sun

R_sun_pixels = 949.770386  # pixels
RpRs = int(float(R_jup/R_sun) * R_sun_pixels) # pixels

# +
import numpy as np
y0 = 1537
x0 = 0 

x, y = np.meshgrid(np.arange(4096), np.arange(4096))

for i in np.arange(0, dset.shape[0])[::-1]:
    x0 = (dset.shape[0] - i)/dset.shape[0] * 4096

    plt.figure(figsize=(10, 10))
    image = dset[i, ...]
    planet = (x - x0)**2 + (y - y0)**2 <= RpRs**2
    image[planet] = 0
    plt.imshow(image, vmin=5000, vmax=64000, cmap=plt.cm.inferno, origin='lower')
    plt.xticks([])
    plt.yticks([])
    plt.savefig('animate/aligned/{0:03d}.png'.format(dset.shape[0] - i), bbox_inches='tight', transparent=True)
    plt.close()
# -



StarcoderdataJupyterScriptsDedupFiltered