Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Hayasaka committed Sep 6, 2024
1 parent f3f0e32 commit c64d7ef
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
16 changes: 9 additions & 7 deletions lib/con_aero.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
# constraints about aerodynamic conditions

import numpy as np
from .utils_c import dynamic_pressure_pa, angle_of_attack_all_rad, q_alpha_pa_rad, dynamic_pressure_array_pa, angle_of_attack_all_array_rad, q_alpha_array_pa_rad
from .utils_c import (
dynamic_pressure_pa,
angle_of_attack_all_rad,
q_alpha_pa_rad,
dynamic_pressure_array_pa,
angle_of_attack_all_array_rad,
q_alpha_array_pa_rad,
)
from .coordinate_c import *



def dynamic_pressure_dimless(pos_eci_e, vel_eci_e, t_e, wind, units):
"""Returns dynamic pressure normalized by its maximum value."""
pos_eci = pos_eci_e * units[0]
Expand Down Expand Up @@ -69,11 +75,7 @@ def q_alpha_dimless(pos_eci_e, vel_eci_e, quat, t_e, wind, units):
pos_eci = pos_eci_e * units[0]
vel_eci = vel_eci_e * units[1]
t = t_e * units[2]
return (
dynamic_pressure_pa(pos_eci, vel_eci, t, wind)
* angle_of_attack_all_rad(pos_eci, vel_eci, quat, t, wind)
/ units[3]
)
return q_alpha_pa_rad(pos_eci, vel_eci, quat, t, wind) / units[3]


def q_alpha_array_dimless(pos_eci_e, vel_eci_e, quat, t_e, wind, units):
Expand Down
6 changes: 1 addition & 5 deletions lib/con_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,9 @@ def equality_jac_dynamics_velocity(xdict, pdict, unitdict, condition):
submat_vel[1::3, 1::3] = pdict["ps_params"].D(i)
submat_vel[2::3, 2::3] = pdict["ps_params"].D(i)

@profile
def dynamics(mass, pos, vel, quat, t):
if param[2] == 0.0:
if hasattr(mass, "__len__"):
return dynamics_velocity_NoAir(mass, pos, quat, param, units)
else:
return dynamics_velocity_NoAir_single(mass, pos, quat, param, units)
return dynamics_velocity_NoAir(mass, pos, quat, param, units)
else:
return dynamics_velocity(
mass, pos, vel, quat, t, param, wind, ca, units
Expand Down
3 changes: 2 additions & 1 deletion lib/con_init_terminal_knot.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def equality_jac_knot_LGR(xdict, pdict, unitdict, condition):

return jac


def equality_6DoF_LGR_terminal(xdict, pdict, unitdict, condition):
"""Equality constraint about terminal condition."""

Expand Down Expand Up @@ -370,7 +371,7 @@ def equality_6DoF_LGR_terminal(xdict, pdict, unitdict, condition):

return np.concatenate(con, axis=None)

@profile

def equality_jac_6DoF_LGR_terminal(xdict, pdict, unitdict, condition):
"""Jacobian of equality_terminal."""

Expand Down
4 changes: 0 additions & 4 deletions lib/con_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ def yb_r_dot(pos_eci, quat_eci2body):
yb_dir_eci = quatrot(conj(quat_eci2body), np.array([0.0, 1.0, 0.0]))
return yb_dir_eci.dot(normalize(pos_eci))

<<<<<<< HEAD:lib/con_trajectory.py

@jit(nopython=True)
=======
>>>>>>> e71cae8 (remove numba dependincies):constraints_b.py
def roll_direction_array(pos, quat):
"""Returns array of sine of roll angles for each state values."""
return np.array([yb_r_dot(pos[i], quat[i]) for i in range(len(pos))])
Expand Down
1 change: 1 addition & 0 deletions lib/con_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from user_constraints import equality_user, inequality_user
from .jac_fd import jac_fd


def equality_jac_user(xdict, pdict, unitdict, condition):
"""Jacobian of user-defined equality constraint."""
if equality_user(xdict, pdict, unitdict, condition) is not None:
Expand Down

0 comments on commit c64d7ef

Please sign in to comment.