Logo Xarray Linked Data

Xarray Linked Data

Cộng đồng
ericmjl
xarray-linked-data

Design, build, and manipulate xarray data structures for highly linked, multi-dimensional data where measurements, derived estimates, and model outputs share coordinates and must stay synchronized. Use when: structuring laboratory/experimental/multi-assay data in xarray (Dataset or DataTree); designing coordinate systems for linked data; writing custom xarray indexes (custom Index subclasses, CoordinateTransforms, interval-based or N-D derived coordinate indexes); selecting/aligning/computing across linked xarray variables; linking data across experiments through shared coordinates or custom indexes; reading or manipulating xarray objects to help a user accomplish analysis goals; converting scattered CSV/Parquet/HDF5 workflows into unified xarray datasets. Covers: progressive data accumulation, coordinate design, sel/isel/where/align, groupby/rolling/ coarsen/resample, Dataset vs DataTree, custom index patterns (PeriodicIndex, RangeIndex, CoordinateTransform, NDIndex, DimensionInterval), and cross-experiment linking.

Tổng quan

Nhà phát hànhericmjl
Kho mãskills
Tên kỹ năngxarray-linked-data
Sao
41
Bản fork
5
Tệp đi kèm
9
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 9 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được ericmjl công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Xarray Linked Data trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/ericmjl/skills/tree/main/skills/xarray-linked-data
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ericmjl/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/xarray-linked-data .claude/skills/xarray-linked-data
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Xarray Linked Data trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Xarray Linked Data ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Xarray Linked Data không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Xarray Linked Data

Xarray is the natural home for highly linked data: measurements, derived estimates, features, and model outputs sharing coordinates and staying synchronized through selection, computation, and storage.

When to use this skill

  • Designing xarray data structures for multi-dimensional, multi-assay data
  • Linking data from different experiments through shared coordinates
  • Writing custom xarray indexes (when default PandasIndex is insufficient)
  • Reading/manipulating xarray to accomplish analysis goals
  • Converting scattered-file workflows into unified coordinate-aligned datasets

Core mental model

Experiment Design          xarray Structure
─────────────────          ────────────────
Samples/subjects    →      dimension coordinates (e.g. molecule, sample)
Experimental factors →     dimension coordinates (e.g. target, cell_line, treatment)
Raw measurements    →      data variables (e.g. od450, intensity, uptake_pct_positive)
Derived estimates   →      data variables (e.g. ec50_nm, kd_nm)
Uncertainty         →      data variables along a `draw` dim (e.g. ec50_nm_posterior)
Features            →      data variables along a feature dimension
Splits/assignments  →      boolean mask variables along a split_type dimension
Physical units      →      coordinate attrs or CoordinateTransform indexes

Key principle: every piece of data knows its own coordinates. When you slice, everything stays aligned. No manual index-matching across files.

Quick reference

Design data structures

Read references/data-structure-design.md for full guidance.

python
# Progressive accumulation: start with raw data, add layers
ds = xr.Dataset(
    {"expression": (["molecule", "treatment", "replicate"], raw_data)},
    coords={
        "molecule": mol_ids,
        "treatment": ["control", "low", "high"],
        "replicate": ["r1", "r2", "r3"],
    },
)
# Add derived estimates — auto-aligned by coordinates
ds = ds.assign({"ec50": (["molecule"], ec50_estimates)})
# Add features along a new dimension
ds = ds.assign({"features": (["molecule", "feature"], feat_matrix)})

When to use Dataset vs DataTree:

  • Dataset: all variables share compatible dimensions/coordinates
  • DataTree: variables live on different grids (different resolutions, different assay types with incompatible shapes); use tree nodes with coordinate inheritance

Select and manipulate

Read references/selection-and-manipulation.md for full guidance.

python
# Label-based selection — everything stays aligned
# (.drop_vars() strips the leftover coordinate so the mask aligns cleanly)
train = ds.where(
    ds.train_mask.sel(split_type="random_80_20").drop_vars("split_type"), drop=True
)

# Pointwise indexing with shared dimension
targets = ds.sel(
    molecule=xr.DataArray(["LNP_003", "LNP_007"], dims="query"),
    method="nearest",
)

# Alignment with explicit join type
aligned_a, aligned_b = xr.align(ds_a, ds_b, join="inner")

Build custom indexes

Read references/custom-indexes.md for full guidance, including complete reference implementations.

When default PandasIndex (1-D monotonic labels) is insufficient, build a custom index. Three patterns, escalating complexity:

  1. Index subclass + hand-written sel — for custom selection logic (periodic/wrapping coordinates, domain-specific nearest-neighbor)
  2. CoordinateTransform subclass — for coordinate mappings with forward/reverse (pixel to physical, lazy z-stacks, nonlinear warps)
  3. Meta-index — wraps other indexes for linked multi-coordinate selection (interval cross-slicing, N-D derived coordinates)
python
# Register a custom index
ds = ds.drop_indexes("angle").set_xindex("angle", PeriodicIndex, period=360.0)

Link across experiments

Read references/cross-experiment-linking.md for full guidance.

python
# DataTree for multi-assay hierarchy: root defines the shared `molecule`
# coordinate, child nodes inherit it (a "deep" tree -- see nb5)
tree = xr.DataTree.from_dict({
    "/": xr.Dataset(coords={"molecule": mol_ids}),
    "/characterization/dls": dls_ds,
    "/characterization/hplc": hplc_ds,
    "/bioassays/binding": binding_ds,
    "/bioassays/flow_cytometry": flow_ds,
})
# One selection propagates to every node
tree.sel(molecule="LNP_007")

Reference notebooks

Self-verifying marimo notebooks with synthetic data covering diverse assay domains (cargo delivery, binding assays, cell-based assays, genomics, functional readouts, analytical chemistry). Run each with uv run:

NotebookTopic
01_linked_data_design.pyProgressive accumulation across 6 assay domains; PyMC posteriors on a draw dim; flat DataTree + Zarr persistence -- all linked by molecule
02_periodic_and_transform_indexes.pyPeriodicIndex + CoordinateTransform (flow cytometry, microscopy, mass spec)
03_ndindex_time_locking.pyNDIndex for N-D derived coordinates, time-locking to dosing events
04_linked_intervals_cross_slicing.pyDimensionInterval for concentration x time interval linking
05_cross_experiment_datatree.pyDeep DataTree (root-coordinate inheritance) for incompatible grids -- contrasted with Notebook 1's flat tree; cross-assay queries

API instability note

Custom indexes are an experimental xarray feature (since v2022.06.0). The API may change without deprecation notice. Pin xarray versions in notebooks and check the official docs for current API.

Key references

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Xarray Linked Data làm được gì?

Design, build, and manipulate xarray data structures for highly linked, multi-dimensional data where measurements, derived estimates, and model outputs share coordinates and must stay synchronized. Use when: structuring laboratory/experimental/multi-assay data in xarray (Dataset or DataTree); designing coordinate systems for linked data; writing custom xarray indexes (custom Index subclasses, CoordinateTransforms, interval-based or N-D derived coordinate indexes); selecting/aligning/computing across linked xarray variables; linking data across experiments through shared coordinates or custo...

Vì sao nên dùng Xarray Linked Data trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Xarray Linked Data là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Xarray Linked Data trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/ericmjl/skills/tree/main/skills/xarray-linked-data. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Xarray Linked Data?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Xarray Linked Data với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Xarray Linked Data với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Xarray Linked Data có miễn phí không?

Có. Kỹ năng này được ericmjl phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇