aero_filewrite#
Pivots a list[StResult] into an AeroDatabase containing numpy arrays shaped for stability and control derivative lookup tables.
Convert list[StResult] into structured aero lookup tables.
- class avl_aero_tables.aero_filewrite.AeroDatabase(date, Sref=0.0, Cref=0.0, Bref=0.0, Xref=0.0, Yref=0.0, Zref=0.0, total_stab=<factory>, total_ctrl=<factory>, stab_deriv=<factory>, ctrl_deriv=<factory>)[source]#
Bases:
objectAero coefficient tables built from a sweep of AVL .st results.
total_stab[coef] → StabTable total coefficients, neutral-control, indexed α×β total_ctrl[coef_surface] → CtrlTable total coefficients, all deflections, indexed α×β×δ stab_deriv[key] → StabTable stability derivatives (CLa, CLb, CLp, …, Cnr), neutral-control only, indexed α×β ctrl_deriv[key] → StabTable control derivatives (CL_d01_flap, …), neutral-control only, indexed α×β
- Parameters:
- Bref: float = 0.0#
- Cref: float = 0.0#
- Sref: float = 0.0#
- Xref: float = 0.0#
- Yref: float = 0.0#
- Zref: float = 0.0#
- date: str#
- class avl_aero_tables.aero_filewrite.CtrlTable(coef, surface, ctrl_name, alpha, beta, defl, data)[source]#
Bases:
object3-D coefficient lookup table indexed by (alpha, beta, deflection).
- Parameters:
coef (str)
surface (str)
ctrl_name (str)
alpha (ndarray)
beta (ndarray)
defl (ndarray)
data (ndarray)
- alpha: ndarray#
- beta: ndarray#
- coef: str#
- ctrl_name: str#
- data: ndarray#
- defl: ndarray#
- surface: str#
- class avl_aero_tables.aero_filewrite.StabTable(coef, alpha, beta, data)[source]#
Bases:
object2-D coefficient lookup table indexed by (alpha, beta).
Populated only for runs where all control surfaces are at neutral (0 deg).
- Parameters:
coef (str)
alpha (ndarray)
beta (ndarray)
data (ndarray)
- alpha: ndarray#
- beta: ndarray#
- coef: str#
- data: ndarray#
- avl_aero_tables.aero_filewrite.aero_filewrite(results)[source]#
Pivot list[StResult] into an AeroDatabase of (alpha × beta [× defl]) tables.
Stability tables are populated only for neutral-control runs (all deflections zero). Control tables are populated for all runs regardless of deflection.
- Parameters:
results (list[StResult]) – Output from avl_sweep.run() or st_fileread().
- Returns:
Structured lookup tables keyed by coefficient name (and surface name for control tables).
- Return type:
Example
>>> import tempfile >>> from avl_aero_tables import avl_sweep >>> from avl_aero_tables.aero_filewrite import aero_filewrite >>> with tempfile.TemporaryDirectory() as tmp: ... results = avl_sweep( ... "examples/bd/bd.avl", alpha=[-5, 0, 5, 10], beta=[0], out_dir=tmp ... ) >>> db = aero_filewrite(results) >>> db.total_stab["CLtot"].data.shape (4, 1) >>> list(db.total_stab) ['CLtot', 'CYtot', 'CDtot', 'Cltot', 'Cmtot', 'Cntot']
- avl_aero_tables.aero_filewrite.ctrl_deriv_to_dataframe(results)[source]#
Return a DataFrame of control derivatives for neutral-control cases only.
Columns: filename, Alpha, Beta, CLd01, CYd01, …, Cnd{n} (6 × n_surfaces columns). One row per neutral-control (α, β) point. AVL notation: CLd01 = ∂CL/∂δ_surface1, no “tot” suffix.
- Parameters:
results (list[StResult])
- Return type:
pd.DataFrame
- avl_aero_tables.aero_filewrite.results_to_dataframe(results)[source]#
Convert a list of StResult to a pandas DataFrame (one row per case).
Each row contains the filename plus every key from StResult.data (Alpha, Beta, CLtot, control deflections, stability derivatives, etc.). This is the recommended format for saving results to CSV, HDF5, Parquet, or any other tabular format.
Example
>>> import tempfile >>> from avl_aero_tables import avl_sweep >>> from avl_aero_tables.aero_filewrite import results_to_dataframe >>> with tempfile.TemporaryDirectory() as tmp: ... results = avl_sweep( ... "examples/bd/bd.avl", alpha=[0, 5], beta=[0], out_dir=tmp ... ) >>> df = results_to_dataframe(results) >>> "Alpha" in df.columns and "CLtot" in df.columns True >>> df.to_csv("tests/sweep.csv", index=False)
- Parameters:
results (list[StResult])
- Return type:
pd.DataFrame
- avl_aero_tables.aero_filewrite.stab_deriv_to_dataframe(results)[source]#
Return a DataFrame of stability derivatives for neutral-control cases only.
Columns: filename, Alpha, Beta, CLa, CLb, …, Cnr (30 derivative columns). One row per neutral-control (α, β) point.
- Parameters:
results (list[StResult])
- Return type:
pd.DataFrame