feat(cycle): ObservationPlan and Observer, an auditable OSSE observation generator
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design, data
Hướng nghiên cứu
Start with packages/pipekit-cycle/src/pipekit_cycle/protocols.py and obs.py to understand the noise and observation operator interfaces, then implement the named public symbols in packages/pipekit-cycle/src/pipekit_cycle/observer.py and re-export them from pipekit_cycle/__init__.py. Add tests for the sampling, reproducibility, stationary and moving plans, and recorded noise invariants described in the issue. Done means the API, README OSSE section, tests, lint, and typecheck meet the listed requirements while the base install imports without NumPy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem / Request
Add an observation generator to pipekit-cycle: given a truth stream, decide which times and locations are observed, apply a noise model, and return the observations with a full audit record.
User Story
As a DA researcher running an observing system simulation experiment (OSSE), I want a reproducible, auditable way to make synthetic observations, so that I don't hand-roll sampling and noise for each experiment.
Motivation
pipekit-cycle has observation operators, which map a state to observation space, but nothing that makes observations from a known truth.
An OSSE is the standard way to evaluate a DA method, because a model run with known initial conditions gives a truth against which the analysis error is exactly measurable.
This is the input leg of the OSSE benchmark recipe, and it comes from the survey of DataAssimBench in jejjohnson/xrtoolz#44.
Proposed API
# Shapes: T truth times; D_x state size; D_y observed locations
# proposed (this issue)
@dataclass(frozen=True)
class ObservationPlan:
time_indices: tuple[int, ...]
location_indices: tuple[tuple[int, ...], ...] # one entry if stationary, else one per time
stationary: bool
seed: int
@classmethod
def sample(
cls, n_times: int, n_locations: int, *,
time_density: float | None = None, time_count: int | None = None,
location_density: float | None = None, location_count: int | None = None,
stationary: bool = True, seed: int = 0,
) -> "ObservationPlan": ...
@dataclass(frozen=True)
class ObservationRecord:
plan: ObservationPlan
errors: tuple[Any, ...] # the noise actually drawn, one entry per time
class Observer(Operator):
def __init__(self, plan, obs_op, noise=None, *, select=default_select): ...
def _apply(self, truth: Sequence[Any]) -> tuple[list[Any], ObservationRecord]: ...
# usage
# y_t = H(x_t)[S_t] + ε_t
observer = Observer(ObservationPlan.sample(100, 40, time_density=0.5, location_count=6), pc.IdentityObs(), noise)
observations, record = observer(truth)
- Exactly one of density and count may be set on each axis, and neither means every index.
select(carrier, indices)picks locations, defaulting tocarrier[indices], so that the module stays free of array imports.- A moving network has one
location_indicesentry per time.
Mathematical Notes
Here x_t is the truth at time t, H is the observation operator, S_t is the set of observed locations at time t, and ε_t is the noise drawn from the ObservationNoise model:
y_t = H(x_t)[S_t] + \varepsilon_t
The invariant the tests pin is that the record reproduces the observations: y_t − H(x_t)[S_t] equals the recorded ε_t exactly.
Design Snapshot
The plan is pure-Python index bookkeeping using random.Random(seed), because pipekit-cycle's base install has no array dependency.
Noise is array work, so it goes through the existing protocol, from packages/pipekit-cycle/src/pipekit_cycle/protocols.py @ 7c446f1:
class ObservationNoise(Protocol):
def covariance(self) -> Any: ...
def sample(self, key: Any, shape: tuple[int, ...]) -> Any: ...
Each time's key comes from the plan's seed and the time index, so that one time can be regenerated alone.
References & Existing Code
Observerin DataAssimBench,dabench/observer/_observer.py(https://github.com/StevePny/DataAssimBench), not copied: it is welded to itsStateVectorcontainer.IdentityObs,LinearObs,CallableObs,CompositeObsinobs.py@7c446f1.
Implementation Steps
- Add
ObservationPlan,ObservationRecordandObserverinpackages/pipekit-cycle/src/pipekit_cycle/observer.py. - Re-export them from
pipekit_cycle/__init__.py. - Add
plantoObserver.get_config, withforbid_in_yamlonly ifobs_oprequires it.
Definition of Done
- Code lands at the intended path.
- Public API exported via
pipekit_cycle/__init__.py. - Tests pass:
make test. - Lint + typecheck pass:
make lint && make typecheck. - Docstrings (Google-style) on all public symbols.
- pipekit-cycle's base install still imports without NumPy.
Testing
- Equal seeds give equal plans, and different seeds give different plans.
-
time_density=0.5on 100 times observes 50 times, and setting a density and a count together raisesValueError. - A stationary plan has one location entry, and a moving plan has one per time.
- With noise, y_t − H(x_t)[S_t] equals the recorded ε_t to 0.
- With
noise=None, every recorded error isNoneand y_t equals H(x_t)[S_t].
Documentation
- A short OSSE section in pipekit-cycle's README.
Relationships
- Parent (theme epic): jejjohnson/xrtoolz#149
- Blocks: jejjohnson/xrtoolz#168
- Related: jejjohnson/xrtoolz#44, jejjohnson/geotoolz#722
- Ngôn ngữ chính
- Python
- Star
- 0
- Fork
- 0
- Merge trung bình
- 3 giờ 50 phút
- Pull request đã merge (30 ngày)
- 143
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của jejjohnson/pipekit
-
area:code layer:0-primitives priority:p2 type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jejjohnson/pipekit#296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:code type:feature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
jejjohnson/pipekit#411 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:code type:feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
jejjohnson/pipekit#410 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:code type:feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
jejjohnson/pipekit#409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:code type:feature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
jejjohnson/pipekit#408 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của jejjohnson/pipekit
Issue tương tự
-
A JSON chat answer blocks the backend event loop for the whole RAG runCó thể đã có người làm @NopeCharon đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
The-OpenROAD-Project/ORAssistant#656 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorCó thể đã có người làm @jejjohnson đã nhận hôm nay. Đang mởtype:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
jejjohnson/integrix#144 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
finos/ai-governance-framework#459 ·
-
slurm: a case outcome nested too deep crashes status/collect instead of reading as no outcomeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày