itasc.contact_analysis.curation¶
The curation artifact — hand QC exclusions joined onto the measurement tables.
A separate, git-versioned tidy table kept apart from the disposable measurement tables (the dividing line is who made the decisions in it). Schema, one row per exclusion:
experiment_id, position_id, frame, excluded, exclusion_reason
frame empty/NA means the whole position (every frame). At export the table
is left-joined onto a measurement table by the natural keys the table already
carries — a frame-level exclusion matches (experiment_id, position_id, frame);
a position-level exclusion (frame NA) matches (experiment_id, position_id)
— marking matched rows excluded = True and copying the reason. Rows with no
entry default to kept; filter, don’t delete. The measurement source is never
mutated.
This restores the curation that commit 95df159 removed, re-keyed on the natural
keys (the old version, at rev 39d0df2, joined on a deterministic row id).
Module attributes
The columns a curation CSV carries. |
Functions
|
Return curation with one exclusion row added. |
|
Return table with |
An empty curation table with the canonical columns (object dtype). |
|
|
Drop the rows |
|
Read the curation CSV at path, or |
|
Return curation without the row(s) matching the given key. |
|
Write curation to path as CSV (creating the parent dir), index-free. |
- itasc.contact_analysis.curation.CURATION_COLUMNS = ('experiment_id', 'position_id', 'frame', 'excluded', 'exclusion_reason')¶
The columns a curation CSV carries.
- itasc.contact_analysis.curation.empty_curation()[source]¶
An empty curation table with the canonical columns (object dtype).
Object columns keep an empty
frameasNA(whole-position) rather than coercing the column to a float that would render NaN on write.- Return type:
- itasc.contact_analysis.curation.read_curation(path)[source]¶
Read the curation CSV at path, or
Nonewhen path is unset/absent.A missing file is not an error: an uncurated series simply keeps every row.
- itasc.contact_analysis.curation.write_curation(path, curation)[source]¶
Write curation to path as CSV (creating the parent dir), index-free.
- itasc.contact_analysis.curation.append_exclusion(curation, *, experiment_id, position_id, frame, reason)[source]¶
Return curation with one exclusion row added.
frame=Nonerecords a whole-position exclusion (stored as NA); a numeric frame records a single-frame exclusion. Idempotent on the(experiment_id, position_id, frame)key: an existing row with the same key is replaced (its reason updated) rather than duplicated. The input is not mutated.
- itasc.contact_analysis.curation.remove_exclusion(curation, *, experiment_id, position_id, frame)[source]¶
Return curation without the row(s) matching the given key.
frame=Noneremoves the whole-position row (frameNA); a numeric frame removes that single-frame row. A non-matching key is a no-op. The input is not mutated.
- itasc.contact_analysis.curation.apply_curation(table, curation)[source]¶
Return table with
excluded/exclusion_reasoncolumns marked.A measurement row is marked excluded iff a curation entry matches it by either
(experiment_id, position_id, frame)(frame-level) or(experiment_id, position_id)with the curationframeNA (position-level). Keys are compared as strings (CSV round-trips ids as strings);frameas an integer. Unmatched rows default to kept with an empty reason. The input frame is not mutated.
- itasc.contact_analysis.curation.filter_excluded(marked)[source]¶
Drop the rows
apply_curation()marked excluded.Returns
(kept, n_dropped)where kept has the two marker columns removed (so it matches the source schema) and a reset index. A frame with noexcludedcolumn is returned unchanged withn_dropped == 0.