@@ -656,9 +656,16 @@ def energy_data(self, *, filename=None): # pylint: disable=too-many-statements
656656 ax2 .grid ()
657657
658658 ax3 = plt .subplot (413 )
659+ # Handle both array-based and callable-based Functions
660+ thrust_power = self .flight .thrust_power
661+ if callable (thrust_power .source ):
662+ # For callable sources, discretize based on speed
663+ thrust_power = thrust_power .set_discrete_based_on_model (
664+ self .flight .speed , mutate_self = False
665+ )
659666 ax3 .plot (
660- self . flight . thrust_power [:, 0 ],
661- self . flight . thrust_power [:, 1 ],
667+ thrust_power [:, 0 ],
668+ thrust_power [:, 1 ],
662669 label = "|Thrust Power|" ,
663670 )
664671 ax3 .set_xlim (0 , self .flight .rocket .motor .burn_out_time )
@@ -670,9 +677,16 @@ def energy_data(self, *, filename=None): # pylint: disable=too-many-statements
670677 ax3 .grid ()
671678
672679 ax4 = plt .subplot (414 )
680+ # Handle both array-based and callable-based Functions
681+ drag_power = self .flight .drag_power
682+ if callable (drag_power .source ):
683+ # For callable sources, discretize based on speed
684+ drag_power = drag_power .set_discrete_based_on_model (
685+ self .flight .speed , mutate_self = False
686+ )
673687 ax4 .plot (
674- self . flight . drag_power [:, 0 ],
675- - self . flight . drag_power [:, 1 ],
688+ drag_power [:, 0 ],
689+ - drag_power [:, 1 ],
676690 label = "|Drag Power|" ,
677691 )
678692 ax4 .set_xlim (
0 commit comments