Visualize_Fields
by tatsuki-washimi
多次元フィールドデータの描画API実装、およびプロット軸のスケール・目盛・表示範囲の診断・修正を行う
Skill Details
Repository Files
2 files in this skill directory
name: visualize_fields description: 多次元フィールドデータの描画API実装、およびプロット軸のスケール・目盛・表示範囲の診断・修正を行う
Visualize Fields Best Practices
When implementing visualization for multi-dimensional data (3D, 4D, Matrix, etc.), design using the following three-layer structure to ensure maintainability and physical accuracy.
1. Infrastructure (Coordinate & Utility Layer)
Separate the conversion logic between physical coordinates and array indices from the class body, and implement it as reusable functions.
nearest_index(axis, value): A nearest-neighbor search that ensures mutual conversion between unit systems (Astropy Units).select_value(data, mode): Extractreal,abs,power, etc., from complex data.- Location:
gwexpy/plot/utils.pyor_coord.py. This prevents the data type classes (Types layer) from directly depending on plotting libraries (such as Matplotlib).
2. Extraction API Layer
Add methods to data type classes that generate "subsets" for visualization.
extract_points/slice_map2d: Returns data formatted for immediate use in drawing.- Convention: Maintain the original class (e.g., Field4D) where possible, or return standard
TimeSeries/FrequencySeries.
3. Plotting API Layer
Drawing methods called directly by the user.
- Naming Convention:
plot_map2d,plot_profile,plot_timeseries_points, etc. - Spectral Visualization:
freq_space_map(Waterfall, etc.) is a 2D map where the time axis is replaced by a frequency axis.- When plotting spectral density (PSD), consider using a log scale (
norm=LogNormorset_yscale('log')) by default.
Physical Consistency Checklist
- Unit Propagation: Does the unit become
unit^2inpowermode? Isangleinrad? - Coordinate Accuracy: Do the values of the plotted axis correspond correctly to the physical axis of the original data via
nearest_index? - Dimensional Maintenance: Are dimensions unexpectedly lost (Squeeze) through slicing operations, breaking the drawing logic?
- Memory Efficiency: For large-scale data, are unnecessary copies (
copy=True) avoided?
Debug Axes
プロットの軸スケール(対数軸等)、目盛、表示範囲の不具合を診断・修正:
Related Skills
Reactome Database
Query Reactome REST API for pathway analysis, enrichment, gene-pathway mapping, disease pathways, molecular interactions, expression analysis, for systems biology studies.
Mermaid Diagrams
Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts,
Polars
Fast DataFrame library (Apache Arrow). Select, filter, group_by, joins, lazy evaluation, CSV/Parquet I/O, expression API, for high-performance data analysis workflows.
Reactome Database
Query Reactome REST API for pathway analysis, enrichment, gene-pathway mapping, disease pathways, molecular interactions, expression analysis, for systems biology studies.
Mermaidjs V11
Create diagrams and visualizations using Mermaid.js v11 syntax. Use when generating flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, user journeys, timelines, architecture diagrams, or any of 24+ diagram types. Supports JavaScript API integration, CLI rendering to SVG/PNG/PDF, theming, configuration, and accessibility features. Essential for documentation, technical diagrams, project planning, system architecture, and visual communication.
Monitoring Apis
|
Validating Performance Budgets
Validate application performance against defined budgets to identify regressions early. Use when checking page load times, bundle sizes, or API response times against thresholds. Trigger with phrases like "validate performance budget", "check performance metrics", or "detect performance regression".
Tracking Application Response Times
Track and optimize application response times across API endpoints, database queries, and service calls. Use when monitoring performance or identifying bottlenecks. Trigger with phrases like "track response times", "monitor API performance", or "analyze latency".
Databuddy
Integrate Databuddy analytics into applications using the SDK or REST API. Use when implementing analytics tracking, feature flags, custom events, Web Vitals, error tracking, LLM observability, or querying analytics data programmatically.
Datasette Plugin Writer
Guide for writing Datasette plugins. This skill should be used when users want to create or develop plugins for Datasette, including information about plugin hooks, the cookiecutter template, database APIs, request/response handling, and plugin configuration.
