Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3
BUG: issues with encoding and null field updates#60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
82ea8bb44a2ebc8cbd9399114d81cbefff8b721e282f36252597aad0ec9a5520286681476f88b82d55e67c4be89f8c4b79File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -28,7 +28,7 @@ async def read_motor_by_id(self, motor_id: str) -> Optional[MotorModel]: | ||
| @repository_exception_handler | ||
| async def update_motor_by_id(self, motor_id: str, motor: MotorModel): | ||
| await self.update_by_id( | ||
| motor.model_dump(exclude_none=True), data_id=motor_id | ||
| motor.model_dump(exclude_none=False), data_id=motor_id | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was not able to initialise fields back to null om update Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably because of some legacy rockets (e.g before drop null was deployed). Could you please test if this is also the case for rockets created after drop null was implemented? MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tested some old rockets and motors from April this year and null assignment is working fine for them. Not sure when this migration took place but it looks quite backward compatible. | ||
| ) | ||
| @repository_exception_handler | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -55,26 +55,28 @@ def for_flight(cls) -> 'DiscretizeConfig': | ||
| class InfinityEncoder(RocketPyEncoder): | ||
| def default(self, o): | ||
| obj = o | ||
| if ( | ||
| isinstance(obj, Function) | ||
| and not callable(obj.source) | ||
| and obj.__dom_dim__ == 1 | ||
| isinstance(o, Function) | ||
| and not callable(o.source) | ||
| and o.__dom_dim__ == 1 | ||
| ): | ||
| size = len(obj._domain) | ||
| size = len(o._domain) | ||
| reduction_factor = 1 | ||
| if size > 25: | ||
| reduction_factor = size // 25 | ||
| if reduction_factor > 1: | ||
| obj = obj.set_discrete( | ||
| obj.x_array[0], | ||
| obj.x_array[-1], | ||
| o = o.set_discrete( | ||
| o.x_array[0], | ||
| o.x_array[-1], | ||
| size // reduction_factor, | ||
| mutate_self=False, | ||
| ) | ||
| if isinstance(obj, Flight): | ||
| obj._Flight__evaluate_post_process() | ||
| solution = np.array(obj.solution) | ||
| if isinstance(o, Flight): | ||
| try: | ||
| o._Flight__evaluate_post_process | ||
| except Exception: | ||
| pass | ||
GabrielBarberini marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| solution = np.array(o.solution) | ||
| size = len(solution) | ||
| if size > 25: | ||
| reduction_factor = size // 25 | ||
| @@ -88,12 +90,12 @@ def default(self, o): | ||
| reduced_solution[:, i] = interp1d( | ||
| solution[:, 0], col, assume_sorted=True | ||
| )(reduced_scale) | ||
| obj.solution = reduced_solution.tolist() | ||
| o.solution = reduced_solution.tolist() | ||
| obj.flight_phases = None | ||
| obj.function_evaluations = None | ||
| o.flight_phases = None | ||
| o.function_evaluations = None | ||
| return super().default(obj) | ||
| return super().default(o) | ||
| def rocketpy_encoder(obj): | ||
Uh oh!
There was an error while loading. Please reload this page.