Code Style¶
Code Formatting¶
Follow existing code style (black) and conventions
Maintain consistent indentation and spacing
When initializing numpy arrays (e.g., using
np.zeros,np.ones,np.empty, etc.), always specify thedtypeparameter (e.g.,dtype=float,dtype=int,dtype=object, etc.)
Variable Naming¶
Use descriptive variable names that clearly indicate their purpose
Use underscores for variable names
CRITICAL: Follow the formalized coordinate system naming conventions exactly as described in the
AXES_AND_COORDINATE_SYSTEMS.mdandAXES_POINTS_AND_FRAMES.mddocuments when naming vector-valued variables or things such as transformation and rotation matrices.Do not use
wcs(or any other abbreviation) for “wing cross section” or “WingCrossSection” in variable names. Instead, always write it out in full (e.g.,wing_cross_section,wing_cross_section_movement, etc.).
Running Black¶
Black is configured as a pre-commit hook. Run it with:
pre-commit run --all-files black
Running CodeSpell¶
CodeSpell is configured as a pre-commit hook. Run it with:
pre-commit run --all-files codespell
Running mypy¶
mypy is configured as a pre-commit hook. Run it with:
pre-commit run --all-files mypy
Imports¶
Import Ptera Software using the following pattern:
import pterasoftware as psBy default, place import statements at the top of the file and avoid imports inside functions or methods. The only exceptions are intentional lazy-import patterns (for example, using
importlib.import_moduleinside__getattr__for lazy loading) and cases where there is no other way to avoid circular imports.
Miscellaneous Guidelines¶
Use
np.deg2radandnp.rad2degfor angle conversions instead ofnp.radiansandnp.degreesor manual conversions.