@@ -54,29 +54,29 @@ def for_flight(cls) -> 'DiscretizeConfig':
5454
5555
5656class InfinityEncoder (RocketPyEncoder ):
57- def __init__ (self , * args , ** kwargs ):
58- super ().__init__ (* args , ** kwargs )
59-
60- def default (self , obj ):
57+ def default (self , o ):
6158 if (
62- isinstance (obj , Function )
63- and not callable (obj .source )
64- and obj .__dom_dim__ == 1
59+ isinstance (o , Function )
60+ and not callable (o .source )
61+ and o .__dom_dim__ == 1
6562 ):
66- size = len (obj ._domain )
63+ size = len (o ._domain )
6764 reduction_factor = 1
6865 if size > 25 :
6966 reduction_factor = size // 25
7067 if reduction_factor > 1 :
71- obj = obj .set_discrete (
72- obj .x_array [0 ],
73- obj .x_array [- 1 ],
68+ o = o .set_discrete (
69+ o .x_array [0 ],
70+ o .x_array [- 1 ],
7471 size // reduction_factor ,
7572 mutate_self = False ,
7673 )
77- if isinstance (obj , Flight ):
78- obj ._Flight__evaluate_post_process
79- solution = np .array (obj .solution )
74+ if isinstance (o , Flight ):
75+ try :
76+ o ._Flight__evaluate_post_process
77+ except Exception :
78+ pass
79+ solution = np .array (o .solution )
8080 size = len (solution )
8181 if size > 25 :
8282 reduction_factor = size // 25
@@ -90,12 +90,12 @@ def default(self, obj):
9090 reduced_solution [:, i ] = interp1d (
9191 solution [:, 0 ], col , assume_sorted = True
9292 )(reduced_scale )
93- obj .solution = reduced_solution .tolist ()
93+ o .solution = reduced_solution .tolist ()
9494
95- obj .flight_phases = None
96- obj .function_evaluations = None
95+ o .flight_phases = None
96+ o .function_evaluations = None
9797
98- return super ().default (obj )
98+ return super ().default (o )
9999
100100
101101def rocketpy_encoder (obj ):
0 commit comments