sbpy
sbpy copied to clipboard
Implement syndynes and synchrones
Pending Ephemeris class definition.
I'm considering class designs for implementing this feature. At the heart, a syndyne generator is an integrator that connects the dots between particles of a single beta. It needs the state of the target at the time of the observation, the list of betas and the ages to simulate, and an integrator. In sbpy, we have an orbit and ephemeris class that can potentially be used to provide the state vector.
Thinking about API options. Here is a first try.
state = State(r, v, t) # initialize state vector from position, velocity, and time of observation
state = State.from_ephem(eph) # initialize from Ephem object (requires x, y, z, vx, vy, vz, and time fields)
state = State.from_orbit(orbit) # initialize from Orbit object
syn = Syndynes(state) # using defaults
syn = Syndynes(state, betas=betas, ages=ages) # specific betas and ages
syn = Syndynes(state, integrator='quad') # specify integrator or integration method to use (if we have options)
syn.betas[0] # the first beta quantity
syn.syndyne[0] # get state vectors for all particles with beta=betas[0]
syn.ages[0] # the first age
syn.synchrone[0] # get state vectors for all particles with age=ages[0]
syn.plot_syndynes() # default observer is the Earth
syn.plot_synchrones()
# how to observe at other locations?
syn.plot_syndynes(observer=r) # specify observer's location with a heliocentric position vector?
syn.plot_syndynes(observer=state) # specify observer's location with a State object?
syn.plot_syndynes(observer=coords) # specify observer's location with SkyCoords object?
I'm going to think about whether or not an astropy.coordinates.SkyCoord object could be used in lieu of State. That might help us take advantage of the astropy reference frames.
I like the top-level design. It includes everything I will need, at least, in a simple and clear way.
I see the need of using SkyCoord in many places in the implementation of plot-related methods, but I doubt it can be used in lieu of State, because you would need at least three coordinates together with times to uniquely solve the state. Solving for state is not at the core of Syndynes class.
I suggest making the time parameter optional in the initiation of a State object with position and velocity, so the class supports relative time in the calculation of syndynes/synchrones. The absolute time isn't important. After all, ages will be relative.
Regarding the integrator, we have too many options, including openorb, SPICE, and those natives in scipy. It would be nice to have options for users, but I think the most important is efficiency and robustness, if a common interface for all is hard to implement and test. I myself would be happy with just one integrator that the software developers decide, trusting they would do their best to consider and test.