When Light Curves Throw Us Curve Balls

High-Level Project Summary

Our approach is to render an STL or OBJ file in 3D space. The user is able to adjust the object's scale and resize it to morph the shape as they please. Once the user has chosen their parameters, they can click “Start Simulation”. This begins the rotation of the object. Every frame we process a 2D image of the asteroid to determine its light level. We then plot the light level at each rotation to generate a light curve. The user then has the option to adjust the shape and rerun the simulation in order to compare how adjusting the shape impacts the light curve.

Detailed Project Description

Technologies Overview:

Our project was written in Python and uses the following libraries:

  • PyQT5
  • VTK
  • Matplotlib
  • PIL
  • Astropy
  • Poliastro


Rendering Asteroid:

In order to render the asteroid in 3D, we make use of a library called VTK. We wrote code to convert either STL or OBJ files into VTK actors. This allowed us to display them in 3D space. VTK also gave us access to a number of useful functions, allowing us to move, rotate, and resize the object.


VTK allows for the creation of light sources. We used this to represent the Sun. In our solution, we consider the VTK light source to be the Sun, the VTK camera to represent the earth, and the 3D asteroid model to represent the asteroid. By simplifying the problem in this way, we gave ourselves the option to fix the asteroid to the origin of the coordinate system, and simply adjust the positions of the camera or light source around it. This prevented constantly doing transforms to the individual actor each time.

With this implemented, we get these images as a result:

To make this more flexible, we added the ability for a user to import their own STL or OBJ files, as can be seen here:


Calculating Object Positions:

(Fig. 1) The Sun is the yellow circle, Earth is the blue dotted orbit and red is the asteroid. The orbit plot updates live as the user changes configuration for the simulation. These settings are then loaded into the simulation.


We first use the Poliastro library to get accurate location vectors for the Sun, Earth and Asteroid.

The angle:

then gives the strictly positive angle of light incident at the asteroid. 

Then to calculate an angle in the range [-𝛑,𝛑] , we choose a reference vector.

And define.

Hence gives the angle in the range [-𝛑,𝛑]. 


Now that we have the angle that light is reflected through, we can position the viewport along the z-axis, and position our light source at [20arccos(𝛿θ),0,20arccos(𝛿θ)], to give the correct reflection of light off the asteroid.


Plot light levels:

Here we can have a close look on how we use the graphs to compare the effect of the shape of an object on a light curve. We generate a light curve graph using the rendered image of an asteroid model. We generate the light curve by capturing a photo of an asteroid phase, we grayscale this image, we take the total amount of pixels that the image has and we plot it onto a histogram. The histogram lets us keep track of the brightness of an individual pixel. We then calculate the ratio by dividing each index of a pixel by the amount of pixels which allows us to put all our values into the equation below. The value returned is plotted onto the graph forming a light curve. 

 

This mimics the physical process through which real asteroids’ light curves are measured.

Fig. 2) As the object rotates with the settings supplied by the user, the graph plots the current light curve of its rotational phase.


User Interface:

The user interface is created using PyQt 5. The UI consists of two windows. The first is the initial launch screen where the user is prompted to choose a 3D model from a predefined list, or to import their own 3D model. This page contains our logos, credits, and app name.

The second window is the main application window. It contains all of the app's key functionality. While this version of the app is clearly a prototype, we did design it with users in mind. This is mostly seen in the controls. We initially had a lot of sliders with no value boxes beside them. However, after meeting with one of the UI designer mentors, we changed this to display numerical values. This makes the users life easier by giving them the option to just type in a value instead of using the slider. It also makes the tool easier to understand as the sliders are no longer just an arbitrary thing with no concrete value.

 


Target Audience

This tool will cater to a variety of groups with it’s easy to use and simple UI. The groups we would envision adopting our project are as follows:

  • Asteroid Impact Monitoring team
  • Asteroid Miners  
  • Space program teams
  • Deep-space mission team
  • Close proximity operations team
  • Researchers and engineers 
  • Astronomers
  • Research field
  • It can also be used in an educational context


Conclusion and Future Improvements

We are delighted with the outcome of the program we have created. We believe it's a useful tool for many different audiences. We have given the program intuitive controls and made the user interface easy to understand so that even a person with very little knowledge about the topic would still be able to use this tool to compare the lightcurve of two different objects.


For the future we plan to improve mostly on the current functionalities we have implemented. One example is to scale the camera more efficiently or make the entire application live, as the settings are being changed the program fully shows the initial position of the object before it starts to graph the lightcurve. 

We could also improve on the overall accuracy of the program’s simulation, taking into account factors that change the rotation unpredictably, like planets’ gravity, and the effect of thermal radiation.

Space Agency Data

Bennu Asteroid STL file

Geographos Asteroid STL file

 

The Poliastra module uses SPICE Data (SPICE Kernels) from JPL’s Navigation and Ancillary Information Facility to accurately model the position of Earth in its orbit, which is used in calculating the incident light angle onto the asteroid.

Hackathon Journey

Our Hackathon experience was a rollercoaster of emotions! We flew between not knowing what to do, not knowing what we are doing and all the exciting states in between in the quest for that sweet sweet error free compilation. The networking and team building opportunities provided to us will be something we will be forever grateful for.


We gained a fundamental understanding in 3D model rendering in VTK, effectively using matplotlib and PyQT5. The adoption of libraries such as Poliastra and Astropy were a challenge due to our unfamiliarity with this area of mathematics. Most importantly we took a leap into an unfamiliar language only to emerge with a proof of concept that we are extremely proud of.

Tags

#python #3DModelRendering #lightcurve

Global Judging

This project has been submitted for consideration during the Judging process.