Message Boards Message Boards

Building a Planetary System: AstronomicalData vs MinorPlanetData

Hi, I show two examples building a Planetary System for Plutoid planets using: AstronomicalData and a Planetary System: AstronomicalData vs MinorPlanetData. MinorPlanet works slower than AstromicalData. Any idea to improve the function included using MinorPlanetData

(*MinorPlanetData. Too slow*)

minorplanets = MinorPlanetData[EntityClass["MinorPlanet", "Plutoid"]];

Manipulate[
 Graphics3D[{(Tooltip[Sphere[#[[2]], 1], #[[1]]]) & /@ 
    Transpose[{minorplanets, 
      QuantityMagnitude[
       MinorPlanetData[EntityClass["MinorPlanet", "Plutoid"], 
        EntityProperty["MinorPlanet", 
         "HelioCoordinates", {"Date" -> DateObject[{2015, 1, fecha}]}]]]}], 
   ColorData[1, 1], MinorPlanetData[#, "OrbitPath"] & /@ minorplanets}, 
  PlotLabel -> DateString[DateList[{2015, 1, fecha}]]], {fecha, 1, 300 365.25}]



(*AstronomicalData. Ceres is included but doesn't matter*)

Manipulate[
 Graphics3D[{(Tooltip[
       Sphere[#[[2]], 1], #[[
        1]]]) & /@ (({AstronomicalData[#, "Name"], 
         AstronomicalData[#, {"Position", {2015, 01, fecha}}]/
          AstronomicalData["Sun", "Distance"]} & /@ 
       AstronomicalData["DwarfPlanet"])), ColorData[1, 1], 
   AstronomicalData[#, "OrbitPath"] & /@ AstronomicalData["DwarfPlanet"]}, 
  PlotLabel -> DateString[DateList[{2015, 1, fecha}]]], {fecha, 1, 
  300 365.25}]

Manipulate is intended to be a real-time tool. Putting things in Manipulate that are potentially slow will often lead to poor interactivity. Calling data paclets or making API calls, like MinorPlanetData does, inside Manipulate can lead to such things.

Although it won't make the call to MinorPlanetData faster, you can at least get the control to be responsive if you use the option SynchronousUpdating -> False:

Manipulate[
 Graphics3D[{(Tooltip[Sphere[#[[2]], 1], #[[1]]]) & /@ 
    Transpose[{minorplanets, 
      QuantityMagnitude[
       MinorPlanetData[EntityClass["MinorPlanet", "Plutoid"], 
        EntityProperty["MinorPlanet", 
         "HelioCoordinates", {"Date" -> 
           DateObject[{2015, 1, fecha}]}]]]}], ColorData[1, 1], 
   MinorPlanetData[#, "OrbitPath"] & /@ minorplanets}, 
  PlotLabel -> DateString[DateList[{2015, 1, fecha}]]],
 {fecha, 1, 300 365.25},
 SynchronousUpdating -> False]
POSTED BY: Jeffrey Bryant
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract