rodluger / pysyzygy

A fast and general planet transit (syzygy) code written in C and in Python
MIT License
7 stars 5 forks source link

Adding class for generating Lambert spheres #2

Closed bmorris3 closed 9 years ago

bmorris3 commented 9 years ago

Here's the backbone class for making Lambert spheres. You can make a super simple demo animation with the following:

from spheres import Sphere
s = Sphere()
for phase in range(0,6):
    s.gen_image(phase)
    fig, ax = s.plot_image(show=True)

This will show you the Lambert sphere at six different phases along its orbit. The code does some linear algebra to calculate the brightness of each pixel for a Lambert sphere of specified dimensions, resolution, albedo. The plot_image method will return a figure and axis, and I'm imagining that you can inset the axis into your code where you normally draw a circle. To facilitate natural insetting, the image has a transparent background and the frames are turned off.

Currently the code is set up to do edge-on orbits very intuitively, but for arbitrarily tilted orbits you might want to fiddle with the orbitplane keyword in the Sphere() constructor to change the viewing geometry.