| name | add_type |
| description | gwexpyに新しい配列型(Array/Series/Field)とコレクションを実装する |
Implement GWExPy Type
This skill guides the implementation of new array/field types in gwexpy, ensuring consistency with the existing class hierarchy, metadata management, and documentation standards.
Workflow
1. Survey & Plan
- Identify Base Class: Inherit from
gwexpy.types.Array, Array2D, or similar.
- Metadata: Determine new metadata slots needed (e.g.,
_axis0_name, _unit).
- Behavior: Define slicing behavior (does it drop dimensions or maintain them?), arithmetic rules, and domain logic (FFT, etc.).
2. Implementation: Core Class
3. Implementation: Collections
- File:
gwexpy/types/yourtype_collections.py (or inside the same file if small).
- List Class: Inherit
list. Add batch methods (e.g., process_all).
- Dict Class: Inherit
dict. Add batch methods.
4. Integration
- Export: Add the new classes to
gwexpy/types/__init__.py.
- Docs:
- Create
docs/reference/en/YourType.md and docs/reference/ja/YourType.md.
- Add to
docs/reference/{en,ja}/index.rst.
5. Testing
- Location:
tests/types/test_yourtype.py.
- Coverage:
- Construction (from array, from list, with units).
- Metadata persistence.
- Slicing behavior (key feature).
- Arithmetic operations.
- Collection behavior.
Key Considerations
- Quantity Compatibility: gwexpy types are often subclasses of
astropy.units.Quantity. Ensure unit handling works.
- Axis Management: If managing axes, use
AxisApiMixin or look at Array3D/Array4D for how to sync separate axis properties with the array shape.
- Documentation: Always provide both English and Japanese API references.