Note
Go to the end to download the full example code.
Convex Light Curves#
Simulates torque-free rigid body motion for a simple object and computes the light curve
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import mirage as mr
To keep things simple, we’ll just use a cube for this demo
obj = mr.SpaceObject('cube.obj')
brdf = mr.Brdf('diffuse', cd=1.0, cs=0.0)
Computing the quaternion time history of the object
teval = np.linspace(0, 10, 1000)
q, _ = mr.propagate_attitude_torque_free(
quat0=np.array([0.0, 0.0, 0.0, 1.0]),
omega0=np.array([1.0, 1.0, 1.0]),
itensor=np.diag([1, 2, 3]),
teval=teval,
)
dcm = mr.quat_to_dcm(q) # Converting to quaternion
Transforming fixed inertial Sun and Observer vectors into the body frame
svi = np.array([[1, 0, 0]])
# Sun vector in the inertial frame
svb = mr.stack_mat_mult_vec(dcm, svi)
# Sun vector in the body frame
ovi = np.array([[0, 1, 0]])
# Observer vector in the inertial frame
ovb = mr.stack_mat_mult_vec(dcm, ovi)
# Observer vector in the body frame
lc = obj.convex_light_curve(brdf, svb, ovb)
plt.figure()
sns.lineplot(x=teval, y=lc)
plt.title('Convex Light Curves')
plt.xlabel('Time [s]')
plt.ylabel('Normalized brightness')
plt.grid()
plt.show()

Total running time of the script: (0 minutes 0.794 seconds)