From bcefced27d881b18a8e7c01e930e54c1a5fe2486 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 23:37:22 +0000 Subject: [PATCH 01/45] Raw-v1 reading helpers, a per-class raw switch, and the round trip; subject family switched Phase 2 of the generic migration, on a small scale (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - +did2/+convert/+v1read: readDependsOn, readBase, readApp, readStamp read the raw v1 document as NDI's templates (locked NDI-matlab main 3cb19a8) define it, and drop nothing: a losing depends_on key, a version, both app spellings, fields outside the template come back in other/extra. - did2.convert.rawV1Classes: the classes whose migrator takes raw v1. v1_to_v2 hands those to their +migrators_j migrator without universalRenames or superclass migrators; a carry is the untouched v1 source. Counted as legacy_ndi_document.bodies_read_raw_v1 (in the denominator). Option 'RawV1Classes' ({} = everything as before). - +did2/+convert/+roundtrip: check rebuilds the v1 document from the emitted V2 documents with the class's inverse and compares leaf by leaf (matched / not set / restated / exempt / lost / invented / unplaced). - subject and subject_group switched, reading through the helpers; carries keep citing carry-033 / carry-034. - Tests: testV1Read, testRawV1RoundTrip (NDI writer shapes; two broken inputs the round trip must catch; the raw path emits the same converted documents as the renamed path). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+did2/+convert/+migrators_j/Contents.m | 4 +- src/did/+did2/+convert/+migrators_j/subject.m | 37 ++- .../+convert/+migrators_j/subject_group.m | 46 ++- src/did/+did2/+convert/+roundtrip/check.m | 182 ++++++++++++ .../+convert/+roundtrip/private/classNameOf.m | 8 + .../+convert/+roundtrip/private/fieldText.m | 7 + .../+roundtrip/private/flattenLeaves.m | 47 ++++ .../+roundtrip/private/isEmptyValue.m | 11 + .../+roundtrip/private/isEntityOfType.m | 10 + .../+convert/+roundtrip/private/rebuildBase.m | 32 +++ .../+roundtrip/private/resolveSteps.m | 36 +++ .../+convert/+roundtrip/private/sameValue.m | 19 ++ src/did/+did2/+convert/+roundtrip/subject.m | 56 ++++ .../+did2/+convert/+roundtrip/subject_group.m | 96 +++++++ .../+did2/+convert/+v1read/private/textOf.m | 16 ++ src/did/+did2/+convert/+v1read/readApp.m | 66 +++++ src/did/+did2/+convert/+v1read/readBase.m | 68 +++++ .../+did2/+convert/+v1read/readDependsOn.m | 113 ++++++++ src/did/+did2/+convert/+v1read/readStamp.m | 92 ++++++ src/did/+did2/+convert/Contents.m | 14 +- src/did/+did2/+convert/rawV1Classes.m | 39 +++ src/did/+did2/+convert/v1_to_v2.m | 185 +++++++----- tests/+did2/+unittest/testRawV1RoundTrip.m | 265 ++++++++++++++++++ tests/+did2/+unittest/testV1Read.m | 227 +++++++++++++++ tests/+did2/fixtures/ndi_templates/app.json | 22 ++ tests/+did2/fixtures/ndi_templates/base.json | 17 ++ .../+did2/fixtures/ndi_templates/subject.json | 17 ++ .../fixtures/ndi_templates/subject_group.json | 14 + tools/census_digest.py | 6 + 29 files changed, 1668 insertions(+), 84 deletions(-) create mode 100644 src/did/+did2/+convert/+roundtrip/check.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/classNameOf.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/fieldText.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/flattenLeaves.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/isEmptyValue.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/isEntityOfType.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/rebuildBase.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/resolveSteps.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/sameValue.m create mode 100644 src/did/+did2/+convert/+roundtrip/subject.m create mode 100644 src/did/+did2/+convert/+roundtrip/subject_group.m create mode 100644 src/did/+did2/+convert/+v1read/private/textOf.m create mode 100644 src/did/+did2/+convert/+v1read/readApp.m create mode 100644 src/did/+did2/+convert/+v1read/readBase.m create mode 100644 src/did/+did2/+convert/+v1read/readDependsOn.m create mode 100644 src/did/+did2/+convert/+v1read/readStamp.m create mode 100644 src/did/+did2/+convert/rawV1Classes.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTrip.m create mode 100644 tests/+did2/+unittest/testV1Read.m create mode 100644 tests/+did2/fixtures/ndi_templates/app.json create mode 100644 tests/+did2/fixtures/ndi_templates/base.json create mode 100644 tests/+did2/fixtures/ndi_templates/subject.json create mode 100644 tests/+did2/fixtures/ndi_templates/subject_group.json diff --git a/src/did/+did2/+convert/+migrators_j/Contents.m b/src/did/+did2/+convert/+migrators_j/Contents.m index 2aa070ea..6f1e539b 100644 --- a/src/did/+did2/+convert/+migrators_j/Contents.m +++ b/src/did/+did2/+convert/+migrators_j/Contents.m @@ -983,8 +983,8 @@ % subject % Brainstorm-J migrator: a v1 subject -> one `entity` of type `organism`, id % preserved, carrying `local_identifier` and `description`. A v1 subject's -% handle was optional, so an empty or missing one is filled from the preserved -% document id (jEnsureLocalId). +% handle was optional; one that states none is carried whole as v1 +% (carry-033). % subject_group % Brainstorm-J migrator: did_v1 subject_group -> an `entity` of type `group`, % id preserved (+ one member_of directed_relation per member). diff --git a/src/did/+did2/+convert/+migrators_j/subject.m b/src/did/+did2/+convert/+migrators_j/subject.m index 27c68fc5..2dd3af83 100644 --- a/src/did/+did2/+convert/+migrators_j/subject.m +++ b/src/did/+did2/+convert/+migrators_j/subject.m @@ -1,8 +1,8 @@ function v2Body = subject(preBody) %SUBJECT Brainstorm-J migrator: a v1 subject -> one `entity` of type % `organism`, id preserved, carrying `local_identifier` and `description`. A -% v1 subject's handle was optional, so an empty or missing one is filled from -% the preserved document id (jEnsureLocalId). +% v1 subject's handle was optional; one that states none is carried whole as +% v1 (carry-033). % did-schema #88 (V_eta_entity_composition_plan.md sec. 4, signed 2026-10-08): % `subject` is gone; a v1 subject becomes one `entity` with its id preserved, @@ -10,11 +10,40 @@ % v1 subject class names the animal an experiment is about. That default is % PROPOSED, not signed: a v1 subject that is a culture or a plate takes it too % until a source field says otherwise. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames. Every v1 field, from NDI's +% subject.json and base.json at the locked NDI-matlab `main` (3cb19a8), and +% where it goes; did2.convert.roundtrip.subject rebuilds the v1 document from +% the output and testRawV1RoundTrip compares the two: +% +% base.id -> base.id (preserved) +% base.session_id -> the session_id edge (v1_to_v2, on the way out) +% base.datestamp -> base.creation_timestamp (v1_to_v2, on the way out) +% base.name -> not written (#73 item 54). ndi.subject's +% newdocument writes it equal to +% local_identifier; +NDIMaker/subjectMaker +% leaves the template's ''. Both are recoverable +% ([lossless means round trip], [writer default +% is not set]); any other value is NOT, and the +% round trip reports it (open, see +% testRawV1RoundTrip). +% subject.local_identifier -> entity.local_identifier (empty: carry-033) +% subject.description -> entity.description ('' is left out) +% document_class -> the V2 document_class the builder writes arguments preBody (1,1) struct end +base = did2.convert.v1read.readBase(preBody); +if ~strcmp(base.source, 'base') || ~any(strcmp(base.present, 'id')) + % as before the switch: a body with no base.id quarantines (it used to + % fail reading preBody.base.id) + error('did2:convert:subject:noId', ... + 'A v1 subject with no base.id cannot keep its id.'); +end blk = struct(); if isfield(preBody, 'subject') && isstruct(preBody.subject) && isscalar(preBody.subject) blk = preBody.subject; @@ -29,7 +58,7 @@ % filled with the document id (jEnsureLocalId); the document is carried % whole as v1. % carry-register: carry-033 - did2.convert.reportNote('carried_as_v1', 'subject', char(preBody.base.id), ... + did2.convert.reportNote('carried_as_v1', 'subject', base.id, ... '[carry-033] unplaced: no subject.local_identifier (it would be invented)'); v2Body = {preBody}; return; @@ -38,5 +67,5 @@ if isfield(blk, 'description') && ~isempty(blk.description) f.description = char(blk.description); end -v2Body = jEntity(preBody, 'organism', f, 'Id', char(preBody.base.id)); +v2Body = jEntity(preBody, 'organism', f, 'Id', base.id); end diff --git a/src/did/+did2/+convert/+migrators_j/subject_group.m b/src/did/+did2/+convert/+migrators_j/subject_group.m index e40b308b..c1331c46 100644 --- a/src/did/+did2/+convert/+migrators_j/subject_group.m +++ b/src/did/+did2/+convert/+migrators_j/subject_group.m @@ -21,6 +21,29 @@ % % The group id is preserved on the subject so inbound references (and the % member edges' parent) resolve to it. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames, so a member edge is read in its v1 +% spelling, {name, value} (did2.convert.v1read.readDependsOn). Every v1 +% field, from NDI's subject_group.json and base.json at the locked +% NDI-matlab `main` (3cb19a8), and where it goes; did2.convert.roundtrip. +% subject_group rebuilds the v1 document from the output: +% +% base.id -> the group entity's base.id (preserved), and +% each member_of relation's parent_id +% base.session_id -> the session_id edge (v1_to_v2, on the way out) +% base.datestamp -> base.creation_timestamp (v1_to_v2) +% base.name -> not written (#73 item 54); '' (the template +% default, +babu/import) or the group's name is +% recoverable; any other value is reported by +% the round trip +% depends_on subject_id_N -> one member_of relation each, in order +% subject_group (block) -> NDI's template block is EMPTY: a writer-shaped +% group states no name and is carried whole as +% v1 (carry-034, [unnamed groups named by the +% map]). `group_name` / `description` are read +% when a body carries them (DID-side fixtures). arguments preBody (1,1) struct @@ -34,9 +57,10 @@ desc = getCharField(sg, 'description'); end +base = did2.convert.v1read.readBase(preBody); groupId = ''; -if isfield(preBody, 'base') && isstruct(preBody.base) && isfield(preBody.base, 'id') - groupId = preBody.base.id; +if strcmp(base.source, 'base') + groupId = base.id; end % did-schema #88: an `entity` of type group (members by `member_of`), id @@ -64,20 +88,14 @@ % ===================== helpers ========================================= function ids = memberSubjectIds(preBody) -%MEMBERSUBJECTIDS The non-empty member dependencies (subject_id / subject_id_N). +%MEMBERSUBJECTIDS The non-empty member dependencies (subject_id / subject_id_N), +% read from the raw v1 `depends_on` (did2.convert.v1read.readDependsOn). ids = {}; -if ~isfield(preBody, 'depends_on') || ~isstruct(preBody.depends_on) - return; -end -for k = 1:numel(preBody.depends_on) - d = preBody.depends_on(k); - if ~isfield(d, 'name') || isempty(regexp(d.name, '^subject_id(_\d+)?$', 'once')) - continue; +deps = did2.convert.v1read.readDependsOn(preBody, 'Name', '^subject_id(_\d+)?$'); +for k = 1:numel(deps) + if ~isempty(deps(k).document_id) + ids{end+1} = char(deps(k).document_id); %#ok end - val = ''; - if isfield(d, 'value') && ~isempty(d.value); val = char(d.value); - elseif isfield(d, 'document_id') && ~isempty(d.document_id); val = char(d.document_id); end - if ~isempty(val); ids{end+1} = val; end %#ok end end diff --git a/src/did/+did2/+convert/+roundtrip/check.m b/src/did/+did2/+convert/+roundtrip/check.m new file mode 100644 index 00000000..72aef697 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/check.m @@ -0,0 +1,182 @@ +function report = check(v1Body, v2Docs) +%CHECK Rebuild a v1 document from what the migration emitted; compare. +% +% REPORT = did2.convert.roundtrip.check(V1BODY, V2DOCS) takes the RAW v1 +% document V1BODY and every document the migration emitted for it, V2DOCS +% (a cell of did2.document or structs, a struct array, or one struct: e.g. +% `result.migrated` of did2.convert.v1_to_v2 on that one document), rebuilds +% the v1 document from V2DOCS, and compares the rebuilt document with +% V1BODY field by field. +% +% WHY. Decided by Jess Haley, 2026-10-26 [migration reliability practices] +% (a): a round-trip check per class -- each converted document is migrated +% back to v1 and compared with its source -- built with each class's switch +% to raw v1 ([migrators read raw v1]). The test it serves is [lossless means +% round trip] (2026-10-26): a v1 value may be left unwritten only when it is +% 100% recoverable from what V2 keeps. +% +% HOW THE v1 DOCUMENT IS REBUILT. +% - CARRIED (V2DOCS is one document stamped 'did_v1'): the carried body +% IS the v1 document; its stamp is removed when V1BODY had none. +% - CONVERTED: the class's inverse, did2.convert.roundtrip. +% (class_name as v1 spells it, did2.convert.v1read.readStamp), returns +% the rebuilt body and a SPEC of what it cannot rebuild exactly: +% spec.equivalents struct array {path, values, why}: a v1 field V2 +% does not keep but that can only have been one of +% VALUES (a writer default, or a restatement of a +% kept value), each with the decision that allows it +% spec.unplaced cellstr: emitted content the inverse could not +% place (an unexpected document, a wrong type) +% A class with no inverse is an error (did2:convert:roundtrip:noInverse). +% +% HOW IT COMPARES. V1BODY is flattened to its leaf fields (a struct array +% such as `depends_on` by element). For each leaf: +% matched the rebuilt document holds the same value at the same path +% not_set the v1 value is EMPTY and the rebuilt has nothing there (an +% empty template default; [writer default is not set]) +% restated the v1 value is one of spec.equivalents' values for the path +% exempt `document_class.*` except `class_name`, on a CONVERTED +% document only: the v1 stamp (template paths, class_version, +% superclasses), which V2 replaces with its own and +% did2.convert.v1read.readStamp reads; the class name is +% compared +% lost anything else: V2 does not keep it +% and every leaf of the rebuilt document V1BODY does not have, with a +% non-empty value, is INVENTED. +% +% REPORT fields, the denominator first (Operating Rule 5): +% fields_inspected the number of leaf fields of V1BODY +% class_name, source_id, carried +% matched, not_set, restated, exempt cellstr of paths +% lost struct array {path, v1, rebuilt} +% invented cellstr of paths +% unplaced cellstr (from the inverse) +% ok true when lost, invented and unplaced are all empty +% +% See also did2.convert.rawV1Classes, did2.convert.roundtrip.subject, +% did2.convert.roundtrip.subject_group. + +arguments + v1Body (1,1) struct + v2Docs +end + +bodies = asBodies(v2Docs); +stamp = did2.convert.v1read.readStamp(v1Body); +base = did2.convert.v1read.readBase(v1Body); +report = struct('fields_inspected', 0, 'class_name', stamp.class_name, ... + 'source_id', base.id, 'carried', false, 'matched', {{}}, ... + 'not_set', {{}}, 'restated', {{}}, 'exempt', {{}}, ... + 'lost', struct('path', {}, 'v1', {}, 'rebuilt', {}), ... + 'invented', {{}}, 'unplaced', {{}}, 'ok', false); + +spec = struct('equivalents', struct('path', {}, 'values', {}, 'why', {}), ... + 'unplaced', {{}}); +if isscalar(bodies) && did2.schema.isV1Stamp(bodies{1}, 'Explicit', true) + report.carried = true; + rebuilt = bodies{1}; + % the 'did_v1' stamp is the carry's own ([passthrough stays v1: how]): + % put back the source's stamp, or none when it had none + hadStamp = isfield(v1Body, 'document_class') && isstruct(v1Body.document_class) ... + && isfield(v1Body.document_class, 'schema_version'); + if isfield(rebuilt, 'document_class') && isstruct(rebuilt.document_class) ... + && isfield(rebuilt.document_class, 'schema_version') + if hadStamp + rebuilt.document_class.schema_version = v1Body.document_class.schema_version; + else + rebuilt.document_class = rmfield(rebuilt.document_class, 'schema_version'); + end + end +else + fqn = ['did2.convert.roundtrip.', stamp.class_name]; + if isempty(stamp.class_name) || isempty(which(fqn)) + error('did2:convert:roundtrip:noInverse', ... + 'No round-trip inverse %s for v1 class "%s".', fqn, stamp.class_name); + end + [rebuilt, spec] = feval(str2func(fqn), bodies); +end +report.unplaced = spec.unplaced; + +origLeaves = flattenLeaves(v1Body); +report.fields_inspected = numel(origLeaves); +for k = 1:numel(origLeaves) + lf = origLeaves(k); + if ~report.carried && startsWith(lf.path, 'document_class') ... + && ~strcmp(lf.path, 'document_class.class_name') + report.exempt{end+1} = lf.path; + continue; + end + [rv, found] = resolveSteps(rebuilt, lf.steps); + if found && sameValue(lf.value, rv) + report.matched{end+1} = lf.path; + elseif isEmptyValue(lf.value) && (~found || isEmptyValue(rv)) + report.not_set{end+1} = lf.path; + elseif isRestated(spec.equivalents, lf.path, lf.value) + report.restated{end+1} = lf.path; + else + if ~found + rv = ''; + end + report.lost(end+1) = struct('path', lf.path, 'v1', {lf.value}, ... + 'rebuilt', {rv}); + end +end + +origPaths = {origLeaves.path}; +newLeaves = flattenLeaves(rebuilt); +for k = 1:numel(newLeaves) + lf = newLeaves(k); + if any(strcmp(lf.path, origPaths)) || isEmptyValue(lf.value) + continue; + end + if ~report.carried && startsWith(lf.path, 'document_class') + continue; + end + report.invented{end+1} = lf.path; +end + +report.ok = isempty(report.lost) && isempty(report.invented) ... + && isempty(report.unplaced); +end + +% ===================== helpers ========================================= + +function bodies = asBodies(v2Docs) +if isa(v2Docs, 'did2.document') + docs = cell(1, numel(v2Docs)); + for k = 1:numel(v2Docs) + docs{k} = v2Docs(k); + end + v2Docs = docs; +elseif isstruct(v2Docs) + v2Docs = num2cell(reshape(v2Docs, 1, [])); +end +if ~iscell(v2Docs) + error('did2:convert:roundtrip:badInput', ... + 'V2DOCS must be did2.document(s), struct(s) or a cell of them.'); +end +bodies = cell(1, numel(v2Docs)); +for k = 1:numel(v2Docs) + d = v2Docs{k}; + if isa(d, 'did2.document') + d = d.toStruct(); + end + bodies{k} = d; +end +end + +function tf = isRestated(equivalents, path, value) +tf = false; +for k = 1:numel(equivalents) + if ~strcmp(equivalents(k).path, path) + continue; + end + vals = equivalents(k).values; + for j = 1:numel(vals) + if sameValue(value, vals{j}) + tf = true; + return; + end + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/classNameOf.m b/src/did/+did2/+convert/+roundtrip/private/classNameOf.m new file mode 100644 index 00000000..89dd288d --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/classNameOf.m @@ -0,0 +1,8 @@ +function name = classNameOf(body) +%CLASSNAMEOF An emitted body's document_class.class_name ('' when none). +name = ''; +if isstruct(body) && isscalar(body) && isfield(body, 'document_class') ... + && isstruct(body.document_class) && isfield(body.document_class, 'class_name') + name = char(body.document_class.class_name); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/fieldText.m b/src/did/+did2/+convert/+roundtrip/private/fieldText.m new file mode 100644 index 00000000..c9501a98 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/fieldText.m @@ -0,0 +1,7 @@ +function s = fieldText(block, name) +%FIELDTEXT BLOCK.(NAME) as char, or '' when BLOCK does not have it. +s = ''; +if isstruct(block) && isscalar(block) && isfield(block, name) && ~isempty(block.(name)) + s = char(block.(name)); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/flattenLeaves.m b/src/did/+did2/+convert/+roundtrip/private/flattenLeaves.m new file mode 100644 index 00000000..16adbe0c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/flattenLeaves.m @@ -0,0 +1,47 @@ +function leaves = flattenLeaves(s) +%FLATTENLEAVES Every leaf field of a document body, with its path. +% +% LEAVES = flattenLeaves(S) is a struct array {path, steps, value}, one per +% leaf: a value that is not a struct (text, a number, a cellstr), or a +% struct that is empty or has no fields (an empty block or list). A struct +% array is walked by element, and so is ANY `depends_on` or `superclasses`, +% even of one element, so that `depends_on(1).name` is one path whether the +% list has one entry or several. A cell holding structs is walked by cell. +% STEPS is the path as a cell: a char is a field, a number a struct-array +% element, a 1x1 cell {k} a cell element (resolveSteps reads it back). + +leaves = struct('path', {}, 'steps', {}, 'value', {}); +leaves = walk(s, '', {}, '', leaves); +end + +function leaves = walk(v, path, steps, fieldName, leaves) +if isstruct(v) && ~isempty(v) && ~isempty(fieldnames(v)) + indexed = ~isscalar(v) || any(strcmp(fieldName, {'depends_on', 'superclasses'})); + if indexed + for k = 1:numel(v) + leaves = walkStruct(v(k), sprintf('%s(%d)', path, k), [steps, {k}], leaves); + end + else + leaves = walkStruct(v, path, steps, leaves); + end +elseif iscell(v) && ~isempty(v) && any(cellfun(@isstruct, v(:))) + for k = 1:numel(v) + leaves = walk(v{k}, sprintf('%s{%d}', path, k), [steps, {{k}}], '', leaves); + end +else + leaves(end+1) = struct('path', path, 'steps', {steps}, 'value', {v}); +end +end + +function leaves = walkStruct(v, path, steps, leaves) +fns = fieldnames(v); +for f = 1:numel(fns) + name = fns{f}; + if isempty(path) + p = name; + else + p = [path '.' name]; + end + leaves = walk(v.(name), p, [steps, {name}], name, leaves); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/isEmptyValue.m b/src/did/+did2/+convert/+roundtrip/private/isEmptyValue.m new file mode 100644 index 00000000..4c463d2f --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/isEmptyValue.m @@ -0,0 +1,11 @@ +function tf = isEmptyValue(v) +%ISEMPTYVALUE True for a value that states nothing: '', [], {}, an empty +% string, an empty struct array, or a struct with no fields. +if isstruct(v) + tf = isempty(v) || isempty(fieldnames(v)); +elseif isstring(v) + tf = isempty(v) || (isscalar(v) && strlength(v) == 0); +else + tf = isempty(v); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/isEntityOfType.m b/src/did/+did2/+convert/+roundtrip/private/isEntityOfType.m new file mode 100644 index 00000000..396a7cdb --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/isEntityOfType.m @@ -0,0 +1,10 @@ +function tf = isEntityOfType(body, handle) +%ISENTITYOFTYPE True when BODY is an `entity` whose type is HANDLE ('organism', +% 'group'), compared by node through did2.build.vocabularyHandle. +tf = false; +if ~strcmp(classNameOf(body), 'entity') || ~isfield(body, 'entity') ... + || ~isstruct(body.entity) || ~isfield(body.entity, 'type') + return; +end +tf = strcmp(did2.build.vocabularyHandle('entity_type', body.entity.type), handle); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/rebuildBase.m b/src/did/+did2/+convert/+roundtrip/private/rebuildBase.m new file mode 100644 index 00000000..dbb22a9f --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/rebuildBase.m @@ -0,0 +1,32 @@ +function [base, entity] = rebuildBase(body) +%REBUILDBASE The v1 `base` block (id, session_id, datestamp) of an emitted +% V2 document BODY, and its `entity` block (struct() when it has none). +% +% id base.id +% session_id base.session_id, or the `session_id` edge when `base` has no +% such field (did2.schema.cache.sessionIdOf: the edge v1_to_v2 +% writes on the way out) +% datestamp base.creation_timestamp (v1_to_v2 renames datestamp on the +% way out), else base.datestamp +% +% `name` is NOT rebuilt here: V2 never writes base.name (#73 item 54), so +% each inverse states what it can only have been (spec.equivalents). + +base = struct('id', '', 'session_id', '', 'datestamp', ''); +entity = struct(); +if isfield(body, 'base') && isstruct(body.base) && isscalar(body.base) + b = body.base; + if isfield(b, 'id') + base.id = char(b.id); + end + if isfield(b, 'creation_timestamp') + base.datestamp = char(b.creation_timestamp); + elseif isfield(b, 'datestamp') + base.datestamp = char(b.datestamp); + end +end +base.session_id = char(did2.schema.cache.sessionIdOf(body)); +if isfield(body, 'entity') && isstruct(body.entity) && isscalar(body.entity) + entity = body.entity; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/resolveSteps.m b/src/did/+did2/+convert/+roundtrip/private/resolveSteps.m new file mode 100644 index 00000000..40e866eb --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/resolveSteps.m @@ -0,0 +1,36 @@ +function [v, found] = resolveSteps(s, steps) +%RESOLVESTEPS The value at STEPS (from flattenLeaves) in S, if S has one. +% A numeric step k on a scalar struct reads element 1 when k is 1, so a +% one-entry list matches a one-entry list however each was built. +v = s; +found = true; +for i = 1:numel(steps) + st = steps{i}; + if ischar(st) + if isstruct(v) && isscalar(v) && isfield(v, st) + v = v.(st); + else + found = false; + end + elseif isnumeric(st) + if isstruct(v) && numel(v) >= st + v = v(st); + elseif iscell(v) && numel(v) >= st && isstruct(v{st}) + v = v{st}; % jsondecode's cell of differently-keyed entries + else + found = false; + end + else + k = st{1}; + if iscell(v) && numel(v) >= k + v = v{k}; + else + found = false; + end + end + if ~found + v = []; + return; + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/sameValue.m b/src/did/+did2/+convert/+roundtrip/private/sameValue.m new file mode 100644 index 00000000..f5416ab2 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/sameValue.m @@ -0,0 +1,19 @@ +function tf = sameValue(a, b) +%SAMEVALUE True when two v1 values state the same thing. +% Text compares as text (a string and a char of the same characters are +% equal; a char column and a row too); everything else by isequaln. Two +% EMPTY values of any type are the same (an empty field states nothing). +if isEmptyValue(a) && isEmptyValue(b) + tf = true; + return; +end +if isText(a) && isText(b) + tf = strcmp(reshape(char(a), 1, []), reshape(char(b), 1, [])); + return; +end +tf = isequaln(a, b); +end + +function tf = isText(v) +tf = ischar(v) || (isstring(v) && isscalar(v)); +end diff --git a/src/did/+did2/+convert/+roundtrip/subject.m b/src/did/+did2/+convert/+roundtrip/subject.m new file mode 100644 index 00000000..1bb0aec3 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/subject.m @@ -0,0 +1,56 @@ +function [v1, spec] = subject(bodies) +%SUBJECT Rebuild a v1 `subject` from what did2.convert.migrators_j.subject +% emitted: one `entity` of type organism. +% +% [V1, SPEC] = did2.convert.roundtrip.subject(BODIES): BODIES is a cell of +% the emitted document structs. V1 is the subject in NDI's v1 shape +% (subject.json + base.json at the locked NDI-matlab `main`, 3cb19a8): +% +% base.id, base.session_id, base.datestamp from the entity (rebuildBase) +% base.name the local identifier; '' is equally possible +% subject.local_identifier entity.local_identifier +% subject.description entity.description ('' when left out) +% +% SPEC.equivalents: `base.name` can only have been the local identifier +% (NDI ndi.subject.newdocument writes it so: a restatement of a kept value, +% [lossless means round trip]) or '' (the template default, written by +% +NDIMaker/subjectMaker: [writer default is not set]). Any other v1 +% base.name is not recoverable, and did2.convert.roundtrip.check reports it. +% +% SPEC.unplaced lists any emitted document that is not one organism entity. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.subject. + +arguments + bodies cell +end + +spec = struct('equivalents', struct('path', {}, 'values', {}, 'why', {}), ... + 'unplaced', {{}}); +v1 = struct(); +ent = []; +for k = 1:numel(bodies) + b = bodies{k}; + if isEntityOfType(b, 'organism') && isempty(ent) + ent = b; + else + spec.unplaced{end+1} = sprintf('emitted document %d (%s) is not the one organism entity', ... + k, classNameOf(b)); + end +end +if isempty(ent) + spec.unplaced{end+1} = 'no organism entity was emitted'; + return; +end +[base, entity] = rebuildBase(ent); +li = fieldText(entity, 'local_identifier'); +v1.document_class = struct('class_name', 'subject'); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'name', li, 'datestamp', base.datestamp); +v1.subject = struct('local_identifier', li, ... + 'description', fieldText(entity, 'description')); +spec.equivalents(end+1) = struct('path', 'base.name', 'values', {{li, ''}}, ... + 'why', ['ndi.subject writes the local identifier ([lossless means round ' ... + 'trip]: a restatement); subjectMaker leaves the template default '''' ' ... + '([writer default is not set])']); +end diff --git a/src/did/+did2/+convert/+roundtrip/subject_group.m b/src/did/+did2/+convert/+roundtrip/subject_group.m new file mode 100644 index 00000000..ab760b14 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/subject_group.m @@ -0,0 +1,96 @@ +function [v1, spec] = subject_group(bodies) +%SUBJECT_GROUP Rebuild a v1 `subject_group` from what +% did2.convert.migrators_j.subject_group emitted: one `entity` of type group +% and one `member_of` directed_relation per member. +% +% [V1, SPEC] = did2.convert.roundtrip.subject_group(BODIES): BODIES is a cell +% of the emitted document structs. V1 is the group in NDI's v1 shape +% (subject_group.json + base.json at the locked NDI-matlab `main`, 3cb19a8; +% members as +babu/import writes them, add_dependency_value_n): +% +% base.id, base.session_id, base.datestamp from the group entity +% base.name the group's name; '' is equally possible +% depends_on {name 'subject_id_', value }, +% n = 1..N in the order the relations were +% emitted (the order of the v1 entries) +% subject_group.group_name entity.local_identifier +% subject_group.description entity.description ('' when left out) +% +% NDI's template block is EMPTY, so a writer-shaped group is carried whole +% as v1 (carry-034) and never reaches this function +% (did2.convert.roundtrip.check compares a carried body directly). +% `group_name` / `description` are the shape the migrator reads when a body +% carries them. +% +% SPEC.equivalents: `base.name` can only have been the group's name or '' +% (the template default; +babu/import leaves it). SPEC.unplaced lists any +% emitted document that is neither the group entity nor a member_of relation +% whose parent is the group. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.subject_group. + +arguments + bodies cell +end + +spec = struct('equivalents', struct('path', {}, 'values', {}, 'why', {}), ... + 'unplaced', {{}}); +v1 = struct(); +grp = []; +rels = {}; +for k = 1:numel(bodies) + b = bodies{k}; + if isEntityOfType(b, 'group') && isempty(grp) + grp = b; + elseif strcmp(classNameOf(b), 'directed_relation') + rels{end+1} = b; %#ok + else + spec.unplaced{end+1} = sprintf('emitted document %d (%s) is not the group or a member edge', ... + k, classNameOf(b)); + end +end +if isempty(grp) + spec.unplaced{end+1} = 'no group entity was emitted'; + return; +end +[base, entity] = rebuildBase(grp); +name = fieldText(entity, 'local_identifier'); + +members = {}; +for k = 1:numel(rels) + r = rels{k}; + child = edgeOf(r, 'child_id'); + parent = edgeOf(r, 'parent_id'); + isMember = isfield(r, 'directed_relation') && isstruct(r.directed_relation) ... + && isfield(r.directed_relation, 'relation') ... + && strcmp(did2.build.vocabularyHandle('relation', r.directed_relation.relation), 'member_of'); + if isMember && strcmp(parent, base.id) && ~isempty(child) + members{end+1} = child; %#ok + else + spec.unplaced{end+1} = sprintf( ... + 'a directed_relation (child %s, parent %s) is not a member_of edge to the group', ... + child, parent); + end +end + +v1.document_class = struct('class_name', 'subject_group'); +v1.depends_on = struct('name', {}, 'value', {}); +for k = 1:numel(members) + v1.depends_on(k) = struct('name', sprintf('subject_id_%d', k), 'value', members{k}); +end +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'name', name, 'datestamp', base.datestamp); +v1.subject_group = struct('group_name', name, ... + 'description', fieldText(entity, 'description')); +spec.equivalents(end+1) = struct('path', 'base.name', 'values', {{name, ''}}, ... + 'why', ['the group''s name ([lossless means round trip]: a restatement) ' ... + 'or the template default '''' ([writer default is not set])']); +end + +function id = edgeOf(body, name) +deps = did2.convert.v1read.readDependsOn(body, 'Name', ['^' name '$']); +id = ''; +if ~isempty(deps) + id = deps(1).document_id; +end +end diff --git a/src/did/+did2/+convert/+v1read/private/textOf.m b/src/did/+did2/+convert/+v1read/private/textOf.m new file mode 100644 index 00000000..1e4cc3c2 --- /dev/null +++ b/src/did/+did2/+convert/+v1read/private/textOf.m @@ -0,0 +1,16 @@ +function v = textOf(v) +%TEXTOF A v1 value as a char row when it is text; anything else as given. +% +% V = textOf(V): a char array comes back as a row, a scalar string as char, +% an empty value of any type as ''. A value that is not text (a number, a +% struct) is returned UNCHANGED: these helpers read, they never convert, so +% nothing a v1 document states is reshaped on the way in. + +if ischar(v) + v = reshape(v, 1, []); +elseif isstring(v) && isscalar(v) + v = char(v); +elseif isempty(v) && ~isstruct(v) + v = ''; +end +end diff --git a/src/did/+did2/+convert/+v1read/readApp.m b/src/did/+did2/+convert/+v1read/readApp.m new file mode 100644 index 00000000..e4abd140 --- /dev/null +++ b/src/did/+did2/+convert/+v1read/readApp.m @@ -0,0 +1,66 @@ +function a = readApp(body) +%READAPP The `app` block of a RAW v1 document, keeping every spelling. +% +% A = did2.convert.v1read.readApp(BODY) reads the v1 `app` block, as NDI's +% app.json declares it at the locked NDI-matlab `main` (3cb19a8): +% +% name, version, url, os, os_version, interpreter, interpreter_version +% +% and returns a struct with +% +% present true when BODY carries an `app` block +% name, version, url, os, os_version, interpreter, interpreter_version +% as text ('' when the block does not state the field) +% app_name, app_version +% the V2 spellings, read as given when a body carries them +% ('' otherwise). A raw v1 body never does; they are read so +% that a body which holds BOTH spellings loses neither. +% conflicts cellstr: 'name' and/or 'version' when both spellings are +% present, non-empty and DIFFERENT. Both values are kept above; +% the caller decides (or carries the document). universalRenames +% kept `app_name` and dropped `name` here (carry-049). +% extra a struct of every field outside the nine above +% +% Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md): the `app` block is read by a shared +% helper each migrator calls on the raw v1 document, not renamed by a pass. +% +% See also did2.convert.v1read.readBase, did2.convert.v1read.readDependsOn, +% did2.convert.v1read.readStamp. + +template = {'name', 'version', 'url', 'os', 'os_version', 'interpreter', ... + 'interpreter_version'}; +renamed = {'app_name', 'app_version'}; +a = struct('present', false); +for k = 1:numel(template) + a.(template{k}) = ''; +end +for k = 1:numel(renamed) + a.(renamed{k}) = ''; +end +a.conflicts = {}; +a.extra = struct(); +if ~isstruct(body) || ~isscalar(body) || ~isfield(body, 'app') ... + || ~isstruct(body.app) || ~isscalar(body.app) + return; +end +a.present = true; +block = body.app; +fns = fieldnames(block); +for k = 1:numel(fns) + f = fns{k}; + if any(strcmp(f, template)) || any(strcmp(f, renamed)) + a.(f) = textOf(block.(f)); + else + a.extra.(f) = block.(f); + end +end +pairs = {'name', 'app_name'; 'version', 'app_version'}; +for p = 1:size(pairs, 1) + v1 = a.(pairs{p, 1}); + v2 = a.(pairs{p, 2}); + if ~isempty(v1) && ~isempty(v2) && ~isequal(v1, v2) + a.conflicts{end+1} = pairs{p, 1}; + end +end +end diff --git a/src/did/+did2/+convert/+v1read/readBase.m b/src/did/+did2/+convert/+v1read/readBase.m new file mode 100644 index 00000000..a7b0194c --- /dev/null +++ b/src/did/+did2/+convert/+v1read/readBase.m @@ -0,0 +1,68 @@ +function b = readBase(body) +%READBASE The identity block of a RAW v1 document, nothing dropped. +% +% B = did2.convert.v1read.readBase(BODY) reads the v1 `base` block, as NDI's +% base.json declares it at the locked NDI-matlab `main` (3cb19a8): +% +% id, session_id, name, datestamp +% +% and returns a struct with +% +% source 'base', 'ndi_document' (a pre-2023 document whose only +% identity block is the legacy one), or '' (neither) +% id, session_id, name, datestamp +% as text ('' when the block does not state the field; a value +% that is not text is returned as given) +% present cellstr: which of the four fields the block states +% extra a struct of every field of the block OUTSIDE those four (a +% stale `schema_version`, or the 2019 `ndi_document` fields +% `experiment_id`, `type`, `database_version`, ...) +% legacy the `ndi_document` block when it is present BESIDE `base` +% (struct() otherwise) +% +% A legacy `ndi_document` block is read for the same four names only: its +% 2019 shapes spell identity differently (`experiment_id`, `document_id`), +% and those fields come back in `extra`, unread, for the caller to place or +% carry. Nothing is renamed or moved; universalRenames' wholesale move of +% the block into `base` is not repeated here. +% +% Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md): the `base` block is read by a shared +% helper each migrator calls on the raw v1 document. +% +% See also did2.convert.v1read.readDependsOn, did2.convert.v1read.readApp, +% did2.convert.v1read.readStamp. + +fields = {'id', 'session_id', 'name', 'datestamp'}; +b = struct('source', '', 'id', '', 'session_id', '', 'name', '', ... + 'datestamp', '', 'present', {{}}, 'extra', struct(), 'legacy', struct()); +if ~isstruct(body) || ~isscalar(body) + return; +end +block = []; +if isfield(body, 'base') && isstruct(body.base) && isscalar(body.base) + block = body.base; + b.source = 'base'; + if isfield(body, 'ndi_document') && isstruct(body.ndi_document) ... + && isscalar(body.ndi_document) + b.legacy = body.ndi_document; + end +elseif isfield(body, 'ndi_document') && isstruct(body.ndi_document) ... + && isscalar(body.ndi_document) + block = body.ndi_document; + b.source = 'ndi_document'; +end +if isempty(block) + return; +end +fns = fieldnames(block); +for k = 1:numel(fns) + f = fns{k}; + if any(strcmp(f, fields)) + b.(f) = textOf(block.(f)); + b.present{end+1} = f; + else + b.extra.(f) = block.(f); + end +end +end diff --git a/src/did/+did2/+convert/+v1read/readDependsOn.m b/src/did/+did2/+convert/+v1read/readDependsOn.m new file mode 100644 index 00000000..5efcfe96 --- /dev/null +++ b/src/did/+did2/+convert/+v1read/readDependsOn.m @@ -0,0 +1,113 @@ +function deps = readDependsOn(body, options) +%READDEPENDSON The `depends_on` entries of a RAW v1 document, nothing dropped. +% +% DEPS = did2.convert.v1read.readDependsOn(BODY) reads BODY's top-level +% `depends_on` as v1 writes it and returns a 1xN struct array, one element per +% entry, in the document's order: +% +% name the dependency name (char) +% document_id the id the entry names (char; '' when it names none) +% source_key which key held that id: 'value' (NDI v1: ndi.document +% add_dependency_value_n / set_dependency_value), 'id' (the +% older {name, id, version} shape), 'document_id' (a body +% already renamed), or '' when no key held one +% version the entry's `version` as given ('' when it has none) +% other a struct of every OTHER key of the entry, and of any target +% key that lost the precedence below while holding a +% DIFFERENT value. Nothing is discarded: a caller that cannot +% place a key in `other` carries the document. +% +% DEPS = ...readDependsOn(BODY, 'Name', PATTERN) keeps only the entries whose +% name matches the regular expression PATTERN (e.g. '^subject_id(_\d+)?$'). +% +% PRECEDENCE when an entry holds more than one target key: `value` (the v1 +% spelling), then `id`, then `document_id`. A losing key with the SAME value +% restates the winner and is not repeated in `other`. +% +% WHY THIS EXISTS. Decided by Jess Haley, 2026-10-26 [migrators read raw v1] +% (did-schema V_eta_go_forward_class_audit.md): what is truly shared -- +% `depends_on`, the `base` and `app` blocks, the stamp -- becomes reading +% helpers each migrator calls on the raw v1 document, not a pass that rewrites +% it. This replaces, for a switched class, universalRenames' +% renameDependsOnEntries, which kept one key and DROPPED `version` and any +% losing key (carry-049). +% +% BODY is the raw v1 document (a struct, as jsondecode gives it). A +% `depends_on` that is absent or empty gives a 1x0 struct array with the +% fields above. A struct array and a cell array of structs (jsondecode's +% shape for entries with different keys) are both read. Anything else is +% an error (did2:convert:v1read:badDependsOn), which v1_to_v2 quarantines. +% +% See also did2.convert.v1read.readBase, did2.convert.v1read.readApp, +% did2.convert.v1read.readStamp. + +arguments + body + options.Name (1,:) char = '' +end + +deps = struct('name', {}, 'document_id', {}, 'source_key', {}, ... + 'version', {}, 'other', {}); +deps = reshape(deps, 1, 0); +if ~isstruct(body) || ~isscalar(body) || ~isfield(body, 'depends_on') + return; +end +raw = body.depends_on; +if isempty(raw) + return; +end +if isstruct(raw) + entries = num2cell(reshape(raw, 1, [])); +elseif iscell(raw) + entries = reshape(raw, 1, []); +else + error('did2:convert:v1read:badDependsOn', ... + 'depends_on is a %s; v1 writes a list of {name, value} entries.', class(raw)); +end + +targetKeys = {'value', 'id', 'document_id'}; +for k = 1:numel(entries) + e = entries{k}; + if ~isstruct(e) || ~isscalar(e) + error('did2:convert:v1read:badDependsOn', ... + 'depends_on entry %d is a %s, not a {name, value} struct.', k, class(e)); + end + name = ''; + if isfield(e, 'name') + name = textOf(e.name); + end + if ~isempty(options.Name) && (~ischar(name) || isempty(regexp(name, options.Name, 'once'))) + continue; + end + docId = ''; + sourceKey = ''; + for t = 1:numel(targetKeys) + key = targetKeys{t}; + if isfield(e, key) && ~isempty(e.(key)) + docId = textOf(e.(key)); + sourceKey = key; + break; + end + end + version = ''; + if isfield(e, 'version') + version = textOf(e.version); + end + other = struct(); + fns = fieldnames(e); + for f = 1:numel(fns) + key = fns{f}; + if any(strcmp(key, {'name', 'version'})) || strcmp(key, sourceKey) + continue; + end + v = e.(key); + if any(strcmp(key, targetKeys)) ... + && (isempty(v) || isequal(textOf(v), docId)) + continue; % empty, or restates the winner + end + other.(key) = v; + end + deps(end+1) = struct('name', {name}, 'document_id', {docId}, ... + 'source_key', {sourceKey}, 'version', {version}, 'other', {other}); %#ok +end +end diff --git a/src/did/+did2/+convert/+v1read/readStamp.m b/src/did/+did2/+convert/+v1read/readStamp.m new file mode 100644 index 00000000..1d0ca6e4 --- /dev/null +++ b/src/did/+did2/+convert/+v1read/readStamp.m @@ -0,0 +1,92 @@ +function s = readStamp(body) +%READSTAMP The `document_class` block (the stamp) of a RAW v1 document. +% +% S = did2.convert.v1read.readStamp(BODY) reads `document_class` as NDI's +% templates write it at the locked NDI-matlab `main` (3cb19a8): +% +% definition, validation, class_name, property_list_name, +% class_version, superclasses [{definition}] +% +% and returns a struct with +% +% class_name as written; when absent, the basename of +% `definition` ('$NDIDOCUMENTPATH/subject.json' -> +% 'subject'). Never snake_cased: a raw migrator is +% chosen by the v1 spelling. +% class_version as given ([] when absent) +% definition, validation, property_list_name +% as text ('' when absent) +% superclasses cellstr of superclass names, in order, each its +% `class_name` or else its `definition` basename +% schema_version the generation stamp ('' when absent: a v1 document +% written before the stamps were named carries none) +% is_v1, is_v2 did2.schema.isV1Stamp / isV2Stamp of that stamp +% (Decided by Jess Haley, 2026-10-25 [document +% stamps]: v1 = 'did_v1', V2 = 'did_v2') +% extra a struct of every other `document_class` field +% +% Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md): the stamp is read by a shared helper each +% migrator calls on the raw v1 document. +% +% See also did2.convert.v1read.readBase, did2.convert.v1read.readDependsOn, +% did2.convert.v1read.readApp, did2.schema.stampOf. + +known = {'class_name', 'class_version', 'definition', 'validation', ... + 'property_list_name', 'superclasses', 'schema_version'}; +s = struct('class_name', '', 'class_version', [], 'definition', '', ... + 'validation', '', 'property_list_name', '', 'superclasses', {{}}, ... + 'schema_version', '', 'is_v1', false, 'is_v2', false, 'extra', struct()); +if ~isstruct(body) || ~isscalar(body) || ~isfield(body, 'document_class') ... + || ~isstruct(body.document_class) || ~isscalar(body.document_class) + return; +end +dc = body.document_class; +for f = {'definition', 'validation', 'property_list_name', 'schema_version'} + if isfield(dc, f{1}) + s.(f{1}) = textOf(dc.(f{1})); + end +end +if isfield(dc, 'class_version') + s.class_version = dc.class_version; +end +if isfield(dc, 'class_name') && ~isempty(dc.class_name) + s.class_name = textOf(dc.class_name); +elseif ischar(s.definition) && ~isempty(s.definition) + s.class_name = basenameOf(s.definition); +end +if isfield(dc, 'superclasses') && ~isempty(dc.superclasses) + sc = dc.superclasses; + if isstruct(sc) + sc = num2cell(reshape(sc, 1, [])); + end + if iscell(sc) + for k = 1:numel(sc) + e = sc{k}; + nm = ''; + if isstruct(e) && isscalar(e) + if isfield(e, 'class_name') && ~isempty(e.class_name) + nm = textOf(e.class_name); + elseif isfield(e, 'definition') && ~isempty(e.definition) + nm = basenameOf(textOf(e.definition)); + end + end + s.superclasses{end+1} = nm; + end + end +end +fns = fieldnames(dc); +for k = 1:numel(fns) + if ~any(strcmp(fns{k}, known)) + s.extra.(fns{k}) = dc.(fns{k}); + end +end +if ischar(s.schema_version) + s.is_v1 = did2.schema.isV1Stamp(s.schema_version); + s.is_v2 = did2.schema.isV2Stamp(s.schema_version); +end +end + +function name = basenameOf(path) +[~, name, ~] = fileparts(strrep(char(path), '\/', '/')); +end diff --git a/src/did/+did2/+convert/Contents.m b/src/did/+did2/+convert/Contents.m index 00dee277..dc15424e 100644 --- a/src/did/+did2/+convert/Contents.m +++ b/src/did/+did2/+convert/Contents.m @@ -26,7 +26,19 @@ % struct with `migrated`, `quarantine` and % `summary` fields (plus the audit censuses). % universalRenames - the cross-cutting did_v1 renames applied before -% any migrator. +% any migrator of a class NOT yet switched to raw +% v1 (deleted once the last class has switched, +% [migrators read raw v1]). +% rawV1Classes - the classes whose migrator reads the RAW v1 +% document (no universalRenames, no superclass +% migrators); one family at a time. +% +v1read - shared raw-v1 reading helpers: readDependsOn, +% readBase, readApp, readStamp. They read v1 as the +% NDI templates define it and drop nothing. +% +roundtrip - the round trip of a switched class +% ([migration reliability practices] (a)): check +% rebuilds the v1 document from the emitted V2 +% documents with the class's inverse and compares. % ensureClassBlocks - give a body exactly the class blocks its schema % chain hosts. % isAlreadyTarget - true when a body is already stamped did_v2 (a diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m new file mode 100644 index 00000000..b9eac137 --- /dev/null +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -0,0 +1,39 @@ +function names = rawV1Classes() +%RAWV1CLASSES The v1 classes whose migrator reads the RAW v1 document. +% +% NAMES = did2.convert.rawV1Classes() is a cellstr of v1 class names (the +% v1 spelling, document_class.class_name exactly as v1 writes it). +% did2.convert.v1_to_v2 hands a document of one of these classes to its +% +migrators_j migrator UNCHANGED: no did2.convert.universalRenames, no +% superclass migrators. Every other class runs exactly as before. +% +% WHY. Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md): a migrator reads v1 exactly as v1 defines +% it (the NDI template and writer at the locked `main`), writes V2 only +% through the builder, and accounts for every v1 field; the shared reads are +% helpers (did2.convert.v1read.*), not a pass that rewrites the document. +% Migrators switch ONE AT A TIME, each with a check that every v1 field is +% accounted for; universalRenames is deleted once the last one has switched. +% The check is the round trip of [migration reliability practices] (a): +% did2.convert.roundtrip.check. +% +% ADDING A CLASS HERE requires, in the same commit: +% - its migrator +migrators_j/.m reads the raw v1 shape (the +% did2.convert.v1read helpers for depends_on / base / app / stamp); +% - its inverse +roundtrip/.m, and a round-trip test on the NDI +% writer shape (tests/+did2/+unittest/testRawV1RoundTrip.m); +% - the class has no superclass migrator whose work the raw migrator now +% has to do itself (+migrators/.m, +migrators_j/+super/). +% testRawV1RoundTrip checks the first two for every name listed. +% +% THE LIST, and why each is here: +% subject first family switched (phase 2 of docs/V2_PLAN.md in +% subject_group did-schema): two classes, superclass `base` only, no +% `app` block, no superclass migrator, and NDI writers +% small enough to state every field (ndi.subject, +% +NDIMaker/subjectMaker; +babu/import for subject_group). +% +% See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. + +names = {'subject', 'subject_group'}; +end diff --git a/src/did/+did2/+convert/v1_to_v2.m b/src/did/+did2/+convert/v1_to_v2.m index 492edf4a..3859bfed 100644 --- a/src/did/+did2/+convert/v1_to_v2.m +++ b/src/did/+did2/+convert/v1_to_v2.m @@ -5,6 +5,9 @@ % did_v1-shaped document bodies (struct, struct array, cell array, or % JSON char) and runs each through this pipeline: % +% 0. a class listed by did2.convert.rawV1Classes skips steps 1-2: its +% +migrators_j migrator reads the RAW v1 document (Decided by Jess +% Haley, 2026-10-26 [migrators read raw v1]); see 'RawV1Classes' % 1. did2.convert.universalRenames (cross-cutting renames) % 2. matching superclass migrators: the V_eta override under % +did2.+convert.+migrators_j.+super. when one @@ -80,6 +83,14 @@ % identifiers in the legacy (camelCase) form so % the body stays schema-compatible while still % gaining the shared shape transformations. +% RawV1Classes (cellstr, default did2.convert.rawV1Classes()) - the +% v1 classes whose migrator takes the RAW v1 document: +% no universalRenames, no superclass migrators, and a +% carry is the untouched v1 source ([migrators read raw +% v1]). Counted as `bodies_read_raw_v1` in +% summary.legacy_ndi_document. Pass {} to run every +% class through universalRenames as before the switch +% (testRawV1RoundTrip compares the two). % Audits (1,1 logical, default true) - run the report-only % census instruments over the batch (silentLoss, % fileList, timeReferenceFamilies) into @@ -132,6 +143,7 @@ options.RenameClassNames (1,1) logical = true options.TargetVersion (1,:) char {mustBeMember(options.TargetVersion, {'V_eta', 'did_v2'})} = 'V_eta' options.Audits (1,1) logical = true + options.RawV1Classes cell = did2.convert.rawV1Classes() end % a migrator transcribes the v1 source's own terms, which the term @@ -254,6 +266,7 @@ 'bodies_total', numel(bodies), ... 'bodies_reaching_universal_renames', 0, ... 'bodies_skipped_already_target', 0, ... + 'bodies_read_raw_v1', 0, ... 'bodies_unreached', 0, ... 'ndi_document_block_seen', 0, ... 'moved_wholesale_no_base', 0, ... @@ -317,68 +330,87 @@ legacy.bodies_skipped_already_target = ... legacy.bodies_skipped_already_target + 1; else - % Incremented BEFORE the call: a body that throws inside the pass - % still reached it, and a denominator that quietly excluded the - % failures would be the "all-zero reads as clean" defect again. - legacy.bodies_reaching_universal_renames = ... - legacy.bodies_reaching_universal_renames + 1; - [postUniversalBody, legacyReport, renameDropped] = did2.convert.universalRenames( ... - preBody, 'RenameClassNames', options.RenameClassNames); - className = char(postUniversalBody.document_class.class_name); - legacy = accumulateLegacyReport(legacy, legacyReport); - if legacyReport.moved_wholesale_no_base - [legacyMovedNames, legacyMovedValues] = bumpClassCounter( ... - legacyMovedNames, legacyMovedValues, className); - end - if legacyReport.discarded_ndi_document_base_present - [legacyDiscNames, legacyDiscValues] = bumpClassCounter( ... - legacyDiscNames, legacyDiscValues, className); - end - if isempty(renameDropped) - v2Body = applySuperclassMigrators(postUniversalBody, className, ... - options.TargetVersion); - superUnchanged = isequaln(v2Body, postUniversalBody); - % runConcreteMigrator returns a CELL of one-or-more bodies. - % A class with a base migrator only returns a single body; a - % class with a +migrators_j split/fold migrator (treatment, - % ontology_table_row, ...) may fan out to several (1 -> N). - v2Bodies = runConcreteMigrator(v2Body, className, ... - options.TargetVersion); - % A CARRY IS THE V1 SOURCE, NOT THE SUPERCLASS-RESHAPED BODY. - % A migrator carries a document by returning its input - % unchanged with a `carried_as_v1` note ([generic stage is - % lossless], [partly placed is carried as v1], Jess Haley, - % 2026-10-25). Its input is the body AFTER the superclass - % migrators, which may have reshaped it (+migrators/filter.m - % renames `type` -> `filter_type`; the image_stack_parameters - % override strips an empty `timestamp`), and such a body was - % not recorded as a passthrough, so it came out under its - % tombstone stamped did_v2. The carried document is the - % universalRenames output instead -- the same body every other - % passthrough is -- recorded as a passthrough, so the caller - % stores its untouched v1 source, stamped did_v1. - if isscalar(v2Bodies) && isequaln(v2Bodies{1}, v2Body) ... + rawClass = rawV1ClassNameOf(preBody); + if any(strcmp(rawClass, options.RawV1Classes)) + % A CLASS SWITCHED TO RAW v1 (did2.convert.rawV1Classes; + % Decided by Jess Haley, 2026-10-26 [migrators read raw v1]): + % its migrator reads the document exactly as v1 wrote it. No + % universalRenames, no superclass migrators; a carry is the + % untouched v1 source. Counted in the denominator below + % (`bodies_read_raw_v1`), so a raw body is never "unreached". + legacy.bodies_read_raw_v1 = legacy.bodies_read_raw_v1 + 1; + className = rawClass; + v2Body = preBody; + superUnchanged = true; + v2Bodies = runRawV1Migrator(preBody, className); + if isscalar(v2Bodies) && isequaln(v2Bodies{1}, preBody) ... && did2.convert.reportNote('pending', 'carried_as_v1') > 0 + carried = true; + end + else + % Incremented BEFORE the call: a body that throws inside the pass + % still reached it, and a denominator that quietly excluded the + % failures would be the "all-zero reads as clean" defect again. + legacy.bodies_reaching_universal_renames = ... + legacy.bodies_reaching_universal_renames + 1; + [postUniversalBody, legacyReport, renameDropped] = did2.convert.universalRenames( ... + preBody, 'RenameClassNames', options.RenameClassNames); + className = char(postUniversalBody.document_class.class_name); + legacy = accumulateLegacyReport(legacy, legacyReport); + if legacyReport.moved_wholesale_no_base + [legacyMovedNames, legacyMovedValues] = bumpClassCounter( ... + legacyMovedNames, legacyMovedValues, className); + end + if legacyReport.discarded_ndi_document_base_present + [legacyDiscNames, legacyDiscValues] = bumpClassCounter( ... + legacyDiscNames, legacyDiscValues, className); + end + if isempty(renameDropped) + v2Body = applySuperclassMigrators(postUniversalBody, className, ... + options.TargetVersion); + superUnchanged = isequaln(v2Body, postUniversalBody); + % runConcreteMigrator returns a CELL of one-or-more bodies. + % A class with a base migrator only returns a single body; a + % class with a +migrators_j split/fold migrator (treatment, + % ontology_table_row, ...) may fan out to several (1 -> N). + v2Bodies = runConcreteMigrator(v2Body, className, ... + options.TargetVersion); + % A CARRY IS THE V1 SOURCE, NOT THE SUPERCLASS-RESHAPED BODY. + % A migrator carries a document by returning its input + % unchanged with a `carried_as_v1` note ([generic stage is + % lossless], [partly placed is carried as v1], Jess Haley, + % 2026-10-25). Its input is the body AFTER the superclass + % migrators, which may have reshaped it (+migrators/filter.m + % renames `type` -> `filter_type`; the image_stack_parameters + % override strips an empty `timestamp`), and such a body was + % not recorded as a passthrough, so it came out under its + % tombstone stamped did_v2. The carried document is the + % universalRenames output instead -- the same body every other + % passthrough is -- recorded as a passthrough, so the caller + % stores its untouched v1 source, stamped did_v1. + if isscalar(v2Bodies) && isequaln(v2Bodies{1}, v2Body) ... + && did2.convert.reportNote('pending', 'carried_as_v1') > 0 + v2Body = postUniversalBody; + v2Bodies = {postUniversalBody}; + superUnchanged = true; + carried = true; + end + else + % [generic stage is lossless] / [partly placed is carried as + % v1] (Jess Haley, 2026-10-25): universalRenames discarded v1 + % content it keeps nowhere, so no migrator runs and the body is + % a passthrough, carried whole as v1 (its v1 source is what the + % end of ndi.migrate.local stores). + % carry-register: carry-049 (v1_class '*', temporary: [renames + % carry is temporary], removed with the pass) + did2.convert.reportNote('carried_as_v1', className, ... + sourceIdOf(preBody), ['[carry-049] universalRenames would discard: ' ... + strjoin(renameDropped, ', ')]); v2Body = postUniversalBody; - v2Bodies = {postUniversalBody}; superUnchanged = true; + v2Bodies = {v2Body}; carried = true; end - else - % [generic stage is lossless] / [partly placed is carried as - % v1] (Jess Haley, 2026-10-25): universalRenames discarded v1 - % content it keeps nowhere, so no migrator runs and the body is - % a passthrough, carried whole as v1 (its v1 source is what the - % end of ndi.migrate.local stores). - % carry-register: carry-049 (v1_class '*', temporary: [renames - % carry is temporary], removed with the pass) - did2.convert.reportNote('carried_as_v1', className, ... - sourceIdOf(preBody), ['[carry-049] universalRenames would discard: ' ... - strjoin(renameDropped, ', ')]); - v2Body = postUniversalBody; - superUnchanged = true; - v2Bodies = {v2Body}; - carried = true; end % PHASE 1 REPORT-ONLY (V_eta_ground_truth_plan.md): did the migrator % hand its input straight back? `bodies = {preBody}` is how a @@ -539,12 +571,14 @@ end % `bodies_unreached` closes the denominator: every body either reached -% universalRenames, took the idempotency short-circuit, or failed before -% either (a non-struct input, undecodable JSON). Written as a subtraction so -% the three sum to `total` by construction rather than by hope. +% universalRenames, took the idempotency short-circuit, was read raw by a +% switched class's migrator (did2.convert.rawV1Classes), or failed before +% any of them (a non-struct input, undecodable JSON). Written as a subtraction +% so the four sum to `total` by construction rather than by hope. legacy.bodies_unreached = legacy.bodies_total ... - legacy.bodies_reaching_universal_renames ... - - legacy.bodies_skipped_already_target; + - legacy.bodies_skipped_already_target ... + - legacy.bodies_read_raw_v1; % THE VINTAGE PARTITION, CHECKED RATHER THAN ASSUMED. Six buckets classify % every body that took the wholesale-move arm, and a body falling through all % six is exactly what the `unknown` bucket exists to catch -- so if the sum ever @@ -787,6 +821,31 @@ function refuseUnknownSchemaVersion(body) end end +function name = rawV1ClassNameOf(body) +%RAWV1CLASSNAMEOF A raw v1 body's class name, as v1 spells it ('' if none). +% The switch (did2.convert.rawV1Classes) is keyed on the v1 spelling, read by +% did2.convert.v1read.readStamp, never on a universalRenames output. +stamp = did2.convert.v1read.readStamp(body); +name = stamp.class_name; +if ~ischar(name) + name = ''; +end +end + +function bodies = runRawV1Migrator(rawBody, className) +%RUNRAWV1MIGRATOR Run a switched class's migrator on the RAW v1 body. +% A class listed by did2.convert.rawV1Classes has its own +migrators_j +% migrator by definition ([early migration pieces fixed] (1): no identity +% fallback), so a missing one is an error, which quarantines the document. +fqn = ['did2.convert.migrators_j.', className]; +if isempty(which(fqn)) + error('did2:convert:rawV1NoMigrator', ... + ['%s is listed by did2.convert.rawV1Classes but has no ' ... + '+migrators_j migrator.'], className); +end +bodies = normaliseMigratorOutput(feval(str2func(fqn), rawBody)); +end + function fcn = lookupMigrator(className) fqn = ['did2.convert.migrators.', className]; if ~isempty(which(fqn)) @@ -1324,9 +1383,9 @@ function printLegacyNdiDocument(result) if ~isfield(result.summary, 'legacy_ndi_document'); return; end L = result.summary.legacy_ndi_document; fprintf([' legacy ndi_document: %d body(ies) reached universalRenames ' ... - '(of %d; %d already at target, %d never reached it)\n'], ... + '(of %d; %d already at target, %d read raw v1, %d never reached it)\n'], ... L.bodies_reaching_universal_renames, L.bodies_total, ... - L.bodies_skipped_already_target, L.bodies_unreached); + L.bodies_skipped_already_target, L.bodies_read_raw_v1, L.bodies_unreached); fprintf(' %8d carried an `ndi_document` block\n', ... L.ndi_document_block_seen); fprintf(' %8d MOVED WHOLESALE into `base` (no `base` present)\n', ... diff --git a/tests/+did2/+unittest/testRawV1RoundTrip.m b/tests/+did2/+unittest/testRawV1RoundTrip.m new file mode 100644 index 00000000..2e6dbbcb --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTrip.m @@ -0,0 +1,265 @@ +function tests = testRawV1RoundTrip +%TESTRAWV1ROUNDTRIP The classes switched to raw v1, and their round trip. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): +% [migrators read raw v1] a migrator reads v1 exactly as v1 +% defines it; migrators switch one at a +% time (did2.convert.rawV1Classes) +% [migration reliability practices] (a) a round-trip check per class: +% each converted document is migrated +% back to v1 and compared with its +% source (did2.convert.roundtrip.check) +% +% The v1 documents here are built from NDI's templates at the locked +% NDI-matlab `main` (3cb19a8; tests/+did2/fixtures/ndi_templates) in the +% shapes NDI's writers give them, and pass through jsonencode/jsondecode, the +% shape a corpus delivers: +% subject ndi.subject.newdocument (base.name = local_identifier) +% +NDIMaker/subjectMaker (base.name left '') +% subject_group +babu/import (empty block, base.name '', members by +% add_dependency_value_n -> subject_id_1..N) +% plus the DID-side shape with `group_name` the subject_group migrator reads. +% +% Each round trip must report ok: every v1 leaf matched, restated (a value +% that can only have been one of a stated few), not set (empty), or exempt +% (the v1 document_class beyond its class name), and nothing lost, invented +% or unplaced. Two tests break a document ON PURPOSE and require the round +% trip to say so: a check that cannot fail proves nothing. +tests = functiontests(localfunctions); +end + +% ===================== the switch ====================================== + +function testEverySwitchedClassHasAMigratorAndAnInverse(testCase) +names = did2.convert.rawV1Classes(); +verifyNotEmpty(testCase, names); +for k = 1:numel(names) + verifyNotEmpty(testCase, which(['did2.convert.migrators_j.' names{k}]), ... + sprintf('%s is switched to raw v1 but has no +migrators_j migrator', names{k})); + verifyNotEmpty(testCase, which(['did2.convert.roundtrip.' names{k}]), ... + sprintf('%s is switched to raw v1 but has no round-trip inverse', names{k})); +end +end + +function testASwitchedClassSkipsUniversalRenames(testCase) +% the denominator: a raw body is counted as read raw, not as reaching the pass +% and not as unreached; a class not on the list still reaches the pass +other = struct(); +other.document_class = struct('class_name', 'treatment', 'class_version', '1.0.0', ... + 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); +other.depends_on = struct('name', {}, 'value', {}); +other.base = struct('id', 'tr_1', 'session_id', 'sess_1', 'name', '', ... + 'datestamp', '2024-06-01T12:00:00.000Z'); +other.treatment = struct(); +r = runRaw({ndiSubject('mouse_42', '', 'mouse_42'), other}); +L = r.summary.legacy_ndi_document; +verifyEqual(testCase, L.bodies_total, 2); +verifyEqual(testCase, L.bodies_read_raw_v1, 1); +verifyEqual(testCase, L.bodies_reaching_universal_renames, 1); +verifyEqual(testCase, L.bodies_unreached, 0); + +r = did2.convert.v1_to_v2({ndiSubject('mouse_42', '', 'mouse_42')}, ... + 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', {}); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_read_raw_v1, 0, ... + 'RawV1Classes {} runs every class as before the switch'); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_reaching_universal_renames, 1); +end + +function testTheSwitchChangesNoConvertedDocument(testCase) +% "keep behaviour identical": every CONVERTED document the raw path emits is +% the one the universalRenames path emitted (ids are deterministic, practice +% (b), and every fixture states its datestamp) +fixtures = {ndiSubject('mouse_42@lab', 'a mouse', 'mouse_42@lab'), ... + ndiSubject('mouse_43', '', ''), namedGroup({'m_1', 'm_2', 'm_3'})}; +for k = 1:numel(fixtures) + raw = runRaw(fixtures{k}); + old = did2.convert.v1_to_v2(fixtures{k}, 'Validate', false, ... + 'TargetVersion', 'V_eta', 'RawV1Classes', {}); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated)); + verifyEmpty(testCase, raw.quarantine); + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + verifyTrue(testCase, isequaln(raw.migrated{j}.toStruct(), old.migrated{j}.toStruct()), ... + sprintf('fixture %d, document %d differs between the raw and the renamed path', k, j)); + end +end +end + +% ===================== subject ========================================= + +function testNdiSubjectWriterShapeRoundTrips(testCase) +v1 = ndiSubject('mouse_42@lab', 'a C57 mouse', 'mouse_42@lab'); +out = runRaw(v1); +verifyEqual(testCase, numel(out.migrated), 1); +verifyEqual(testCase, out.summary.quarantine_count, 0); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyRoundTrip(testCase, r); +verifyFalse(testCase, r.carried); +% every field NDI's templates declare is accounted for, by name +accounted = [r.matched, r.restated, r.not_set]; +for p = {'base.id', 'base.session_id', 'base.name', 'base.datestamp', ... + 'subject.local_identifier', 'subject.description', 'document_class.class_name'} + verifyTrue(testCase, any(strcmp(p{1}, accounted)), ... + sprintf('template field %s is not accounted for', p{1})); +end +end + +function testSubjectMakerShapeRoundTrips(testCase) +% +NDIMaker/subjectMaker leaves base.name at the template's '' +v1 = ndiSubject('mouse_43', '', ''); +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyRoundTrip(testCase, r); +verifyTrue(testCase, any(strcmp('base.name', [r.restated, r.not_set]))); +end + +function testADifferingBaseNameIsReportedLost(testCase) +% OPEN (a team decision): a v1 subject whose base.name is neither '' nor its +% local identifier. No NDI writer at the locked `main` writes one; V2 does not +% keep base.name (#73 item 54), so the value is not recoverable and the round +% trip must say so. Today the migrator converts it anyway. +v1 = ndiSubject('mouse_44', '', 'Mouse forty-four'); +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, {r.lost.path}, {'base.name'}); +end + +function testAFieldOutsideTheTemplateIsReportedLost(testCase) +% the round trip fails on ANY dropped field: a subject field NDI's template +% does not declare is read by nothing, and the check names it +v1 = ndiSubject('mouse_45', '', 'mouse_45'); +v1.subject.strain = 'C57BL/6J'; +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(strcmp('subject.strain', {r.lost.path}))); +end + +function testASubjectWithNoLocalIdIsCarriedUntouched(testCase) +% carry-033: the carry is the RAW v1 source, stamped did_v1, nothing renamed +v1 = ndiSubject('', '', ''); +out = runRaw(v1); +verifyEqual(testCase, numel(out.migrated), 1); +verifyEqual(testCase, numel(out.passthrough), 1); +emitted = out.migrated{1}.toStruct(); +verifyEqual(testCase, emitted.document_class.schema_version, 'did_v1'); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carried body is not the untouched v1 source'); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyTrue(testCase, r.carried); +verifyRoundTrip(testCase, r); +end + +% ===================== subject_group =================================== + +function testBabuShapedGroupIsCarriedAndRoundTrips(testCase) +% NDI's template block is empty: the group states no name, carry-034 +v1 = babuGroup({'m_1', 'm_2', 'm_3'}); +out = runRaw(v1); +verifyEqual(testCase, numel(out.migrated), 1); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyTrue(testCase, r.carried); +verifyRoundTrip(testCase, r); +% the members are read from the v1 spelling, untouched +emitted = out.migrated{1}.toStruct(); +verifyEqual(testCase, {emitted.depends_on.value}, {'m_1', 'm_2', 'm_3'}); +end + +function testNamedGroupRoundTripsWithItsMembers(testCase) +v1 = namedGroup({'m_1', 'm_2', 'm_3'}); +out = runRaw(v1); +verifyEqual(testCase, numel(out.migrated), 4, 'the group and three member_of edges'); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyRoundTrip(testCase, r); +verifyFalse(testCase, r.carried); +end + +function testADroppedMemberEdgeIsReportedLost(testCase) +v1 = namedGroup({'m_1', 'm_2', 'm_3'}); +out = runRaw(v1); +kept = out.migrated; +for k = numel(kept):-1:1 + if strcmp(kept{k}.className(), 'directed_relation') + kept(k) = []; + break; + end +end +r = did2.convert.roundtrip.check(v1, kept); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(startsWith({r.lost.path}, 'depends_on(3)'))); +end + +function testAnUnplacedDocumentFailsTheRoundTrip(testCase) +v1 = ndiSubject('mouse_46', '', 'mouse_46'); +out = runRaw(v1); +extra = runRaw(namedGroup({'m_9'})).migrated; +r = did2.convert.roundtrip.check(v1, [out.migrated, extra(1)]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +% ===================== helpers ========================================= + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function verifyRoundTrip(testCase, r) +verifyGreaterThan(testCase, r.fields_inspected, 0, 'the round trip inspected nothing'); +lost = ''; +if ~isempty(r.lost) + lost = strjoin({r.lost.path}, ', '); +end +verifyEmpty(testCase, r.lost, ['lost: ' lost]); +verifyEmpty(testCase, r.invented, ['invented: ' strjoin(r.invented, ', ')]); +verifyEmpty(testCase, r.unplaced, ['unplaced: ' strjoin(r.unplaced, '; ')]); +verifyTrue(testCase, r.ok); +end + +function v1 = ndiSubject(localId, description, baseName) +% ndi.subject.newdocument / subjectMaker: subject.json over base.json +tpl = loadTemplate('subject'); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.base = baseTpl.base; +v1.base.id = '41268b6f5c6a3d4e_c0d1a9e2b3f4a5b6'; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.name = baseName; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.subject = tpl.subject; +v1.subject.local_identifier = localId; +v1.subject.description = description; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = babuGroup(memberIds) +% +babu/import: ndi.document('subject_group') + session.newdocument(), then +% add_dependency_value_n('subject_id', ...) per member +tpl = loadTemplate('subject_group'); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = struct('name', {}, 'value', {}); +for k = 1:numel(memberIds) + v1.depends_on(k) = struct('name', sprintf('subject_id_%d', k), 'value', memberIds{k}); +end +v1.base = baseTpl.base; +v1.base.id = '41268b6f5c6a3d4e_aa00000000000001'; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.subject_group = tpl.subject_group; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = namedGroup(memberIds) +% the DID-side shape the subject_group migrator converts: a group_name +v1 = babuGroup(memberIds); +v1.base.name = 'cohortB'; +v1.subject_group = struct('group_name', 'cohortB', 'description', 'the treated cohort'); +v1 = jsondecode(jsonencode(v1)); +end + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/+unittest/testV1Read.m b/tests/+did2/+unittest/testV1Read.m new file mode 100644 index 00000000..5b33aa98 --- /dev/null +++ b/tests/+did2/+unittest/testV1Read.m @@ -0,0 +1,227 @@ +function tests = testV1Read +%TESTV1READ The raw-v1 reading helpers, did2.convert.v1read.*. +% +% Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md): `depends_on`, the `base` and `app` +% blocks and the stamp are read by shared helpers on the RAW v1 document, +% not rewritten by a pass. Each helper is tested on the v1 shapes NDI writes +% (templates at the locked NDI-matlab `main` 3cb19a8, copied into +% tests/+did2/fixtures/ndi_templates) and on the older or already-renamed +% shapes universalRenames used to fold together, and each is checked to +% DROP NOTHING: what it cannot name it returns in `other` / `extra`. +tests = functiontests(localfunctions); +end + +% ===================== readDependsOn =================================== + +function testDependsOnReadsTheNdiValueShape(testCase) +body = struct('depends_on', struct('name', {'subject_id_1', 'subject_id_2'}, ... + 'value', {'m_1', 'm_2'})); +d = did2.convert.v1read.readDependsOn(body); +verifyEqual(testCase, numel(d), 2); +verifyEqual(testCase, {d.name}, {'subject_id_1', 'subject_id_2'}); +verifyEqual(testCase, {d.document_id}, {'m_1', 'm_2'}); +verifyEqual(testCase, {d.source_key}, {'value', 'value'}); +verifyEqual(testCase, d(1).version, ''); +verifyEmpty(testCase, fieldnames(d(1).other)); +end + +function testDependsOnKeepsTheVersionOfTheIdShape(testCase) +% the older {name, id, version} shape: universalRenames dropped `version` +body = struct('depends_on', struct('name', 'element_id', 'id', 'e_1', 'version', '2')); +d = did2.convert.v1read.readDependsOn(body); +verifyEqual(testCase, d.document_id, 'e_1'); +verifyEqual(testCase, d.source_key, 'id'); +verifyEqual(testCase, d.version, '2'); +end + +function testDependsOnReadsARenamedEntry(testCase) +body = struct('depends_on', struct('name', 'element_id', 'document_id', 'e_1')); +d = did2.convert.v1read.readDependsOn(body); +verifyEqual(testCase, d.document_id, 'e_1'); +verifyEqual(testCase, d.source_key, 'document_id'); +end + +function testDependsOnKeepsAConflictingKey(testCase) +% `value` wins; an `id` that names a DIFFERENT document is kept in `other` +% (universalRenames reported it in carry-049 and discarded it); one that +% restates the winner is not repeated. +body = struct('depends_on', struct('name', {'a', 'b'}, 'value', {'x', 'y'}, ... + 'id', {'z', 'y'})); +d = did2.convert.v1read.readDependsOn(body); +verifyEqual(testCase, d(1).document_id, 'x'); +verifyEqual(testCase, d(1).other, struct('id', 'z')); +verifyEmpty(testCase, fieldnames(d(2).other)); +end + +function testDependsOnKeepsAnUnknownKey(testCase) +body = struct('depends_on', struct('name', 'a', 'value', 'x', 'note', 'kept')); +d = did2.convert.v1read.readDependsOn(body); +verifyEqual(testCase, d.other, struct('note', 'kept')); +end + +function testDependsOnFiltersByName(testCase) +body = struct('depends_on', struct('name', {'subject_id_1', 'session_id', 'subject_id'}, ... + 'value', {'m_1', 's', 'm_0'})); +d = did2.convert.v1read.readDependsOn(body, 'Name', '^subject_id(_\d+)?$'); +verifyEqual(testCase, {d.document_id}, {'m_1', 'm_0'}); +end + +function testDependsOnReadsACellOfEntries(testCase) +% jsondecode gives a cell when the entries carry different keys +body = jsondecode('{"depends_on":[{"name":"a","value":"x"},{"name":"b","id":"y","version":3}]}'); +verifyTrue(testCase, iscell(body.depends_on), 'fixture premise: a cell'); +d = did2.convert.v1read.readDependsOn(body); +verifyEqual(testCase, {d.document_id}, {'x', 'y'}); +verifyEqual(testCase, d(2).version, 3); +end + +function testDependsOnAbsentOrEmptyIsAnEmptyList(testCase) +for body = {struct(), struct('depends_on', []), jsondecode('{"depends_on":[]}')} + d = did2.convert.v1read.readDependsOn(body{1}); + verifyEmpty(testCase, d); + verifyTrue(testCase, isfield(d, 'document_id'), 'the fields are there, even empty'); +end +end + +function testDependsOnRefusesAShapeV1NeverWrites(testCase) +verifyError(testCase, @() did2.convert.v1read.readDependsOn(struct('depends_on', 'x')), ... + 'did2:convert:v1read:badDependsOn'); +end + +% ===================== readBase ======================================== + +function testBaseReadsTheTemplateFields(testCase) +tpl = loadTemplate(testCase, 'base'); +tpl.base.id = 'i_1'; +tpl.base.session_id = 's_1'; +tpl.base.name = 'n'; +b = did2.convert.v1read.readBase(tpl); +verifyEqual(testCase, b.source, 'base'); +verifyEqual(testCase, {b.id, b.session_id, b.name, b.datestamp}, ... + {'i_1', 's_1', 'n', '2018-12-05T18:36:47.241Z'}); +verifyEqual(testCase, sort(b.present), sort({'id', 'session_id', 'name', 'datestamp'})); +verifyEmpty(testCase, fieldnames(b.extra)); +end + +function testBaseKeepsAFieldOutsideTheTemplate(testCase) +body = struct('base', struct('id', 'i', 'schema_version', 'V_eta')); +b = did2.convert.v1read.readBase(body); +verifyEqual(testCase, b.extra, struct('schema_version', 'V_eta')); +verifyEqual(testCase, b.present, {'id'}); +end + +function testBaseReadsTheLegacyBlockWithoutMovingIt(testCase) +% the 2019-12 vintage: `id` read; `experiment_id`, `type`, +% `database_version` returned in `extra`, not renamed +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_document_vintages', 'f4f9d9450.json'); +tpl = jsondecode(fileread(f)); +b = did2.convert.v1read.readBase(tpl); +verifyEqual(testCase, b.source, 'ndi_document'); +verifyTrue(testCase, isfield(b.extra, 'experiment_id')); +verifyTrue(testCase, isfield(b.extra, 'database_version')); +verifyFalse(testCase, isfield(tpl, 'base'), 'the body itself is not changed'); +end + +function testBaseKeepsALegacyBlockBesideBase(testCase) +body = struct('base', struct('id', 'i'), 'ndi_document', struct('id', 'old')); +b = did2.convert.v1read.readBase(body); +verifyEqual(testCase, b.source, 'base'); +verifyEqual(testCase, b.legacy, struct('id', 'old')); +end + +function testBaseOfABodyWithNoneIsEmpty(testCase) +b = did2.convert.v1read.readBase(struct('x', 1)); +verifyEqual(testCase, b.source, ''); +verifyEmpty(testCase, b.present); +end + +% ===================== readApp ========================================= + +function testAppReadsTheTemplateFields(testCase) +tpl = loadTemplate(testCase, 'app'); +tpl.app.name = 'ndi_calc'; +tpl.app.version = 'abc123'; +tpl.app.os = 'GLNXA64'; +a = did2.convert.v1read.readApp(tpl); +verifyTrue(testCase, a.present); +verifyEqual(testCase, a.name, 'ndi_calc'); +verifyEqual(testCase, a.version, 'abc123'); +verifyEqual(testCase, a.os, 'GLNXA64'); +verifyEqual(testCase, a.app_name, ''); +verifyEmpty(testCase, a.conflicts); +verifyEmpty(testCase, fieldnames(a.extra)); +end + +function testAppKeepsBothSpellingsWhenTheyDiffer(testCase) +% universalRenames kept app_name and DROPPED name (carry-049); both are kept +body = struct('app', struct('name', 'v1name', 'app_name', 'v2name', ... + 'version', '1', 'app_version', '1')); +a = did2.convert.v1read.readApp(body); +verifyEqual(testCase, a.name, 'v1name'); +verifyEqual(testCase, a.app_name, 'v2name'); +verifyEqual(testCase, a.conflicts, {'name'}); +end + +function testAppAbsentIsNotPresent(testCase) +a = did2.convert.v1read.readApp(struct('base', struct())); +verifyFalse(testCase, a.present); +verifyEqual(testCase, a.name, ''); +end + +function testAppKeepsAFieldOutsideTheTemplate(testCase) +a = did2.convert.v1read.readApp(struct('app', struct('name', 'x', 'build', 7))); +verifyEqual(testCase, a.extra, struct('build', 7)); +end + +% ===================== readStamp ======================================= + +function testStampReadsTheNdiTemplateClass(testCase) +tpl = loadTemplate(testCase, 'subject'); +s = did2.convert.v1read.readStamp(tpl); +verifyEqual(testCase, s.class_name, 'subject'); +verifyEqual(testCase, s.superclasses, {'base'}, 'derived from the definition path'); +verifyEqual(testCase, s.class_version, 1); +verifyEqual(testCase, s.property_list_name, 'subject'); +verifyEqual(testCase, s.schema_version, ''); +verifyTrue(testCase, s.is_v1, 'an unstamped document is v1'); +verifyFalse(testCase, s.is_v2); +end + +function testStampNeverSnakeCasesTheClassName(testCase) +body = struct('document_class', struct('class_name', 'ontologyImage')); +s = did2.convert.v1read.readStamp(body); +verifyEqual(testCase, s.class_name, 'ontologyImage'); +end + +function testStampReadsTheClassNameFromTheDefinition(testCase) +body = struct('document_class', struct('definition', '$NDIDOCUMENTPATH/subject_group.json')); +s = did2.convert.v1read.readStamp(body); +verifyEqual(testCase, s.class_name, 'subject_group'); +end + +function testStampReadsTheGenerationStamp(testCase) +v2 = struct('document_class', struct('class_name', 'entity', 'schema_version', 'did_v2')); +s = did2.convert.v1read.readStamp(v2); +verifyTrue(testCase, s.is_v2); +verifyFalse(testCase, s.is_v1); +v1 = struct('document_class', struct('class_name', 'subject', 'schema_version', 'did_v1')); +s = did2.convert.v1read.readStamp(v1); +verifyTrue(testCase, s.is_v1); +end + +function testStampKeepsAnUnknownField(testCase) +body = struct('document_class', struct('class_name', 'x', 'note', 'kept')); +s = did2.convert.v1read.readStamp(body); +verifyEqual(testCase, s.extra, struct('note', 'kept')); +end + +% ===================== helpers ========================================= + +function tpl = loadTemplate(testCase, name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +verifyTrue(testCase, isfile(f), sprintf('NDI template fixture not found at %s', f)); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/fixtures/ndi_templates/app.json b/tests/+did2/fixtures/ndi_templates/app.json new file mode 100644 index 00000000..e7d5b1c5 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/app.json @@ -0,0 +1,22 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/app.json", + "validation": "$NDISCHEMAPATH\/app_schema.json", + "class_name": "app", + "property_list_name": "app", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "app": { + "name": "", + "version": "", + "url": "", + "os": "", + "os_version": "", + "interpreter": "", + "interpreter_version": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/base.json b/tests/+did2/fixtures/ndi_templates/base.json new file mode 100644 index 00000000..807cfd92 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/base.json @@ -0,0 +1,17 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/base.json", + "validation": "$NDISCHEMAPATH\/base_schema.json", + "class_name": "base", + "property_list_name": "base", + "class_version": 1, + "superclasses": [ ] + }, + "base": { + "id": "", + "session_id": "", + "name": "", + "datestamp": "2018-12-05T18:36:47.241Z" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/subject.json b/tests/+did2/fixtures/ndi_templates/subject.json new file mode 100644 index 00000000..6c16d5b7 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/subject.json @@ -0,0 +1,17 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/subject.json", + "validation": "$NDISCHEMAPATH\/subject_schema.json", + "class_name": "subject", + "property_list_name": "subject", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "subject": { + "local_identifier": "", + "description": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/subject_group.json b/tests/+did2/fixtures/ndi_templates/subject_group.json new file mode 100644 index 00000000..1fc601d9 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/subject_group.json @@ -0,0 +1,14 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/subject_group.json", + "validation": "$NDISCHEMAPATH\/subject_group_schema.json", + "class_name": "subject_group", + "property_list_name": "subject_group", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ ], + "subject_group": { } +} \ No newline at end of file diff --git a/tools/census_digest.py b/tools/census_digest.py index 61aaecd0..93090327 100644 --- a/tools/census_digest.py +++ b/tools/census_digest.py @@ -5128,6 +5128,12 @@ def render_legacy_ndi_document(r, out): L.get("bodies_total", "?"), L.get("bodies_skipped_already_target", "?"), L.get("bodies_unreached", "?"))) + if L.get("bodies_read_raw_v1"): + # [migrators read raw v1] (Jess Haley, 2026-10-26): a switched class's + # body is read raw and never reaches the pass; it is not "unreached" + p(" %s bod(ies) read raw v1 by a switched class's migrator " + "(did2.convert.rawV1Classes; not inspected by the pass)" + % L.get("bodies_read_raw_v1")) if L.get("bodies_reaching_universal_renames") == 0: p(" *** 0 bodies reached the rename pass -- every count below is") p(" *** vacuous. This is what a re-run over already-migrated bodies") From b18a5c1f87da7bb51ed2ad12c90762fc6b95270c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 00:30:51 +0000 Subject: [PATCH 02/45] Treatment family reads raw v1; per-class round trips with known findings Phase 2 of the generic migration, second family (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - did2.convert.rawV1Classes: + treatment, treatment_drug, treatment_transfer, virus_injection. Each migrator reads the raw document through jRawBody (identity by v1read.readBase, a legacy ndi_document-only identity as the renamed path gave it) and returns the untouched v1 source when it carries. treatment.m reads NDI's `ontologyName` (then `ontology_name`); the other three already read the v1 camelCase spellings first. - +roundtrip: inverses for the four classes (treatmentParts / treatmentRows rebuild the mixture rows from chemicals, formulation and dose); check.m gains spec.same (a field kept in another notation: a mixture table's rows, a CURIE's prefix case; [spelling is notation]) reported as `equivalent`. - Fixtures: NDI templates treatment, treatment_drug, treatment_transfer, virus_injection copied verbatim from locked NDI-matlab main 3cb19a8. - testRawV1RoundTripTreatment: writer shapes (treatmentMaker with the vhlab, Birren and Babu rows; table2treatment; Haley; Dabrowska) round trip with their lost fields listed EXACTLY as known findings (open questions, no rule made); the raw path converts every writer and DID-side fixture as the renamed path did; three broken inputs must fail the round trip. - testConvertV1ToV2 / testRawV1RoundTrip: tests about the universalRenames path pass 'RawV1Classes', {} or use an unswitched class. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+convert/+migrators_j/private/jRawBody.m | 40 ++ .../+did2/+convert/+migrators_j/treatment.m | 38 +- .../+convert/+migrators_j/treatment_drug.m | 30 ++ .../+migrators_j/treatment_transfer.m | 29 + .../+convert/+migrators_j/virus_injection.m | 29 + src/did/+did2/+convert/+roundtrip/check.m | 32 +- .../+convert/+roundtrip/private/anchorOnset.m | 13 + .../+convert/+roundtrip/private/asCell.m | 12 + .../+roundtrip/private/bathEquivalents.m | 20 + .../+convert/+roundtrip/private/edgeIds.m | 15 + .../+convert/+roundtrip/private/emptySpec.m | 5 + .../+convert/+roundtrip/private/firstOf.m | 9 + .../+did2/+convert/+roundtrip/private/getIn.m | 18 + .../+convert/+roundtrip/private/mixtureRows.m | 63 +++ .../+convert/+roundtrip/private/mixtureText.m | 22 + .../+convert/+roundtrip/private/numberOf.m | 8 + .../+convert/+roundtrip/private/sameCurie.m | 21 + .../+convert/+roundtrip/private/sameMixture.m | 33 ++ .../+convert/+roundtrip/private/termParts.m | 12 + .../+roundtrip/private/treatmentParts.m | 99 ++++ .../+roundtrip/private/treatmentRows.m | 74 +++ src/did/+did2/+convert/+roundtrip/treatment.m | 100 ++++ .../+convert/+roundtrip/treatment_drug.m | 69 +++ .../+convert/+roundtrip/treatment_transfer.m | 87 +++ .../+convert/+roundtrip/virus_injection.m | 94 ++++ src/did/+did2/+convert/rawV1Classes.m | 10 +- tests/+did2/+unittest/testConvertV1ToV2.m | 16 +- tests/+did2/+unittest/testRawV1RoundTrip.m | 6 +- .../+unittest/testRawV1RoundTripTreatment.m | 495 ++++++++++++++++++ .../fixtures/ndi_templates/treatment.json | 26 + .../ndi_templates/treatment_drug.json | 24 + .../ndi_templates/treatment_transfer.json | 25 + .../ndi_templates/virus_injection.json | 33 ++ 33 files changed, 1596 insertions(+), 11 deletions(-) create mode 100644 src/did/+did2/+convert/+migrators_j/private/jRawBody.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/anchorOnset.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/asCell.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/bathEquivalents.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/edgeIds.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/emptySpec.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/firstOf.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/getIn.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/mixtureRows.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/mixtureText.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/numberOf.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/sameCurie.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/sameMixture.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/termParts.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/treatmentParts.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/treatmentRows.m create mode 100644 src/did/+did2/+convert/+roundtrip/treatment.m create mode 100644 src/did/+did2/+convert/+roundtrip/treatment_drug.m create mode 100644 src/did/+did2/+convert/+roundtrip/treatment_transfer.m create mode 100644 src/did/+did2/+convert/+roundtrip/virus_injection.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripTreatment.m create mode 100644 tests/+did2/fixtures/ndi_templates/treatment.json create mode 100644 tests/+did2/fixtures/ndi_templates/treatment_drug.json create mode 100644 tests/+did2/fixtures/ndi_templates/treatment_transfer.json create mode 100644 tests/+did2/fixtures/ndi_templates/virus_injection.json diff --git a/src/did/+did2/+convert/+migrators_j/private/jRawBody.m b/src/did/+did2/+convert/+migrators_j/private/jRawBody.m new file mode 100644 index 00000000..bda96902 --- /dev/null +++ b/src/did/+did2/+convert/+migrators_j/private/jRawBody.m @@ -0,0 +1,40 @@ +function body = jRawBody(preBody, className) +%JRAWBODY The raw v1 document a switched migrator reads, its identity read +% through did2.convert.v1read.readBase. +% +% BODY = jRawBody(PREBODY, CLASSNAME). PREBODY is the RAW v1 document +% (did2.convert.rawV1Classes: no universalRenames). BODY is PREBODY itself +% when it has a `base` block. A pre-2023 document whose only identity block +% is the legacy `ndi_document` gets a `base` holding the four fields +% readBase reads from it (id, session_id, name, datestamp), and the legacy +% block is removed, so the migrator's builders (jOpts, jSid, jStamp) find the +% identity where they read it. That is what universalRenames' wholesale move +% gave the migrator before the switch; the legacy block's other fields were +% read by no migrator then either (readBase returns them in `extra`). +% +% A document whose identity block states no `id` field raises +% did2:convert::noId, which v1_to_v2 quarantines -- as the +% migrator's read of `preBody.base.id` did before the switch. +% +% A migrator that carries the document returns PREBODY, never BODY: the carry +% is the untouched v1 source ([migrators read raw v1]). +% +% See also did2.convert.v1read.readBase, did2.convert.rawV1Classes. + +b = did2.convert.v1read.readBase(preBody); +if isempty(b.source) || ~any(strcmp(b.present, 'id')) + error(['did2:convert:' className ':noId'], ... + 'A v1 %s with no base.id cannot keep its id.', className); +end +body = preBody; +if strcmp(b.source, 'ndi_document') + base = struct(); + for f = {'id', 'session_id', 'name', 'datestamp'} + if any(strcmp(b.present, f{1})) + base.(f{1}) = b.(f{1}); + end + end + body.base = base; + body = rmfield(body, 'ndi_document'); +end +end diff --git a/src/did/+did2/+convert/+migrators_j/treatment.m b/src/did/+did2/+convert/+migrators_j/treatment.m index 8b98a025..20de7743 100644 --- a/src/did/+did2/+convert/+migrators_j/treatment.m +++ b/src/did/+did2/+convert/+migrators_j/treatment.m @@ -36,18 +36,54 @@ % Not-a-manipulation rows (date of birth, experiment time) and substance rows whose dose amounts cannot all be placed are also % carried whole as v1 ([generic stage is lossless], [partly placed is % carried as v1], Jess Haley, 2026-10-25). +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames (identity through jRawBody / +% did2.convert.v1read.readBase; a carry is the untouched v1 source). Block +% fields are read in the v1 spelling first and the universalRenames spelling +% second, so 'RawV1Classes', {} still works. Every v1 field (NDI treatment.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8, as +% +NDIMaker/treatmentMaker writes it) and where it goes; +% did2.convert.roundtrip.treatment rebuilds the v1 document and +% testRawV1RoundTripTreatment compares the two: +% +% base.id / session_id / datestamp -> the manipulation's id / session edge / +% creation_timestamp; base.name (writers: '') +% is not written (#73 item 54) +% depends_on subject_id -> the statement's entity_id +% depends_on manipulation_id, protocol_id +% -> NOT READ: empty in every writer but +% table2treatment, whose group link is lost +% (an open finding, testRawV1RoundTripTreatment) +% treatment.ontologyName, name -> statement.variable (registry term) +% treatment.numeric_value -> the value (termNumberKind) or the `numeric +% value` condition +% treatment.string_value -> notes, or the site observation / the +% immersion when it is a CURIE arguments preBody (1,1) struct end +body = jRawBody(preBody, 'treatment'); +v2Body = convertTreatment(body); +if isscalar(v2Body) && isequaln(v2Body{1}, body) + v2Body = {preBody}; % a carry is the untouched v1 source +end +end + +function v2Body = convertTreatment(preBody) if ~isfield(preBody, 'treatment') || ~isstruct(preBody.treatment) error('did2:convert:missingBlock', ... 'treatment body is missing the treatment property block.'); end block = preBody.treatment; -node = jGetChar(block, 'ontology_name'); +% NDI's template and writers (treatmentMaker, table2treatment, +haley, +% +dabrowska) spell the node `ontologyName`; `ontology_name` is the spelling of +% a body that went through universalRenames ('RawV1Classes', {}). +node = jGetCharAny(block, {'ontologyName', 'ontology_name'}); label = jGetChar(block, 'name'); strValue = jGetChar(block, 'string_value'); numValue = []; diff --git a/src/did/+did2/+convert/+migrators_j/treatment_drug.m b/src/did/+did2/+convert/+migrators_j/treatment_drug.m index 2b0ad1f7..8d82e914 100644 --- a/src/did/+did2/+convert/+migrators_j/treatment_drug.m +++ b/src/did/+did2/+convert/+migrators_j/treatment_drug.m @@ -29,11 +29,41 @@ % % 1 -> N: the manipulation, one chemical per mixture row, the formulation % and the anchor, plus the site observation for a dose at a site. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames (identity through jRawBody / +% did2.convert.v1read.readBase; a carry is the untouched v1 source). Block +% fields are read in the v1 spelling first and the universalRenames spelling +% second, so 'RawV1Classes', {} still works. Every v1 field (NDI treatment/treatment_drug.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8, as +% +NDIMaker/treatmentMaker writes it) and where it goes; +% did2.convert.roundtrip.treatment_drug rebuilds the v1 document and +% testRawV1RoundTripTreatment compares the two: +% +% base.*, depends_on subject_id -> as treatment.m +% location_ontologyNode, location_name -> the route (jTreatmentRoute) and +% the site observation of a dose +% location_ontologyName -> NOT READ: the WRITER's spelling of the node +% (treatmentMaker); an open finding +% mixture_table -> chemicals + formulation (+ the dose's +% per-ingredient amounts, jDoseValue) +% administration_onset_time -> the anchor (jTreatmentAnchor) +% administration_offset_time, administration_duration +% -> NOT READ (open findings) arguments preBody (1,1) struct end +body = jRawBody(preBody, 'treatment_drug'); +v2Body = convertTreatmentDrug(body); +if isscalar(v2Body) && isequaln(v2Body{1}, body) + v2Body = {preBody}; % a carry is the untouched v1 source +end +end + +function v2Body = convertTreatmentDrug(preBody) if ~isfield(preBody, 'treatment_drug') || ~isstruct(preBody.treatment_drug) error('did2:convert:missingBlock', ... 'treatment_drug body is missing the treatment_drug property block.'); diff --git a/src/did/+did2/+convert/+migrators_j/treatment_transfer.m b/src/did/+did2/+convert/+migrators_j/treatment_transfer.m index 340124d4..fe1971c0 100644 --- a/src/did/+did2/+convert/+migrators_j/treatment_transfer.m +++ b/src/did/+did2/+convert/+migrators_j/treatment_transfer.m @@ -23,11 +23,40 @@ % relate THAT to the donor (Path S); that refinement is a job for the NDI % second pass (ndi.migrate) which has the corpus-wide subject graph. Here we % emit the recipient<-donor provenance edge directly. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames (identity through jRawBody / +% did2.convert.v1read.readBase; a carry is the untouched v1 source). Block +% fields are read in the v1 spelling first and the universalRenames spelling +% second, so 'RawV1Classes', {} still works. Every v1 field (NDI treatment/treatment_transfer.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8, as +% +NDIMaker/treatmentMaker writes it) and where it goes; +% did2.convert.roundtrip.treatment_transfer rebuilds the v1 document and +% testRawV1RoundTripTreatment compares the two: +% +% base.* -> as treatment.m +% depends_on recipient_id -> the act's entity_id and the relation's child +% depends_on donor_id -> the relation's parent +% entity_ontologyNode, entity_name -> the variable and the term value +% method_name -> interaction.method (a label; '' becomes +% 'transfer', an open finding) +% method_ontologyNode -> NOT READ (an open finding) +% timestamp, clocktype -> the anchor; a clock with no timestamp is +% not kept (an open finding) arguments preBody (1,1) struct end +body = jRawBody(preBody, 'treatment_transfer'); +v2Body = convertTreatmentTransfer(body); +if isscalar(v2Body) && isequaln(v2Body{1}, body) + v2Body = {preBody}; % a carry is the untouched v1 source +end +end + +function v2Body = convertTreatmentTransfer(preBody) if ~isfield(preBody, 'treatment_transfer') || ~isstruct(preBody.treatment_transfer) error('did2:convert:missingBlock', ... 'treatment_transfer body is missing the treatment_transfer property block.'); diff --git a/src/did/+did2/+convert/+migrators_j/virus_injection.m b/src/did/+did2/+convert/+migrators_j/virus_injection.m index 7413c363..1b5f21ab 100644 --- a/src/did/+did2/+convert/+migrators_j/virus_injection.m +++ b/src/did/+did2/+convert/+migrators_j/virus_injection.m @@ -20,11 +20,40 @@ % NaN in `volume.liters` (the template has no volume field) plus the site % `term_observation` (Path S, D3); no location -> that dose, listed in the % migration report as `route_unknown`. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames (identity through jRawBody / +% did2.convert.v1read.readBase; a carry is the untouched v1 source). Block +% fields are read in the v1 spelling first and the universalRenames spelling +% second, so 'RawV1Classes', {} still works. Every v1 field (NDI treatment/virus_injection.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8, as +% +NDIMaker/treatmentMaker writes it) and where it goes; +% did2.convert.roundtrip.virus_injection rebuilds the v1 document and +% testRawV1RoundTripTreatment compares the two: +% +% base.*, depends_on subject_id -> as treatment.m +% virus_OntologyName, virus_name -> the variable and the first chemical +% dilution -> its concentration (0: NaN, [virus-location]) +% diluent_OntologyName, diluent_name -> the second chemical +% virusLocation_OntologyName, virusLocation_name -> the route and the +% site observation of a dose +% virus_AdministrationDate -> the anchor (jTreatmentAnchor) +% virus_AdministrationPND -> NOT READ (an open finding) +% files.file_list -> empty in the template and the writer arguments preBody (1,1) struct end +body = jRawBody(preBody, 'virus_injection'); +v2Body = convertVirusInjection(body); +if isscalar(v2Body) && isequaln(v2Body{1}, body) + v2Body = {preBody}; % a carry is the untouched v1 source +end +end + +function v2Body = convertVirusInjection(preBody) if ~isfield(preBody, 'virus_injection') || ~isstruct(preBody.virus_injection) error('did2:convert:missingBlock', ... 'virus_injection body is missing the virus_injection property block.'); diff --git a/src/did/+did2/+convert/+roundtrip/check.m b/src/did/+did2/+convert/+roundtrip/check.m index 72aef697..762125dc 100644 --- a/src/did/+did2/+convert/+roundtrip/check.m +++ b/src/did/+did2/+convert/+roundtrip/check.m @@ -25,6 +25,12 @@ % does not keep but that can only have been one of % VALUES (a writer default, or a restatement of a % kept value), each with the decision that allows it +% spec.same struct array {path, fn, why} (optional): a v1 +% field V2 keeps in another notation, compared by +% FN(v1Value, rebuiltValue) -> true when both state +% the same thing (a CSV table's rows, a CURIE's +% prefix case: [spelling is notation], Jess Haley, +% 2026-10-26), each with the decision that allows it % spec.unplaced cellstr: emitted content the inverse could not % place (an unexpected document, a wrong type) % A class with no inverse is an error (did2:convert:roundtrip:noInverse). @@ -35,6 +41,8 @@ % not_set the v1 value is EMPTY and the rebuilt has nothing there (an % empty template default; [writer default is not set]) % restated the v1 value is one of spec.equivalents' values for the path +% equivalent spec.same's FN for the path says the rebuilt value states the +% same thing in another notation % exempt `document_class.*` except `class_name`, on a CONVERTED % document only: the v1 stamp (template paths, class_version, % superclasses), which V2 replaces with its own and @@ -47,7 +55,7 @@ % REPORT fields, the denominator first (Operating Rule 5): % fields_inspected the number of leaf fields of V1BODY % class_name, source_id, carried -% matched, not_set, restated, exempt cellstr of paths +% matched, not_set, restated, equivalent, exempt cellstr of paths % lost struct array {path, v1, rebuilt} % invented cellstr of paths % unplaced cellstr (from the inverse) @@ -66,7 +74,7 @@ base = did2.convert.v1read.readBase(v1Body); report = struct('fields_inspected', 0, 'class_name', stamp.class_name, ... 'source_id', base.id, 'carried', false, 'matched', {{}}, ... - 'not_set', {{}}, 'restated', {{}}, 'exempt', {{}}, ... + 'not_set', {{}}, 'restated', {{}}, 'equivalent', {{}}, 'exempt', {{}}, ... 'lost', struct('path', {}, 'v1', {}, 'rebuilt', {}), ... 'invented', {{}}, 'unplaced', {{}}, 'ok', false); @@ -95,6 +103,10 @@ end [rebuilt, spec] = feval(str2func(fqn), bodies); end +same = struct('path', {}, 'fn', {}, 'why', {}); +if isfield(spec, 'same') + same = spec.same; +end report.unplaced = spec.unplaced; origLeaves = flattenLeaves(v1Body); @@ -113,6 +125,8 @@ report.not_set{end+1} = lf.path; elseif isRestated(spec.equivalents, lf.path, lf.value) report.restated{end+1} = lf.path; + elseif found && isSame(same, lf.path, lf.value, rv) + report.equivalent{end+1} = lf.path; else if ~found rv = ''; @@ -165,6 +179,20 @@ end end +function tf = isSame(same, path, value, rebuilt) +tf = false; +for k = 1:numel(same) + if ~strcmp(same(k).path, path) + continue; + end + fn = same(k).fn; + if fn(value, rebuilt) + tf = true; + return; + end +end +end + function tf = isRestated(equivalents, path, value) tf = false; for k = 1:numel(equivalents) diff --git a/src/did/+did2/+convert/+roundtrip/private/anchorOnset.m b/src/did/+did2/+convert/+roundtrip/private/anchorOnset.m new file mode 100644 index 00000000..bd867f27 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/anchorOnset.m @@ -0,0 +1,13 @@ +function onset = anchorOnset(anchor) +%ANCHORONSET The instant an `absolute_time_reference` anchor states, as the +% v1 text it was read from (`value.start.source_value`, jAbsoluteReference); +% '' for any other anchor (a "during the session" reference states none). +onset = ''; +if ~strcmp(classNameOf(anchor), 'absolute_time_reference') + return; +end +[v, ok] = getIn(anchor, 'absolute_time_reference', 'value', 'start', 'source_value'); +if ok && (ischar(v) || (isstring(v) && isscalar(v))) + onset = char(v); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/asCell.m b/src/did/+did2/+convert/+roundtrip/private/asCell.m new file mode 100644 index 00000000..9c860808 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/asCell.m @@ -0,0 +1,12 @@ +function c = asCell(v) +%ASCELL A list (struct array or cell) as a 1xN cell; {} for an empty one. +if iscell(v) + c = reshape(v, 1, []); +elseif isstruct(v) + c = num2cell(reshape(v, 1, [])); +elseif isempty(v) + c = {}; +else + c = {v}; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/bathEquivalents.m b/src/did/+did2/+convert/+roundtrip/private/bathEquivalents.m new file mode 100644 index 00000000..26e3e130 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/bathEquivalents.m @@ -0,0 +1,20 @@ +function spec = bathEquivalents(spec, nodePath, namePath) +%BATHEQUIVALENTS An immersion's v1 location, which V2 does not write: an +% immersion IS a treatment at the bath, so its v1 location can only have +% been the bath, NCIm:C0179246 "bath", the node and name NDI's writers use +% (+birren/TreatmentCreator.m, createSayaTreatments.m, +babu/treatments.json) +% and the only location jTreatmentRoute routes to an immersion (Jess Haley, +% 2026-10-21 [treatment-location], [virus-location]: "a bath location makes +% it an immersion ... no location observation"). Any other spelling is +% reported lost. NODEPATH or NAMEPATH '' adds nothing for it. +why = ['an immersion is a treatment at the bath, NCIm:C0179246 "bath" ' ... + '([treatment-location], [virus-location]; jTreatmentRoute)']; +if ~isempty(nodePath) + spec.equivalents(end+1) = struct('path', nodePath, ... + 'values', {{'NCIm:C0179246'}}, 'why', why); +end +if ~isempty(namePath) + spec.equivalents(end+1) = struct('path', namePath, ... + 'values', {{'bath'}}, 'why', why); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/edgeIds.m b/src/did/+did2/+convert/+roundtrip/private/edgeIds.m new file mode 100644 index 00000000..fb8f173d --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/edgeIds.m @@ -0,0 +1,15 @@ +function ids = edgeIds(body, name) +%EDGEIDS Every id an emitted document's depends_on edge NAME names, in +% order, as a 1xN cellstr (read with did2.convert.v1read.readDependsOn, so +% either spelling of an edge is read). +ids = {}; +if ~isstruct(body) || ~isscalar(body) + return; +end +deps = did2.convert.v1read.readDependsOn(body, 'Name', ['^' name '$']); +for k = 1:numel(deps) + if ~isempty(deps(k).document_id) + ids{end+1} = char(deps(k).document_id); %#ok + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/emptySpec.m b/src/did/+did2/+convert/+roundtrip/private/emptySpec.m new file mode 100644 index 00000000..398e3711 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/emptySpec.m @@ -0,0 +1,5 @@ +function spec = emptySpec() +%EMPTYSPEC An inverse's SPEC with nothing in it (did2.convert.roundtrip.check). +spec = struct('equivalents', struct('path', {}, 'values', {}, 'why', {}), ... + 'same', struct('path', {}, 'fn', {}, 'why', {}), 'unplaced', {{}}); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/firstOf.m b/src/did/+did2/+convert/+roundtrip/private/firstOf.m new file mode 100644 index 00000000..f8e67255 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/firstOf.m @@ -0,0 +1,9 @@ +function v = firstOf(v) +%FIRSTOF The first element of a non-scalar struct array or of a cell; V +% itself otherwise. +if iscell(v) && ~isempty(v) + v = v{1}; +elseif isstruct(v) && numel(v) > 1 + v = v(1); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/getIn.m b/src/did/+did2/+convert/+roundtrip/private/getIn.m new file mode 100644 index 00000000..289d434a --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/getIn.m @@ -0,0 +1,18 @@ +function [v, found] = getIn(s, varargin) +%GETIN The value at S.(A).(B)... (FOUND false, V [] when any step is +% missing). A struct array or a cell is read at its first element at each +% step, the shape jsondecode or did2.build gives a one-element list. +v = s; +found = true; +for i = 1:numel(varargin) + v = firstOf(v); + f = varargin{i}; + if isstruct(v) && isscalar(v) && isfield(v, f) + v = v.(f); + else + v = []; + found = false; + return; + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/mixtureRows.m b/src/did/+did2/+convert/+roundtrip/private/mixtureRows.m new file mode 100644 index 00000000..633ee055 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/mixtureRows.m @@ -0,0 +1,63 @@ +function rows = mixtureRows(raw) +%MIXTUREROWS The rows of a v1 `mixture_table` text, read as +% did2.convert.migrators_j reads them (its private jMixtureTable): a CSV as +% NDI's ndi.database.fun.writetablechar writes it, an optional HEADER row +% (ontologyName,name,value,ontologyUnit,unitName) naming the columns, cells +% possibly double-quoted; a table with no header is read by position in the +% same order. A line with neither a node nor a name is skipped. +% +% ROWS is a struct array {node, name, value, unode, uname}: text, and VALUE +% a double ([] when the cell is empty). +rows = struct('node', {}, 'name', {}, 'value', {}, 'unode', {}, 'uname', {}); +if isstring(raw); raw = char(raw); end +if ~ischar(raw) || isempty(strtrim(raw)) + return; +end +lines = regexp(raw, '\r?\n', 'split'); +col = struct('node', 1, 'name', 2, 'value', 3, 'unode', 4, 'uname', 5); +for i = 1:numel(lines) + line = strtrim(lines{i}); + if isempty(line); continue; end + cells = regexp(line, '("([^"]|"")*"|[^,]*)(,|$)', 'tokens'); + cells = cellfun(@(c) unquote(c{1}), cells, 'UniformOutput', false); + if strcmpi(cells{1}, 'ontologyName') + col = headerColumns(cells, col); + continue; + end + node = cellAt(cells, col.node); + name = cellAt(cells, col.name); + if isempty(node) && isempty(name); continue; end + value = []; + v = cellAt(cells, col.value); + if ~isempty(v) + value = str2double(v); + end + rows(end+1) = struct('node', node, 'name', name, 'value', value, ... + 'unode', cellAt(cells, col.unode), 'uname', cellAt(cells, col.uname)); %#ok +end +end + +function col = headerColumns(cells, col) +names = {'ontologyName', 'node'; 'name', 'name'; 'value', 'value'; ... + 'ontologyUnit', 'unode'; 'unitName', 'uname'}; +for k = 1:size(names, 1) + hit = find(strcmpi(cells, names{k, 1}), 1); + if ~isempty(hit) + col.(names{k, 2}) = hit; + end +end +end + +function c = cellAt(cells, k) +c = ''; +if k <= numel(cells) + c = strtrim(cells{k}); +end +end + +function t = unquote(t) +t = strtrim(t); +if numel(t) >= 2 && t(1) == '"' && t(end) == '"' + t = strrep(t(2:end-1), '""', '"'); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/mixtureText.m b/src/did/+did2/+convert/+roundtrip/private/mixtureText.m new file mode 100644 index 00000000..a11cf966 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/mixtureText.m @@ -0,0 +1,22 @@ +function txt = mixtureText(rows) +%MIXTURETEXT A `mixture_table` text from ROWS (mixtureRows' shape), in the +% layout ndi.database.fun.writetablechar gives it: the header row, then one +% line per row; a cell holding a comma or a quote is double-quoted. +lines = {'ontologyName,name,value,ontologyUnit,unitName'}; +for k = 1:numel(rows) + r = rows(k); + v = ''; + if ~isempty(r.value) + v = num2str(r.value, 15); + end + lines{end+1} = strjoin({q(r.node), q(r.name), v, q(r.unode), q(r.uname)}, ','); %#ok +end +txt = [strjoin(lines, newline) newline]; +end + +function s = q(s) +s = char(s); +if contains(s, ',') || contains(s, '"') + s = ['"' strrep(s, '"', '""') '"']; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/numberOf.m b/src/did/+did2/+convert/+roundtrip/private/numberOf.m new file mode 100644 index 00000000..ac10b41b --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/numberOf.m @@ -0,0 +1,8 @@ +function v = numberOf(x) +%NUMBEROF X as a scalar double when it is a finite number; [] otherwise. +v = []; +x = firstOf(x); +if isnumeric(x) && ~isempty(x) && isfinite(double(x(1))) + v = double(x(1)); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/sameCurie.m b/src/did/+did2/+convert/+roundtrip/private/sameCurie.m new file mode 100644 index 00000000..d59c194f --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/sameCurie.m @@ -0,0 +1,21 @@ +function tf = sameCurie(a, b) +%SAMECURIE True when two CURIE texts name one node: equal once the prefix +% case is set aside (did2.schema.curieKey). A prefix's case is spelling +% ([spelling is notation], Jess Haley, 2026-10-26; the term registry writes +% a registered node in its registered spelling, did2.convert.registeredTerm). +tf = false; +if ~(ischar(a) || isstring(a)) || ~(ischar(b) || isstring(b)) + return; +end +a = strtrim(char(a)); +b = strtrim(char(b)); +tf = strcmp(a, b) || strcmp(curieKeyOf(a), curieKeyOf(b)); +end + +function k = curieKeyOf(s) +try + k = char(did2.schema.curieKey(s)); +catch + k = lower(s); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/sameMixture.m b/src/did/+did2/+convert/+roundtrip/private/sameMixture.m new file mode 100644 index 00000000..2a645775 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/sameMixture.m @@ -0,0 +1,33 @@ +function tf = sameMixture(a, b) +%SAMEMIXTURE True when two `mixture_table` texts state the same rows: the +% same number of rows, in order, each with the same substance node (prefix +% case aside, sameCurie) and name, the same number (compared as numbers, +% so 1e-05 and 0.00001 agree) and the same unit node and name. The text's +% layout -- header, quoting, number format, line ends -- is notation +% ([spelling is notation], Jess Haley, 2026-10-26). +ra = mixtureRows(a); +rb = mixtureRows(b); +tf = numel(ra) == numel(rb); +for k = 1:numel(ra) + if ~tf; return; end + tf = sameNode(ra(k).node, rb(k).node) && strcmp(ra(k).name, rb(k).name) ... + && sameNumber(ra(k).value, rb(k).value) ... + && sameNode(ra(k).unode, rb(k).unode) && strcmp(ra(k).uname, rb(k).uname); +end +end + +function tf = sameNode(a, b) +tf = (isempty(a) && isempty(b)) || sameCurie(a, b); +end + +function tf = sameNumber(a, b) +if isempty(a) || isempty(b) + tf = isempty(a) && isempty(b); + return; +end +if isnan(a) || isnan(b) + tf = isnan(a) && isnan(b); + return; +end +tf = abs(a - b) <= 1e-12 * max(1, abs(a)); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/termParts.m b/src/did/+did2/+convert/+roundtrip/private/termParts.m new file mode 100644 index 00000000..790ee29f --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/termParts.m @@ -0,0 +1,12 @@ +function [node, name] = termParts(t) +%TERMPARTS A term's node and name as text ('' when absent). +node = ''; +name = ''; +t = firstOf(t); +if isstruct(t) && isscalar(t) + if isfield(t, 'node') && ~isempty(t.node); node = char(t.node); end + if isfield(t, 'name') && ~isempty(t.name); name = char(t.name); end +elseif ischar(t) || (isstring(t) && isscalar(t)) + name = char(t); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/treatmentParts.m b/src/did/+did2/+convert/+roundtrip/private/treatmentParts.m new file mode 100644 index 00000000..a118c88c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/treatmentParts.m @@ -0,0 +1,99 @@ +function p = treatmentParts(bodies) +%TREATMENTPARTS The documents a treatment-family migrator emitted, by role. +% +% P = treatmentParts(BODIES), BODIES the emitted document structs of ONE v1 +% treatment, treatment_drug, treatment_transfer or virus_injection +% (did2.convert.migrators_j: jTreatmentBodies, jDoseBodies, +% jTreatmentAnchor). Roles, each found by the edge that names it: +% +% manip the `manipulation` (the first one; it keeps the v1 id) +% kind its value kind (did2.convert.statementKind): 'dose', +% 'formulation' (an immersion), 'term', 'time', ... +% anchor the time reference its first `time_reference_id` names +% formulation the formulation its `formulation_id` (a dose) or `value_id` +% (an immersion) names +% chemicals the chemicals the formulation's `ingredient_id` edges name, +% in edge order (jDoseBodies writes them in mixture-row order) +% site the `observation` about the same entity whose variable is +% NCIT:C13717 "Anatomic Site" (the Path S site, D3) +% relations every `directed_relation` +% unplaced cellstr: a document no role claims, or a named edge whose +% document is not among BODIES +% +% Every field is [] / {} when absent. + +p = struct('manip', [], 'kind', '', 'anchor', [], 'formulation', [], ... + 'chemicals', {{}}, 'site', [], 'relations', {{}}, 'unplaced', {{}}); +n = numel(bodies); +used = false(1, n); +ids = cell(1, n); +for k = 1:n + ids{k} = ''; + [v, ok] = getIn(bodies{k}, 'base', 'id'); + if ok && ~isempty(v); ids{k} = char(v); end +end + +for k = 1:n + if strcmp(classNameOf(bodies{k}), 'manipulation') + p.manip = bodies{k}; + used(k) = true; + break; + end +end +if isempty(p.manip) + p.unplaced{end+1} = 'no manipulation was emitted'; + return; +end +[~, p.kind] = did2.convert.statementKind(p.manip); + +tr = edgeIds(p.manip, 'time_reference_id'); +if ~isempty(tr) + [p.anchor, used, p.unplaced] = claim(tr{1}, 'time reference', ids, bodies, used, p.unplaced); +end +fid = edgeIds(p.manip, 'formulation_id'); +if isempty(fid) + fid = edgeIds(p.manip, 'value_id'); +end +if ~isempty(fid) + [p.formulation, used, p.unplaced] = claim(fid{1}, 'formulation', ids, bodies, used, p.unplaced); +end +if ~isempty(p.formulation) + ing = edgeIds(p.formulation, 'ingredient_id'); + for i = 1:numel(ing) + [c, used, p.unplaced] = claim(ing{i}, 'chemical', ids, bodies, used, p.unplaced); + p.chemicals{end+1} = c; + end +end +entity = edgeIds(p.manip, 'entity_id'); +for k = 1:n + if used(k); continue; end + b = bodies{k}; + switch classNameOf(b) + case 'observation' + [node, ~] = termParts(getIn(b, 'statement', 'variable')); + if isempty(p.site) && sameCurie(node, 'NCIT:C13717') ... + && isequal(edgeIds(b, 'entity_id'), entity) + p.site = b; + used(k) = true; + end + case 'directed_relation' + p.relations{end+1} = b; + used(k) = true; + end +end +for k = find(~used) + p.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in a treatment', ... + k, classNameOf(bodies{k})); +end +end + +function [doc, used, unplaced] = claim(id, role, ids, bodies, used, unplaced) +doc = []; +hit = find(strcmp(ids, id), 1); +if isempty(hit) + unplaced{end+1} = sprintf('the %s %s the manipulation names was not emitted', role, id); + return; +end +doc = bodies{hit}; +used(hit) = true; +end diff --git a/src/did/+did2/+convert/+roundtrip/private/treatmentRows.m b/src/did/+did2/+convert/+roundtrip/private/treatmentRows.m new file mode 100644 index 00000000..7a8d05b3 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/treatmentRows.m @@ -0,0 +1,74 @@ +function rows = treatmentRows(p) +%TREATMENTROWS The substances a treatment's formulation names, one row per +% chemical in ingredient order, in mixtureRows' shape {node, name, value, +% unode, uname}: the inverse of jMixtureTable + jDoseValue + jDoseBodies. +% +% P is treatmentParts' output. For row k (the k-th `ingredient_id` of the +% formulation): +% node, name the chemical's `value.substance` +% value, unit the formulation's k-th ingredient `concentration` +% (source_value, source_unit) when its source_value is a +% finite number; else the DOSE's own per-ingredient amount +% for that chemical (the dose's `value.ingredients` entry at +% the position of the dose's `ingredient_id` edge naming it: +% amount_per_body_mass, mass or substance_amount), which +% jDoseValue took off the row; else no value. A unit stated +% with no number (NaN) is kept with an empty value. +% +% An amount jDoseValue placed on the dose itself (`value.volume`, `mass`, +% ... with a finite source_value) belongs to a row it does not name; it is +% not attributed here, and the round trip reports that row's value lost. +rows = struct('node', {}, 'name', {}, 'value', {}, 'unode', {}, 'uname', {}); +ingredients = asCell(getIn(p.formulation, 'formulation', 'value', 'ingredients')); +doseIng = {}; +doseIngIds = {}; +if strcmp(p.kind, 'dose') + doseIng = asCell(getIn(p.manip, 'dose', 'value', 'ingredients')); + doseIngIds = edgeIds(p.manip, 'ingredient_id'); +end +for k = 1:numel(p.chemicals) + c = p.chemicals{k}; + [node, name] = termParts(getIn(c, 'chemical', 'value', 'substance')); + value = []; + unit = []; + if k <= numel(ingredients) + [value, unit] = amountOf(ingredients{k}, {'concentration'}); + end + if isempty(value) + cid = ''; + [v, ok] = getIn(c, 'base', 'id'); + if ok; cid = char(v); end + j = find(strcmp(doseIngIds, cid), 1); + if ~isempty(j) && j <= numel(doseIng) + [v2, u2] = amountOf(doseIng{j}, {'amount_per_body_mass', 'mass', 'substance_amount'}); + if ~isempty(v2) || ~isempty(u2) + value = v2; + unit = u2; + end + end + end + [unode, uname] = termParts(unit); + rows(end+1) = struct('node', node, 'name', name, 'value', value, ... + 'unode', unode, 'uname', uname); %#ok +end +end + +function [value, unit] = amountOf(entry, slots) +value = []; +unit = []; +for s = 1:numel(slots) + [q, ok] = getIn(entry, slots{s}); + if ~ok || ~isstruct(q); continue; end + [sv, okv] = getIn(q, 'source_value'); + [su, oku] = getIn(q, 'source_unit'); + if okv + value = numberOf(sv); + end + if oku + unit = su; + end + if ~isempty(value) || ~isempty(unit) + return; + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/treatment.m b/src/did/+did2/+convert/+roundtrip/treatment.m new file mode 100644 index 00000000..bfa3056a --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/treatment.m @@ -0,0 +1,100 @@ +function [v1, spec] = treatment(bodies) +%TREATMENT Rebuild a v1 `treatment` from what did2.convert.migrators_j.treatment +% emitted for it when it CONVERTED it (a carried treatment is compared by +% did2.convert.roundtrip.check directly). +% +% [V1, SPEC] = did2.convert.roundtrip.treatment(BODIES): BODIES is a cell of +% the emitted document structs. V1 is the treatment in NDI's v1 shape +% (treatment.json + base.json at the locked NDI-matlab `main`, 3cb19a8; +% written by +NDIMaker/treatmentMaker, +database/+metadata/table2treatment, +% +haley/doImport, +dabrowska/doImport): +% +% base.id, session_id, datestamp the manipulation (rebuildBase) +% depends_on(1) subject_id the manipulation's `entity_id` +% treatment.ontologyName statement.variable's node +% treatment.name statement.variable's name +% treatment.numeric_value a manipulation of the kind its term states +% (termNumberKind): the value's source_value; +% a dose / immersion: the `numeric value` +% condition (an unlabelled number) +% treatment.string_value the manipulation's notes; or the site +% observation's term node (the Dab "Target +% Location" idiom: the site CURIE); for an +% immersion the bath, NCIm:C0179246 +% +% SPEC: the template's other two depends_on entries (manipulation_id, +% protocol_id) are restated by name when the writer left them empty +% (ndi.document fills every template entry; an EMPTY one states nothing), +% so a non-empty `manipulation_id` (table2treatment's group link) is +% reported lost. `string_value` as a site or bath CURIE compares by node +% (sameCurie: the registry writes its registered spelling). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.treatment. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +p = treatmentParts(bodies); +spec.unplaced = p.unplaced; +if isempty(p.manip) + return; +end +[base, ~] = rebuildBase(p.manip); +[node, name] = termParts(getIn(p.manip, 'statement', 'variable')); + +numeric = []; +if any(strcmp(p.kind, {'dose', 'formulation'})) + numeric = conditionNumber(getIn(p.manip, 'statement', 'conditions')); +elseif ~isempty(p.kind) + numeric = numberOf(getIn(p.manip, p.kind, 'value', 'source_value')); +end + +stringValue = ''; +[notes, hasNotes] = getIn(p.manip, 'statement', 'notes'); +if hasNotes && ~isempty(notes) + stringValue = char(notes); +elseif ~isempty(p.site) + stringValue = termParts(getIn(p.site, 'term', 'value')); +elseif strcmp(p.kind, 'formulation') + stringValue = 'NCIm:C0179246'; +end + +v1.document_class = struct('class_name', 'treatment'); +v1.depends_on = struct('name', 'subject_id', 'value', firstId(p.manip, 'entity_id')); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +v1.treatment = struct('ontologyName', node, 'name', name, ... + 'numeric_value', numeric, 'string_value', stringValue); + +why = ['a template depends_on entry the writer left empty (ndi.document ' ... + 'writes every entry of treatment.json; an empty one states nothing)']; +for k = 2:3 + spec.equivalents(end+1) = struct('path', sprintf('depends_on(%d).name', k), ... + 'values', {{'manipulation_id', 'protocol_id'}}, 'why', why); +end +spec.same(end+1) = struct('path', 'treatment.string_value', ... + 'fn', @(a, b) sameCurie(a, b), 'why', ['a site or bath CURIE, compared ' ... + 'by node ([spelling is notation]; V_eta_prefix_spelling_plan.md)']); +end + +function v = conditionNumber(conds) +v = []; +for c = asCell(conds) + [~, name] = termParts(getIn(c{1}, 'variable')); + if strcmp(name, 'numeric value') + v = numberOf(getIn(c{1}, 'quantity', 'value')); + return; + end +end +end + +function id = firstId(body, name) +ids = edgeIds(body, name); +id = ''; +if ~isempty(ids) + id = ids{1}; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/treatment_drug.m b/src/did/+did2/+convert/+roundtrip/treatment_drug.m new file mode 100644 index 00000000..dde98c5e --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/treatment_drug.m @@ -0,0 +1,69 @@ +function [v1, spec] = treatment_drug(bodies) +%TREATMENT_DRUG Rebuild a v1 `treatment_drug` from what +% did2.convert.migrators_j.treatment_drug emitted when it CONVERTED it: an +% immersion (bath) or a dose (an UBERON site), with its chemicals, +% formulation, anchor and, for a dose, the site observation. +% +% [V1, SPEC] = did2.convert.roundtrip.treatment_drug(BODIES). V1 is the +% treatment_drug in NDI's v1 shape (treatment/treatment_drug.json + base.json +% at the locked NDI-matlab `main`, 3cb19a8): +% +% base.id, session_id, datestamp the manipulation (rebuildBase) +% depends_on(1) subject_id the manipulation's `entity_id` +% treatment_drug.mixture_table one row per chemical (treatmentRows), +% compared row by row (sameMixture) +% treatment_drug.location_ontologyNode, location_name +% a dose: the site observation's term; +% an immersion: the bath (SPEC) +% treatment_drug.administration_onset_time +% the absolute anchor's source text +% +% NOT REBUILT, because V2 does not keep them (the round trip reports them): +% `administration_offset_time` and `administration_duration` (no migrator +% reads them), and the WRITER's spelling of the location node, +% `location_ontologyName` (+NDIMaker/treatmentMaker writes that name; the +% template's is `location_ontologyNode`, the only one the migrator reads). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.treatment_drug. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +p = treatmentParts(bodies); +spec.unplaced = p.unplaced; +if isempty(p.manip) + return; +end +[base, ~] = rebuildBase(p.manip); + +block = struct('mixture_table', mixtureText(treatmentRows(p))); +if ~isempty(p.site) + [block.location_ontologyNode, block.location_name] = ... + termParts(getIn(p.site, 'term', 'value')); +elseif strcmp(p.kind, 'formulation') + spec = bathEquivalents(spec, 'treatment_drug.location_ontologyNode', ... + 'treatment_drug.location_name'); +end +onset = anchorOnset(p.anchor); +if ~isempty(onset) + block.administration_onset_time = onset; +end + +v1.document_class = struct('class_name', 'treatment_drug'); +ids = edgeIds(p.manip, 'entity_id'); +if isempty(ids); ids = {''}; end +v1.depends_on = struct('name', 'subject_id', 'value', ids{1}); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +v1.treatment_drug = block; + +spec.same(end+1) = struct('path', 'treatment_drug.mixture_table', ... + 'fn', @(a, b) sameMixture(a, b), 'why', ['the same rows in another ' ... + 'layout ([spelling is notation])']); +spec.same(end+1) = struct('path', 'treatment_drug.location_ontologyNode', ... + 'fn', @(a, b) sameCurie(a, b), 'why', ['the site node in the registry''s ' ... + 'spelling ([spelling is notation]; V_eta_prefix_spelling_plan.md)']); +end diff --git a/src/did/+did2/+convert/+roundtrip/treatment_transfer.m b/src/did/+did2/+convert/+roundtrip/treatment_transfer.m new file mode 100644 index 00000000..fdcd74cb --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/treatment_transfer.m @@ -0,0 +1,87 @@ +function [v1, spec] = treatment_transfer(bodies) +%TREATMENT_TRANSFER Rebuild a v1 `treatment_transfer` from what +% did2.convert.migrators_j.treatment_transfer emitted when it CONVERTED it: +% a `manipulation` of value kind term on the recipient, a `derived_from` +% directed_relation recipient <- donor, and the anchor. +% +% [V1, SPEC] = did2.convert.roundtrip.treatment_transfer(BODIES). V1 is the +% treatment_transfer in NDI's v1 shape (treatment/treatment_transfer.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8; written by +% +NDIMaker/treatmentMaker create_treatment_transfer_doc from +% +babu/TreatmentCreator.m's table): +% +% base.id, session_id, datestamp the manipulation (rebuildBase) +% depends_on(1) recipient_id the manipulation's `entity_id` +% depends_on(2) donor_id the relation's `parent_id` +% entity_ontologyNode, entity_name statement.variable (also term.value) +% method_name interaction.method's term name +% method_ontologyNode that term's node, when it has one +% timestamp, clocktype the relative anchor's start +% source_value and clock name, when it +% has a start ("during the session" +% states neither) +% +% SPEC.unplaced: a relation that is not `derived_from` from the recipient, +% or more than one relation. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.treatment_transfer. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +p = treatmentParts(bodies); +spec.unplaced = p.unplaced; +if isempty(p.manip) + return; +end +[base, ~] = rebuildBase(p.manip); +recipient = edgeIds(p.manip, 'entity_id'); +if isempty(recipient); recipient = {''}; end +recipient = recipient{1}; + +donor = ''; +for k = 1:numel(p.relations) + r = p.relations{k}; + child = edgeIds(r, 'child_id'); + parent = edgeIds(r, 'parent_id'); + rel = getIn(r, 'directed_relation', 'relation'); + isDerived = strcmp(did2.build.vocabularyHandle('relation', rel), 'derived_from'); + if k == 1 && isDerived && isequal(child, {recipient}) && isscalar(parent) + donor = parent{1}; + else + spec.unplaced{end+1} = sprintf(['relation %d is not the one derived_from ' ... + 'edge from the recipient'], k); + end +end + +block = struct(); +[block.entity_ontologyNode, block.entity_name] = ... + termParts(getIn(p.manip, 'statement', 'variable')); +[mnode, mname] = termParts(getIn(p.manip, 'interaction', 'method', 'term')); +block.method_name = mname; +if ~isempty(mnode) + block.method_ontologyNode = mnode; +end +if strcmp(classNameOf(p.anchor), 'relative_time_reference') + [t, hasStart] = getIn(p.anchor, 'relative_time_reference', 'value', 'start', 'source_value'); + if hasStart && ~isempty(t) + block.timestamp = t; + [~, clk] = termParts(getIn(p.anchor, 'relative_time_reference', 'value', 'clock')); + block.clocktype = clk; + end +end + +v1.document_class = struct('class_name', 'treatment_transfer'); +v1.depends_on = struct('name', {'recipient_id', 'donor_id'}, ... + 'value', {recipient, donor}); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +v1.treatment_transfer = block; + +spec.same(end+1) = struct('path', 'treatment_transfer.entity_ontologyNode', ... + 'fn', @(a, b) sameCurie(a, b), 'why', ['a node in the registry''s ' ... + 'spelling ([spelling is notation]; V_eta_prefix_spelling_plan.md)']); +end diff --git a/src/did/+did2/+convert/+roundtrip/virus_injection.m b/src/did/+did2/+convert/+roundtrip/virus_injection.m new file mode 100644 index 00000000..4f93b12e --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/virus_injection.m @@ -0,0 +1,94 @@ +function [v1, spec] = virus_injection(bodies) +%VIRUS_INJECTION Rebuild a v1 `virus_injection` from what +% did2.convert.migrators_j.virus_injection emitted when it CONVERTED it: an +% immersion (bath) or a dose (an UBERON site), the virus (and diluent) as +% chemicals of one formulation, the anchor and, for a dose, the site +% observation. +% +% [V1, SPEC] = did2.convert.roundtrip.virus_injection(BODIES). V1 is the +% virus_injection in NDI's v1 shape (treatment/virus_injection.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8; written by +% +NDIMaker/treatmentMaker create_virus_injection_doc): +% +% base.id, session_id, datestamp the manipulation (rebuildBase) +% depends_on(1) subject_id the manipulation's `entity_id` +% virus_OntologyName, virus_name the first chemical's substance +% dilution the first ingredient's concentration +% source_value; 0 when it is NaN (SPEC) +% diluent_OntologyName, diluent_name +% the second chemical's substance +% virusLocation_OntologyName, virusLocation_name +% a dose: the site observation's term; +% an immersion: the bath (SPEC) +% virus_AdministrationDate the absolute anchor's source text +% +% SPEC.equivalents: `dilution` 0 when the ingredient's concentration is NaN +% -- "A dilution of 0 is treated as not recorded (NaN), not as a measured 0" +% (Jess Haley, 2026-10-21 [virus-location]); 0 is also the template's value. +% +% NOT REBUILT, because V2 does not keep it (the round trip reports it): +% `virus_AdministrationPND` (no migrator reads it). The template's `files` +% block is empty as the writer leaves it, and so not set. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.virus_injection. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +p = treatmentParts(bodies); +spec.unplaced = p.unplaced; +if isempty(p.manip) + return; +end +[base, ~] = rebuildBase(p.manip); +rows = treatmentRows(p); + +block = struct(); +if ~isempty(rows) + block.virus_OntologyName = rows(1).node; + block.virus_name = rows(1).name; + if ~isempty(rows(1).value) + block.dilution = rows(1).value; + else + spec.equivalents(end+1) = struct('path', 'virus_injection.dilution', ... + 'values', {{0}}, 'why', ['a dilution of 0 is not recorded: NaN ' ... + '([virus-location]); 0 is the template value']); + end +end +if numel(rows) >= 2 + block.diluent_OntologyName = rows(2).node; + block.diluent_name = rows(2).name; +end +if numel(rows) > 2 + spec.unplaced{end+1} = sprintf(['the formulation names %d ingredients; a ' ... + 'virus_injection states a virus and one diluent'], numel(rows)); +end +if ~isempty(p.site) + [block.virusLocation_OntologyName, block.virusLocation_name] = ... + termParts(getIn(p.site, 'term', 'value')); +elseif strcmp(p.kind, 'formulation') + spec = bathEquivalents(spec, 'virus_injection.virusLocation_OntologyName', ... + 'virus_injection.virusLocation_name'); +end +onset = anchorOnset(p.anchor); +if ~isempty(onset) + block.virus_AdministrationDate = onset; +end + +v1.document_class = struct('class_name', 'virus_injection'); +ids = edgeIds(p.manip, 'entity_id'); +if isempty(ids); ids = {''}; end +v1.depends_on = struct('name', 'subject_id', 'value', ids{1}); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +v1.virus_injection = block; + +for f = {'virus_OntologyName', 'diluent_OntologyName', 'virusLocation_OntologyName'} + spec.same(end+1) = struct('path', ['virus_injection.' f{1}], ... + 'fn', @(a, b) sameCurie(a, b), 'why', ['a node in the registry''s ' ... + 'spelling ([spelling is notation]; V_eta_prefix_spelling_plan.md)']); +end +end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index b9eac137..062091ae 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -32,8 +32,16 @@ % `app` block, no superclass migrator, and NDI writers % small enough to state every field (ndi.subject, % +NDIMaker/subjectMaker; +babu/import for subject_group). +% treatment the treatment family: four classes, superclass +% treatment_drug `base` only, no `app` block, no superclass migrator, +% treatment_transfer sharing jTreatmentBodies / jTreatmentAnchor; written +% virus_injection by +NDIMaker/treatmentMaker (all four), +% table2treatment, +haley and +dabrowska (treatment). +% Round trips: testRawV1RoundTripTreatment, which +% lists what V2 does not keep as known findings. % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. -names = {'subject', 'subject_group'}; +names = {'subject', 'subject_group', 'treatment', 'treatment_drug', ... + 'treatment_transfer', 'virus_injection'}; end diff --git a/tests/+did2/+unittest/testConvertV1ToV2.m b/tests/+did2/+unittest/testConvertV1ToV2.m index e3c921fe..4ea6bd74 100644 --- a/tests/+did2/+unittest/testConvertV1ToV2.m +++ b/tests/+did2/+unittest/testConvertV1ToV2.m @@ -554,7 +554,9 @@ function testABodyUniversalRenamesWouldDiscardFromIsCarriedWholeAsV1(testCase) v1.treatment = struct('ontology_name', 'NCIT:C0000', 'name', 'a drug', ... 'numeric_value', [], 'string_value', ''); v1.ndi_document = struct('name', 'jrclust.prm'); -result = did2.convert.v1_to_v2(v1, 'Validate', false); +% 'RawV1Classes', {}: `treatment` reads raw v1 since phase 2 +% (did2.convert.rawV1Classes); this test is about the universalRenames path. +result = did2.convert.v1_to_v2(v1, 'Validate', false, 'RawV1Classes', {}); verifyEqual(testCase, result.summary.migrated_count, 1); verifyEqual(testCase, result.summary.passthrough_count, 1); verifyEqual(testCase, result.migrated{1}.className(), 'treatment', ... @@ -724,7 +726,9 @@ function testLegacyCountersReachTheBatchSummaryWithItsDenominator(testCase) v1 = make2019Body(); clean = makeV1Skeleton('treatment'); clean.treatment = struct(); -result = did2.convert.v1_to_v2({v1, clean}, 'Validate', false); +% 'RawV1Classes', {}: `treatment` reads raw v1 since phase 2 +% (did2.convert.rawV1Classes); this test is about the universalRenames path. +result = did2.convert.v1_to_v2({v1, clean}, 'Validate', false, 'RawV1Classes', {}); L = result.summary.legacy_ndi_document; verifyEqual(testCase, L.bodies_total, 2); verifyEqual(testCase, L.bodies_reaching_universal_renames, 2); @@ -744,7 +748,9 @@ function testLegacySummaryIsPresentAndZeroWhenNoBodyCarriesTheBlock(testCase) % a fact about the SAMPLE, not evidence none exist. clean = makeV1Skeleton('treatment'); clean.treatment = struct(); -result = did2.convert.v1_to_v2(clean, 'Validate', false); +% 'RawV1Classes', {}: `treatment` reads raw v1 since phase 2 +% (did2.convert.rawV1Classes); this test is about the universalRenames path. +result = did2.convert.v1_to_v2(clean, 'Validate', false, 'RawV1Classes', {}); L = result.summary.legacy_ndi_document; verifyEqual(testCase, L.bodies_total, 1); verifyEqual(testCase, L.bodies_reaching_universal_renames, 1); @@ -1090,7 +1096,9 @@ function testTheVintageBucketsPartitionTheArmAcrossABatch(testCase) clean.treatment = struct(); bodies{end+1} = clean; -result = did2.convert.v1_to_v2(bodies, 'Validate', false); +% 'RawV1Classes', {}: `treatment` reads raw v1 since phase 2 +% (did2.convert.rawV1Classes); this test is about the universalRenames path. +result = did2.convert.v1_to_v2(bodies, 'Validate', false, 'RawV1Classes', {}); L = result.summary.legacy_ndi_document; verifyEqual(testCase, L.bodies_total, 9); diff --git a/tests/+did2/+unittest/testRawV1RoundTrip.m b/tests/+did2/+unittest/testRawV1RoundTrip.m index 2e6dbbcb..5e5c90c3 100644 --- a/tests/+did2/+unittest/testRawV1RoundTrip.m +++ b/tests/+did2/+unittest/testRawV1RoundTrip.m @@ -46,12 +46,12 @@ function testASwitchedClassSkipsUniversalRenames(testCase) % the denominator: a raw body is counted as read raw, not as reaching the pass % and not as unreached; a class not on the list still reaches the pass other = struct(); -other.document_class = struct('class_name', 'treatment', 'class_version', '1.0.0', ... +other.document_class = struct('class_name', 'unknown_class', 'class_version', '1.0.0', ... 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); other.depends_on = struct('name', {}, 'value', {}); -other.base = struct('id', 'tr_1', 'session_id', 'sess_1', 'name', '', ... +other.base = struct('id', 'uc_1', 'session_id', 'sess_1', 'name', '', ... 'datestamp', '2024-06-01T12:00:00.000Z'); -other.treatment = struct(); +other.unknown_class = struct('foo', 'bar'); r = runRaw({ndiSubject('mouse_42', '', 'mouse_42'), other}); L = r.summary.legacy_ndi_document; verifyEqual(testCase, L.bodies_total, 2); diff --git a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m new file mode 100644 index 00000000..4e074ef0 --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m @@ -0,0 +1,495 @@ +function tests = testRawV1RoundTripTreatment +%TESTRAWV1ROUNDTRIPTREATMENT The treatment family read as raw v1, and its +% round trip: treatment, treatment_drug, treatment_transfer, virus_injection. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes) and [migration reliability +% practices] (a) (a round trip per class, did2.convert.roundtrip.check). The +% test of the round trip is [lossless means round trip]; equivalent spellings +% are [spelling is notation]. +% +% THE v1 DOCUMENTS are built from NDI's templates at the locked NDI-matlab +% `main` (3cb19a8; tests/+did2/fixtures/ndi_templates, copied verbatim) in +% the shapes NDI's WRITERS give them (the writer wins over the template), and +% pass through jsonencode/jsondecode as a corpus delivers them: +% +% treatment +NDIMaker/treatmentMaker create_treatment_doc +% (+vhlab/treatmentTable.m's grating hours; a ChEBI +% substance at an UBERON site), table2treatment (the +% `manipulation_id` group link), +haley/doImport (food +% restriction onset), +dabrowska/doImport (target +% location) +% treatment_drug treatmentMaker create_treatment_drug_doc with +% +birren/TreatmentCreator.m's chronic CNO row (writes +% `location_ontologyName`, the offset and duration) +% virus_injection treatmentMaker create_virus_injection_doc with +% +birren/TreatmentCreator.m's neuronal DREADD row, and +% a body-site row +% treatment_transfer treatmentMaker create_treatment_transfer_doc with +% +babu/TreatmentCreator.m's pick row (a timestamp, and +% NaN where no transfer time was recorded) +% +% Every writer shape below converts or carries exactly as before the switch +% (testTheSwitchChangesNoConvertedTreatment), and its round trip reports +% nothing invented or unplaced. WHAT V2 DOES NOT KEEP is listed, per fixture, +% as KNOWN FINDINGS (knownFindings): open questions for the team, not rules +% made here. Each fixture's lost paths must be EXACTLY its listed findings, +% so a new loss fails, and so does a finding that stops being one. +tests = functiontests(localfunctions); +end + +% ===================== the known findings =============================== + +function f = knownFindings() +% One row per v1 field a writer-shaped document loses today. Open questions, +% reported to the team; nothing here is decided. {fixture, path, why} +f = { ... + 'table2treatment group link', 'depends_on(2).value', ... + ['treatment `manipulation_id` (table2treatment links every treatment ' ... + 'of a group to the first): no migrator reads it']; ... + 'Birren CNO in the bath', 'treatment_drug.location_ontologyName', ... + ['the writer spells the location node `location_ontologyName` ' ... + '(treatmentMaker); the template and the migrator `location_ontologyNode`, ' ... + 'so the node is never read (the bath is found by its name)']; ... + 'Birren CNO in the bath', 'treatment_drug.administration_offset_time', ... + 'no migrator reads the offset time'; ... + 'Birren CNO in the bath', 'treatment_drug.administration_duration', ... + 'no migrator reads the duration'; ... + 'Birren DREADD virus in the bath', 'virus_injection.virus_AdministrationPND', ... + 'no migrator reads the postnatal day'; ... + 'virus at V1', 'virus_injection.virusLocation_name', ... + ['the site term is written with the registry label (T19, ' ... + 'did2.convert.registeredTerm: "primary visual cortex"); the writer''s ' ... + 'label "V1" is kept nowhere']; ... + 'virus at V1', 'virus_injection.virus_AdministrationPND', ... + 'no migrator reads the postnatal day'; ... + 'Babu pick transfer', 'treatment_transfer.method_ontologyNode', ... + ['the method is written as a label only (jMethod(method_name)); ' ... + 'its node is kept nowhere']; ... + 'Babu transfer, no time', 'treatment_transfer.clocktype', ... + ['a clock with no timestamp (Babu writes NaN): the anchor is "during ' ... + 'the session", which states no clock']; ... + 'Babu transfer, no time', 'treatment_transfer.method_ontologyNode', ... + 'as for the pick transfer'}; +end + +function paths = findingsFor(fixture) +f = knownFindings(); +paths = reshape(sort(f(strcmp(f(:, 1), fixture), 2)), 1, []); +end + +% ===================== the writer shapes round trip ====================== + +function testTreatmentWriterShapesRoundTrip(testCase) +roundTripCases(testCase, { ... + 'vhlab grating hours', vhlabHours(), false; ... + 'ChEBI substance at an UBERON site', muscimolAtV1(), false; ... + 'table2treatment group link', groupLinked(), false; ... + 'Haley food restriction onset', haleyOnset(), true; ... + 'Dabrowska target location', dabTarget(), true}); +end + +function testTreatmentDrugWriterShapesRoundTrip(testCase) +roundTripCases(testCase, { ... + 'Birren CNO in the bath', birrenCno(), false; ... + 'treatmentMaker drug at an UBERON site', drugAtSite(), true}); +end + +function testVirusInjectionWriterShapesRoundTrip(testCase) +roundTripCases(testCase, { ... + 'Birren DREADD virus in the bath', birrenVirus(), false; ... + 'virus at V1', virusAtV1(), false}); +end + +function testTreatmentTransferWriterShapesRoundTrip(testCase) +roundTripCases(testCase, { ... + 'Babu pick transfer', babuTransfer(-72000), false; ... + 'Babu transfer, no time', babuTransfer(NaN), false}); +end + +function testEveryKnownFindingNamesAFixtureThatIsRun(testCase) +% a finding whose fixture is not round-tripped would never fail +f = knownFindings(); +names = {'table2treatment group link', 'Birren CNO in the bath', ... + 'Birren DREADD virus in the bath', 'virus at V1', 'Babu pick transfer', ... + 'Babu transfer, no time'}; +for k = 1:size(f, 1) + verifyTrue(testCase, any(strcmp(f{k, 1}, names)), f{k, 1}); +end +end + +% ===================== what the round trip accounts for ================== + +function testEveryTemplateFieldOfAConvertedDrugIsAccountedFor(testCase) +% the Birren row: each field the writer sets is matched, restated, +% equivalent, not set, exempt, or a listed finding +v1 = birrenCno(); +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +accounted = [r.matched, r.restated, r.equivalent, r.not_set, {r.lost.path}]; +for p = {'base.id', 'base.session_id', 'base.name', 'base.datestamp', ... + 'depends_on(1).name', 'depends_on(1).value', ... + 'treatment_drug.location_ontologyName', 'treatment_drug.location_name', ... + 'treatment_drug.mixture_table', 'treatment_drug.administration_onset_time', ... + 'treatment_drug.administration_offset_time', ... + 'treatment_drug.administration_duration', 'document_class.class_name'} + verifyTrue(testCase, any(strcmp(p{1}, accounted)), ... + sprintf('%s is not accounted for', p{1})); +end +verifyTrue(testCase, any(strcmp('treatment_drug.mixture_table', r.equivalent)), ... + 'the mixture table is compared row by row'); +verifyTrue(testCase, any(strcmp('treatment_drug.location_name', r.restated)), ... + 'an immersion''s location is the bath'); +end + +function testADilutionOfZeroIsRestatedAndAnyOtherIsNot(testCase) +% [virus-location]: "A dilution of 0 is treated as not recorded (NaN)" +v1 = birrenVirus(); +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyTrue(testCase, any(strcmp('virus_injection.dilution', r.restated))); +end + +% ===================== the round trip can fail =========================== + +function testAChangedMixtureRowIsReportedLost(testCase) +% the row-by-row comparison is not a pass-through: a different amount fails +v1 = birrenCno(); +out = runRaw(v1); +v1b = v1; +v1b.treatment_drug.mixture_table = strrep(v1.treatment_drug.mixture_table, '1e-05', '2e-05'); +r = did2.convert.roundtrip.check(v1b, out.migrated); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(strcmp('treatment_drug.mixture_table', {r.lost.path}))); +end + +function testADroppedChemicalIsReported(testCase) +v1 = birrenCno(); +out = runRaw(v1); +kept = out.migrated; +for k = numel(kept):-1:1 + if strcmp(kept{k}.className(), 'chemical') + kept(k) = []; + break; + end +end +r = did2.convert.roundtrip.check(v1, kept); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +function testABathNodeThatIsNotTheBathIsReportedLost(testCase) +% the restatement is the bath only: a virus "in the bath" by its name whose +% node names something else loses that node +v1 = birrenVirus(); +v1.virus_injection.virusLocation_OntologyName = 'NCIm:C9999999'; +out = runRaw(v1); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(strcmp('virus_injection.virusLocation_OntologyName', {r.lost.path}))); +end + +% ===================== the switch changes nothing converted ============== + +function testTheSwitchChangesNoConvertedTreatment(testCase) +% "keep behaviour identical": every document the raw path CONVERTS is the one +% the universalRenames path converted (ids are deterministic, practice (b)); +% a carry is carried on both paths, the raw one the untouched v1 source +fixtures = [writerFixtures(), didSideFixtures()]; +for k = 1:numel(fixtures) + v1 = jsondecode(jsonencode(fixtures{k})); % the shape a corpus delivers + raw = runRaw(v1); + old = did2.convert.v1_to_v2(v1, 'Validate', false, ... + 'TargetVersion', 'V_eta', 'RawV1Classes', {}); + label = sprintf('fixture %d (%s %s)', k, v1.document_class.class_name, v1.base.id); + verifyEmpty(testCase, raw.quarantine, label); + verifyEqual(testCase, numel(raw.quarantine), numel(old.quarantine), label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), [label ': carried on one path only']); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + if ~isempty(raw.passthrough) + emitted = raw.migrated{1}.toStruct(); + emitted.document_class = rmfield(emitted.document_class, 'schema_version'); + verifyTrue(testCase, isequaln(emitted, v1), [label ': the carry is not the v1 source']); + continue; + end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + verifyTrue(testCase, isequaln(raw.migrated{j}.toStruct(), old.migrated{j}.toStruct()), ... + sprintf('%s, document %d differs between the raw and the renamed path', label, j)); + end +end +end + +function testALegacyIdentityBlockConvertsAsBefore(testCase) +% a pre-2023 treatment whose identity is only in `ndi_document` (the 2020 +% vintage: id and session_id spelled as `base` spells them): universalRenames +% moved the block into `base`; the raw migrator reads it through readBase +v1 = vhlabHours(); +legacy = struct('id', v1.base.id, 'session_id', v1.base.session_id, ... + 'name', '', 'type', '', 'datestamp', v1.base.datestamp, 'database_version', 1); +v1 = rmfield(v1, 'base'); +v1.ndi_document = legacy; +raw = runRaw(v1); +old = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', {}); +verifyEmpty(testCase, raw.quarantine); +verifyEqual(testCase, numel(raw.migrated), numel(old.migrated)); +for j = 1:min(numel(raw.migrated), numel(old.migrated)) + verifyTrue(testCase, isequaln(raw.migrated{j}.toStruct(), old.migrated{j}.toStruct()), ... + sprintf('document %d differs', j)); +end +verifyEqual(testCase, raw.migrated{1}.get('base.id'), legacy.id); +end + +function testAWriterShapedDrugAtABodySiteCarriesForItsNodeSpelling(testCase) +% FINDING (behaviour kept): treatmentMaker writes the node as +% `location_ontologyName`, which the migrator does not read, so an UBERON site +% is seen by its name alone, is not an UBERON term, and carries (carry-028) +out = runRaw(drugAtSite()); +verifyEqual(testCase, numel(out.passthrough), 1); +d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, startsWith(d, '[carry-028] '), d); +end + +% ===================== helpers ========================================= + +function roundTripCases(testCase, cases) +for k = 1:size(cases, 1) + [label, v1, carried] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, [label ': quarantined']); + if ~isempty(out.quarantine) + continue; + end + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); + verifyEqual(testCase, r.carried, carried, [label ': carried?']); + lost = reshape(sort({r.lost.path}), 1, []); + verifyEqual(testCase, lost, findingsFor(label), ... + sprintf('%s: lost paths are not the listed findings; lost: %s', label, describeLost(r))); + verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); + verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + show(r.lost(k).v1), show(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function s = show(v) +try + s = jsonencode(v); +catch + s = class(v); +end +end + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function fx = writerFixtures() +fx = {vhlabHours(), muscimolAtV1(), groupLinked(), haleyOnset(), dabTarget(), ... + birrenCno(), drugAtSite(), birrenVirus(), virusAtV1(), ... + babuTransfer(-72000), babuTransfer(NaN)}; +end + +function fx = didSideFixtures() +% the shapes testMigratorsJ / testFixtureCorpus use (snake `ontology_name`, +% the template's `location_ontologyNode`, `document_id` edges) +t1 = didTreatment('tr_d1', 'EMPTY:0000199', ... + 'treatment: grating direction-of-motion visual stimulation', 6.5, ''); +t2 = didTreatment('tr_d2', 'CHEBI:5613', 'haloperidol', 2.5, 'uberon:0002436'); +t3 = didTreatment('tr_d3', 'CHEBI:7035', 'muscimol', [], 'uberon:0002436'); +t4 = didTreatment('tr_d4', '', 'cold exposure', 4.0, ''); +d1 = didDrug('td_d1', 'CHEBI:5613,haloperidol,5', 'uberon:0002436', 'primary visual cortex'); +d2 = didDrug('td_d2', sprintf(['ontologyName,name,value,ontologyUnit,unitName\n' ... + 'NCIT:C227,alprazolam,0.25,SNOMED:396163008,mg/kg']), 'UBERON:0001179', 'peritoneal cavity'); +d2.treatment_drug.administration_onset_time = '2024-06-01T09:15:00Z'; +d3 = didDrug('td_d3', sprintf(['ontologyName,name,value,ontologyUnit,unitName\n' ... + 'NCIm:C0212364,clozapine N-oxide,1e-05,OM:MolarVolumeUnit,Molar']), 'NCIm:C0179246', 'bath'); +v = struct(); +v.document_class = struct('class_name', 'virus_injection', 'class_version', '1.0.0', ... + 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); +v.depends_on = struct('name', {'subject_id'}, 'value', {'subj_007'}); +v.base = struct('id', 'vi_d1', 'session_id', 'sess_09', ... + 'name', 'vi', 'datestamp', '2024-06-01T12:00:00.000Z'); +v.virus_injection = struct('virus_OntologyName', 'addgene:26973', ... + 'virus_name', 'pAAV-hSyn-hChR2(H134R)-EYFP', 'dilution', 1000, ... + 'virusLocation_OntologyName', 'uberon:0002436', 'virusLocation_name', 'V1'); +x = struct(); +x.document_class = struct('class_name', 'treatment_transfer', 'class_version', '1.0.0', ... + 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); +x.depends_on = [ ... + struct('name', 'recipient_id', 'document_id', 'rec_001'), ... + struct('name', 'donor_id', 'document_id', 'don_002')]; +x.base = struct('id', 'tt_d1', 'session_id', 'sess_09', ... + 'name', 'graft', 'datestamp', '2024-06-01T12:00:00.000Z'); +x.treatment_transfer = struct('entity_ontologyNode', 'UBERON:0005291', ... + 'entity_name', 'embryonic tissue', 'method_name', 'transplantation'); +fx = {t1, t2, t3, t4, d1, d2, d3, v, x}; +end + +function v1 = didTreatment(id, node, name, numeric, stringValue) +v1 = struct(); +v1.document_class = struct('class_name', 'treatment', 'class_version', '1.0.0', ... + 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); +v1.depends_on = struct('name', {'subject_id'}, 'value', {'subj_007'}); +v1.base = struct('id', id, 'session_id', 'sess_09', ... + 'name', 'trt', 'datestamp', '2024-06-01T12:00:00.000Z'); +t = struct('ontology_name', node, 'name', name); +if ~isempty(numeric); t.numeric_value = numeric; end +if ~isempty(stringValue); t.string_value = stringValue; end +v1.treatment = t; +end + +function v1 = didDrug(id, mixture, locNode, locName) +v1 = struct(); +v1.document_class = struct('class_name', 'treatment_drug', 'class_version', '1.0.0', ... + 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); +v1.depends_on = struct('name', {'subject_id'}, 'value', {'subj_007'}); +v1.base = struct('id', id, 'session_id', 'sess_09', ... + 'name', 'td', 'datestamp', '2024-06-01T12:00:00.000Z'); +v1.treatment_drug = struct('mixture_table', mixture, ... + 'location_ontologyNode', locNode, 'location_name', locName); +end + +% ----- writer shapes --------------------------------------------------- + +function v1 = vhlabHours() +% treatmentMaker.create_treatment_doc, +vhlab/treatmentTable.m row 1: the +% looked-up node and label, numeric_value the hours, string_value "" +v1 = ndiDoc('treatment', '41268b6f5c6a3d4e_7a00000000000001', ... + struct('ontologyName', 'EMPTY:0000199', ... + 'name', 'treatment: grating direction-of-motion visual stimulation', ... + 'string_value', '', 'numeric_value', 6.5), {'subject_id', 'subj_1'}); +end + +function v1 = muscimolAtV1() +% treatmentMaker.create_treatment_doc with a ChEBI substance whose +% string_value is the site CURIE (the Dab "Target Location" idiom) +v1 = ndiDoc('treatment', '41268b6f5c6a3d4e_7a00000000000002', ... + struct('ontologyName', 'CHEBI:7035', 'name', 'muscimol', ... + 'string_value', 'UBERON:0002436', 'numeric_value', 2.5), {'subject_id', 'subj_1'}); +end + +function v1 = groupLinked() +% table2treatment: the second treatment of a group links the first by +% `manipulation_id` +v1 = ndiDoc('treatment', '41268b6f5c6a3d4e_7a00000000000003', ... + struct('ontologyName', 'EMPTY:0000199', ... + 'name', 'treatment: grating direction-of-motion visual stimulation', ... + 'numeric_value', 3, 'string_value', ''), ... + {'subject_id', 'subj_1', 'manipulation_id', '41268b6f5c6a3d4e_7a00000000000001'}); +end + +function v1 = haleyOnset() +% +haley/doImport: food restriction onset, numeric_value [], the time as text +v1 = ndiDoc('treatment', '41268b6f5c6a3d4e_7a00000000000004', ... + struct('ontologyName', 'EMPTY:0000202', ... + 'name', 'treatment: food restriction onset time', ... + 'numeric_value', [], 'string_value', '2024-05-01T08:00:00'), {'subject_id', 'worm_1'}); +end + +function v1 = dabTarget() +% +dabrowska/doImport: the optogenetic target location +v1 = ndiDoc('treatment', '41268b6f5c6a3d4e_7a00000000000005', ... + struct('ontologyName', 'EMPTY:0000074', ... + 'name', 'Optogenetic Tetanus Stimulation Target Location', ... + 'numeric_value', [], 'string_value', 'UBERON:0001880'), {'subject_id', 'rat_1'}); +end + +function v1 = birrenCno() +% treatmentMaker.create_treatment_drug_doc, +birren/TreatmentCreator.m +% Chronic_48h_Dreads: the bath, a writetablechar mixture, onset/offset as +% 'yyyy-MM-ddTHH:mm:ss', duration in days +mix = sprintf(['ontologyName,name,value,ontologyUnit,unitName\n' ... + 'NCIm:C0212364,clozapine N-oxide,1e-05,OM:MolarVolumeUnit,Molar\n']); +v1 = ndiDoc('treatment_drug', '41268b6f5c6a3d4e_7b00000000000001', ... + struct('location_ontologyName', 'NCIm:C0179246', 'location_name', 'bath', ... + 'mixture_table', mix, 'administration_onset_time', '2024-05-30T00:00:00', ... + 'administration_offset_time', '2024-06-01T00:00:00', 'administration_duration', 2), ... + {'subject_id', 'culture_1'}); +end + +function v1 = drugAtSite() +% treatmentMaker.create_treatment_drug_doc at an UBERON site +mix = sprintf(['ontologyName,name,value,ontologyUnit,unitName\n' ... + 'NCIT:C227,alprazolam,0.25,SNOMED:396163008,mg/kg\n']); +v1 = ndiDoc('treatment_drug', '41268b6f5c6a3d4e_7b00000000000002', ... + struct('location_ontologyName', 'UBERON:0001179', 'location_name', 'peritoneal cavity', ... + 'mixture_table', mix, 'administration_onset_time', '2024-06-01T09:15:00', ... + 'administration_offset_time', '2024-06-01T09:16:00', 'administration_duration', 1/1440), ... + {'subject_id', 'rat_1'}); +end + +function v1 = birrenVirus() +% treatmentMaker.create_virus_injection_doc, +birren/TreatmentCreator.m +% neuronal_dreadds: the bath, no date, PND "3" (double() of the string), +% dilution 0, water as the diluent +v1 = ndiDoc('virus_injection', '41268b6f5c6a3d4e_7c00000000000001', ... + struct('virus_OntologyName', 'AddGene:AAV9-hSyn-hM3D(Gq)-mCherry', ... + 'virus_name', 'AAV9-hSyn-hM3D(Gq)-mCherry', ... + 'virusLocation_OntologyName', 'NCIm:C0179246', 'virusLocation_name', 'bath', ... + 'virus_AdministrationDate', '', 'virus_AdministrationPND', 3, 'dilution', 0, ... + 'diluent_OntologyName', 'NCIm:C0043047', 'diluent_name', 'Water'), ... + {'subject_id', 'culture_1'}); +end + +function v1 = virusAtV1() +% treatmentMaker.create_virus_injection_doc at a brain site, a dilution, a date +v1 = ndiDoc('virus_injection', '41268b6f5c6a3d4e_7c00000000000002', ... + struct('virus_OntologyName', 'addgene:26973', ... + 'virus_name', 'pAAV-hSyn-hChR2(H134R)-EYFP', ... + 'virusLocation_OntologyName', 'UBERON:0002436', 'virusLocation_name', 'V1', ... + 'virus_AdministrationDate', '2024-05-02', 'virus_AdministrationPND', 21, ... + 'dilution', 1000, 'diluent_OntologyName', '', 'diluent_name', ''), ... + {'subject_id', 'mouse_1'}); +end + +function v1 = babuTransfer(timestamp) +% treatmentMaker.create_treatment_transfer_doc from +babu/TreatmentCreator.m: +% timestamp seconds(hours(-TransferTime)) (NaN where none was recorded) on +% dev_local_time; the agar plate entity; the pick method; donor_id set +v1 = ndiDoc('treatment_transfer', sprintf('41268b6f5c6a3d4e_7d0000000000000%d', 1 + isnan(timestamp)), ... + struct('timestamp', timestamp, 'clocktype', 'dev_local_time', ... + 'entity_name', 'agar plate medium', 'entity_ontologyNode', 'MICRO:0000480', ... + 'method_name', 'C. elegans transfer method: titanium pick', ... + 'method_ontologyNode', 'EMPTY:0000256'), ... + {'recipient_id', 'worm_1', 'donor_id', 'plate_1'}); +end + +function v1 = ndiDoc(className, id, block, deps) +% ndi.document(className) from its template (+ base.json), as +% S.newdocument(className, className, block) writes it: base.session_id set, +% base.name left '', the class block REPLACED by the writer's struct, the +% template's depends_on entries kept and DEPS ({name, value, ...}) set in place +% (set_dependency_value); then the JSON round a corpus file goes through +tpl = loadTemplate(className); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = tpl.depends_on; +for k = 1:2:numel(deps) + hit = find(strcmp({v1.depends_on.name}, deps{k}), 1); + v1.depends_on(hit).value = deps{k + 1}; +end +if isfield(tpl, 'files') + v1.files = tpl.files; +end +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.(className) = block; +v1 = jsondecode(jsonencode(v1)); +end + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/fixtures/ndi_templates/treatment.json b/tests/+did2/fixtures/ndi_templates/treatment.json new file mode 100644 index 00000000..dacfdcbb --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/treatment.json @@ -0,0 +1,26 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/treatment.json", + "validation": "$NDISCHEMAPATH\/treatment_schema.json", + "comment": "A treatment of a subject (that is not associated with a particular recording epoch). Treatments that are associated with recording epochs are usually characterized as stimulations. This document type does not contain a full protocol but may contain a link to a protocol with a dependency.", + "class_name": "treatment", + "property_list_name": "treatment", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "subject_id", "value": [] }, + { "name": "manipulation_id", "value": [] }, + { "name": "protocol_id", "value": [] } + + ], + "treatment": { + "ontologyName": "", + "name": "", + "numeric_value": "", + "string_value": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/treatment_drug.json b/tests/+did2/fixtures/ndi_templates/treatment_drug.json new file mode 100644 index 00000000..bb904015 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/treatment_drug.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/treatment\/treatment_drug.json", + "validation": "$NDISCHEMAPATH\/treatment\/treatment_drug.json", + "class_name": "treatment_drug", + "property_list_name": "treatment_drug", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "subject_id", "value": "" } + ], + "treatment_drug": { + "location_ontologyNode": [], + "location_name": [], + "mixture_table": [], + "administration_onset_time": [], + "administration_offset_time": [], + "administration_duration": [] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/treatment_transfer.json b/tests/+did2/fixtures/ndi_templates/treatment_transfer.json new file mode 100644 index 00000000..66b250b6 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/treatment_transfer.json @@ -0,0 +1,25 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/treatment\/treatment_transfer.json", + "validation": "$NDISCHEMAPATH\/treatment\/treatment_transfer.json", + "class_name": "treatment_transfer", + "property_list_name": "treatment_transfer", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "recipient_id", "value": "" }, + { "name": "donor_id", "value": "" } + ], + "treatment_transfer": { + "timestamp": [], + "clocktype": [], + "entity_name": [], + "entity_ontologyNode": [], + "method_name": [], + "method_ontologyNode": [] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/virus_injection.json b/tests/+did2/fixtures/ndi_templates/virus_injection.json new file mode 100644 index 00000000..0c20d9da --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/virus_injection.json @@ -0,0 +1,33 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/treatment\/virus_injection.json", + "validation": "$NDISCHEMAPATH\/treatment\/virus_injection_schema.json", + "class_name": "virus_injection", + "property_list_name": "virus_injection", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + + "depends_on": [ + { "name": "subject_id", + "value": "" + } + ], + + "files": { + "file_list": [] + }, + "virus_injection": { + "virus_OntologyName": "", + "virus_name": "", + "virusLocation_OntologyName": "", + "virusLocation_name": "", + "virus_AdministrationDate": "", + "virus_AdministrationPND": 0, + "dilution": 0.0, + "diluent_OntologyName": "", + "diluent_name": "" + } +} From 1f8110f190b94e63d9df6d09a5f68e977ee5291b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 00:36:40 +0000 Subject: [PATCH 03/45] Round-trip tests: a mixture table rebuilt as written matches; print a legacy-identity difference Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- tests/+did2/+unittest/testRawV1RoundTripTreatment.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m index 4e074ef0..0185ca99 100644 --- a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m +++ b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m @@ -136,8 +136,8 @@ function testEveryTemplateFieldOfAConvertedDrugIsAccountedFor(testCase) verifyTrue(testCase, any(strcmp(p{1}, accounted)), ... sprintf('%s is not accounted for', p{1})); end -verifyTrue(testCase, any(strcmp('treatment_drug.mixture_table', r.equivalent)), ... - 'the mixture table is compared row by row'); +verifyTrue(testCase, any(strcmp('treatment_drug.mixture_table', [r.matched, r.equivalent])), ... + 'the mixture table is rebuilt: as written, or row by row'); verifyTrue(testCase, any(strcmp('treatment_drug.location_name', r.restated)), ... 'an immersion''s location is the bath'); end @@ -232,8 +232,10 @@ function testALegacyIdentityBlockConvertsAsBefore(testCase) verifyEmpty(testCase, raw.quarantine); verifyEqual(testCase, numel(raw.migrated), numel(old.migrated)); for j = 1:min(numel(raw.migrated), numel(old.migrated)) - verifyTrue(testCase, isequaln(raw.migrated{j}.toStruct(), old.migrated{j}.toStruct()), ... - sprintf('document %d differs', j)); + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + verifyTrue(testCase, isequaln(a, b), ... + sprintf('document %d differs: raw %s; renamed %s', j, jsonencode(a), jsonencode(b))); end verifyEqual(testCase, raw.migrated{1}.get('base.id'), legacy.id); end From 15a87ee99a64a03103f119b03adf33f498cc9fc0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 00:41:45 +0000 Subject: [PATCH 04/45] Legacy-identity test maps the minted ids across (a base-less document mints random ids on either path) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+unittest/testRawV1RoundTripTreatment.m | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m index 0185ca99..292920fc 100644 --- a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m +++ b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m @@ -231,11 +231,24 @@ function testALegacyIdentityBlockConvertsAsBefore(testCase) old = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', {}); verifyEmpty(testCase, raw.quarantine); verifyEqual(testCase, numel(raw.migrated), numel(old.migrated)); -for j = 1:min(numel(raw.migrated), numel(old.migrated)) - a = raw.migrated{j}.toStruct(); - b = old.migrated{j}.toStruct(); - verifyTrue(testCase, isequaln(a, b), ... - sprintf('document %d differs: raw %s; renamed %s', j, jsonencode(a), jsonencode(b))); +% FINDING (not this switch): v1_to_v2 keys the mint context on `base.id` +% (sourceIdOf), so a document with no `base` mints RANDOM ids on either path +% (did2.convert.mintId with an empty key), against practice (b). The minted +% ids are therefore mapped across before comparing. +n = min(numel(raw.migrated), numel(old.migrated)); +aText = cell(1, n); +bText = cell(1, n); +for j = 1:n + aText{j} = jsonencode(raw.migrated{j}.toStruct()); + bText{j} = jsonencode(old.migrated{j}.toStruct()); +end +for j = 2:n + aId = raw.migrated{j}.get('base.id'); + bId = old.migrated{j}.get('base.id'); + aText = strrep(aText, aId, bId); +end +for j = 1:n + verifyEqual(testCase, aText{j}, bText{j}, sprintf('document %d differs', j)); end verifyEqual(testCase, raw.migrated{1}.get('base.id'), legacy.id); end From 467d36ef3fd3f3657fa73f3feabe2edd41eccbf0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 00:49:21 +0000 Subject: [PATCH 05/45] A document with no base block mints deterministic ids (mintKey) Practice (b) of [migration reliability practices] (Jess Haley, 2026-10-26, did-schema V_eta_go_forward_class_audit.md): v1_to_v2 keyed each source's mint context on base.id alone, so a pre-2023 document whose identity is only in `ndi_document` (or a document with no id) minted RANDOM ids on every run. did2.convert.mintKey keys it on base.id, else the legacy block's id (`id`, then the 2019 `document_id` / `document_unique_reference`), else the document's canonical JSON. Tests: testMintId (the key's order; a base-less treatment converted twice gives identical ids on both paths); testRawV1RoundTripTreatment's legacy identity test compares the minted ids directly again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/mintKey.m | 77 +++++++++++++++++++ src/did/+did2/+convert/v1_to_v2.m | 5 +- tests/+did2/+unittest/testMintId.m | 43 +++++++++++ .../+unittest/testRawV1RoundTripTreatment.m | 25 ++---- 4 files changed, 131 insertions(+), 19 deletions(-) create mode 100644 src/did/+did2/+convert/mintKey.m diff --git a/src/did/+did2/+convert/mintKey.m b/src/did/+did2/+convert/mintKey.m new file mode 100644 index 00000000..5386af9f --- /dev/null +++ b/src/did/+did2/+convert/mintKey.m @@ -0,0 +1,77 @@ +function key = mintKey(body) +%MINTKEY The key a v1 source document's minted ids are derived from. +% +% KEY = did2.convert.mintKey(BODY), BODY one v1 source document (a struct). +% did2.convert.v1_to_v2 opens the did2.convert.mintId context for each source +% with this key, so every document the migration mints for it gets an id +% derived from (KEY, role, n): practice (b) of [migration reliability +% practices] (Jess Haley, 2026-10-26, did-schema +% V_eta_go_forward_class_audit.md), "a document the migration mints gets an +% id derived from its v1 source id and its role, so two runs on the same +% input are identical". +% +% In order, the first that is non-empty: +% 1. `base.id` every document since 2023 (base.json) +% 2. the legacy identity block's id a pre-2023 document whose identity is +% only in `ndi_document`: its `id` +% (did2.convert.v1read.readBase), else +% the 2019 spellings `document_id` +% (5d0b66d8f) or +% `document_unique_reference` (4f1a2b801) +% 3. 'json:' + the document's JSON a document stating no id at all: its +% canonical JSON (jsonencode of the +% decoded body), so the same input gives +% the same key on every run +% Only 3 can be '' (a body jsonencode cannot encode), and then mintId falls +% back to random ids, as before. +% +% Before this function the key was `base.id` alone, so a document with no +% `base` block minted RANDOM ids on every run. +% +% See also did2.convert.mintId, did2.convert.v1_to_v2. + +key = ''; +if ~isstruct(body) || ~isscalar(body) + return; +end +key = textOf(fieldOf(body, 'base', 'id')); +if ~isempty(key) + return; +end +try + b = did2.convert.v1read.readBase(body); + key = textOf(b.id); + for f = {'document_id', 'document_unique_reference'} + if isempty(key) && isstruct(b.extra) && isfield(b.extra, f{1}) + key = textOf(b.extra.(f{1})); + end + end +catch + key = ''; +end +if ~isempty(key) + return; +end +try + key = ['json:' jsonencode(body)]; +catch + key = ''; +end +end + +function v = fieldOf(s, block, name) +v = []; +if isfield(s, block) && isstruct(s.(block)) && isscalar(s.(block)) ... + && isfield(s.(block), name) + v = s.(block).(name); +end +end + +function t = textOf(v) +t = ''; +if ischar(v) + t = strtrim(v); +elseif isstring(v) && isscalar(v) + t = strtrim(char(v)); +end +end diff --git a/src/did/+did2/+convert/v1_to_v2.m b/src/did/+did2/+convert/v1_to_v2.m index 3859bfed..42095ce0 100644 --- a/src/did/+did2/+convert/v1_to_v2.m +++ b/src/did/+did2/+convert/v1_to_v2.m @@ -310,7 +310,10 @@ did2.convert.mintId('-popto', mintDepth); try preBody = ensureStruct(rawBody); - did2.convert.mintId('-push', sourceIdOf(preBody)); + % the mint key: base.id, else the legacy identity, else the source's + % JSON (did2.convert.mintKey), so a base-less document mints the same + % ids on every run too (practice (b)) + did2.convert.mintId('-push', did2.convert.mintKey(preBody)); refuseUnknownSchemaVersion(preBody); if did2.convert.isAlreadyTarget(preBody, options.TargetVersion) % Idempotency short-circuit: the body is already stamped diff --git a/tests/+did2/+unittest/testMintId.m b/tests/+did2/+unittest/testMintId.m index e3a34556..b334e653 100644 --- a/tests/+did2/+unittest/testMintId.m +++ b/tests/+did2/+unittest/testMintId.m @@ -89,3 +89,46 @@ function testAMigratedBatchMintsTheSameIdsTwice(testCase) ids = cellfun(@(d) char(d.get('base.id')), r.migrated, 'UniformOutput', false); ids = sort(ids); end + +% ===== the mint key: a document with no `base` block (practice (b)) ===== + +function testTheMintKeyIsBaseIdThenTheLegacyIdThenTheJson(testCase) +withBase = struct('base', struct('id', '41e1b2c3d4e5f60a_0123456789abcdef')); +verifyEqual(testCase, did2.convert.mintKey(withBase), '41e1b2c3d4e5f60a_0123456789abcdef'); +v2020 = struct('ndi_document', struct('id', '41e1b2c3d4e5f60b_0123456789abcdef', ... + 'session_id', 's', 'name', '', 'type', '', 'datestamp', '', 'database_version', 1)); +verifyEqual(testCase, did2.convert.mintKey(v2020), '41e1b2c3d4e5f60b_0123456789abcdef'); +v2019 = struct('ndi_document', struct('experiment_unique_reference', 'e', ... + 'document_unique_reference', '41e1b2c3d4e5f60c_0123456789abcdef', 'name', '', ... + 'type', '', 'datestamp', '', 'database_version', 1)); +verifyEqual(testCase, did2.convert.mintKey(v2019), '41e1b2c3d4e5f60c_0123456789abcdef'); +noId = struct('document_class', struct('class_name', 'x'), 'x', struct('a', 1)); +k1 = did2.convert.mintKey(noId); +verifyTrue(testCase, startsWith(k1, 'json:'), k1); +verifyEqual(testCase, did2.convert.mintKey(noId), k1, 'the same input gives the same key'); +noId.x.a = 2; +verifyNotEqual(testCase, did2.convert.mintKey(noId), k1, 'another input another key'); +end + +function testABaseLessDocumentMintsTheSameIdsTwice(testCase) +% a 2020-vintage treatment (identity only in `ndi_document`) whose migration +% mints an anchor: converting it twice gives identical ids, on the raw path and +% on the universalRenames path. (It minted random ids before mintKey.) +v1 = struct(); +v1.document_class = struct('class_name', 'treatment', 'class_version', 1); +v1.depends_on = struct('name', {'subject_id'}, 'value', {'subj_1'}); +v1.ndi_document = struct('id', '41e1b2c3d4e5f60d_0123456789abcdef', ... + 'session_id', '41e1b2c3d4e5f60d_00000000000000a1', 'name', '', 'type', '', ... + 'datestamp', '2021-06-01T12:00:00.000Z', 'database_version', 1); +v1.treatment = struct('ontologyName', 'EMPTY:0000199', ... + 'name', 'treatment: grating direction-of-motion visual stimulation', ... + 'numeric_value', 6.5, 'string_value', ''); +for raw = {did2.convert.rawV1Classes(), {}} + r1 = did2.convert.v1_to_v2({v1}, 'Validate', false, 'RawV1Classes', raw{1}); + r2 = did2.convert.v1_to_v2({v1}, 'Validate', false, 'RawV1Classes', raw{1}); + verifyEmpty(testCase, r1.quarantine); + verifyGreaterThan(testCase, numel(r1.migrated), 1, 'the anchor was not minted'); + verifyEqual(testCase, cellfun(@(d) d.get('base.id'), r1.migrated, 'UniformOutput', false), ... + cellfun(@(d) d.get('base.id'), r2.migrated, 'UniformOutput', false)); +end +end diff --git a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m index 292920fc..11795adf 100644 --- a/tests/+did2/+unittest/testRawV1RoundTripTreatment.m +++ b/tests/+did2/+unittest/testRawV1RoundTripTreatment.m @@ -231,24 +231,13 @@ function testALegacyIdentityBlockConvertsAsBefore(testCase) old = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', {}); verifyEmpty(testCase, raw.quarantine); verifyEqual(testCase, numel(raw.migrated), numel(old.migrated)); -% FINDING (not this switch): v1_to_v2 keys the mint context on `base.id` -% (sourceIdOf), so a document with no `base` mints RANDOM ids on either path -% (did2.convert.mintId with an empty key), against practice (b). The minted -% ids are therefore mapped across before comparing. -n = min(numel(raw.migrated), numel(old.migrated)); -aText = cell(1, n); -bText = cell(1, n); -for j = 1:n - aText{j} = jsonencode(raw.migrated{j}.toStruct()); - bText{j} = jsonencode(old.migrated{j}.toStruct()); -end -for j = 2:n - aId = raw.migrated{j}.get('base.id'); - bId = old.migrated{j}.get('base.id'); - aText = strrep(aText, aId, bId); -end -for j = 1:n - verifyEqual(testCase, aText{j}, bText{j}, sprintf('document %d differs', j)); +% the minted ids agree too: did2.convert.mintKey keys a base-less document on +% its legacy id (practice (b); it minted random ids before) +for j = 1:min(numel(raw.migrated), numel(old.migrated)) + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + verifyTrue(testCase, isequaln(a, b), ... + sprintf('document %d differs: raw %s; renamed %s', j, jsonencode(a), jsonencode(b))); end verifyEqual(testCase, raw.migrated{1}.get('base.id'), legacy.id); end From 082922e8f37b8757d6b0d8c469cc5a919daa6fa8 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 01:00:15 +0000 Subject: [PATCH 06/45] Element reads raw v1: name | reference, decided entity types, dependents of a carry carry Decided by Jess Haley, 2026-10-26 (did-schema V_eta_go_forward_class_audit.md): [migrators read raw v1], [migration reliability practices] (a), and - [element local identifier is name and reference]: local_identifier is ' | ' (did2.convert.elementLocalIdentifier / elementNameReference, mirrors of NDI-matlab ndi.vintage's on claude/phase3 471cd5c66); not reversible -> carried (carry-048 / carry-055). epochMint and resolveEpochProbemap join probemap rows with the same function. - [element types have no default], [electrode spellings and imaging types are devices], [event lines and environment probes are devices]: a device only for a registered probe type (NDI probetype2object.json) or a spelled electrode on an ndi.probe.* class; anything else carried (carry-063). - [sorted units are cells or groups], [unlabelled units need a map]: a sorted unit is a cell (single) or group (multi) by the batch's neuron_extracellular quality_label (did2.convert.unitQualityLabels; v1_to_v2 'UnitQualityLabels' for a label from outside the batch); no label or conflicting labels -> carried (carry-062). - [dependents of a carried document carry]: v1_to_v2 carries, down the chain, a converted source whose depends_on edge names a source carried in the batch (carry-064). - element added to did2.convert.rawV1Classes; +roundtrip/element.m; testRawV1RoundTripElement (writer shapes from element.json; lost fields listed as known findings). Tests whose fixtures the decisions change are inverted or given their sorting-run label. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+did2/+convert/+migrators_j/Contents.m | 11 +- src/did/+did2/+convert/+migrators_j/element.m | 182 +++++++++-- src/did/+did2/+convert/+roundtrip/element.m | 127 ++++++++ .../+did2/+convert/elementLocalIdentifier.m | 79 +++++ src/did/+did2/+convert/elementNameReference.m | 68 +++++ src/did/+did2/+convert/epochMint.m | 16 +- src/did/+did2/+convert/rawV1Classes.m | 8 +- src/did/+did2/+convert/resolveEpochProbemap.m | 20 +- src/did/+did2/+convert/unitQualityLabels.m | 127 ++++++++ src/did/+did2/+convert/v1_to_v2.m | 135 ++++++++ tests/+did2/+unittest/testMigratorsJ.m | 29 +- .../testMigratorsJRecordingObservation.m | 31 +- .../+unittest/testRawV1RoundTripElement.m | 289 ++++++++++++++++++ .../+unittest/testResolveEpochProbemap.m | 75 +++-- .../+did2/fixtures/ndi_templates/element.json | 28 ++ .../ndi_templates/neuron_extracellular.json | 26 ++ 16 files changed, 1150 insertions(+), 101 deletions(-) create mode 100644 src/did/+did2/+convert/+roundtrip/element.m create mode 100644 src/did/+did2/+convert/elementLocalIdentifier.m create mode 100644 src/did/+did2/+convert/elementNameReference.m create mode 100644 src/did/+did2/+convert/unitQualityLabels.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripElement.m create mode 100644 tests/+did2/fixtures/ndi_templates/element.json create mode 100644 tests/+did2/fixtures/ndi_templates/neuron_extracellular.json diff --git a/src/did/+did2/+convert/+migrators_j/Contents.m b/src/did/+did2/+convert/+migrators_j/Contents.m index 1111be77..a0f889e6 100644 --- a/src/did/+did2/+convert/+migrators_j/Contents.m +++ b/src/did/+did2/+convert/+migrators_j/Contents.m @@ -694,11 +694,12 @@ % the raw-recording observation + a lineage relation). V_eta retires the % recording-side `element` class: any identifiable thing -- an organism, a % device/probe, a derived signal or sorted unit -- is an `entity` with a -% `type` (here `cell` for a sorted unit, `group` for an ensemble, `device` -% otherwise; see elementEntityType). The element document therefore becomes an -% `entity` with its id PRESERVED, so the ~50 classes that reference it -% (`element_id` / `underlying_element_id` / `stimulator_id`) keep resolving -- -% now to an entity. +% `type` (a device for a probe, a cell or group for a sorted unit, a group for +% an ensemble; anything else carried: elementEntityType, decided 2026-10-26, +% below). The element document therefore becomes an `entity` with its id +% PRESERVED, so the ~50 classes that reference it (`element_id` / +% `underlying_element_id` / `stimulator_id`) keep resolving -- now to an +% entity. % element_epoch % Brainstorm-J migrator: element_epoch -> acquisition_epoch. % epochfiles_ingested diff --git a/src/did/+did2/+convert/+migrators_j/element.m b/src/did/+did2/+convert/+migrators_j/element.m index 327c7c57..2e474a9f 100644 --- a/src/did/+did2/+convert/+migrators_j/element.m +++ b/src/did/+did2/+convert/+migrators_j/element.m @@ -3,15 +3,16 @@ % assertions + the raw-recording observation + a lineage relation). V_eta % retires the recording-side `element` class: any identifiable thing -- an % organism, a device/probe, a derived signal or sorted unit -- is an `entity` -% with a `type` (here `cell` for a sorted unit, `group` for an ensemble, -% `device` otherwise; see elementEntityType). The element document therefore +% with a `type` (a device for a probe, a cell or group for a sorted unit, a +% group for an ensemble; anything else carried: elementEntityType, decided +% 2026-10-26, below). The element document therefore % becomes an `entity` with its id PRESERVED, so the ~50 classes that reference % it (`element_id` / `underlying_element_id` / `stimulator_id`) keep resolving % -- now to an entity. % % 1 -> N: -% - subject the element itself (id preserved; name/reference -> -% local_identifier). +% - entity the element itself (id preserved; name/reference -> +% local_identifier ' | '). % - term_assertion(s) its kind, nothing dropped: `type` -> variable % "element type"; `ndi_element_class` -> variable "ndi % element class" (the MATLAB reconstruction handle; kept @@ -75,16 +76,72 @@ % CATCH THE CODE"). It is left alone here only because testMigratorsJ.m is % outside this change's file scope and is being edited concurrently. +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI element.json + base.json at the locked NDI-matlab +% `main`, 3cb19a8, as ndi.element/newdocument writes it), identity through +% jRawBody; a carry is the untouched v1 source. Every v1 field and where it +% goes; did2.convert.roundtrip.element rebuilds the v1 document and +% testRawV1RoundTripElement compares the two: +% +% base.id / session_id / datestamp -> the entity's id / session edge / +% creation_timestamp; base.name (writer: '') +% is not written (#73 item 54) +% element.name, element.reference -> entity.local_identifier, +% ' | ' (NDI's display form; +% did2.convert.elementLocalIdentifier, the +% mirror of NDI ndi.vintage's). Not reversible +% (an empty name, a non-integer reference, a +% reference-less name that reads as a pair): +% carried (carry-048 / carry-055) +% element.type, element.ndi_element_class -> the entity type +% (elementEntityType) and one term assertion +% each +% element.direct -> which lineage relation is written +% depends_on subject_id, underlying_element_id -> the lineage relation +% depends_on jrclust_clusters_id -> a prov:wasDerivedFrom relation +% +% THE ENTITY TYPE (elementEntityType): Decided by Jess Haley, 2026-10-26, +% did-schema V_eta_go_forward_class_audit.md -- +% [element types have no default] a fixed list, NO default: a type not +% on it, or a probe type on a class that +% is not ndi.probe.*, is carried +% (carry-063) +% a registered probe type (NDI probetype2object.json at 3cb19a8: 24 keys) +% on an ndi.probe.* class -> device; with +% [electrode spellings and imaging types are devices] `electrode-` +% and `_electrode-` too, +% and the four imaging types +% [event lines and environment probes are devices] `event`, +% `lick-spout`, `reward-well`, +% `intraoral-cannula` +% [sorted units are cells or groups] `spikes`, `neuron`, `cell`: the +% sorting run's label (the batch's +% neuron_extracellular `quality_label`, +% did2.convert.unitQualityLabels): +% single -> cell, multi -> group +% [unlabelled units need a map] a sorted unit with no label is carried +% (carry-062) +% `ensemble` -> group + arguments preBody (1,1) struct end +body = jRawBody(preBody, 'element'); +v2Body = convertElement(body); +if isscalar(v2Body) && isequaln(v2Body{1}, body) + v2Body = {preBody}; % a carry is the untouched v1 source +end +end + +function v2Body = convertElement(preBody) block = struct(); if isfield(preBody, 'element') && isstruct(preBody.element); block = preBody.element; end elementId = baseId(preBody); -name = jGetChar(block, 'name'); -reference = jGetChar(block, 'reference'); +name = getField(block, 'name'); +reference = getField(block, 'reference'); type = jGetChar(block, 'type'); ndiClass = jGetChar(block, 'ndi_element_class'); isDirect = isTruthy(getField(block, 'direct')); @@ -92,33 +149,42 @@ underlyingId = depValue(preBody, 'underlying_element_id'); sortingRunId = depValue(preBody, 'jrclust_clusters_id'); -localId = name; -if ~isempty(reference); localId = strtrim(sprintf('%s (ref %s)', name, reference)); end -% [generic stage is lossless] (Jess Haley, 2026-10-25): name and reference are -% packed as ' (ref )'. That is read back exactly only when the -% name holds no ' (ref ' of its own and neither value carries edge whitespace -% (strtrim); and a required local_identifier the source does not state is not -% invented from the document id ([no invented values]). Otherwise the element -% is carried whole as v1. -if isempty(strtrim(localId)) || contains(name, ' (ref ') ... - || ~strcmp(name, strtrim(name)) || ~strcmp(reference, strtrim(reference)) +% [element local identifier is name and reference] (Jess Haley, 2026-10-26): +% ' | ', NDI's display form, read back by splitting at the last +% ' | '. [no invented values] / [generic stage is lossless]: an identifier +% that would not read back exactly is not written; the element is carried. +localId = ''; +if isempty(name) || ischar(name) || (isstring(name) && isscalar(name)) + localId = did2.convert.elementLocalIdentifier(char(name), reference); +end +if isempty(localId) + nameText = ''; + if ischar(name) || (isstring(name) && isscalar(name)); nameText = char(name); end row = '[carry-055] '; - if isempty(strtrim(localId)); row = '[carry-048] '; end + if isempty(nameText) && isEmptyRef(reference); row = '[carry-048] '; end % carry-register: carry-048 (no name and no reference); carry-055 (not - % packed reversibly) + % written reversibly as ' | ') did2.convert.reportNote('carried_as_v1', 'element', elementId, ... - sprintf('%sunplaced: element.name "%s" / element.reference "%s" (not packed reversibly)', ... - row, name, reference)); + sprintf('%sunplaced: element.name "%s" / element.reference "%s" (no reversible local_identifier)', ... + row, nameText, refText(reference))); + v2Body = {preBody}; + return; +end + +[entityType, why] = elementEntityType(type, ndiClass, elementId); +if isempty(entityType) + % carry-register: carry-062 (an unlabelled sorted unit); carry-063 (a type + % with no entity type) + did2.convert.reportNote('carried_as_v1', 'element', elementId, why); v2Body = {preBody}; return; end % --- the element as an entity (id preserved) ------------------------------- % did-schema #88: one `entity` class with a bound `type` -% (V_eta_entity_composition_plan.md sec. 4). Which type an element is, is read -% off its v1 `type` by elementEntityType below -- a PROPOSED mapping (device for -% a probe, cell for a sorted unit, group for an ensemble), not a signed one. -subjectDoc = jEntity(preBody, elementEntityType(type), ... +% (V_eta_entity_composition_plan.md sec. 4), read off the v1 `type` and +% `ndi_element_class` by elementEntityType (decided, above). +subjectDoc = jEntity(preBody, entityType, ... struct('local_identifier', localId), 'Id', elementId); bodies = {subjectDoc}; @@ -236,17 +302,69 @@ rel = jEntityRelation(preBody, childId, parentId, relationName); end -function t = elementEntityType(elementType) -%ELEMENTENTITYTYPE The entity.type an element-subject takes (PROPOSED, unsigned): -% a sorted unit ('spikes', 'neuron') is a cell, an ensemble a group, and every -% other element (a probe, a stimulator, a derived signal) a device. -switch lower(strtrim(char(elementType))) +function [t, why] = elementEntityType(elementType, ndiClass, elementId) +%ELEMENTENTITYTYPE The entity.type an element takes, or '' and the carry note. +% Decided by Jess Haley, 2026-10-26 (header): [element types have no +% default], [electrode spellings and imaging types are devices], [event lines +% and environment probes are devices], [sorted units are cells or groups], +% [unlabelled units need a map]. Types are compared exactly as NDI writes +% them (probestruct2probe matches its keys exactly), edge blanks aside. +t = ''; +why = ''; +ty = strtrim(char(elementType)); +isProbeClass = startsWith(strtrim(char(ndiClass)), 'ndi.probe.'); +% NDI-matlab main 3cb19a8 src/ndi/ndi_common/probe/probetype2object.json +probeTypes = {'n-trode', 'electrode-$', 'patch', 'patch-Vm', 'patch-I', ... + 'patch-attached', 'sharp', 'sharp-Vm', 'sharp-Im', 'wide-field-imaging', ... + 'two-photon-imaging', 'one-photon-imaging', 'brightfield-imaging', ... + 'lick-spout', 'intraoral-cannula', 'optogenetic-fiber', 'reward-well', ... + 'stimulator', 'ecg', 'eeg', 'accelerometer', 'thermometer', 'ppg', 'event'}; +isElectrodeSpelling = ~isempty(regexp(ty, '^([A-Za-z0-9]+_)?electrode-\S+$', 'once')); +if any(strcmp(ty, probeTypes)) || isElectrodeSpelling + if isProbeClass + t = 'device'; + else + why = sprintf(['[carry-063] needs_mapping: element type "%s" is a probe type ' ... + 'on class "%s", not ndi.probe.* (a derived copy of its probe)'], ty, char(ndiClass)); + end + return; +end +switch ty case {'spikes', 'neuron', 'cell'} - t = 'cell'; - case {'ensemble'} + label = did2.convert.unitQualityLabels('get', elementId); + switch label + case 'single' + t = 'cell'; + case 'multi' + t = 'group'; + otherwise + if isempty(label) + label = 'none'; + end + why = sprintf(['[carry-062] needs_mapping: sorted unit (type "%s") ' ... + 'with no single/multi label from its sorting run (label: %s)'], ty, label); + end + case 'ensemble' t = 'group'; otherwise - t = 'device'; + why = sprintf(['[carry-063] needs_mapping: element type "%s" (class "%s") ' ... + 'is not on the element type list'], ty, char(ndiClass)); +end +end + +function tf = isEmptyRef(r) +tf = isempty(r) || ((ischar(r) || isstring(r)) && isempty(strtrim(char(r)))); +end + +function s = refText(r) +if ischar(r) || (isstring(r) && isscalar(r)) + s = char(r); +elseif isnumeric(r) && isscalar(r) + s = num2str(r, 17); +elseif isempty(r) + s = ''; +else + s = sprintf('<%s>', class(r)); end end diff --git a/src/did/+did2/+convert/+roundtrip/element.m b/src/did/+did2/+convert/+roundtrip/element.m new file mode 100644 index 00000000..6b82ac6c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/element.m @@ -0,0 +1,127 @@ +function [v1, spec] = element(bodies) +%ELEMENT Rebuild a v1 `element` from what did2.convert.migrators_j.element +% emitted when it CONVERTED it: one `entity` (device, cell or group), its +% term assertions, and its relations. +% +% [V1, SPEC] = did2.convert.roundtrip.element(BODIES). V1 is the element in +% NDI's v1 shape (element.json + base.json at the locked NDI-matlab `main`, +% 3cb19a8, as ndi.element/newdocument writes it): +% +% base.id, session_id, datestamp the entity (rebuildBase) +% element.name, element.reference entity.local_identifier, read back by +% did2.convert.elementNameReference +% (' | '; the name alone +% for an element with no reference) +% element.type the 'element type' assertion's value +% element.ndi_element_class the 'ndi element class' assertion's value +% element.direct, depends_on the lineage relation, in the order the +% template lists the edges +% (underlying_element_id, subject_id) and +% any other edge after them: +% observes X direct true, subject_id X (a direct element) +% derived_from X underlying_element_id X (the migrator's first +% branch). An element with no underlying element +% that derives from its subject writes the same +% relation; the round trip reports that case. +% wasDerivedFrom R jrclust_clusters_id R (the sorting run) +% +% NOT REBUILT, because V2 does not keep it (the round trip reports it): for +% an element with an underlying element, its `direct` and its `subject_id` +% (NDI's writer copies the underlying element's subject; the migrator writes +% only the derived_from edge). A 'modality unresolved' assertion is a +% worklist label made from `type` and states nothing more; it is placed. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.element. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +ent = []; +used = false(1, numel(bodies)); +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'entity') + ent = bodies{k}; + used(k) = true; + break; + end +end +if isempty(ent) + spec.unplaced{end+1} = 'no entity was emitted'; + return; +end +[base, entity] = rebuildBase(ent); +[name, reference] = did2.convert.elementNameReference(fieldText(entity, 'local_identifier')); + +type = ''; +ndiClass = ''; +underlying = ''; +subject = ''; +direct = []; +sortingRun = ''; +for k = 1:numel(bodies) + if used(k); continue; end + b = bodies{k}; + switch classNameOf(b) + case 'assertion' + if ~isequal(edgeIds(b, 'entity_id'), {base.id}) + continue; + end + [~, variable] = termParts(getIn(b, 'statement', 'variable')); + [~, value] = termParts(getIn(b, 'term', 'value')); + switch lower(variable) + case 'element type' + type = value; + used(k) = true; + case 'ndi element class' + ndiClass = value; + used(k) = true; + case 'modality unresolved' + used(k) = true; + end + case 'directed_relation' + child = edgeIds(b, 'child_id'); + parent = edgeIds(b, 'parent_id'); + if ~isequal(child, {base.id}) || ~isscalar(parent) + continue; + end + rel = getIn(b, 'directed_relation', 'relation'); + [node, ~] = termParts(rel); + handle = did2.build.vocabularyHandle('relation', rel); + if strcmp(handle, 'observes') && isempty(subject) && isempty(direct) + subject = parent{1}; + direct = true; + used(k) = true; + elseif strcmp(handle, 'derived_from') && isempty(underlying) && isempty(direct) + underlying = parent{1}; + used(k) = true; + elseif sameCurie(node, 'prov:wasDerivedFrom') && isempty(sortingRun) + sortingRun = parent{1}; + used(k) = true; + end + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in an element', ... + k, classNameOf(bodies{k})); +end + +v1.document_class = struct('class_name', 'element'); +names = {'underlying_element_id', 'subject_id'}; +values = {underlying, subject}; +if ~isempty(sortingRun) + names{end+1} = 'jrclust_clusters_id'; + values{end+1} = sortingRun; +end +v1.depends_on = struct('name', names, 'value', values); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +blk = struct('ndi_element_class', ndiClass, 'name', name, 'type', type); +blk.reference = reference; +if ~isempty(direct) + blk.direct = direct; +end +v1.element = blk; +end diff --git a/src/did/+did2/+convert/elementLocalIdentifier.m b/src/did/+did2/+convert/elementLocalIdentifier.m new file mode 100644 index 00000000..cf856510 --- /dev/null +++ b/src/did/+did2/+convert/elementLocalIdentifier.m @@ -0,0 +1,79 @@ +function [localId, reversible] = elementLocalIdentifier(name, reference) +%ELEMENTLOCALIDENTIFIER A migrated element's local_identifier: its name and reference, as NDI shows them. +% +% [LOCALID, REVERSIBLE] = did2.convert.elementLocalIdentifier(NAME, REFERENCE) +% +% Decided by Jess Haley, 2026-10-26 [element local identifier is name and +% reference] (did-schema V_eta_go_forward_class_audit.md): a migrated +% element's `local_identifier` is NDI's own display form +% +% | e.g. 'leftcortex | 2' +% +% the string ndi.element/elementstring writes +% ([name ' | ' int2str(reference)]). The name alone is not unique (Soph +% holds `leftcortex` n-trodes with references 1, 2 and 3). It replaces the +% unescaped '%s (ref %s)' packing (did-schema OPEN_WORK #142). +% +% It is read back by did2.convert.elementNameReference, which splits at the +% LAST ' | ': the reference is an integer, so it holds no ' | ' of its own, +% and a name may hold any text, ' | ' and ' (ref ' included. +% +% REFERENCE is an integer (numeric, or text that is one, e.g. '2'), or +% empty for an element with no reference, whose LOCALID is NAME alone. +% REVERSIBLE is false, and LOCALID '', when the pair cannot be read back +% exactly: a REFERENCE that is not an integer, an empty NAME, or no +% REFERENCE and a NAME that itself ends in ' | ' or reads as the +% old ' (ref X)' form. A caller then keeps the element as it was (the +% migration's "carried as v1") rather than writing a form that reads back +% as something else. +% +% A MIRROR of NDI-matlab's ndi.vintage.elementLocalIdentifier (branch +% claude/phase3, 471cd5c66): the same rules, so NDI's writer and reader and +% DID's migrator agree on every identifier. Change both together. +% +% See also did2.convert.elementNameReference, did2.convert.migrators_j.element, +% NDI ndi.vintage.elementLocalIdentifier, ndi.element/elementstring. + +arguments + name {mustBeText} + reference = [] +end + +name = char(name); +localId = ''; +reversible = false; +if isempty(name) + return; +end +if isempty(reference) || (isstring(reference) && strlength(reference) == 0) + % no reference: the name alone, if it cannot be mistaken for a pair + [n, r] = did2.convert.elementNameReference(name); + if strcmp(n, name) && isempty(r) + localId = name; + reversible = true; + end + return; +end +ref = integerOf(reference); +if isempty(ref) + return; +end +localId = [name ' | ' int2str(ref)]; +reversible = true; +end + +function r = integerOf(x) +% the integer X is, or [] when it is not one +r = []; +if ischar(x) || isstring(x) + x = strtrim(char(x)); + if isempty(regexp(x, '^-?\d+$', 'once')) + return; + end + x = str2double(x); +end +if (isnumeric(x) || islogical(x)) && isscalar(x) && isfinite(double(x)) ... + && double(x) == round(double(x)) + r = double(x); +end +end diff --git a/src/did/+did2/+convert/elementNameReference.m b/src/did/+did2/+convert/elementNameReference.m new file mode 100644 index 00000000..f04f9b84 --- /dev/null +++ b/src/did/+did2/+convert/elementNameReference.m @@ -0,0 +1,68 @@ +function [name, reference, form] = elementNameReference(localId) +%ELEMENTNAMEREFERENCE A migrated element's name and reference, out of its local_identifier. +% +% [NAME, REFERENCE, FORM] = did2.convert.elementNameReference(LOCALID) +% +% The inverse of did2.convert.elementLocalIdentifier. Read in this order: +% +% 'name | reference' NDI's display form (Decided by Jess Haley, +% 2026-10-26 [element local identifier is name and +% reference]): split at the LAST ' | ', when what +% follows it is an integer. REFERENCE is that +% integer (a double); NAME is everything before it, +% ' | ' and ' (ref ' included. FORM 'display'. +% 'name (ref X)' the form migrated documents carried before it, +% still accepted: DID-matlab +migrators_j/element.m +% wrote sprintf('%s (ref %s)', name, reference). +% REFERENCE is X as a number when it is one, else +% the text. FORM 'ref'. +% anything else an element with no reference: NAME is LOCALID, +% REFERENCE []. FORM 'name'. +% +% The display form is tried first and cannot be mistaken for the old one: +% an old identifier ends in ')', never in ' | '. +% +% A MIRROR of NDI-matlab's ndi.vintage.elementNameReference (branch +% claude/phase3, 471cd5c66): the same rules. Change both together. +% +% See also did2.convert.elementLocalIdentifier, did2.convert.roundtrip.element, +% NDI ndi.vintage.elementNameReference. + +arguments + localId +end + +if isstring(localId) + localId = char(localId); +end +if ~ischar(localId) + localId = ''; +end +name = localId; +reference = []; +form = 'name'; + +% greedy (.*) leaves the LAST ' | ' to the separator +tok = regexp(localId, '^(.*) \| (-?\d+)$', 'tokens', 'once'); +if ~isempty(tok) + name = tok{1}; + reference = str2double(tok{2}); + form = 'display'; + return; +end + +tok = regexp(localId, '^(.*) \(ref (.+)\)$', 'tokens', 'once'); +if ~isempty(tok) + name = tok{1}; + % v1 `reference` is numeric on every NDI-written element; the old form + % stringified it. Restore the number when it is one, and keep the text + % when it is not, rather than silently producing NaN. + refNum = str2double(tok{2}); + if isnan(refNum) + reference = tok{2}; + else + reference = refNum; + end + form = 'ref'; +end +end diff --git a/src/did/+did2/+convert/epochMint.m b/src/did/+did2/+convert/epochMint.m index 3b6ab4cb..3b4e6512 100644 --- a/src/did/+did2/+convert/epochMint.m +++ b/src/did/+did2/+convert/epochMint.m @@ -3350,8 +3350,12 @@ function rowsOut = probemapDevices(pm) %PROBEMAPDEVICES {probe local_identifier, device name} per row of a v1 % epochprobemap (tab-separated, header `name reference type devicestring -% subjectstring`). The local_identifier is +migrators_j/element.m's: the name, -% or 'name (ref REFERENCE)'. The device is the devicestring before ':'. +% subjectstring`). The local_identifier is +migrators_j/element.m's, +% did2.convert.elementLocalIdentifier: 'name | reference', or the name alone +% ([element local identifier is name and reference], Jess Haley, +% 2026-10-26); a row that cannot be written reversibly matches no element +% (element.m carries such an element). The device is the devicestring before +% ':'. rowsOut = {}; lines = regexp(char(pm), '\r?\n', 'split'); if isempty(lines); return; end @@ -3365,10 +3369,12 @@ c = strsplit(lines{i}, sprintf('\t')); if numel(c) < max([iName, iDev, iRef]); continue; end nm = strtrim(c{iName}); - lid = nm; - if ~isempty(iRef) && ~isempty(strtrim(c{iRef})) - lid = sprintf('%s (ref %s)', nm, strtrim(c{iRef})); + ref = ''; + if ~isempty(iRef) + ref = strtrim(c{iRef}); end + lid = did2.convert.elementLocalIdentifier(nm, ref); + if isempty(lid); continue; end dev = strtrim(c{iDev}); colon = find(dev == ':', 1); if ~isempty(colon); dev = strtrim(dev(1:colon-1)); end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index 062091ae..c91884f2 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -39,9 +39,15 @@ % table2treatment, +haley and +dabrowska (treatment). % Round trips: testRawV1RoundTripTreatment, which % lists what V2 does not keep as known findings. +% element superclass `base` only, no `app` block; the old +% +migrators/element.m is never run for it (a class +% with a +migrators_j migrator skips it). Written by +% ndi.element/newdocument. Round trips: +% testRawV1RoundTripElement. element_epoch is NOT +% switched yet. % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. names = {'subject', 'subject_group', 'treatment', 'treatment_drug', ... - 'treatment_transfer', 'virus_injection'}; + 'treatment_transfer', 'virus_injection', 'element'}; end diff --git a/src/did/+did2/+convert/resolveEpochProbemap.m b/src/did/+did2/+convert/resolveEpochProbemap.m index f9f08086..97d1bc8d 100644 --- a/src/did/+did2/+convert/resolveEpochProbemap.m +++ b/src/did/+did2/+convert/resolveEpochProbemap.m @@ -338,7 +338,7 @@ epochIdByKey = containers.Map('KeyType', 'char', 'ValueType', 'char'); % (b) `subject` documents by (session_id, local_identifier) -> id. This one map % resolves BOTH joins: the subjectstring column (a bare local identifier) -% and the probe (name, reference) columns (encoded 'name (ref X)' the way +% and the probe (name, reference) columns (encoded 'name | X' the way % +migrators_j/element.m mints a probe-subject's local_identifier). subjectIdByKey = containers.Map('KeyType', 'char', 'ValueType', 'char'); % (c) `acquisition_system` documents by (session_id, base.name) -> id. The device @@ -1854,17 +1854,13 @@ function lid = probeLocalIdentifier(name, reference) %PROBELOCALIDENTIFIER The element-subject local_identifier a probe row maps to. -% Mirrors +migrators_j/element.m: localId = name, or 'name (ref REFERENCE)' -% when a reference is present. The probemap serialises `reference` with -% int2str and element.m stringifies with num2str; for the integer references -% probes carry these agree, which is the join's one soft spot (documented in -% the pass header / the build report). -name = char(name); -reference = char(reference); -lid = name; -if ~isempty(reference) - lid = strtrim(sprintf('%s (ref %s)', name, reference)); -end +% +migrators_j/element.m's, did2.convert.elementLocalIdentifier: 'name | +% reference', or the name alone ([element local identifier is name and +% reference], Jess Haley, 2026-10-26). The probemap serialises `reference` +% with int2str; the identifier reads the integer from that text, so the join +% no longer depends on two number formats agreeing. '' when the pair cannot +% be written reversibly (element.m carries such an element; nothing matches). +lid = did2.convert.elementLocalIdentifier(char(name), char(reference)); end % ===================== the epoch files as bodies (2026-10-21) ========== diff --git a/src/did/+did2/+convert/unitQualityLabels.m b/src/did/+did2/+convert/unitQualityLabels.m new file mode 100644 index 00000000..7d3a49b4 --- /dev/null +++ b/src/did/+did2/+convert/unitQualityLabels.m @@ -0,0 +1,127 @@ +function [label, found] = unitQualityLabels(action, arg) +%UNITQUALITYLABELS The single/multi label the batch's sorting runs give each +% sorted unit. +% +% Decided by Jess Haley, 2026-10-26 [sorted units are cells or groups] +% (did-schema V_eta_go_forward_class_audit.md): a sorted unit (a v1 `element` +% of type `spikes`) is a `cell` when it is a SINGLE unit and a `Group` of +% unidentified cells when it is a MULTI-unit cluster; "whether it is single +% or multi is an assertion by the sorting run". In v1 that assertion is not +% on the element: it is `quality_label` ('single' / 'multi') of the +% `neuron_extracellular` document whose `element_id` names the element. +% [unlabelled units need a map]: a unit with no label is carried as v1 +% (carry-062). A per-document migrator cannot follow an edge, so +% did2.convert.v1_to_v2 indexes the labels of every v1 neuron_extracellular in +% its batch before the first migrator runs (as stimulusPresentationSpecs). +% +% did2.convert.unitQualityLabels('reset') forget all +% did2.convert.unitQualityLabels('load', BODIES) index every v1 +% `neuron_extracellular` in the cell BODIES by the id its `element_id` +% edge names (adds to what is held; v1_to_v2 resets first) +% did2.convert.unitQualityLabels('add', PAIRS) add labels a caller already +% holds, PAIRS = {ELEMENTID, LABEL, ELEMENTID, LABEL, ...} (v1_to_v2's +% 'UnitQualityLabels': a caller migrating an element whose +% neuron_extracellular is not in the same batch, or a test). A label the +% batch also states and that differs is 'conflict'. +% [LABEL, FOUND] = did2.convert.unitQualityLabels('get', ELEMENTID) +% LABEL is 'single' or 'multi' (as written, case and edge blanks aside) +% when every neuron_extracellular naming ELEMENTID states that one label; +% '' when none in the batch names it or none states a label (FOUND +% false); any other label as written; 'conflict' when two state +% different labels (FOUND true). +% +% A label not in the batch is NOT a pass: element.m carries the unit. +% +% See also did2.convert.migrators_j.element, +% did2.convert.migrators_j.neuron_extracellular. + +arguments + action (1,:) char {mustBeMember(action, {'reset', 'load', 'add', 'get'})} + arg = [] +end + +persistent index +if isempty(index) || ~isa(index, 'containers.Map') + index = containers.Map('KeyType', 'char', 'ValueType', 'char'); +end +label = ''; +found = false; +switch action + case 'reset' + index = containers.Map('KeyType', 'char', 'ValueType', 'char'); + case 'load' + bodies = arg; + if isstruct(bodies); bodies = num2cell(bodies); end + for k = 1:numel(bodies) + b = bodies{k}; + if ischar(b) || (isstring(b) && isscalar(b)) + if ~contains(b, 'neuron_extracellular'); continue; end + try + b = jsondecode(char(b)); + catch + continue; + end + end + if ~isUnit(b); continue; end + id = elementIdOf(b); + lab = labelOf(b.neuron_extracellular); + if isempty(id) || isempty(lab); continue; end + if isKey(index, id) && ~strcmp(index(id), lab) + index(id) = 'conflict'; + elseif ~isKey(index, id) + index(id) = lab; + end + end + case 'add' + pairs = arg; + for k = 1:2:numel(pairs) - 1 + id = char(pairs{k}); + lab = labelOf(struct('quality_label', pairs{k + 1})); + if isempty(id) || isempty(lab); continue; end + if isKey(index, id) && ~strcmp(index(id), lab) + index(id) = 'conflict'; + elseif ~isKey(index, id) + index(id) = lab; + end + end + case 'get' + id = char(arg); + if ~isempty(id) && isKey(index, id) + label = index(id); + found = true; + end +end +end + +function tf = isUnit(b) +tf = isstruct(b) && isscalar(b) && isfield(b, 'document_class') ... + && isstruct(b.document_class) && isfield(b.document_class, 'class_name') ... + && strcmp(char(b.document_class.class_name), 'neuron_extracellular') ... + && isfield(b, 'neuron_extracellular') && isstruct(b.neuron_extracellular) ... + && isscalar(b.neuron_extracellular); +end + +function id = elementIdOf(b) +id = ''; +try + deps = did2.convert.v1read.readDependsOn(b, 'Name', '^element_id$'); +catch + return; +end +if ~isempty(deps) + id = char(deps(1).document_id); +end +end + +function lab = labelOf(blk) +lab = ''; +if isfield(blk, 'quality_label') + v = blk.quality_label; + if ischar(v) || (isstring(v) && isscalar(v)) + lab = strtrim(char(v)); + if any(strcmpi(lab, {'single', 'multi'})) + lab = lower(lab); + end + end +end +end diff --git a/src/did/+did2/+convert/v1_to_v2.m b/src/did/+did2/+convert/v1_to_v2.m index 42095ce0..f80fd9d6 100644 --- a/src/did/+did2/+convert/v1_to_v2.m +++ b/src/did/+did2/+convert/v1_to_v2.m @@ -83,6 +83,12 @@ % identifiers in the legacy (camelCase) form so % the body stays schema-compatible while still % gaining the shared shape transformations. +% UnitQualityLabels (cell, default {}) - {ELEMENTID, LABEL, ...}: the +% single/multi label of sorted units whose +% neuron_extracellular is not in this batch +% (did2.convert.unitQualityLabels; [sorted units are +% cells or groups], Jess Haley, 2026-10-26). The batch's +% own neuron_extracellular documents are read anyway. % RawV1Classes (cellstr, default did2.convert.rawV1Classes()) - the % v1 classes whose migrator takes the RAW v1 document: % no universalRenames, no superclass migrators, and a @@ -144,6 +150,7 @@ options.TargetVersion (1,:) char {mustBeMember(options.TargetVersion, {'V_eta', 'did_v2'})} = 'V_eta' options.Audits (1,1) logical = true options.RawV1Classes cell = did2.convert.rawV1Classes() + options.UnitQualityLabels cell = {} end % a migrator transcribes the v1 source's own terms, which the term @@ -176,6 +183,13 @@ % membership], Jess Haley, 2026-10-26). did2.convert.sessionReferences('reset'); did2.convert.sessionReferences('load', bodies); +% The single/multi label each sorted unit's sorting run gives it (the +% `quality_label` of the neuron_extracellular naming it), read by +% migrators_j.element ([sorted units are cells or groups], Jess Haley, +% 2026-10-26). +did2.convert.unitQualityLabels('reset'); +did2.convert.unitQualityLabels('load', bodies); +did2.convert.unitQualityLabels('add', options.UnitQualityLabels); % Asked ONCE per call, of the schema the documents validate against: does % `base` declare `session_id` as an edge (did-schema @@ -300,8 +314,24 @@ mintDepth = did2.convert.mintId('-depth'); restoreMint = onCleanup(@() did2.convert.mintId('-popto', mintDepth)); %#ok +% What each source became, for [dependents of a carried document carry] +% (carryDependents, after the loop): done (not quarantined), carried as v1, +% read raw, already a V2 document, its class, its id, its depends_on edges, and +% the indices of its documents in `migrated`. +nBodies = numel(bodies); +srcDone = false(nBodies, 1); +srcCarried = false(nBodies, 1); +srcRaw = false(nBodies, 1); +srcTarget = false(nBodies, 1); +srcClass = cell(nBodies, 1); +srcId = cell(nBodies, 1); +srcDepNames = cell(nBodies, 1); +srcDepIds = cell(nBodies, 1); +srcOut = cell(nBodies, 1); + for k = 1:numel(bodies) rawBody = bodies{k}; + nBefore = numel(migrated); originalJSON = encodeForQuarantine(rawBody); className = ''; passedThrough = false; @@ -330,6 +360,7 @@ className = char(v2Body.document_class.class_name); end v2Bodies = {v2Body}; + srcTarget(k) = true; legacy.bodies_skipped_already_target = ... legacy.bodies_skipped_already_target + 1; else @@ -342,6 +373,7 @@ % untouched v1 source. Counted in the denominator below % (`bodies_read_raw_v1`), so a raw body is never "unreached". legacy.bodies_read_raw_v1 = legacy.bodies_read_raw_v1 + 1; + srcRaw(k) = true; className = rawClass; v2Body = preBody; superUnchanged = true; @@ -548,6 +580,11 @@ dimTermNoNode(ix) = dimTermNoNode(ix) + nNoNode; end end + srcDone(k) = true; + srcCarried(k) = carried; + srcClass{k} = className; + [srcId{k}, srcDepNames{k}, srcDepIds{k}] = sourceEdges(preBody); + srcOut{k} = nBefore + 1:numel(migrated); catch err did2.convert.reportNote('truncate', noteMark); % a body that quarantines did not pass through: drop its record if @@ -573,6 +610,14 @@ did2.convert.mintId('-popto', mintDepth); end +% [dependents of a carried document carry] (Jess Haley, 2026-10-26, did-schema +% V_eta_go_forward_class_audit.md): a document whose edge names a document +% carried as v1 is carried too, down the chain (carry-064). +[migrated, passthrough, classCountNames, classCountValues] = carryDependents( ... + bodies, migrated, passthrough, classCountNames, classCountValues, ... + srcDone, srcCarried, srcRaw, srcTarget, srcClass, srcId, srcDepNames, ... + srcDepIds, srcOut, options.RenameClassNames); + % `bodies_unreached` closes the denominator: every body either reached % universalRenames, took the idempotency short-circuit, was read raw by a % switched class's migrator (did2.convert.rawV1Classes), or failed before @@ -1156,6 +1201,96 @@ function refuseUnknownSchemaVersion(body) end end +function [id, depNames, depIds] = sourceEdges(body) +%SOURCEEDGES A v1 source's id (base.id, or its legacy identity block's) and +% its depends_on edges (did2.convert.v1read), for carryDependents. +id = ''; +depNames = {}; +depIds = {}; +try + b = did2.convert.v1read.readBase(body); + if ischar(b.id); id = b.id; end + deps = did2.convert.v1read.readDependsOn(body); + for k = 1:numel(deps) + if ischar(deps(k).document_id) && ~isempty(deps(k).document_id) + depNames{end+1} = char(deps(k).name); %#ok + depIds{end+1} = deps(k).document_id; %#ok + end + end +catch +end +end + +function [migrated, passthrough, names, counts] = carryDependents(bodies, ... + migrated, passthrough, names, counts, done, carried, raw, target, ... + cls, ids, depNames, depIds, outs, renameClassNames) +%CARRYDEPENDENTS [dependents of a carried document carry] (Jess Haley, +% 2026-10-26, did-schema V_eta_go_forward_class_audit.md): "a document whose +% edge points at a document carried as v1 (e.g. an element_epoch, +% position_metadata or spike train of a carried element) is carried too, +% down the chain, rather than converting with an edge to a v1 document" +% (carry-064, any class). +% +% After every source has been migrated: a CONVERTED source (not carried, not +% quarantined, not already a V2 document) any of whose depends_on edges names +% the id of a CARRIED source in this batch has its documents replaced by its +% v1 source carried whole -- the raw document for a class read raw +% (did2.convert.rawV1Classes), else the universalRenames output, as every +% other carry -- stamped did_v1, recorded as a passthrough, and noted +% `carried_as_v1` citing carry-064. Repeated until nothing changes, so a +% chain carries to its end. A carried document outside this batch is not +% seen. The notes the source's conversion left stay in the report. +carriedIds = ids(done & carried); +carriedIds = carriedIds(~cellfun(@isempty, carriedIds)); +if isempty(carriedIds) + return; +end +drop = false(1, numel(migrated)); +changed = true; +while changed + changed = false; + for k = reshape(find(done & ~carried & ~target), 1, []) + j = find(ismember(depIds{k}, carriedIds), 1); + if isempty(j) + continue; + end + body = ensureStruct(bodies{k}); + if ~raw(k) + body = did2.convert.universalRenames(body, 'RenameClassNames', renameClassNames); + end + if isfield(body, 'document_class') && isstruct(body.document_class) + body.document_class.schema_version = 'did_v1'; + end + for i = outs{k} + [names, counts] = dropClassCounter(names, counts, migrated{i}.className()); + end + drop(outs{k}) = true; + migrated{end+1} = did2.document(body); %#ok + drop(end+1) = false; %#ok + [names, counts] = bumpClassCounter(names, counts, cls{k}); + passthrough(end+1) = struct('input_index', k, 'id', ids{k}, ... + 'class_name', cls{k}, 'body', body); %#ok + % carry-register: carry-064 + did2.convert.reportNote('carried_as_v1', cls{k}, ids{k}, sprintf( ... + '[carry-064] needs_mapping: its %s edge names %s, which is carried as v1', ... + depNames{k}{j}, depIds{k}{j})); + carried(k) = true; + if ~isempty(ids{k}) + carriedIds{end+1} = ids{k}; %#ok + end + changed = true; + end +end +migrated = migrated(~drop); +end + +function [names, counts] = dropClassCounter(names, counts, name) +idx = find(strcmp(names, name), 1); +if ~isempty(idx) && counts(idx) > 0 + counts(idx) = counts(idx) - 1; +end +end + function [names, counts] = bumpClassCounter(names, counts, name) idx = find(strcmp(names, name), 1); if isempty(idx) diff --git a/tests/+did2/+unittest/testMigratorsJ.m b/tests/+did2/+unittest/testMigratorsJ.m index ffe741b7..4f932334 100644 --- a/tests/+did2/+unittest/testMigratorsJ.m +++ b/tests/+did2/+unittest/testMigratorsJ.m @@ -96,6 +96,14 @@ function setupOnce(testCase) out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); end +function out = runJUnit(v1) +% a sorted unit (element el_1) whose sorting run labels it a single unit: +% [sorted units are cells or groups] (Jess Haley, 2026-10-26); without a label +% it is carried ([unlabelled units need a map], testRawV1RoundTripElement) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_1', 'single'}); +end + function tf = schemaSaysAbstract(classSchema) %SCHEMASAYSABSTRACT True when a schema struct's header carries `abstract: true`. % @@ -345,10 +353,11 @@ function testElementDerivedBecomesSubjectDerivedFrom(testCase) % would keep passing if that emission regressed. It is NOT the gate for it: % testMigratorsJRecordingObservation.m owns that, and the note is here so the % next reader does not mistake a green run of this test for coverage of it. -out = runJ(elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1')); +out = runJUnit(elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1')); sub = firstOfClassJ(out.migrated, 'cell'); % #88: a spikes element is an entity of type cell verifyEqual(testCase, sub.get('base.id'), 'el_1'); % id preserved -verifyEqual(testCase, sub.get('entity.local_identifier'), 'unit3 (ref 1)'); +% [element local identifier is name and reference] (Jess Haley, 2026-10-26) +verifyEqual(testCase, sub.get('entity.local_identifier'), 'unit3 | 1'); % type + ndi_element_class preserved as term_assertions (no silent drop) verifyEqual(testCase, nLeafJ(out.migrated, 'assertion+term'), 2); % lineage: derived_from the underlying element (safe computational lineage) @@ -368,7 +377,7 @@ function testElementKeepsTheSortingRunItWasDerivedFrom(testCase) % 20211116 elements, drop census). v1 = elementDoc('leftcortex_17', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1'); v1.depends_on(end+1) = struct('name', 'jrclust_clusters_id', 'value', 'jrc_run_1'); -out = runJ(v1); +out = runJUnit(v1); rels = allOfClassJ(out.migrated, 'directed_relation'); parents = cellfun(@(r) depVal(r, 'parent_id'), rels, 'UniformOutput', false); verifyTrue(testCase, any(strcmp(parents, 'probe_1')), 'the electrode lineage is still there'); @@ -385,7 +394,7 @@ function testElementKeepsTheSortingRunItWasDerivedFrom(testCase) function testElementWithNoSortingRunEmitsNoSortingRunEdge(testCase) % the other half: no `jrclust_clusters_id`, so exactly the one lineage edge -out = runJ(elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1')); +out = runJUnit(elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1')); verifyNumElements(testCase, allOfClassJ(out.migrated, 'directed_relation'), 1); end @@ -2581,7 +2590,10 @@ function testDeferredBathIsAManipulationValuedByItsFormulation(testCase) elem.depends_on = struct('name', {'subject_id'}, 'value', {subjId}); elem.base = struct('id', stimId, 'session_id', 'aabb1122ccdd3344_9900aabbccddeeff', ... 'name', 'stimulator', 'datestamp', '2024-06-01T12:00:00.000Z'); -elem.element = struct('ndi_element_class', 'ndi.element', 'name', 'stim', ... +% a stimulator element is an ndi.probe.timeseries.stimulator (NDI +% probetype2object.json): [element types have no default] makes a probe type a +% device only on an ndi.probe.* class (Jess Haley, 2026-10-26) +elem.element = struct('ndi_element_class', 'ndi.probe.timeseries.stimulator', 'name', 'stim', ... 'reference', 1, 'type', 'stimulator', 'direct', 0); bath = struct(); @@ -2679,7 +2691,10 @@ function testDeferredGenericBathHasNoLocationObservation(testCase) elem.depends_on = struct('name', {'subject_id'}, 'value', {subjId}); elem.base = struct('id', stimId, 'session_id', 'aabb1122ccdd3344_9900aabbccddeeff', ... 'name', 'stimulator', 'datestamp', '2024-06-01T12:00:00.000Z'); -elem.element = struct('ndi_element_class', 'ndi.element', 'name', 'bath_x', ... +% a stimulator element is an ndi.probe.timeseries.stimulator (NDI +% probetype2object.json): [element types have no default] makes a probe type a +% device only on an ndi.probe.* class (Jess Haley, 2026-10-26) +elem.element = struct('ndi_element_class', 'ndi.probe.timeseries.stimulator', 'name', 'bath_x', ... 'reference', 1, 'type', 'stimulator', 'direct', 0); for loc = {struct('ontologyNode', 'NCIm:C0179246', 'name', 'Baths, Water, Laboratory'), ... struct('ontologyNode', '', 'name', 'bath')} @@ -3576,7 +3591,7 @@ function testDirectedRelationsHaveNoSubjectRelationBlock(testCase) % must NOT emit a subject_relation property block, or the doc fails validation % with "undeclared top-level block subject_relation" and quarantines (the JH % 163k-orphan regression). Check the element + subject_group relation emitters. -outs = {runJ(elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1')), ... +outs = {runJUnit(elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'subj_007', 'probe_1')), ... runJ(subjectGroupWithMembers())}; for i = 1:numel(outs) for k = 1:numel(outs{i}.migrated) diff --git a/tests/+did2/+unittest/testMigratorsJRecordingObservation.m b/tests/+did2/+unittest/testMigratorsJRecordingObservation.m index 3d5f7658..11d684ad 100644 --- a/tests/+did2/+unittest/testMigratorsJRecordingObservation.m +++ b/tests/+did2/+unittest/testMigratorsJRecordingObservation.m @@ -283,7 +283,8 @@ function testDerivedSpikesEmitNoObservationUntilTheirBodyIsDecided(testCase) % emitted -- and nothing is quarantined either, which the old value-less % observation was. v1 = elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'specimen_1', 'probe_1'); -out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta'); +out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_1', 'single'}); verifyEmpty(testCase, out.quarantine, 'the derived element quarantined'); verifyEqual(testCase, countOfClass(out, 'observation+time'), 0); verifyNotEmpty(testCase, firstOfClass(out, 'cell'), 'the neuron must still become a subject'); @@ -416,15 +417,18 @@ function testBannedClassNamesAreNeverMinted(testCase) end end -function testElementWithNoTypeAtAllIsFlaggedNotDropped(testCase) -% A real, reachable shape: +setup/+conv/+gluckman/channelname2probename.m:29-35 -% returns probetype = '' for counter / status / ACC channels. An empty type is -% Guard A with the ndi_element_class as the best-known label -- never a silent -% gap, and never a guessed modality. +function testElementWithNoTypeAtAllIsCarried(testCase) +% INVERTS testElementWithNoTypeAtAllIsFlaggedNotDropped. A real, reachable +% shape: +setup/+conv/+gluckman/channelname2probename.m:29-35 returns probetype +% = '' for counter / status / ACC channels. [element types have no default] +% (Jess Haley, 2026-10-26): an empty type is on no list, so the element is +% carried as v1 (carry-063) instead of becoming a device flagged `modality +% unresolved`. out = runJ(elementDoc('counter', '', 'ndi.probe.timeseries.mfdaq', 1, 'specimen_1', '')); -flag = assertionWithVariable(out, 'modality unresolved'); -verifyNotEmpty(testCase, flag); -verifyEqual(testCase, flag.get('term.value').name, 'ndi.probe.timeseries.mfdaq'); +verifyEqual(testCase, numel(out.migrated), 1); +verifyEqual(testCase, numel(out.passthrough), 1); +d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, startsWith(d, '[carry-063] '), d); verifyFalse(testCase, anyObservationEmitted(out)); end @@ -484,7 +488,8 @@ function testTheSpikeTrainAlsoValidatesAgainstVEta(testCase) % value_inline_or_body) -- and emits NO observation until its per-epoch body is % decided (see testDerivedSpikesEmitNoObservationUntilTheirBodyIsDecided). v1 = elementDoc('unit3', 'spikes', 'ndi.neuron', 0, 'specimen_1', 'probe_1'); -out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta'); +out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_1', 'single'}); if ~isempty(out.quarantine) verifyFail(testCase, sprintf('quarantined under validation: [%s] %s', ... out.quarantine(1).class_name, out.quarantine(1).reason)); @@ -520,7 +525,11 @@ function testTheSpikeTrainAlsoValidatesAgainstVEta(testCase) % ===================== helpers ============================================ function out = runJ(v1) -out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +% every element here is el_1; a `spikes` one is a unit its sorting run labels +% single ([sorted units are cells or groups], Jess Haley, 2026-10-26; without a +% label it is carried, testRawV1RoundTripElement) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_1', 'single'}); end function names = classNames(out) diff --git a/tests/+did2/+unittest/testRawV1RoundTripElement.m b/tests/+did2/+unittest/testRawV1RoundTripElement.m new file mode 100644 index 00000000..63a77037 --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripElement.m @@ -0,0 +1,289 @@ +function tests = testRawV1RoundTripElement +%TESTRAWV1ROUNDTRIPELEMENT The v1 `element` read as raw v1, and its round trip. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1], [migration +% reliability practices] (a); and for what an element becomes: +% [element local identifier is name and reference] ' | ' +% (did2.convert.elementLocalIdentifier, +% the mirror of NDI-matlab's +% ndi.vintage.elementLocalIdentifier on +% claude/phase3 471cd5c66) +% [element types have no default], [electrode spellings and imaging types +% are devices], [event lines and environment probes are devices] +% a device only on an ndi.probe.* class; +% anything else carried (carry-063) +% [sorted units are cells or groups], [unlabelled units need a map] +% single -> cell, multi -> group, no label +% carried (carry-062) +% +% THE v1 DOCUMENTS are built from NDI's element.json template at the locked +% NDI-matlab `main` (3cb19a8; tests/+did2/fixtures/ndi_templates) as +% ndi.element/newdocument writes them (every template field set; `reference` +% a number; `direct` a logical; underlying_element_id then subject_id, and +% any other dependency after them), shaped on the corpus census in did-schema +% docs/v2_working/ELEMENT_TYPES_DRAFT.md (Soph / Dab probes and units, JH +% position tracks), and pass through jsonencode/jsondecode. A sorted unit's +% label comes from a neuron_extracellular document in the same batch. +% +% WHAT V2 DOES NOT KEEP is listed per fixture as KNOWN FINDINGS (open +% questions, no rule made here); each fixture's lost paths must be exactly +% its listed findings. +tests = functiontests(localfunctions); +end + +% ===================== the known findings =============================== + +function f = knownFindings() +f = { ... + 'single unit', 'element.direct', ['an element with an underlying element ' ... + 'writes only derived_from that element; `direct` is kept nowhere']; + 'single unit', 'depends_on(2).value', ['its subject_id (ndi.element copies ' ... + 'the underlying element''s subject) is kept nowhere in its own V2 documents']; + 'multi unit', 'element.direct', 'as for the single unit'; + 'multi unit', 'depends_on(2).value', 'as for the single unit'}; +end + +function paths = findingsFor(fixture) +f = knownFindings(); +paths = reshape(sort(f(strcmp(f(:, 1), fixture), 2)), 1, []); +end + +% ===================== converted writer shapes ========================== + +function testConvertedElementsRoundTrip(testCase) +units = {neuronDoc('ne_1', 'el_unit_s', 'single'), neuronDoc('ne_2', 'el_unit_m', 'multi')}; +cases = { ... + 'n-trode probe', probeDoc('el_probe', 'leftcortex', 2, 'n-trode', 'ndi.probe.timeseries.mfdaq'), 'device'; ... + 'stimulator probe', probeDoc('el_stim', 'vhvis_spike2', 1, 'stimulator', 'ndi.probe.timeseries.stimulator'), 'device'; ... + 'patch-I probe', probeDoc('el_patch', 'patch1', 1, 'patch-I', 'ndi.probe.timeseries.mfdaq'), 'device'; ... + 'spelled electrode probe', probeDoc('el_e4', 'tet', 1, 'extracellular_electrode-4', 'ndi.probe.timeseries.mfdaq'), 'device'; ... + 'event line probe', probeDoc('el_ev', 'vhtaste_sync', 1, 'event', 'ndi.probe.timeseries.stimulator'), 'device'; ... + 'single unit', unitDoc('el_unit_s', 'leftcortex_17', 1), 'cell'; ... + 'multi unit', unitDoc('el_unit_m', 'leftcortex_18', 1), 'group'}; +for k = 1:size(cases, 1) + [label, v1, entityType] = cases{k, :}; + out = runRaw([{v1}, units]); + docs = elementOutputs(out, v1.base.id); + verifyEqual(testCase, numel(out.passthrough(strcmp({out.passthrough.id}, v1.base.id))), 0, ... + [label ': carried']); + ent = docs{1}; + verifyEqual(testCase, did2.unittest.helpers.classKey(ent), entityType, label); + r = did2.convert.roundtrip.check(v1, docs); + verifyFalse(testCase, r.carried, label); + verifyGreaterThan(testCase, r.fields_inspected, 0); + verifyEqual(testCase, reshape(sort({r.lost.path}), 1, []), findingsFor(label), ... + sprintf('%s: lost paths are not the listed findings; lost: %s', label, describeLost(r))); + verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); + verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end +end + +function testTheLocalIdentifierIsNameBarReference(testCase) +v1 = probeDoc('el_probe', 'leftcortex', 2, 'n-trode', 'ndi.probe.timeseries.mfdaq'); +out = runRaw(v1); +ent = out.migrated{1}; +verifyEqual(testCase, ent.get('entity.local_identifier'), 'leftcortex | 2'); +[n, r] = did2.convert.elementNameReference('leftcortex | 2'); +verifyEqual(testCase, n, 'leftcortex'); +verifyEqual(testCase, r, 2); +% a name holding ' | ' itself still reads back: the split is at the LAST one +v1 = probeDoc('el_probe2', 'a | b', 3, 'n-trode', 'ndi.probe.timeseries.mfdaq'); +r2 = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyEmpty(testCase, r2.lost, describeLost(r2)); +end + +% ===================== carried writer shapes ============================ + +function testCarriedElementsCiteTheirRows(testCase) +cases = { ... + 'unlabelled unit', unitDoc('el_unit_u', 'leftcortex_19', 1), {}, '[carry-062] '; ... + 'conflicting labels', unitDoc('el_unit_c', 'leftcortex_20', 1), ... + {neuronDoc('ne_3', 'el_unit_c', 'single'), neuronDoc('ne_4', 'el_unit_c', 'multi')}, '[carry-062] '; ... + 'JH position track', jhTrack('el_pos', 'worm1_head_position', 'position'), {}, '[carry-063] '; ... + 'JH distance track', jhTrack('el_dist', 'worm1_head_distance', 'distance'), {}, '[carry-063] '; ... + 'downsampled copy of a probe', derivedCopy('el_ds'), {}, '[carry-063] '; ... + 'probe type on no probe class', probeDoc('el_np', 'x', 1, 'n-trode', 'ndi.element.timeseries'), {}, '[carry-063] '; ... + 'unlisted type', probeDoc('el_ul', 'x', 1, 'sharp-I', 'ndi.probe.timeseries.mfdaq'), {}, '[carry-063] '; ... + 'name reads as a pair', probeDoc('el_pair', 'leftcortex | 2', [], 'n-trode', 'ndi.probe.timeseries.mfdaq'), {}, '[carry-055] '; ... + 'non-integer reference', probeDoc('el_frac', 'leftcortex', 1.5, 'n-trode', 'ndi.probe.timeseries.mfdaq'), {}, '[carry-055] '; ... + 'no name, no reference', probeDoc('el_none', '', [], 'n-trode', 'ndi.probe.timeseries.mfdaq'), {}, '[carry-048] '}; +for k = 1:size(cases, 1) + [label, v1, others, row] = cases{k, :}; + out = runRaw([{v1}, others]); + docs = elementOutputs(out, v1.base.id); + verifyEqual(testCase, numel(docs), 1, [label ': one document, the v1 source']); + verifyEqual(testCase, numel(out.passthrough(strcmp({out.passthrough.id}, v1.base.id))), 1, ... + [label ': not recorded as carried']); + d = carryNoteFor(out, v1.base.id); + verifyTrue(testCase, startsWith(d, row), sprintf('%s: %s', label, d)); + r = did2.convert.roundtrip.check(v1, docs); + verifyTrue(testCase, r.carried, label); + verifyTrue(testCase, r.ok, sprintf('%s: %s', label, describeLost(r))); +end +end + +function testABatchLabelCanBeGivenByTheCaller(testCase) +% 'UnitQualityLabels': a unit whose neuron_extracellular is not in the batch +v1 = unitDoc('el_unit_g', 'leftcortex_21', 1); +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_unit_g', 'multi'}); +verifyEqual(testCase, did2.unittest.helpers.classKey(out.migrated{1}), 'group'); +end + +% ===================== the switch changes nothing else ================== + +function testBothPathsConvertAnElementAlike(testCase) +% the migrator is the same on the raw and the universalRenames path; the +% inputs differ only in spelling it reads both ways +fixtures = {probeDoc('el_probe', 'leftcortex', 2, 'n-trode', 'ndi.probe.timeseries.mfdaq'), ... + unitDoc('el_unit_s', 'leftcortex_17', 1), jhTrack('el_pos', 'worm1_head_position', 'position')}; +for k = 1:numel(fixtures) + v1 = fixtures{k}; + raw = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_unit_s', 'single'}); + old = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', {'el_unit_s', 'single'}, 'RawV1Classes', {}); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), v1.base.id); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), v1.base.id); + if ~isempty(raw.passthrough); continue; end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + verifyTrue(testCase, isequaln(a, b), sprintf('%s document %d: raw %s; renamed %s', ... + v1.base.id, j, jsonencode(a), jsonencode(b))); + end +end +end + +% ===================== helpers ========================================= + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function docs = elementOutputs(out, elementId) +% the documents migrators_j.element emitted for ELEMENTID: its entity (or its +% carry), the assertions about it it writes, and the relations from it +docs = {}; +for k = 1:numel(out.migrated) + b = out.migrated{k}.toStruct(); + cn = char(b.document_class.class_name); + if strcmp(char(b.base.id), elementId) + docs = [{b}, docs]; %#ok + elseif strcmp(cn, 'assertion') && strcmp(edgeOf(b, 'entity_id'), elementId) + v = b.statement.variable; + if isstruct(v) && any(strcmpi(char(v.name), {'element type', 'ndi element class', 'modality unresolved'})) + docs{end+1} = b; %#ok + end + elseif strcmp(cn, 'directed_relation') && strcmp(edgeOf(b, 'child_id'), elementId) + docs{end+1} = b; %#ok + end +end +end + +function id = edgeOf(b, name) +deps = did2.convert.v1read.readDependsOn(b, 'Name', ['^' name '$']); +id = ''; +if ~isempty(deps); id = deps(1).document_id; end +end + +function d = carryNoteFor(out, id) +d = ''; +n = out.summary.migration_notes.carried_as_v1; +ix = find(strcmp(n.ids, id), 1); +if ~isempty(ix) + d = n.details{ix}; +end +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + show(r.lost(k).v1), show(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function s = show(v) +try + s = jsonencode(v); +catch + s = class(v); +end +end + +function v1 = probeDoc(id, name, reference, type, ndiClass) +% ndi.probe (ndi.element with direct 1 and no underlying element) +v1 = ndiElement(id, name, reference, type, ndiClass, true, [], 'subj_1', {}); +end + +function v1 = unitDoc(id, name, reference) +% ndi.neuron from a spike sorter: type spikes, direct false, on its probe, +% the probe's subject, and the JRCLUST run it came from +v1 = ndiElement(id, name, reference, 'spikes', 'ndi.neuron', false, 'el_probe', ... + 'subj_1', {'jrclust_clusters_id', 'jrc_run_1'}); +end + +function v1 = jhTrack(id, name, type) +% +haley/doImport.m: ndi.element.timeseries(session, name, 1, type, [], 0, subject) +v1 = ndiElement(id, name, 1, type, 'ndi.element.timeseries', false, [], 'worm_1', {}); +end + +function v1 = derivedCopy(id) +% +element/downsample.m: an ndi.element.timeseries with its probe's type +v1 = ndiElement(id, 'leftcortex_ds', 2, 'n-trode', 'ndi.element.timeseries', false, ... + 'el_probe', 'subj_1', {}); +end + +function v1 = ndiElement(id, name, reference, type, ndiClass, direct, underlying, subject, extra) +tpl = loadTemplate('element'); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = tpl.depends_on; +v1.depends_on(strcmp({v1.depends_on.name}, 'underlying_element_id')).value = underlying; +v1.depends_on(strcmp({v1.depends_on.name}, 'subject_id')).value = subject; +for k = 1:2:numel(extra) + v1.depends_on(end+1) = struct('name', extra{k}, 'value', extra{k + 1}); +end +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.element = tpl.element; +v1.element.ndi_element_class = ndiClass; +v1.element.name = name; +v1.element.reference = reference; +v1.element.type = type; +v1.element.direct = direct; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = neuronDoc(id, elementId, label) +% a neuron_extracellular from its template: the element it is, and the +% sorting run's single/multi label (no waveform: the counts left blank) +tpl = loadTemplate('neuron_extracellular'); +baseTpl = loadTemplate('base'); +appTpl = loadTemplate('app'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = tpl.depends_on; +v1.depends_on(strcmp({v1.depends_on.name}, 'element_id')).value = elementId; +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.app = appTpl.app; +v1.neuron_extracellular = tpl.neuron_extracellular; +v1.neuron_extracellular.quality_label = label; +v1 = jsondecode(jsonencode(v1)); +end + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/+unittest/testResolveEpochProbemap.m b/tests/+did2/+unittest/testResolveEpochProbemap.m index ee80c23e..c1858b43 100644 --- a/tests/+did2/+unittest/testResolveEpochProbemap.m +++ b/tests/+did2/+unittest/testResolveEpochProbemap.m @@ -40,7 +40,13 @@ %DECOMPOSE Pass 1, then the batch chain up to and including this pass. Validation % is ON from resolveSessionAnchors onward so the minted observations and % anchors are checked against the real V_eta schema. -out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +% the sorted units below are labelled single units by their sorting run: +% [sorted units are cells or groups] (Jess Haley, 2026-10-26); an unlabelled +% one is carried ([unlabelled units need a map]) +labels = {'el_neuron', 'single', 'el_neuron_x', 'single', 'el_neuron_u', 'single', ... + 'el_neuron_u2', 'single', 'el_neuron_q', 'single'}; +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'UnitQualityLabels', labels); out = did2.convert.epochMint(out, 'Validate', false, 'TargetVersion', 'V_eta'); out = did2.convert.resolveSessionAnchors(out, 'Validate', true, ... 'TargetVersion', 'V_eta'); @@ -474,11 +480,12 @@ function testTheTrainIsAnchoredToItsEpochWithItsOwnExtent(testCase) verifyEmpty(testCase, out.quarantine); end -function testAnUndecidedElementTypeKeepsItsAcquisitionEpochCounted(testCase) -% F1 AMENDMENT 1: key on the element `type`. A type with no decided row keeps -% its acquisition_epoch, counted by type -- never given a spike-shaped home. -% (`lfp` stands in; JH's `position` / `distance` are kept the same way since -% 2026-10-26, testJHPositionAndDistanceEpochsStayAcquisitionEpochs.) +function testAnElementOfNoListedTypeCarriesWithItsEpoch(testCase) +% INVERTS testAnUndecidedElementTypeKeepsItsAcquisitionEpochCounted. [element +% types have no default] (Jess Haley, 2026-10-26): an element whose type is not +% on the element type list (`lfp`; `camera` is no registered probe type) is +% carried as v1 (carry-063), and [dependents of a carried document carry]: its +% element_epoch is carried too (carry-064), so no acquisition_epoch is made. subj = subjectBody('specimen_sp2', 'sess_sp2', 'W'); elP = elementBody('el_probe_p', 'sess_sp2', 'cam', '1', 'camera', 1, 'specimen_sp2'); elN = derivedElementBody('el_lfp', 'sess_sp2', 'w1_lfp', 'lfp', 'el_probe_p'); @@ -486,12 +493,13 @@ function testAnUndecidedElementTypeKeepsItsAcquisitionEpochCounted(testCase) ing = ingestedWithRows('ing_sp2', 'sess_sp2', 't00sp2', {{'cam', '1', 'camera', 'W'}}); daq = daqsystemBody('daq_sp2', 'sess_sp2', 'vhspike2'); [out, rep] = decompose({sessionBody('sd_sp2', 'sess_sp2', 'ref'), subj, elP, elN, ee, ing, daq}); -verifyEqual(testCase, rep.acquisition_epoch_seen, 1); -verifyEqual(testCase, rep.acquisition_epoch_dissolved, 0); -verifyEqual(testCase, rep.acquisition_epoch_kept_type_undecided, 1); -verifyEqual(testCase, rep.acquisition_epoch_kept_types, 'lfp=1'); -verifyEqual(testCase, numel(bodiesOfClass(out, 'acquisition_epoch')), 1); -verifyEqual(testCase, rep.spike_epochs_seen, 0); +verifyEqual(testCase, rep.acquisition_epoch_seen, 0); +verifyEmpty(testCase, bodiesOfClass(out, 'acquisition_epoch')); +carried = carriedIds(out); +for id = {'el_probe_p', 'el_lfp', 'ee_p'} + verifyTrue(testCase, any(strcmp(carried, id{1})), [id{1} ' is not carried']); +end +verifyEmpty(testCase, out.quarantine); end % ===================== JH position and distance (left 2026-10-26) ======= @@ -538,26 +546,25 @@ function testAnUndecidedElementTypeKeepsItsAcquisitionEpochCounted(testCase) 't0_t1', [0 739081.594; 3599.8 739081.636]); end -function testJHPositionAndDistanceEpochsStayAcquisitionEpochs(testCase) -% INVERTS testJHPositionAndDistanceDissolveIntoTrackCalculations: the JH worm -% track shapes left the generic migration (Decided by Jess Haley, 2026-10-26 -% [dataset audit batch 1 and 2] (1), superseding [JH position and distance] for -% the generic stage). A `position` or `distance` epoch has no row, so it keeps -% its acquisition_epoch, counted by type; no track calculation, coordinate -% system or nearest-patch item is written. +function testJHPositionAndDistanceCarryWithTheirEpochs(testCase) +% INVERTS testJHPositionAndDistanceEpochsStayAcquisitionEpochs. The JH worm +% track shapes left the generic migration ([dataset audit batch 1 and 2] (1)); +% [element types have no default] (Jess Haley, 2026-10-26): `position` and +% `distance` are on no element type list, so the elements are carried as v1 +% (carry-063), and [dependents of a carried document carry] carries their +% element_epochs and the distance_metadata (carry-064). No acquisition_epoch, +% track calculation, coordinate system or nearest-patch item is written. sid = 'sess_jh'; worm = subjectBody('worm_1', sid, 'N2_worm0001'); patch = subjectBody('patch_1', sid, 'patch 1'); [els, ees, dm] = jhWorm(sid, 'N2_x_midpoint', 'worm_1', 'patch_1'); [out, rep] = decompose([{sessionBody('sd_jh', sid, 'ref'), worm, patch}, els, ees, {dm}]); -verifyEqual(testCase, rep.acquisition_epoch_seen, 2); -verifyEqual(testCase, rep.acquisition_epoch_dissolved, 0); -% kept either way: JH's v1 holds no daqsystem and no epochprobemap, so the -% extents tie to no acquisition system and are carried ([device clocks on one -% epoch]); with a tie they would be kept as an undecided type -verifyEqual(testCase, rep.acquisition_epoch_kept_type_undecided ... - + rep.acquisition_epoch_kept_extent_carried, 2); -verifyEqual(testCase, numel(bodiesOfClass(out, 'acquisition_epoch')), 2); +verifyEqual(testCase, rep.acquisition_epoch_seen, 0); +verifyEmpty(testCase, bodiesOfClass(out, 'acquisition_epoch')); +carried = carriedIds(out); +for b = [els, ees, {dm}] + verifyTrue(testCase, any(strcmp(carried, b{1}.base.id)), [b{1}.base.id ' is not carried']); +end verifyEmpty(testCase, bodiesOfClass(out, 'calculation+position')); verifyEmpty(testCase, bodiesOfClass(out, 'calculation+length')); verifyEmpty(testCase, bodiesOfClass(out, 'calculation+item')); @@ -1195,7 +1202,7 @@ function testAnIngestedDocWithNoMintedEpochIsRefused(testCase) %ELEMENTBODY A did_v1 element. A DIRECT element drives jRecordingObservation to a % #30 recording observation of the SPECIMEN, with instrument_id = docId (the % element-subject, id preserved). Its subject local_identifier becomes -% 'name (ref reference)', which is the join key a probemap row reconstructs. +% 'name | reference', which is the join key a probemap row reconstructs. el = struct(); el.document_class = struct('class_name', 'element', 'class_version', '1.0.0', ... 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); @@ -1321,6 +1328,18 @@ function testAnIngestedDocWithNoMintedEpochIsRefused(testCase) end +function ids = carriedIds(result) +%CARRIEDIDS base.id of every migrated document stamped did_v1 (carried as v1). +ids = {}; +for k = 1:numel(result.migrated) + b = result.migrated{k}.toStruct(); + if isfield(b, 'document_class') && isfield(b.document_class, 'schema_version') ... + && strcmp(char(b.document_class.schema_version), 'did_v1') + ids{end+1} = char(b.base.id); %#ok + end +end +end + function out = bodiesOfClass(result, className) %BODIESOFCLASS Migrated bodies (as structs) of document_class className. out = {}; diff --git a/tests/+did2/fixtures/ndi_templates/element.json b/tests/+did2/fixtures/ndi_templates/element.json new file mode 100644 index 00000000..cc446f7c --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/element.json @@ -0,0 +1,28 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/element.json", + "validation": "$NDISCHEMAPATH\/element_schema.json", + "class_name": "element", + "property_list_name": "element", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + { "name": "underlying_element_id", + "value": "" + }, + { "name": "subject_id", + "value": "" + } + ], + "element": { + "ndi_element_class": "ndi_element", + "name": "", + "reference": "", + "type": "", + "direct": 0 + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/neuron_extracellular.json b/tests/+did2/fixtures/ndi_templates/neuron_extracellular.json new file mode 100644 index 00000000..25bcc66d --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/neuron_extracellular.json @@ -0,0 +1,26 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/neuron\/neuron_extracellular.json", + "validation": "$NDISCHEMAPATH\/neuron\/neuron_extracellular_schema.json", + "class_name": "neuron_extracellular", + "property_list_name": "neuron_extracellular", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/app.json" } + ] + }, + "depends_on": [ + { "name": "element_id", "value": "" }, + { "name": "spike_clusters_id", "value": "" } + ], + "neuron_extracellular": { + "number_of_samples_per_channel": [], + "number_of_channels": [], + "mean_waveform": [], + "waveform_sample_times": [], + "cluster_index": 0, + "quality_number": 0, + "quality_label": "" + } +} From 91082c38eb763874391518eacdeceb65d83028d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 01:05:19 +0000 Subject: [PATCH 07/45] Dependents of a carry: not of a document handed to NDI's second pass; registry spelling of Numeric Value carryDependents follows no carry that only hands a document to NDI's second pass (stimulus_presentation, carry-045; daqmetadatareader_epochdata_ingested, carry-046): those are converted there, so an edge to them is not an edge to a v1 document. The treatment round trip and testMigratorsJ read the condition's variable as did-schema main now registers it (NCIT:C81274 "Numeric Value"). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/+roundtrip/treatment.m | 2 +- src/did/+did2/+convert/v1_to_v2.m | 12 +++++++++++- tests/+did2/+unittest/testMigratorsJ.m | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/did/+did2/+convert/+roundtrip/treatment.m b/src/did/+did2/+convert/+roundtrip/treatment.m index bfa3056a..efd53532 100644 --- a/src/did/+did2/+convert/+roundtrip/treatment.m +++ b/src/did/+did2/+convert/+roundtrip/treatment.m @@ -84,7 +84,7 @@ v = []; for c = asCell(conds) [~, name] = termParts(getIn(c{1}, 'variable')); - if strcmp(name, 'numeric value') + if strcmpi(name, 'numeric value') v = numberOf(getIn(c{1}, 'quantity', 'value')); return; end diff --git a/src/did/+did2/+convert/v1_to_v2.m b/src/did/+did2/+convert/v1_to_v2.m index f80fd9d6..40240526 100644 --- a/src/did/+did2/+convert/v1_to_v2.m +++ b/src/did/+did2/+convert/v1_to_v2.m @@ -1240,7 +1240,17 @@ function refuseUnknownSchemaVersion(body) % `carried_as_v1` citing carry-064. Repeated until nothing changes, so a % chain carries to its end. A carried document outside this batch is not % seen. The notes the source's conversion left stay in the report. -carriedIds = ids(done & carried); +% +% NOT A v1 END STATE, so not followed: a document pass 1 carries only to hand +% it to NDI's second pass, which converts it -- `stimulus_presentation` +% (carry-045: "a retired class, decomposed by NDI's second pass") and +% `daqmetadatareader_epochdata_ingested` (carry-046: "made an opaque_body of +% the epoch's presentation by NDI's second pass"). An edge to one of them +% does not end as "an edge to a v1 document", which is what the decision +% prevents; following it would carry every stimulus response. +handedOn = {'stimulus_presentation', 'daqmetadatareader_epochdata_ingested'}; +isHandedOn = cellfun(@(c) ischar(c) && any(strcmp(c, handedOn)), cls); +carriedIds = ids(done & carried & ~isHandedOn); carriedIds = carriedIds(~cellfun(@isempty, carriedIds)); if isempty(carriedIds) return; diff --git a/tests/+did2/+unittest/testMigratorsJ.m b/tests/+did2/+unittest/testMigratorsJ.m index 4f932334..b5c4a24c 100644 --- a/tests/+did2/+unittest/testMigratorsJ.m +++ b/tests/+did2/+unittest/testMigratorsJ.m @@ -651,7 +651,9 @@ function testTreatmentSubstanceIsDoseManipulation(testCase) end p = m.toStruct(); cnd = p.statement.conditions; -verifyEqual(testCase, cnd.variable.name, 'numeric value'); +% the registry's label: did-schema main registers NCIT:C81274 "Numeric Value" +% (since 5c0bfad); a registered term is written as the registry writes it (T19) +verifyEqual(testCase, lower(cnd.variable.name), 'numeric value'); verifyEqual(testCase, cnd.quantity.value, 2.5, 'AbsTol', 1e-12); verifyFalse(testCase, isfield(cnd, 'unit'), 'an unlabelled number has no unit'); n = out.summary.migration_notes.treatment_number_unlabelled; From afb76d448f7501ca96d74aa5c2de0335139b34f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 01:05:51 +0000 Subject: [PATCH 08/45] Divergence table: NDI's carryRowOf is a reason-to-row helper, not a pass NDI-matlab V2 (#1074) calls ndi.migrate.internal.carryRowOf from local.m, so testBatchPassWiring measured a new NDI-only name with no row. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- tests/+did2/+unittest/testBatchPassWiring.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/+did2/+unittest/testBatchPassWiring.m b/tests/+did2/+unittest/testBatchPassWiring.m index 624b84f7..7a12b44f 100644 --- a/tests/+did2/+unittest/testBatchPassWiring.m +++ b/tests/+did2/+unittest/testBatchPassWiring.m @@ -373,6 +373,12 @@ 'that could differ. Listed rather than filtered out because a filter ' ... 'for "things that are not really passes" is a judgement that would ' ... 'have to be re-made, silently, for every future entry.']; ... +'carryRowOf', 'NDI', ... + ['Not a transform at all: ndi.migrate.internal.carryRowOf (NDI-matlab V2, ' ... + 'PR #1074) returns the `[carry-NNN]` register row a second-pass carry ' ... + 'reason cites, so local.m can report carries by row ([migration ' ... + 'reliability practices] (d)). It reads a string and migrates nothing; the ' ... + 'DID side cites rows in its own notes (tools/check_carry_citations.py).']; ... 'stimulusBathToBath', 'NDI', ... ['The live-session bath assembler, per document, invoked from step (1). ' ... 'It is the counterpart named in the resolveDeferredBaths row above -- ' ... From 3efea7da697d21c9b849c8525f997340d12e4834 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 01:45:02 +0000 Subject: [PATCH 09/45] element_epoch reads raw v1; round trip of its pass-1 carrier Decided by Jess Haley, 2026-10-26 (did-schema V_eta_go_forward_class_audit.md): [migrators read raw v1], [migration reliability practices] (a). - element_epoch added to did2.convert.rawV1Classes. The migrator reads the raw document through jRawBody, writes depends_on as {name, document_id} (the shape the batch passes read; an entry universalRenames would have discarded is carried, carry-049, as the renamed path carried it), and returns the untouched v1 source when it carries ([small unread settings] (4), carry-009 / carry-038). - +roundtrip/element_epoch.m rebuilds the v1 document from the acquisition_epoch carrier (clocks -> epoch_clock / t0_t1, element_id, epochid, files). The batch dissolution (epochMint, resolveEpochProbemap: [device clocks on one epoch], [untied epochs keep the session anchor]) is unchanged and not inverted here. - Fixtures: NDI templates element_epoch.json, epochid.json (locked main 3cb19a8). testRawV1RoundTripElementEpoch: writer shapes (one clock, two clocks, a file_info) round trip with nothing lost; a mismatched t0_t1 is carried untouched; the epoch of a carried element is carried (carry-064); the raw and renamed paths make the same carrier. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+convert/+migrators_j/element_epoch.m | 72 ++++++++ .../+did2/+convert/+roundtrip/element_epoch.m | 75 ++++++++ src/did/+did2/+convert/rawV1Classes.m | 10 +- .../testRawV1RoundTripElementEpoch.m | 162 ++++++++++++++++++ .../fixtures/ndi_templates/element_epoch.json | 27 +++ .../+did2/fixtures/ndi_templates/epochid.json | 16 ++ 6 files changed, 359 insertions(+), 3 deletions(-) create mode 100644 src/did/+did2/+convert/+roundtrip/element_epoch.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripElementEpoch.m create mode 100644 tests/+did2/fixtures/ndi_templates/element_epoch.json create mode 100644 tests/+did2/fixtures/ndi_templates/epochid.json diff --git a/src/did/+did2/+convert/+migrators_j/element_epoch.m b/src/did/+did2/+convert/+migrators_j/element_epoch.m index b54d92a6..55af9ced 100644 --- a/src/did/+did2/+convert/+migrators_j/element_epoch.m +++ b/src/did/+did2/+convert/+migrators_j/element_epoch.m @@ -127,11 +127,57 @@ % nobody catches it. % % Routed from did2.convert.v1_to_v2 only when TargetVersion == 'V_eta'. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI element_epoch.json + epochid.json + base.json at the +% locked NDI-matlab `main`, 3cb19a8, as ndi.element/addepoch writes it), +% identity through jRawBody; a carry is the untouched v1 source. Every v1 +% field and where it goes in this pass-1 carrier; did2.convert.roundtrip. +% element_epoch rebuilds the v1 document and testRawV1RoundTripElementEpoch +% compares the two: +% +% base.* -> kept (v1_to_v2 renames datestamp and makes +% session_id the edge on the way out) +% depends_on element_id -> kept, as {name, document_id} -- the shape +% universalRenames gave it, which the batch +% passes read. An entry with a `version` or a +% second, different id is carried, as the +% renamed path carried it (carry-049) +% element_epoch.epoch_clock, t0_t1 -> acquisition_epoch.clocks, one +% {name, t0, t1} per clock +% (did2.convert.migrators.element_epoch) +% epochid.epochid, files.file_list -> kept +% +% The batch passes then dissolve this carrier (epochMint, +% resolveEpochProbemap: [epoch dissolution before merge], [device clocks on +% one epoch], [untied epochs keep the session anchor]); a carried element +% carries its epochs too ([dependents of a carried document carry], v1_to_v2). arguments preBody (1,1) struct end +body = jRawBody(preBody, 'element_epoch'); +[deps, collision] = renamedDependsOn(body); +if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'element_epoch', char(body.base.id), ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); + v2Body = {preBody}; + return; +end +v2Body = convertElementEpoch(body); +if isscalar(v2Body) && iscell(v2Body) + v2Body = {preBody}; % carried: the untouched v1 source + return; +end +if isfield(v2Body, 'depends_on') + v2Body.depends_on = deps; +end +end + +function v2Body = convertElementEpoch(preBody) % Reuse the base clocks-block transform (parses epoch_clock / t0_t1). v2Body = did2.convert.migrators.element_epoch(preBody); if isequaln(v2Body, preBody) @@ -149,3 +195,29 @@ v2Body = rmfield(v2Body, 'element_epoch'); end end + +function [deps, collision] = renamedDependsOn(body) +%RENAMEDDEPENDSON depends_on as {name, document_id}, the shape the +% universalRenames pass wrote and the batch passes read, from the raw v1 +% entries (did2.convert.v1read.readDependsOn). COLLISION lists what that pass +% would have discarded: an entry's `version`, or a second id that differs. +deps = struct('name', {}, 'document_id', {}); +collision = {}; +if ~isfield(body, 'depends_on') || isempty(body.depends_on) + if isfield(body, 'depends_on') + deps = body.depends_on; % an empty list stays as written, as the pass left it + end + return; +end +raw = did2.convert.v1read.readDependsOn(body); +for k = 1:numel(raw) + deps(end+1) = struct('name', raw(k).name, 'document_id', raw(k).document_id); %#ok + if ~isempty(raw(k).version) + collision{end+1} = sprintf('depends_on(%s).version', raw(k).name); %#ok + end + others = fieldnames(raw(k).other); + for j = 1:numel(others) + collision{end+1} = sprintf('depends_on(%s).%s', raw(k).name, others{j}); %#ok + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/element_epoch.m b/src/did/+did2/+convert/+roundtrip/element_epoch.m new file mode 100644 index 00000000..d76abbd6 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/element_epoch.m @@ -0,0 +1,75 @@ +function [v1, spec] = element_epoch(bodies) +%ELEMENT_EPOCH Rebuild a v1 `element_epoch` from the pass-1 carrier +% did2.convert.migrators_j.element_epoch emitted: one `acquisition_epoch`. +% +% [V1, SPEC] = did2.convert.roundtrip.element_epoch(BODIES). V1 is the +% element_epoch in NDI's v1 shape (element_epoch.json + epochid.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8, as ndi.element/addepoch +% writes it): +% +% base.id, session_id, datestamp the carrier (rebuildBase) +% depends_on(1) element_id the carrier's element_id edge +% element_epoch.epoch_clock the clocks' names, joined by ',' +% element_epoch.t0_t1 [t0; t1] per clock, one column each (the +% writer's column vector for one clock) +% epochid.epochid the carrier's epochid.epochid +% files the carrier's files block +% +% THIS IS THE PASS-1 ROUND TRIP. The batch passes (epochMint, +% resolveEpochProbemap) then dissolve the carrier into an epoch, its time +% references and an observation with its data body; that dissolution is not +% inverted here. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.element_epoch. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +ae = []; +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'acquisition_epoch') && isempty(ae) + ae = bodies{k}; + else + spec.unplaced{end+1} = sprintf('emitted document %d (%s) is not the one acquisition_epoch', ... + k, classNameOf(bodies{k})); + end +end +if isempty(ae) + spec.unplaced{end+1} = 'no acquisition_epoch was emitted'; + return; +end +[base, ~] = rebuildBase(ae); +clocks = asCell(getIn(ae, 'acquisition_epoch', 'clocks')); +names = cell(1, numel(clocks)); +t0t1 = zeros(2, numel(clocks)); +for k = 1:numel(clocks) + names{k} = fieldText(clocks{k}, 'name'); + t0t1(:, k) = [timeOf(clocks{k}, 't0'); timeOf(clocks{k}, 't1')]; +end +ids = edgeIds(ae, 'element_id'); +if isempty(ids); ids = {''}; end + +v1.document_class = struct('class_name', 'element_epoch'); +v1.depends_on = struct('name', 'element_id', 'value', ids{1}); +if isfield(ae, 'files') + v1.files = ae.files; +end +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +[epochId, ok] = getIn(ae, 'epochid', 'epochid'); +if ok + v1.epochid = struct('epochid', epochId); +end +v1.element_epoch = struct('epoch_clock', strjoin(names, ','), 't0_t1', t0t1); +end + +function t = timeOf(clock, name) +t = NaN; +[v, ok] = getIn(clock, name); +if ok && isnumeric(v) && isscalar(v) + t = double(v); +end +end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index c91884f2..c13e6e54 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -43,11 +43,15 @@ % +migrators/element.m is never run for it (a class % with a +migrators_j migrator skips it). Written by % ndi.element/newdocument. Round trips: -% testRawV1RoundTripElement. element_epoch is NOT -% switched yet. +% testRawV1RoundTripElement. +% element_epoch superclasses `base` and `epochid` (no migrator for +% either); pass 1 makes the acquisition_epoch carrier +% the batch passes dissolve. Written by +% ndi.element/addepoch. Round trips: +% testRawV1RoundTripElementEpoch (the pass-1 carrier). % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. names = {'subject', 'subject_group', 'treatment', 'treatment_drug', ... - 'treatment_transfer', 'virus_injection', 'element'}; + 'treatment_transfer', 'virus_injection', 'element', 'element_epoch'}; end diff --git a/tests/+did2/+unittest/testRawV1RoundTripElementEpoch.m b/tests/+did2/+unittest/testRawV1RoundTripElementEpoch.m new file mode 100644 index 00000000..d4511e8f --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripElementEpoch.m @@ -0,0 +1,162 @@ +function tests = testRawV1RoundTripElementEpoch +%TESTRAWV1ROUNDTRIPELEMENTEPOCH The v1 `element_epoch` read as raw v1, and the +% round trip of its pass-1 carrier (an `acquisition_epoch`). +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1], [migration +% reliability practices] (a); [small unread settings] (4) (a t0_t1 that does +% not match its clocks is carried, carry-009); [dependents of a carried +% document carry] (the epoch of a carried element is carried, carry-064). +% The carrier's dissolution ([device clocks on one epoch], [untied epochs +% keep the session anchor]) is the batch passes' (testEpochMint, +% testResolveEpochProbemap) and is not this round trip. +% +% THE v1 DOCUMENTS are built from NDI's element_epoch.json / epochid.json / +% base.json templates at the locked NDI-matlab `main` (3cb19a8) as +% ndi.element/addepoch writes them (+ndi/element.m: epoch_clock the clock +% string, t0_t1 a column [t0; t1] for one clock, epochid.epochid, then +% set_dependency_value('element_id', ...) and the .vhsb file), and pass +% through jsonencode/jsondecode. +tests = functiontests(localfunctions); +end + +function testWriterShapedEpochsRoundTrip(testCase) +cases = { ... + 'one clock', epochDoc('ee_1', 'el_probe', 't00001', 'dev_local_time', [0; 10.5], false); ... + 'two clocks', epochDoc('ee_2', 'el_track', 'N2_head_position', ... + 'dev_local_time,exp_global_time', [0 739081.594; 3599.8 739081.636], false); ... + 'with its file info', epochDoc('ee_3', 'el_probe', 't00002', 'dev_local_time', [0; 12], true)}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + verifyEmpty(testCase, out.passthrough, [label ': carried']); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEqual(testCase, out.migrated{1}.className(), 'acquisition_epoch', label); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyGreaterThan(testCase, r.fields_inspected, 0); + verifyEmpty(testCase, r.lost, sprintf('%s: lost: %s', label, describeLost(r))); + verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); + verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); + for p = {'element_epoch.epoch_clock', 'element_epoch.t0_t1', 'epochid.epochid', ... + 'depends_on(1).value', 'base.id', 'files.file_list'} + verifyTrue(testCase, any(strcmp(p{1}, r.matched)), sprintf('%s: %s not matched', label, p{1})); + end +end +end + +function testAMismatchedT0T1IsCarriedUntouched(testCase) +% [small unread settings] (4): three columns for two clocks +v1 = epochDoc('ee_bad', 'el_probe', 't00003', 'dev_local_time,exp_global_time', ... + [0 1 2; 10 11 12], false); +out = runRaw(v1); +verifyEqual(testCase, numel(out.passthrough), 1); +emitted = out.migrated{1}.toStruct(); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carry is not the v1 source'); +d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, contains(d, '[carry-009]'), d); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyTrue(testCase, r.carried && r.ok); +end + +function testTheEpochOfACarriedElementIsCarried(testCase) +% [dependents of a carried document carry]: an unlabelled sorted unit is +% carried (carry-062), so its epoch is too (carry-064) +unit = elementDoc('el_unit', 'spikes', 'ndi.neuron'); +v1 = epochDoc('ee_unit', 'el_unit', 't00001', 'dev_local_time', [0; 10.5], false); +out = runRaw({unit, v1}); +ids = {out.passthrough.id}; +verifyTrue(testCase, any(strcmp(ids, 'el_unit')), 'the unit is not carried'); +verifyTrue(testCase, any(strcmp(ids, 'ee_unit')), 'its epoch is not carried'); +n = out.summary.migration_notes.carried_as_v1; +d = n.details{strcmp(n.ids, 'ee_unit')}; +verifyTrue(testCase, startsWith(d, '[carry-064] '), d); +for k = 1:numel(out.migrated) + verifyNotEqual(testCase, out.migrated{k}.className(), 'acquisition_epoch'); +end +end + +function testBothPathsMakeTheSameCarrier(testCase) +for v1 = {epochDoc('ee_1', 'el_probe', 't00001', 'dev_local_time', [0; 10.5], false), ... + epochDoc('ee_3', 'el_probe', 't00002', 'dev_local_time', [0; 12], true)} + raw = runRaw(v1{1}); + old = did2.convert.v1_to_v2(v1{1}, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated)); + a = raw.migrated{1}.toStruct(); + b = old.migrated{1}.toStruct(); + verifyTrue(testCase, isequaln(a, b), sprintf('raw %s; renamed %s', jsonencode(a), jsonencode(b))); +end +end + +% ===================== helpers ========================================= + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + jsonencode(r.lost(k).v1), jsonencode(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function v1 = epochDoc(id, elementId, epochId, clock, t0t1, withFileInfo) +tpl = loadTemplate('element_epoch'); +baseTpl = loadTemplate('base'); +eTpl = loadTemplate('epochid'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = tpl.depends_on; +v1.depends_on(1).value = elementId; +v1.files = tpl.files; +if withFileInfo + % ndi.document/add_file (did.document): one file_info entry per file + v1.files.file_info = struct('name', 'epoch_binary_data.vhsb', ... + 'locations', struct('uid', '41268b6f5c6a3d4e_f000000000000001', ... + 'location', 'https://example.org/files/41268b6f5c6a3d4e_f000000000000001', ... + 'parameters', '', 'location_type', 'ndicloud', 'ingest', 0, 'delete_original', 0)); +end +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.epochid = eTpl.epochid; +v1.epochid.epochid = epochId; +v1.element_epoch = tpl.element_epoch; +v1.element_epoch.epoch_clock = clock; +v1.element_epoch.t0_t1 = t0t1; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = elementDoc(id, type, ndiClass) +tpl = loadTemplate('element'); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = tpl.depends_on; +v1.depends_on(strcmp({v1.depends_on.name}, 'underlying_element_id')).value = 'el_probe'; +v1.depends_on(strcmp({v1.depends_on.name}, 'subject_id')).value = 'subj_1'; +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.element = tpl.element; +v1.element.ndi_element_class = ndiClass; +v1.element.name = 'unit_1'; +v1.element.reference = 1; +v1.element.type = type; +v1.element.direct = false; +v1 = jsondecode(jsonencode(v1)); +end + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/fixtures/ndi_templates/element_epoch.json b/tests/+did2/fixtures/ndi_templates/element_epoch.json new file mode 100644 index 00000000..c11336c3 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/element_epoch.json @@ -0,0 +1,27 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/element_epoch.json", + "validation": "$NDISCHEMAPATH\/element_epoch_schema.json", + "class_name": "element_epoch", + "property_list_name": "element_epoch", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/epochid.json" } + ] + }, + "depends_on": [ + { "name": "element_id", + "value": "" + } + ], + "files": { + "file_list": [ + "epoch_binary_data.vhsb" + ] + }, + "element_epoch": { + "epoch_clock": "", + "t0_t1": "" + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_templates/epochid.json b/tests/+did2/fixtures/ndi_templates/epochid.json new file mode 100644 index 00000000..6d4ce761 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/epochid.json @@ -0,0 +1,16 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/epochid.json", + "validation": "$NDISCHEMAPATH\/epochid_schema.json", + "class_name": "epochid", + "property_list_name": "epochid", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "epochid": { + "epochid": "" + } +} + From 548723dfbfe25e4587365708640cfb2455c04431 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 01:55:23 +0000 Subject: [PATCH 10/45] element_epoch carrier names its superclasses by class_name ensureClassBlocks reads document_class.superclasses by class_name; a raw v1 document names them by definition path only (universalRenames derived the name). The carrier now lists them by name (v1read.readStamp); the V_eta chain is rebuilt from the class name as before. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/+migrators_j/element_epoch.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/did/+did2/+convert/+migrators_j/element_epoch.m b/src/did/+did2/+convert/+migrators_j/element_epoch.m index 55af9ced..07f9f099 100644 --- a/src/did/+did2/+convert/+migrators_j/element_epoch.m +++ b/src/did/+did2/+convert/+migrators_j/element_epoch.m @@ -175,6 +175,11 @@ if isfield(v2Body, 'depends_on') v2Body.depends_on = deps; end +% the superclass list by name (did2.convert.v1read.readStamp: v1 names a +% superclass by its definition path); v1_to_v2's ensureClassBlocks rebuilds +% the V_eta chain from the class name, as on the renamed path +stamp = did2.convert.v1read.readStamp(body); +v2Body.document_class.superclasses = struct('class_name', stamp.superclasses); end function v2Body = convertElementEpoch(preBody) From c2869ab07ce3fb5c021b287df43014f326578947 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 03:27:01 +0000 Subject: [PATCH 11/45] Stimulus-response family reads raw v1; round trips of both classes Decided by Jess Haley, 2026-10-26 (did-schema V_eta_go_forward_class_audit.md): [migrators read raw v1], [renames carry is temporary], [migration reliability practices] (a). - stimulus_response_scalar and stimulus_response_scalar_parameters_basic added to did2.convert.rawV1Classes (one line each; v1 spelling = migrator name). No superclass migrator exists for `stimulus_response`, `stimulus_response_scalar_parameters` or `base`, so nothing is folded or deleted. - The response migrator reads the raw document (edges by name in v1's `value` key, identity through jRawBody for a legacy-only ndi_document); every carry and passthrough returns the untouched v1 source. What universalRenames would have discarded (a depends_on version or second id, ndi_document beside base, an app name conflict, a camelCase twin of a field read) is carried, carry-049, as the renamed path carried it (private/jResponseRenameCollisions). - The parameters migrator stays a pass-1 passthrough that resolveResponseParameters turns into a `method`; it carries the same collisions (carry-049). - ensureClassBlocks names a v1 superclass by its definition path when it has no class_name (a switched class's passthrough is not renamed). - +roundtrip/stimulus_response_scalar.m (converted calculation + anchor + software [+ the epoch entity], or a passthrough) and +roundtrip/stimulus_response_scalar_parameters_basic.m (pass-1 passthrough, or the batch pass's method with the responses using it). - NDI templates stimulus_response*.json copied verbatim from locked main 3cb19a8. testRawV1RoundTripStimulusResponse: writer shapes from ndi.app.stimulus.tuning_response (the only writer) are carried, carry-050, and round trip; the converted DID-side shape round trips; lost paths equal the listed known findings; broken inputs fail; raw and renamed paths agree. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../private/jResponseRenameCollisions.m | 66 +++ .../+migrators_j/stimulus_response_scalar.m | 95 +++- ...timulus_response_scalar_parameters_basic.m | 36 ++ .../+roundtrip/stimulus_response_scalar.m | 223 ++++++++ ...timulus_response_scalar_parameters_basic.m | 150 +++++ src/did/+did2/+convert/ensureClassBlocks.m | 6 + src/did/+did2/+convert/rawV1Classes.m | 11 + .../testRawV1RoundTripStimulusResponse.m | 529 ++++++++++++++++++ .../ndi_templates/stimulus_response.json | 31 + .../stimulus_response_scalar.json | 29 + .../stimulus_response_scalar_parameters.json | 15 + ...ulus_response_scalar_parameters_basic.json | 22 + 12 files changed, 1195 insertions(+), 18 deletions(-) create mode 100644 src/did/+did2/+convert/+migrators_j/private/jResponseRenameCollisions.m create mode 100644 src/did/+did2/+convert/+roundtrip/stimulus_response_scalar.m create mode 100644 src/did/+did2/+convert/+roundtrip/stimulus_response_scalar_parameters_basic.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripStimulusResponse.m create mode 100644 tests/+did2/fixtures/ndi_templates/stimulus_response.json create mode 100644 tests/+did2/fixtures/ndi_templates/stimulus_response_scalar.json create mode 100644 tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters.json create mode 100644 tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters_basic.json diff --git a/src/did/+did2/+convert/+migrators_j/private/jResponseRenameCollisions.m b/src/did/+did2/+convert/+migrators_j/private/jResponseRenameCollisions.m new file mode 100644 index 00000000..e5d51c50 --- /dev/null +++ b/src/did/+did2/+convert/+migrators_j/private/jResponseRenameCollisions.m @@ -0,0 +1,66 @@ +function collision = jResponseRenameCollisions(preBody, twins) +%JRESPONSERENAMECOLLISIONS What universalRenames would have DISCARDED from a raw +% v1 stimulus-response document (stimulus_response_scalar, +% stimulus_response_scalar_parameters_basic). +% +% COLLISION = jResponseRenameCollisions(PREBODY, TWINS). PREBODY is the RAW +% v1 document (did2.convert.rawV1Classes). On the renamed path, +% universalRenames' `dropped` output made v1_to_v2 carry such a document +% whole before any migrator ran (carry-049, [renames carry is temporary], +% Jess Haley, 2026-10-26). A switched migrator carries the same documents, so +% the switch changes no outcome. COLLISION lists, for the parts of the +% document these migrators read: +% - a depends_on entry's non-empty `version`, or a second id key (`value`, +% `id`, `document_id`) holding a different id +% (did2.convert.v1read.readDependsOn: `version`, and the losing key in +% `other`); +% - an `ndi_document` block beside `base` (the pass discarded it); +% - an `app` block stating both `name` and `app_name` (or `version` and +% `app_version`) with different values (did2.convert.v1read.readApp); +% - each row {BLOCK, CAMEL, SNAKE} of TWINS (an Nx3 cell) whose block holds +% both spellings with different values (the pass kept SNAKE). +% It does not repeat the pass's renames of a camelCase BLOCK name or class +% name: NDI never wrote these classes that way, and the migrators do not +% read such a block on either path. +% +% See also did2.convert.universalRenames, did2.convert.v1read.readDependsOn. + +collision = {}; +try + deps = did2.convert.v1read.readDependsOn(preBody); +catch + % a depends_on that is not a list of entries: the renamed pass left it + % alone, and so does this check + deps = struct('name', {}, 'version', {}, 'other', {}); +end +for k = 1:numel(deps) + if ~isempty(deps(k).version) + collision{end+1} = sprintf('depends_on(%s).version', deps(k).name); %#ok + end + others = fieldnames(deps(k).other); + for j = 1:numel(others) + if any(strcmp(others{j}, {'value', 'id', 'document_id'})) + collision{end+1} = sprintf('depends_on(%s).%s', deps(k).name, others{j}); %#ok + end + end +end +if isfield(preBody, 'ndi_document') && isfield(preBody, 'base') ... + && ~isempty(preBody.ndi_document) + collision{end+1} = 'ndi_document'; +end +a = did2.convert.v1read.readApp(preBody); +for k = 1:numel(a.conflicts) + collision{end+1} = ['app.' a.conflicts{k}]; %#ok +end +for k = 1:size(twins, 1) + blk = struct(); + if isfield(preBody, twins{k, 1}) && isstruct(preBody.(twins{k, 1})) ... + && isscalar(preBody.(twins{k, 1})) + blk = preBody.(twins{k, 1}); + end + if isfield(blk, twins{k, 2}) && isfield(blk, twins{k, 3}) ... + && ~isequaln(blk.(twins{k, 2}), blk.(twins{k, 3})) + collision{end+1} = [twins{k, 1} '.' twins{k, 2}]; %#ok + end +end +end diff --git a/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar.m b/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar.m index 05849c1a..9ccdfe0d 100644 --- a/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar.m +++ b/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar.m @@ -94,6 +94,25 @@ % With no epoch string at all, the fold runs on the 'during' session anchor. % % 1 -> 3 (calculation + anchor + software entity). +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI stimulus_response_scalar.json + stimulus_response.json +% + base.json at the locked NDI-matlab `main`, 3cb19a8, as +% ndi.app.stimulus.tuning_response/compute_stimulus_response_scalar writes +% it): no universalRenames, no superclass migrators (there are none for +% `stimulus_response` or `base`). Edges are read by name in either v1 key +% (`value`, the older `id`; jDependency); identity through jRawBody for a +% legacy-only `ndi_document`; a carry or a passthrough is the untouched v1 +% source. What universalRenames would have discarded (a depends_on +% `version` or a second, different id; an `ndi_document` beside `base`; an +% `app` name conflict; a camelCase twin of a field read here) is carried, +% carry-049, as the renamed path carried it. Every v1 field and where it +% goes is the MAPPING above; did2.convert.roundtrip.stimulus_response_scalar +% rebuilds the v1 document and testRawV1RoundTripStimulusResponse compares. +% The writer always sets `stimulator_epochid` and `stimulus_control_id`, so +% every writer-shaped response is carried (carry-050); the fold runs only on +% a response that states neither. arguments preBody (1,1) struct @@ -101,10 +120,29 @@ RESPONSE_METHOD = 'ndi.app.stimulus.tuning_response'; -blk = subBlock(preBody, 'stimulus_response_scalar'); +% READS RAW v1 (did2.convert.rawV1Classes). PREBODY is the document exactly as +% v1 wrote it; every read below is of BODY (PREBODY, with a legacy-only +% identity block read into `base` by jRawBody), and every carry or passthrough +% returns PREBODY untouched. First, what universalRenames would have discarded +% on the renamed path, which carried such a document before any migrator ran +% (carry-049, [renames carry is temporary]): carried the same way here. +collision = jResponseRenameCollisions(preBody, {'stimulus_response_scalar', 'responseType', 'response_type'; ... + 'stimulus_response', 'elementEpochid', 'element_epochid'; ... + 'stimulus_response', 'stimulatorEpochid', 'stimulator_epochid'}); +if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'stimulus_response_scalar', ... + sourceIdText(preBody), ['[carry-049] universalRenames would discard: ' ... + strjoin(collision, ', ')]); + bodies = {preBody}; + return; +end +body = identityBody(preBody); + +blk = subBlock(body, 'stimulus_response_scalar'); resp = subBlock(blk, 'responses'); -subjectId = jSubjectOf(preBody, {'element_id'}); +subjectId = jSubjectOf(body, {'element_id'}); harmonic = harmonicFromResponseType(charAny(blk, {'response_type', 'responseType'})); realPart = numAny(resp, {'response_real', 'responseReal'}); if isempty(subjectId) || isempty(harmonic) || isempty(realPart) @@ -119,24 +157,24 @@ % response that states either is carried WHOLE as v1 for the dataset's map, % instead of being folded with a `field_dropped` / `stimulus_control_id` note. unplaced = {}; -srBlock = subBlock(preBody, 'stimulus_response'); +srBlock = subBlock(body, 'stimulus_response'); if ~isempty(charAny(srBlock, {'stimulator_epochid', 'stimulatorEpochid'})) unplaced{end+1} = 'stimulus_response.stimulator_epochid'; end -if ~isempty(jDependency(preBody, 'stimulus_control_id')) +if ~isempty(jDependency(body, 'stimulus_control_id')) unplaced{end+1} = 'depends_on stimulus_control_id'; end if ~isempty(unplaced) % carry-register: carry-050 did2.convert.reportNote('carried_as_v1', 'stimulus_response_scalar', ... - char(preBody.base.id), ['[carry-050] unplaced: ' strjoin(unplaced, ', ')]); + char(body.base.id), ['[carry-050] unplaced: ' strjoin(unplaced, ', ')]); bodies = {preBody}; return; end % GUARD 4 -- the epoch gate, read through the same reader epochMint mints from. -epochString = epochStringOf(preBody, 'stimulus_response.element_epochid'); -epochDocId = jEpochDocId(preBody); +epochString = epochStringOf(body, 'stimulus_response.element_epochid'); +epochDocId = jEpochDocId(body); if ~isempty(epochString) && isempty(epochDocId) bodies = {preBody}; return; @@ -177,16 +215,16 @@ if ~isempty(epochDocId) anchor = did2.build.relativeTimeReference(epochDocId, ... 'Clock', 'dev_local_time', 'Relation', 'intervalDuring', ... - 'SessionId', jSid(preBody), 'CreationTimestamp', jStamp(preBody), ... + 'SessionId', jSid(body), 'CreationTimestamp', jStamp(body), ... 'Validate', false); else - anchor = jSessionAnchor(preBody, 'during'); + anchor = jSessionAnchor(body, 'during'); end -[software, swId, execEnv] = jSoftwareFromApp(preBody); -[runDocs, osId, interpreterId] = jRunEntities(preBody, execEnv); +[software, swId, execEnv] = jSoftwareFromApp(body); +[runDocs, osId, interpreterId] = jRunEntities(body, execEnv); if isempty(swId) - [software, swId] = jSoftware(RESPONSE_METHOD, '', '', jSid(preBody), jStamp(preBody)); + [software, swId] = jSoftware(RESPONSE_METHOD, '', '', jSid(body), jStamp(body)); end % The presentation ONLY. Decided by Jess Haley, 2026-10-22 [control as @@ -196,10 +234,10 @@ % "responses point at the presentation only". The v1 `stimulus_control_id` % edge is therefore not carried (it named the control record, which is gone). inputs = {}; -v = jDependency(preBody, 'stimulus_presentation_id'); +v = jDependency(body, 'stimulus_presentation_id'); if ~isempty(v); inputs{end+1} = v; end -methodId = jDependency(preBody, 'stimulus_response_scalar_parameters_id'); +methodId = jDependency(body, 'stimulus_response_scalar_parameters_id'); methodOpt = {}; if isempty(methodId) methodOpt = {'Method', jLabel(RESPONSE_METHOD)}; % method.term @@ -207,18 +245,18 @@ methodOpt = {'MethodId', methodId}; end -calc = jStatement(preBody, 'calculation', subjectId, ... +calc = jStatement(body, 'calculation', subjectId, ... jLabel('stimulus response'), value, ... 'ValueKind', 'harmonic_component', ... 'Dimensions', dims, 'Covariates', covs, ... 'TimeReferenceIds', {anchor.base.id}, ... - 'InstrumentId', jDependency(preBody, 'stimulator_id'), ... + 'InstrumentId', jDependency(body, 'stimulator_id'), ... 'InputIds', inputs, ... 'SoftwareId', swId, ... 'OperatingSystemId', osId, ... 'InterpreterId', interpreterId, ... methodOpt{:}, ... - 'Id', char(preBody.base.id)); % id preserved -> inbound references resolve + 'Id', char(body.base.id)); % id preserved -> inbound references resolve bodies = [{calc, anchor}, software, runDocs]; @@ -229,11 +267,32 @@ % document is carried as v1 above, so a converted one's DETAIL is always % 'none' (the edge was empty); 'dropped' is no longer written. did2.convert.reportNote('stimulus_control_id', 'stimulus_response_scalar', ... - char(preBody.base.id), 'none'); + char(body.base.id), 'none'); end % ===================== helpers ============================================= +function body = identityBody(preBody) +%IDENTITYBODY The raw v1 document with its identity where the builders read +% it. A document with a `base` block is returned as it is. A pre-2023 +% document whose only identity block is the legacy `ndi_document` (and which +% states an id) gets a `base` from it through jRawBody, as universalRenames' +% wholesale move gave the migrator before the switch. A document with no +% readable id is returned as it is, so it fails (or passes through) exactly +% where it did on the renamed path. +body = preBody; +b = did2.convert.v1read.readBase(preBody); +if strcmp(b.source, 'ndi_document') && any(strcmp(b.present, 'id')) + body = jRawBody(preBody, 'stimulus_response_scalar'); +end +end + +function id = sourceIdText(preBody) +b = did2.convert.v1read.readBase(preBody); +id = b.id; +if ~ischar(id); id = ''; end +end + function v = epochStringOf(preBody, wantedSource) %EPOCHSTRINGOF One NAMED source's epoch string, via the shared reader. v = ''; diff --git a/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar_parameters_basic.m b/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar_parameters_basic.m index 31fcf1a8..e197c7c8 100644 --- a/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar_parameters_basic.m +++ b/src/did/+did2/+convert/+migrators_j/stimulus_response_scalar_parameters_basic.m @@ -123,9 +123,45 @@ % Counted as `unconverted` by v1_to_v2, which is correct and intended: an % unconverted count on a class that is SUPPOSED to convert is the signal that % the resolver has not landed. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI stimulus_response_scalar_parameters_basic.json + +% stimulus_response_scalar_parameters.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as tuning_response.m writes it) and pass 1 +% still hands it back UNCHANGED: a passthrough, which v1_to_v2 pads and +% stamps as before (ensureClassBlocks reads a v1 superclass by its +% `definition`). did2.convert.resolveResponseParameters then reads the +% six knobs off it as before; it reads `base`, the block, and the session +% edge v1_to_v2 makes, none of which universalRenames changed for this +% class. What universalRenames would have discarded (a depends_on `version` +% or second id, an `ndi_document` beside `base`, an `app` name conflict, a +% camelCase twin of a knob) is carried, carry-049, as the renamed path +% carried it. did2.convert.roundtrip.stimulus_response_scalar_parameters_basic +% rebuilds the v1 document from the pass-1 passthrough or from the batch +% pass's `method`; testRawV1RoundTripStimulusResponse compares. arguments preBody (1,1) struct end +knobs = {'temporalfreqfunc', 'freq_response', 'prestimulus_time', ... + 'prestimulus_normalization', 'isspike', 'spiketrain_dt'}; +camel = {'temporalfreqfunc', 'freqResponse', 'prestimulusTime', ... + 'prestimulusNormalization', 'isspike', 'spiketrainDt'}; +twins = cell(0, 3); +for k = 1:numel(knobs) + if ~strcmp(knobs{k}, camel{k}) + twins(end+1, :) = {'stimulus_response_scalar_parameters_basic', camel{k}, knobs{k}}; %#ok + end +end +collision = jResponseRenameCollisions(preBody, twins); +if ~isempty(collision) + b = did2.convert.v1read.readBase(preBody); + id = b.id; + if ~ischar(id); id = ''; end + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'stimulus_response_scalar_parameters_basic', ... + id, ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); +end bodies = {preBody}; end diff --git a/src/did/+did2/+convert/+roundtrip/stimulus_response_scalar.m b/src/did/+did2/+convert/+roundtrip/stimulus_response_scalar.m new file mode 100644 index 00000000..c9698dd5 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/stimulus_response_scalar.m @@ -0,0 +1,223 @@ +function [v1, spec] = stimulus_response_scalar(bodies) +%STIMULUS_RESPONSE_SCALAR Rebuild a v1 `stimulus_response_scalar` from what +% did2.convert.migrators_j.stimulus_response_scalar emitted for it. +% +% [V1, SPEC] = did2.convert.roundtrip.stimulus_response_scalar(BODIES). V1 is +% the response in NDI's v1 shape (stimulus_response_scalar.json + +% stimulus_response.json + base.json at the locked NDI-matlab `main`, +% 3cb19a8, as ndi.app.stimulus.tuning_response/compute_stimulus_response_scalar +% writes it). BODIES is one of: +% +% CONVERTED: the `calculation` with the `harmonic_component` value kind, its +% time anchor, its software (and run) entities, and, when the caller passes +% it, the epoch entity the anchor names (epochMint mints it; it is not a +% pass-1 document): +% base.id, session_id, datestamp the calculation (rebuildBase) +% depends_on, in the order NDI's template merge gives it (names sorted): +% element_id entity_id +% stimulator_id instrument_id +% stimulus_control_id '' (a converted response has none: +% one that names a control is carried, +% carry-050) +% stimulus_presentation_id the first input_id +% stimulus_response_scalar_parameters_id method_id +% stimulus_response.element_epochid the epoch entity's local_identifier +% when the anchor names it; '' when the +% anchor is the session; NOT REBUILT +% when the anchor names an epoch that is +% not in BODIES (the round trip reports +% it lost) +% stimulus_response.stimulator_epochid '' (one that is set is carried, +% carry-050) +% stimulus_response_scalar.response_type 'mean' for harmonic 0, else +% 'F' (the writer's rule) +% stimulus_response_scalar.responses value.real / imaginary / +% control.real / control.imaginary, and +% stimid from the `stimulus` covariate +% along the reading dimension; each as a +% column, the shape jsondecode gives a +% JSON list +% +% PASSED THROUGH: one `stimulus_response_scalar` document (a guard of the +% migrator handed it back; v1_to_v2 padded and stamped it): the document +% itself, its session edge read back into base.session_id and its +% creation_timestamp into base.datestamp (v1_to_v2's outbound renames). +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.stimulus_response_scalar. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), 'stimulus_response_scalar') + v1 = passedThrough(bodies{1}); + return; +end + +used = false(1, numel(bodies)); +calc = []; +for k = 1:numel(bodies) + b = bodies{k}; + if strcmp(classNameOf(b), 'calculation') && isfield(b, 'harmonic_component') + calc = b; + used(k) = true; + break; + end +end +if isempty(calc) + spec.unplaced{end+1} = 'no harmonic_component calculation was emitted'; + return; +end +[base, ~] = rebuildBase(calc); + +anchorIds = edgeIds(calc, 'time_reference_id'); +roleIds = [edgeIds(calc, 'software_id'), edgeIds(calc, 'operating_system_id'), ... + edgeIds(calc, 'interpreter_id')]; +referent = ''; +for k = 1:numel(bodies) + if used(k); continue; end + id = idOf(bodies{k}); + if any(strcmp(id, anchorIds)) && strcmp(classNameOf(bodies{k}), 'relative_time_reference') + r = edgeIds(bodies{k}, 'referent_id'); + if ~isempty(r); referent = r{1}; end + used(k) = true; + elseif any(strcmp(id, roleIds)) && strcmp(classNameOf(bodies{k}), 'entity') + used(k) = true; + elseif strcmp(classNameOf(bodies{k}), 'assertion') ... + && any(strcmp(firstId(edgeIds(bodies{k}, 'entity_id')), roleIds)) + used(k) = true; % a software version (jSoftware), from an `app` block + end +end +epochString = []; +if isempty(referent) || strcmp(referent, base.session_id) + epochString = ''; +else + for k = 1:numel(bodies) + if used(k) || ~strcmp(idOf(bodies{k}), referent) + continue; + end + [lid, ok] = getIn(bodies{k}, 'entity', 'local_identifier'); + if strcmp(classNameOf(bodies{k}), 'entity') && ok + epochString = char(lid); + used(k) = true; + end + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in a stimulus response', ... + k, classNameOf(bodies{k})); +end + +inputs = edgeIds(calc, 'input_id'); +names = {'element_id', 'stimulator_id', 'stimulus_control_id', ... + 'stimulus_presentation_id', 'stimulus_response_scalar_parameters_id'}; +values = {firstId(edgeIds(calc, 'entity_id')), firstId(edgeIds(calc, 'instrument_id')), ... + '', firstId(inputs), firstId(edgeIds(calc, 'method_id'))}; +if numel(inputs) > 1 + spec.unplaced{end+1} = sprintf('%d inputs; a v1 response has one presentation', numel(inputs)); +end + +v1.document_class = struct('class_name', 'stimulus_response_scalar'); +v1.depends_on = struct('name', names, 'value', values); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +sr = struct('stimulator_epochid', ''); +if ischar(epochString) + sr.element_epochid = epochString; +end +v1.stimulus_response = sr; + +value = getIn(calc, 'harmonic_component', 'value'); +h = numberOf(getIn(value, 'harmonic')); +responseType = ''; +if isequal(h, 0) + responseType = 'mean'; +elseif ~isempty(h) + responseType = sprintf('F%d', h); +end +responses = struct(); +responses.stimid = column(stimidOf(calc)); +responses.response_real = column(getIn(value, 'real')); +responses.response_imaginary = column(getIn(value, 'imaginary')); +responses.control_response_real = column(getIn(value, 'control', 'real')); +responses.control_response_imaginary = column(getIn(value, 'control', 'imaginary')); +v1.stimulus_response_scalar = struct('response_type', responseType, ... + 'responses', responses); +end + +% ===================== helpers ========================================= + +function v = stimidOf(calc) +%STIMIDOF The `stimulus` covariate along the reading dimension (0). +v = []; +covs = asCell(getIn(calc, 'data', 'covariates')); +if isempty(covs) + covs = asCell(getIn(calc, 'statement', 'covariates')); +end +for k = 1:numel(covs) + c = covs{k}; + [~, name] = termParts(getIn(c, 'variable')); + along = getIn(c, 'along'); + if iscell(along); along = cell2mat(along); end + if strcmp(name, 'stimulus') && isnumeric(along) && isequal(double(along), 0) + v = getIn(c, 'quantity', 'value'); + return; + end +end +end + +function v = column(x) +%COLUMN A numeric list in the shape jsondecode gives it: N x 1 (a scalar +% stays a scalar, an empty stays empty). +v = x; +if iscell(v) && all(cellfun(@(e) isnumeric(e) && isscalar(e), v)) + v = cell2mat(v); +end +if isnumeric(v) || islogical(v) + v = double(v); + if numel(v) > 1 + v = v(:); + end +end +end + +function id = firstId(ids) +id = ''; +if ~isempty(ids) + id = ids{1}; +end +end + +function id = idOf(body) +id = ''; +[v, ok] = getIn(body, 'base', 'id'); +if ok + id = char(v); +end +end + +function v1 = passedThrough(body) +%PASSEDTHROUGH A passed-through v1 document as v1 stated it: v1_to_v2 moved +% base.session_id onto a `session_id` edge on the way out; read it back. +v1 = body; +sid = char(did2.schema.cache.sessionIdOf(body)); +if isfield(v1, 'depends_on') && isstruct(v1.depends_on) && ~isempty(v1.depends_on) + keep = true(1, numel(v1.depends_on)); + for k = 1:numel(v1.depends_on) + keep(k) = ~strcmp(char(v1.depends_on(k).name), 'session_id'); + end + v1.depends_on = v1.depends_on(keep); +end +if isfield(v1, 'base') && isstruct(v1.base) && ~isfield(v1.base, 'session_id') && ~isempty(sid) + v1.base.session_id = sid; +end +% and renamed base.datestamp to creation_timestamp +if isfield(v1, 'base') && isstruct(v1.base) && isfield(v1.base, 'creation_timestamp') ... + && ~isfield(v1.base, 'datestamp') + v1.base.datestamp = v1.base.creation_timestamp; + v1.base = rmfield(v1.base, 'creation_timestamp'); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/stimulus_response_scalar_parameters_basic.m b/src/did/+did2/+convert/+roundtrip/stimulus_response_scalar_parameters_basic.m new file mode 100644 index 00000000..a1023e8c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/stimulus_response_scalar_parameters_basic.m @@ -0,0 +1,150 @@ +function [v1, spec] = stimulus_response_scalar_parameters_basic(bodies) +%STIMULUS_RESPONSE_SCALAR_PARAMETERS_BASIC Rebuild a v1 +% `stimulus_response_scalar_parameters_basic` from what the migration made of +% it. +% +% [V1, SPEC] = did2.convert.roundtrip.stimulus_response_scalar_parameters_basic(BODIES). +% V1 is the parameters document in NDI's v1 shape +% (stimulus_response_scalar_parameters_basic.json + +% stimulus_response_scalar_parameters.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as ndi.app.stimulus.tuning_response writes it: +% the six knobs, by vlt.data.var2struct). BODIES is one of: +% +% PASSED THROUGH (pass 1): one `stimulus_response_scalar_parameters_basic` +% document, the migrator's passthrough as v1_to_v2 padded and stamped it: +% the document itself, its session edge read back into base.session_id and +% its creation_timestamp into base.datestamp. +% +% CONVERTED (did2.convert.resolveResponseParameters): the `method` document +% (id preserved), optionally with the harmonic_component calculations whose +% `method_id` names it (the responses that use it): +% base.id, session_id, datestamp the method (rebuildBase) +% the knobs each `method.parameters` entry whose +% variable is the knob's name with +% spaces ('spiketrain dt'): its quantity +% value, or its text +% prestimulus_time not written when v1 held [] (no +% baseline period): rebuilt absent +% prestimulus_normalization written 0 when v1 held [] +% ([empty response settings] "c"): +% rebuilt 0, so a v1 [] is reported +% lost (the method cannot tell [] from 0) +% freq_response NOT a parameter: the batch pass checks +% it against the harmonic of the +% responses that use the method. Rebuilt +% from those responses when BODIES holds +% them and they agree; otherwise not +% rebuilt (reported lost) +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.stimulus_response_scalar_parameters_basic, +% did2.convert.resolveResponseParameters. + +arguments + bodies cell +end + +CLASS = 'stimulus_response_scalar_parameters_basic'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = passedThrough(bodies{1}); + return; +end + +used = false(1, numel(bodies)); +m = []; +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'method') + m = bodies{k}; + used(k) = true; + break; + end +end +if isempty(m) + spec.unplaced{end+1} = 'no method document was emitted'; + return; +end +[base, ~] = rebuildBase(m); + +% the responses that use this method: their harmonic is the v1 freq_response +harmonics = []; +for k = 1:numel(bodies) + if used(k); continue; end + b = bodies{k}; + if strcmp(classNameOf(b), 'calculation') && isfield(b, 'harmonic_component') ... + && isequal(edgeIds(b, 'method_id'), {base.id}) + h = numberOf(getIn(b, 'harmonic_component', 'value', 'harmonic')); + if ~isempty(h) + harmonics(end+1) = h; %#ok + end + used(k) = true; + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in a parameters document', ... + k, classNameOf(bodies{k})); +end + +blk = struct(); +entries = asCell(getIn(m, 'method', 'parameters')); +for k = 1:numel(entries) + e = entries{k}; + [~, name] = termParts(getIn(e, 'variable')); + if isempty(name) + spec.unplaced{end+1} = sprintf('method parameter %d names no variable', k); + continue; + end + field = strrep(name, ' ', '_'); + [q, hasQ] = getIn(e, 'quantity', 'value'); + [t, hasT] = getIn(e, 'text'); + if hasT && ~isempty(t) + blk.(field) = char(t); + elseif hasQ && ~isempty(q) + blk.(field) = q; + else + spec.unplaced{end+1} = sprintf('method parameter "%s" has no quantity or text', name); + end +end +if ~isempty(harmonics) + if all(harmonics == harmonics(1)) + blk.freq_response = harmonics(1); + else + spec.unplaced{end+1} = 'the responses using this method state different harmonics'; + end +end + +v1.document_class = struct('class_name', CLASS); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +v1.(CLASS) = blk; +end + +% ===================== helpers ========================================= + +function v1 = passedThrough(body) +%PASSEDTHROUGH A passed-through v1 document as v1 stated it (v1_to_v2's +% outbound renames undone: the session edge, creation_timestamp). +v1 = body; +sid = char(did2.schema.cache.sessionIdOf(body)); +if isfield(v1, 'depends_on') && isstruct(v1.depends_on) + if ~isempty(v1.depends_on) + keep = true(1, numel(v1.depends_on)); + for k = 1:numel(v1.depends_on) + keep(k) = ~strcmp(char(v1.depends_on(k).name), 'session_id'); + end + v1.depends_on = v1.depends_on(keep); + end + if isempty(v1.depends_on) + v1 = rmfield(v1, 'depends_on'); % v1 writes no depends_on here + end +end +if isfield(v1, 'base') && isstruct(v1.base) && ~isfield(v1.base, 'session_id') && ~isempty(sid) + v1.base.session_id = sid; +end +if isfield(v1, 'base') && isstruct(v1.base) && isfield(v1.base, 'creation_timestamp') ... + && ~isfield(v1.base, 'datestamp') + v1.base.datestamp = v1.base.creation_timestamp; + v1.base = rmfield(v1.base, 'creation_timestamp'); +end +end diff --git a/src/did/+did2/+convert/ensureClassBlocks.m b/src/did/+did2/+convert/ensureClassBlocks.m index 388f41e5..e6421bee 100644 --- a/src/did/+did2/+convert/ensureClassBlocks.m +++ b/src/did/+did2/+convert/ensureClassBlocks.m @@ -59,6 +59,12 @@ for k = 1:numel(declared) if isstruct(declared{k}) && isfield(declared{k}, 'class_name') names{k} = char(declared{k}.class_name); + elseif isstruct(declared{k}) && isfield(declared{k}, 'definition') + % a RAW v1 superclass entry names its class by its definition + % path only (did2.convert.rawV1Classes: a switched class's + % passthrough is not renamed); its name is the path's basename, + % as universalRenames and did2.convert.v1read.readStamp read it + [~, names{k}] = fileparts(strrep(char(declared{k}.definition), '\/', '/')); else names{k} = char(declared{k}); end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index c13e6e54..5da01e50 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -49,9 +49,20 @@ % the batch passes dissolve. Written by % ndi.element/addepoch. Round trips: % testRawV1RoundTripElementEpoch (the pass-1 carrier). +% stimulus_response_scalar the stimulus-response family: superclasses +% stimulus_response_scalar_parameters_basic `base` + `stimulus_response` +% / `stimulus_response_scalar_parameters` (no migrator +% for any of them), no `app` block. Written by +% ndi.app.stimulus.tuning_response (the only writer at +% the locked main). The parameters document stays a +% pass-1 passthrough that resolveResponseParameters +% turns into a `method`. Round trips: +% testRawV1RoundTripStimulusResponse. % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. names = {'subject', 'subject_group', 'treatment', 'treatment_drug', ... 'treatment_transfer', 'virus_injection', 'element', 'element_epoch'}; +names{end+1} = 'stimulus_response_scalar'; +names{end+1} = 'stimulus_response_scalar_parameters_basic'; end diff --git a/tests/+did2/+unittest/testRawV1RoundTripStimulusResponse.m b/tests/+did2/+unittest/testRawV1RoundTripStimulusResponse.m new file mode 100644 index 00000000..65b8bf26 --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripStimulusResponse.m @@ -0,0 +1,529 @@ +function tests = testRawV1RoundTripStimulusResponse +%TESTRAWV1ROUNDTRIPSTIMULUSRESPONSE The stimulus-response family read as raw +% v1, and its round trip: stimulus_response_scalar and +% stimulus_response_scalar_parameters_basic. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes), [migration reliability +% practices] (a) (a round trip per class, did2.convert.roundtrip.check), and +% [renames carry is temporary] (what universalRenames would discard is still +% carried, carry-049). The test of the round trip is [lossless means round +% trip]. +% +% THE v1 DOCUMENTS are built from NDI's templates at the locked NDI-matlab +% `main` (3cb19a8; tests/+did2/fixtures/ndi_templates, copied verbatim: +% stimulus_response_scalar.json, stimulus_response.json, +% stimulus_response_scalar_parameters_basic.json, +% stimulus_response_scalar_parameters.json, base.json) in the shapes the ONE +% writer at that commit gives them, and pass through jsonencode/jsondecode as +% a corpus delivers them. The writer is +% +ndi/+app/+stimulus/tuning_response.m (compute_stimulus_response_scalar; +% +ndi/+mock/+fun/stimulus_response.m calls it): +% response ndi.document('stimulus_response_scalar', ...) + newdocument: +% the template merge (ndi.document.readblankdefinition) gives +% depends_on the five names SORTED (element_id, stimulator_id, +% stimulus_control_id, stimulus_presentation_id, +% stimulus_response_scalar_parameters_id), all five then set; +% base.name ''; stimulus_response.{stimulator_epochid, +% element_epochid} both set; response_type 'mean' | 'F'; +% responses five parallel lists (a scalar for one reading) +% parameters var2struct of the six knobs (temporalfreqfunc +% 'ndi.fun.stimulustemporalfrequency', freq_response 0/1/2, +% prestimulus_time [], prestimulus_normalization [], isspike +% 1 for a spike train, spiketrain_dt 0.001); no depends_on; the +% empty `stimulus_response_scalar_parameters` block +% These are the shapes of all 10,124 responses and 11,440 parameters +% documents of the corpora (20211116 and Soph; census of the corpus zips, +% 2026-10-27). +% +% Because the writer sets `stimulator_epochid` and `stimulus_control_id` +% on every response, every writer-shaped response is CARRIED (carry-050): +% its round trip is the carry. The fold is driven by the DID-side shape with +% both empty (testMigratorsJStimulusResponse's responseFixture). +% +% WHAT V2 DOES NOT KEEP is listed per fixture as KNOWN FINDINGS: open +% questions for the team, not rules made here. Each fixture's lost paths +% must be EXACTLY its listed findings. +tests = functiontests(localfunctions); +end + +function setupOnce(testCase) +prev = did2.schema.cache.strictMode('TermRegistry', false); +testCase.addTeardown(@() did2.schema.cache.strictMode('TermRegistry', prev)); +end + +% ===================== the known findings =============================== + +function f = knownFindings() +% {fixture, path, why}. Open questions, reported to the team; nothing here is +% decided. +P = 'stimulus_response_scalar_parameters_basic.'; +f = { ... + 'parameters as a method, no converted user', [P 'freq_response'], ... + ['freq_response is not a method parameter: the batch pass only checks ' ... + 'it against the harmonic of the converted responses using the method. ' ... + 'Every writer-shaped response is carried (carry-050), so on real data ' ... + 'no response is converted and the value is kept nowhere']; ... + 'parameters as a method, no converted user', [P 'prestimulus_normalization'], ... + ['[] is written as 0 ([empty response settings] "c"; NDI: "[] or 0) ' ... + 'No normalization"); the method cannot tell a v1 [] from a v1 0']; ... + 'parameters as a method, with its response', [P 'prestimulus_normalization'], ... + 'as above'; ... + 'converted response, its epoch not given', 'stimulus_response.element_epochid', ... + ['the anchor names the epoch entity epochMint mints; the string is ' ... + 'on that entity, not on the documents the migrator emits']}; +end + +function paths = findingsFor(fixture) +f = knownFindings(); +paths = reshape(sort(f(strcmp(f(:, 1), fixture), 2)), 1, []); +end + +function testEveryKnownFindingNamesAFixtureThatIsRun(testCase) +f = knownFindings(); +names = {'parameters as a method, no converted user', ... + 'parameters as a method, with its response', ... + 'converted response, its epoch not given'}; +for k = 1:size(f, 1) + verifyTrue(testCase, any(strcmp(f{k, 1}, names)), f{k, 1}); +end +end + +% ===================== the switch ====================================== + +function testBothClassesAreSwitched(testCase) +names = did2.convert.rawV1Classes(); +verifyTrue(testCase, any(strcmp(names, 'stimulus_response_scalar'))); +verifyTrue(testCase, any(strcmp(names, 'stimulus_response_scalar_parameters_basic'))); +r = runRaw({writerResponse('resp_1', 'mean', 3), writerParameters('par_0', 0)}); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_read_raw_v1, 2); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_reaching_universal_renames, 0); +end + +% ===================== writer-shaped responses: carried ================= + +function testWriterShapedResponsesAreCarriedAndRoundTrip(testCase) +cases = { ... + 'mean, six readings', writerResponse('resp_m', 'mean', 6); ... + 'F1, six readings', writerResponse('resp_f1', 'F1', 6); ... + 'F2, six readings', writerResponse('resp_f2', 'F2', 6); ... + 'mean, one reading (scalars)', writerResponse('resp_one', 'mean', 1)}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEqual(testCase, numel(out.passthrough), 1, [label ': carried']); + emitted = out.migrated{1}.toStruct(); + verifyEqual(testCase, emitted.document_class.schema_version, 'did_v1', label); + emitted.document_class = rmfield(emitted.document_class, 'schema_version'); + verifyTrue(testCase, isequaln(emitted, v1), [label ': the carry is not the v1 source']); + d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, startsWith(d, '[carry-050] '), d); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyGreaterThan(testCase, r.fields_inspected, 0, label); + verifyTrue(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, {}); +end +end + +% ===================== the fold: a response that states neither =========== + +function testAConvertedResponseRoundTrips(testCase) +% no epoch string: the fold runs on the session anchor +v1 = convertibleResponse('resp_c1', 'F1', ''); +out = runRaw(v1); +verifyEmpty(testCase, out.quarantine); +verifyEmpty(testCase, out.passthrough, 'converted, not carried'); +verifyEqual(testCase, numel(out.migrated), 3, 'calculation, anchor, software'); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyFalse(testCase, r.carried); +verifyRoundTrip(testCase, r, 'converted response, session anchor', {}); +accounted = [r.matched, r.not_set]; +for p = {'base.id', 'base.session_id', 'base.datestamp', 'document_class.class_name', ... + 'depends_on(1).value', 'depends_on(2).value', 'depends_on(4).value', ... + 'depends_on(5).value', 'stimulus_response_scalar.response_type', ... + 'stimulus_response_scalar.responses.stimid', ... + 'stimulus_response_scalar.responses.response_real', ... + 'stimulus_response_scalar.responses.response_imaginary', ... + 'stimulus_response_scalar.responses.control_response_real', ... + 'stimulus_response_scalar.responses.control_response_imaginary'} + verifyTrue(testCase, any(strcmp(p{1}, accounted)), sprintf('%s is not accounted for', p{1})); +end +end + +function testAConvertedResponseOnItsEpochRoundTripsWithTheEpoch(testCase) +% the epoch gate opened as epochMint opens it (the `epoch_id` edge it stamps); +% the epoch entity is the one epochMint mints (an entity of type epoch whose +% local_identifier is the string). The v1 document compared is the source +% WITHOUT the stamped edge. +v1 = convertibleResponse('resp_c2', 'mean', 't00003'); +stamped = v1; +stamped.depends_on(end+1) = struct('name', 'epoch_id', 'value', 'epochdoc_5f21b0'); +out = runRaw(stamped); +verifyEmpty(testCase, out.quarantine); +verifyEmpty(testCase, out.passthrough); +epoch = did2.build.document('entity', ... + struct('type', did2.convert.registeredTerm( ... + did2.build.vocabulary('entity_type', 'epoch'), 'recording epoch'), ... + 'local_identifier', 't00003'), ... + 'Id', 'epochdoc_5f21b0', 'SessionId', v1.base.session_id, ... + 'CreationTimestamp', v1.base.datestamp, 'Validate', false); +r = did2.convert.roundtrip.check(v1, [out.migrated, {epoch}]); +verifyRoundTrip(testCase, r, 'converted response, with its epoch', {}); +verifyTrue(testCase, any(strcmp('stimulus_response.element_epochid', r.matched))); +% without the epoch entity the string is not on the emitted documents +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyRoundTrip(testCase, r, 'converted response, its epoch not given', ... + findingsFor('converted response, its epoch not given')); +end + +% ===================== the parameters document =========================== + +function testWriterShapedParametersPassThroughAndRoundTrip(testCase) +for h = 0:2 + v1 = writerParameters(sprintf('par_%d', h), h); + out = runRaw(v1); + label = sprintf('parameters, freq_response %d', h); + verifyEmpty(testCase, out.quarantine, label); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEqual(testCase, numel(out.passthrough), 1, [label ': a pass-1 passthrough']); + verifyEqual(testCase, out.migrated{1}.get('document_class.schema_version'), 'did_v2', label); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyFalse(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, {}); +end +end + +function testParametersBecomeAMethodAndRoundTrip(testCase) +% the batch pass turns each parameters document into a `method` (id kept) +v1 = writerParameters('par_1', 1); +out = runFold(testCase, {writerResponse('resp_w', 'F1', 6, 'par_1'), v1}); +m = bodyWithId(out, 'par_1'); +verifyEqual(testCase, classNameOfBody(m), 'method'); +r = did2.convert.roundtrip.check(v1, {m}); +verifyRoundTrip(testCase, r, 'parameters as a method, no converted user', ... + findingsFor('parameters as a method, no converted user')); + +% with a converted response using it, freq_response is its harmonic +out = runFold(testCase, {convertibleResponse('resp_c3', 'F1', '', 'par_1'), v1}); +m = bodyWithId(out, 'par_1'); +calc = bodyWithId(out, 'resp_c3'); +r = did2.convert.roundtrip.check(v1, {m, calc}); +verifyRoundTrip(testCase, r, 'parameters as a method, with its response', ... + findingsFor('parameters as a method, with its response')); +verifyTrue(testCase, any(strcmp([ ... + 'stimulus_response_scalar_parameters_basic.freq_response'], r.matched))); +end + +% ===================== the round trip can fail =========================== + +function testAChangedResponseValueIsReportedLost(testCase) +v1 = convertibleResponse('resp_c4', 'F2', ''); +out = runRaw(v1); +v1b = v1; +v1b.stimulus_response_scalar.responses.response_real(2) = 99; +r = did2.convert.roundtrip.check(v1b, out.migrated); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, {r.lost.path}, {'stimulus_response_scalar.responses.response_real'}); +end + +function testAFieldOutsideTheTemplateIsReportedLost(testCase) +% the fold reads the template's fields only; one more is dropped, and the +% round trip names it (behaviour unchanged: the renamed path dropped it too) +v1 = convertibleResponse('resp_c5', 'mean', ''); +v1.stimulus_response_scalar.peak_latency = 0.12; +out = runRaw(v1); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(strcmp('stimulus_response_scalar.peak_latency', {r.lost.path}))); +end + +function testADroppedCalculationIsUnplaced(testCase) +v1 = convertibleResponse('resp_c6', 'mean', ''); +out = runRaw(v1); +kept = {}; +for k = 1:numel(out.migrated) + if ~strcmp(out.migrated{k}.className(), 'calculation') + kept{end+1} = out.migrated{k}; %#ok + end +end +r = did2.convert.roundtrip.check(v1, kept); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +function testAnExtraDocumentIsUnplaced(testCase) +v1 = convertibleResponse('resp_c7', 'mean', ''); +out = runRaw(v1); +other = runRaw(convertibleResponse('resp_c8', 'F1', '')).migrated; +r = did2.convert.roundtrip.check(v1, [out.migrated, other(1)]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +function testAChangedKnobIsReportedLost(testCase) +v1 = writerParameters('par_2', 2); +out = runFold(testCase, {v1}); +m = bodyWithId(out, 'par_2'); +v1b = v1; +v1b.stimulus_response_scalar_parameters_basic.spiketrain_dt = 0.002; +r = did2.convert.roundtrip.check(v1b, {m}); +verifyTrue(testCase, any(strcmp( ... + 'stimulus_response_scalar_parameters_basic.spiketrain_dt', {r.lost.path}))); +end + +% ===================== what universalRenames would discard =============== + +function testADependencyVersionIsCarriedOnBothPaths(testCase) +% the older {name, value, version} entry: the renamed path discarded +% `version` and carried the document (carry-049); the raw path carries it too +v1 = convertibleResponse('resp_v', 'F1', ''); +deps = num2cell(v1.depends_on); +for k = 1:numel(deps) + deps{k}.version = ''; +end +deps{1}.version = 2; +v1.depends_on = [deps{:}]; +v1 = jsondecode(jsonencode(v1)); +raw = runRaw(v1); +old = runRenamed(v1); +verifyEqual(testCase, numel(raw.passthrough), 1, 'raw: carried'); +verifyEqual(testCase, numel(old.passthrough), 1, 'renamed: carried'); +d = raw.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, startsWith(d, '[carry-049] '), d); +emitted = raw.migrated{1}.toStruct(); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carry is not the v1 source'); +end + +function testAConflictingKnobSpellingIsCarriedOnBothPaths(testCase) +v1 = writerParameters('par_c', 1); +v1.stimulus_response_scalar_parameters_basic.freqResponse = 2; +raw = runRaw(v1); +old = runRenamed(v1); +verifyEqual(testCase, numel(raw.passthrough), 1); +verifyEqual(testCase, numel(old.passthrough), 1); +verifyEqual(testCase, raw.migrated{1}.get('document_class.schema_version'), 'did_v1'); +verifyEqual(testCase, old.migrated{1}.get('document_class.schema_version'), 'did_v1'); +end + +% ===================== the switch changes no outcome ====================== + +function testTheSwitchChangesNoOutcome(testCase) +% "keep behaviour identical": a converted document is the one the renamed +% path converted (ids are deterministic, practice (b)); a carry is carried on +% both paths, the raw one the untouched v1 source; the parameters passthrough +% is the same document on both paths, before and after the batch pass +fixtures = {writerResponse('resp_m', 'mean', 6), writerResponse('resp_one', 'F1', 1), ... + convertibleResponse('resp_c1', 'F1', ''), convertibleResponse('resp_c9', 'mean', '', ''), ... + writerParameters('par_0', 0), writerParameters('par_2', 2)}; +for k = 1:numel(fixtures) + v1 = fixtures{k}; + raw = runRaw(v1); + old = runRenamed(v1); + label = sprintf('fixture %d (%s %s)', k, v1.document_class.class_name, v1.base.id); + verifyEmpty(testCase, raw.quarantine, label); + verifyEqual(testCase, numel(raw.quarantine), numel(old.quarantine), label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), [label ': passed through on one path only']); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + if ~isempty(raw.passthrough) && strcmp(raw.migrated{1}.get('document_class.schema_version'), 'did_v1') + verifyEqual(testCase, old.migrated{1}.get('document_class.schema_version'), 'did_v1', label); + continue; % both carry; the raw carry is the v1 source (tested above) + end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + verifyTrue(testCase, isequaln(a, b), sprintf('%s, document %d: raw %s; renamed %s', ... + label, j, jsonencode(a), jsonencode(b))); + end +end +% after the batch pass: the same method from either path +p = writerParameters('par_1', 1); +r = convertibleResponse('resp_c3', 'F1', '', 'par_1'); +a = did2.convert.resolveResponseParameters(runRaw({r, p}), 'Validate', false, 'TargetVersion', 'V_eta'); +b = did2.convert.resolveResponseParameters(runRenamed({r, p}), 'Validate', false, 'TargetVersion', 'V_eta'); +verifyEqual(testCase, numel(a.migrated), numel(b.migrated)); +for j = 1:min(numel(a.migrated), numel(b.migrated)) + verifyTrue(testCase, isequaln(a.migrated{j}.toStruct(), b.migrated{j}.toStruct()), ... + sprintf('after the batch pass, document %d differs', j)); +end +verifyEqual(testCase, a.response_parameters_fold, b.response_parameters_fold); +end + +function testAGuardedResponsePassesThroughOnBothPaths(testCase) +% a response the fold cannot place (an unknown response_type) is handed back +% unchanged on both paths; the raw one keeps v1's `value` edge key where the +% renamed one had `document_id`, and states the same edges +v1 = convertibleResponse('resp_p', 'peak', ''); +raw = runRaw(v1); +old = runRenamed(v1); +verifyEqual(testCase, numel(raw.passthrough), 1); +verifyEqual(testCase, numel(old.passthrough), 1); +a = raw.migrated{1}.toStruct(); +b = old.migrated{1}.toStruct(); +verifyEqual(testCase, edgeMap(a), edgeMap(b)); +verifyTrue(testCase, isequaln(rmfield(a, 'depends_on'), rmfield(b, 'depends_on'))); +r = did2.convert.roundtrip.check(v1, raw.migrated); +verifyRoundTrip(testCase, r, 'guarded response', {}); +end + +% ===================== helpers ========================================= + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function out = runRenamed(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); +end + +function out = runFold(testCase, bodies) +out = runRaw(bodies); +verifyEmpty(testCase, out.quarantine, 'pass 1 quarantined a fixture'); +out = did2.convert.resolveResponseParameters(out, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function b = bodyWithId(out, id) +b = struct(); +for k = 1:numel(out.migrated) + if strcmp(char(out.migrated{k}.get('base.id')), id) + b = out.migrated{k}.toStruct(); + return; + end +end +end + +function name = classNameOfBody(b) +name = ''; +if isfield(b, 'document_class') && isfield(b.document_class, 'class_name') + name = char(b.document_class.class_name); +end +end + +function m = edgeMap(b) +% name -> id, whichever key holds it +m = struct(); +if ~isfield(b, 'depends_on'); return; end +d = b.depends_on; +if isstruct(d); d = num2cell(d); end +for k = 1:numel(d) + e = d{k}; + v = ''; + for key = {'document_id', 'value', 'id'} + if isfield(e, key{1}) && ~isempty(e.(key{1})) + v = char(e.(key{1})); + break; + end + end + m.(matlab.lang.makeValidName(char(e.name))) = v; +end +end + +function verifyRoundTrip(testCase, r, label, expectedLost) +verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); +lost = reshape(sort({r.lost.path}), 1, []); +verifyEqual(testCase, lost, reshape(sort(expectedLost), 1, []), ... + sprintf('%s: lost paths are not the listed findings; lost: %s', label, describeLost(r))); +verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); +verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + show(r.lost(k).v1), show(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function s = show(v) +try + s = jsonencode(v); +catch + s = class(v); +end +end + +function v1 = writerResponse(id, responseType, nReadings, paramId) +% tuning_response.m compute_stimulus_response_scalar: the template merge, +% then set_dependency_value for all five edges, both epoch strings +if nargin < 4; paramId = 'par_x'; end +tpl = loadTemplate('stimulus_response_scalar'); +srTpl = loadTemplate('stimulus_response'); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +deps = [reshape(tpl.depends_on, [], 1); reshape(srTpl.depends_on, [], 1)]; +[~, ix] = unique({deps.name}); % ndi.document.readblankdefinition +deps = reshape(deps(ix), 1, []); +values = struct('element_id', 'el_unit_1', 'stimulator_id', 'el_stim_1', ... + 'stimulus_control_id', 'ctl_1', 'stimulus_presentation_id', 'pres_1', ... + 'stimulus_response_scalar_parameters_id', paramId); +for k = 1:numel(deps) + deps(k).value = values.(deps(k).name); +end +v1.depends_on = deps; +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.stimulus_response = srTpl.stimulus_response; +v1.stimulus_response.stimulator_epochid = 't00003'; +v1.stimulus_response.element_epochid = 't00003'; +v1.stimulus_response_scalar = tpl.stimulus_response_scalar; +v1.stimulus_response_scalar.response_type = responseType; +stimid = repmat(1:3, 1, ceil(nReadings / 3)); +stimid = stimid(1:nReadings); +r = struct(); +r.stimid = stimid; +r.response_real = 2.5 + (1:nReadings) * 1.25; +r.response_imaginary = zeros(1, nReadings); +if ~strcmp(responseType, 'mean') + r.response_imaginary = -0.5 + (1:nReadings) * 0.25; +end +r.control_response_real = repmat(0.75, 1, nReadings); +r.control_response_imaginary = zeros(1, nReadings); +v1.stimulus_response_scalar.responses = r; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = convertibleResponse(id, responseType, elementEpoch, paramId) +% the DID-side shape the fold places whole: the writer shape with no +% stimulator epoch and no control (both left at the template blank) +if nargin < 4; paramId = 'par_x'; end +v1 = writerResponse(id, responseType, 6, paramId); +v1.stimulus_response.stimulator_epochid = ''; +v1.stimulus_response.element_epochid = elementEpoch; +v1.depends_on(strcmp({v1.depends_on.name}, 'stimulus_control_id')).value = ''; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerParameters(id, freqResponse) +% tuning_response.m: var2struct of the six knobs, a spike train's isspike 1 +tpl = loadTemplate('stimulus_response_scalar_parameters_basic'); +parentTpl = loadTemplate('stimulus_response_scalar_parameters'); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = '41268b6f5c6a3d4e_00000000000000a1'; +v1.base.datestamp = '2024-06-01T12:00:00.000Z'; +v1.stimulus_response_scalar_parameters = parentTpl.stimulus_response_scalar_parameters; +v1.stimulus_response_scalar_parameters_basic = struct( ... + 'temporalfreqfunc', 'ndi.fun.stimulustemporalfrequency', ... + 'freq_response', freqResponse, 'prestimulus_time', [], ... + 'prestimulus_normalization', [], 'isspike', 1, 'spiketrain_dt', 0.001); +v1 = jsondecode(jsonencode(v1)); +end + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/fixtures/ndi_templates/stimulus_response.json b/tests/+did2/fixtures/ndi_templates/stimulus_response.json new file mode 100644 index 00000000..796db361 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/stimulus_response.json @@ -0,0 +1,31 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_response.json", + "validation": "$NDISCHEMAPATH\/stimulus\/stimulus_response_schema.json", + "class_name": "stimulus_response", + "property_list_name": "stimulus_response", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "element_id", + "value": [] + }, + { "name": "stimulator_id", + "value": [] + }, + { "name": "stimulus_presentation_id", + "value": [] + }, + { "name": "stimulus_control_id", + "value": [] + } + ], + "stimulus_response": { + "stimulator_epochid": [], + "element_epochid": [] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar.json b/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar.json new file mode 100644 index 00000000..e0d116e8 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar.json @@ -0,0 +1,29 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_response_scalar.json", + "validation": "$NDISCHEMAPATH\/stimulus\/stimulus_response_scalar_schema.json", + "class_name": "stimulus_response_scalar", + "property_list_name": "stimulus_response_scalar", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_response.json"} + ] + }, + "depends_on": [ + { "name": "stimulus_response_scalar_parameters_id", + "value": "" + } + ], + "stimulus_response_scalar": { + "response_type": [], + "responses": { + "stimid": [], + "response_real": [], + "response_imaginary": [], + "control_response_real": [], + "control_response_imaginary": [] + } + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters.json b/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters.json new file mode 100644 index 00000000..85600302 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters.json @@ -0,0 +1,15 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_response_scalar_parameters.json", + "validation": "$NDISCHEMAPATH\/stimulus\/stimulus_response_scalar_parameters_schema.json", + "class_name": "stimulus_response_scalar_parameters", + "property_list_name": "stimulus_response_scalar_parameters", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "stimulus_response_scalar_parameters": { + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters_basic.json b/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters_basic.json new file mode 100644 index 00000000..f04cbc18 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/stimulus_response_scalar_parameters_basic.json @@ -0,0 +1,22 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_response_scalar_parameters_basic.json", + "validation": "$NDISCHEMAPATH\/stimulus\/stimulus_response_scalar_parameters_basic_schema.json", + "class_name": "stimulus_response_scalar_parameters_basic", + "property_list_name": "stimulus_response_scalar_parameters_basic", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"}, + { "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_response_scalar_parameters.json"} + ] + }, + "stimulus_response_scalar_parameters_basic": { + "temporalfreqfunc": "ndi_stimulustemporalfrequency", + "freq_response": 0, + "prestimulus_time": "", + "prestimulus_normalization": "", + "isspike": 0, + "spiketrain_dt": 0.001 + } +} + From 182b66ca6d1f278ee124dbe077b1cd530f0e92de Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 03:31:37 +0000 Subject: [PATCH 12/45] Tuning family reads raw v1; per-class round trips on the writers' own output Phase 2 of the generic migration, the tuning family (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [early migration pieces fixed] (1), [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - did2.convert.rawV1Classes: + tuningcurve_calc, contrasttuning_calc, oridirtuning_calc, spatial_frequency_tuning_calc, temporal_frequency_tuning_calc, contrastsensitivity_calc (the v1 spellings). ONE table maps contrasttuning_calc -> contrast_tuning_calc and contrastsensitivity_calc -> contrast_sensitivity_calc, to go when universalRenames is deleted and the migrators are renamed; v1_to_v2 dispatches through it. - The six migrators read the raw document (jRawBody; a carry is the untouched v1 source). contrast_sensitivity_calc reads its result block by the document's own class name. jCalculation 'AccountForEveryField' (these six only): a field the fold reads nowhere (tuningcurve_calc.log and stim_property_list, a calculator-block field, an app field outside app.json or two differing spellings via v1read.readApp, an edge the calculation does not write, another top-level block, an unread contrastsensitivity field) carries the document (carry-056) instead of being dropped. jTuningCurve: an unread `significance` field is unplaced too. - The old +migrators wrappers for the six classes are deleted: never reached (each class has a +migrators_j migrator; no v1 class names them as a superclass). testMigrators: testTheOldTuningWrappersAreGone. - +roundtrip: inverses for the six classes (calcParts, tuningInverse, tuningBlock, fitBlocks, rawCurveBlock, csfBlock, methodParameters). - Fixtures: the NDI and NDIcalc-vis templates verbatim (NDI-matlab 3cb19a8, NDIcalc-vis-matlab 00e3e0f), and each calculator's stored self-test output (mock.N.json) verbatim as the writer shape. - testRawV1RoundTripTuning: writer outputs and corpus-vintage variants round trip with nothing lost (oridir and contrast sensitivity convert; the other four carry); the converted shapes of the other four round trip; both spellings dispatch to the same documents; raw and renamed paths agree; unread fields carry; broken inputs fail. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/+migrators/Contents.m | 12 +- .../+migrators/contrast_sensitivity_calc.m | 16 - .../+migrators/contrast_tuning_calc.m | 16 - .../+convert/+migrators/oridirtuning_calc.m | 16 - .../spatial_frequency_tuning_calc.m | 16 - .../temporal_frequency_tuning_calc.m | 16 - .../+convert/+migrators/tuningcurve_calc.m | 16 - .../+migrators_j/contrast_sensitivity_calc.m | 27 +- .../+migrators_j/contrast_tuning_calc.m | 27 +- .../+convert/+migrators_j/oridirtuning_calc.m | 27 +- .../+migrators_j/private/jCalculation.m | 130 + .../+migrators_j/private/jTuningCurve.m | 13 +- .../spatial_frequency_tuning_calc.m | 27 +- .../temporal_frequency_tuning_calc.m | 27 +- .../+convert/+migrators_j/tuningcurve_calc.m | 27 +- .../+roundtrip/contrastsensitivity_calc.m | 25 + .../+convert/+roundtrip/contrasttuning_calc.m | 25 + .../+convert/+roundtrip/oridirtuning_calc.m | 25 + .../+convert/+roundtrip/private/calcParts.m | 133 + .../+convert/+roundtrip/private/column.m | 7 + .../+convert/+roundtrip/private/csfBlock.m | 98 + .../+convert/+roundtrip/private/fitBlocks.m | 104 + .../+roundtrip/private/methodParameters.m | 65 + .../+convert/+roundtrip/private/others.m | 14 + .../+roundtrip/private/rawCurveBlock.m | 77 + .../+roundtrip/private/trialsFirstOrient.m | 8 + .../+convert/+roundtrip/private/tuningBlock.m | 197 + .../+roundtrip/private/tuningInverse.m | 88 + .../spatial_frequency_tuning_calc.m | 25 + .../temporal_frequency_tuning_calc.m | 25 + .../+convert/+roundtrip/tuningcurve_calc.m | 28 + src/did/+did2/+convert/rawV1Classes.m | 58 +- src/did/+did2/+convert/v1_to_v2.m | 4 +- tests/+did2/+unittest/testMigrators.m | 30 +- tests/+did2/+unittest/testRawV1RoundTrip.m | 8 +- .../+unittest/testRawV1RoundTripTuning.m | 370 ++ .../fixtures/ndi_templates/calculator.json | 15 + .../ndi_templates/contrast_tuning.json | 73 + .../contrastsensitivity_calc.json | 57 + .../ndi_templates/contrasttuning_calc.json | 24 + .../ndi_templates/oridirtuning_calc.json | 24 + .../orientation_direction_tuning.json | 66 + .../spatial_frequency_tuning.json | 240 ++ .../spatial_frequency_tuning_calc.json | 24 + .../ndi_templates/stimulus_tuningcurve.json | 39 + .../temporal_frequency_tuning.json | 242 ++ .../temporal_frequency_tuning_calc.json | 24 + .../ndi_templates/tuningcurve_calc.json | 35 + .../contrastsensitivity_calc.mock.1.json | 1 + .../contrasttuning_calc.mock.1.json | 875 +++++ .../oridirtuning_calc.mock.1.json | 1096 ++++++ .../spatial_frequency_tuning_calc.mock.6.json | 3480 ++++++++++++++++ ...temporal_frequency_tuning_calc.mock.4.json | 3482 +++++++++++++++++ .../tuningcurve_calc.mock.1.json | 360 ++ 54 files changed, 11856 insertions(+), 128 deletions(-) delete mode 100644 src/did/+did2/+convert/+migrators/contrast_sensitivity_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/contrast_tuning_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/oridirtuning_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/spatial_frequency_tuning_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/temporal_frequency_tuning_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/tuningcurve_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/contrastsensitivity_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/contrasttuning_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/oridirtuning_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/calcParts.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/column.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/csfBlock.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/fitBlocks.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/methodParameters.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/others.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/rawCurveBlock.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/trialsFirstOrient.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/tuningBlock.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/tuningInverse.m create mode 100644 src/did/+did2/+convert/+roundtrip/spatial_frequency_tuning_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/temporal_frequency_tuning_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/tuningcurve_calc.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripTuning.m create mode 100644 tests/+did2/fixtures/ndi_templates/calculator.json create mode 100644 tests/+did2/fixtures/ndi_templates/contrast_tuning.json create mode 100644 tests/+did2/fixtures/ndi_templates/contrastsensitivity_calc.json create mode 100644 tests/+did2/fixtures/ndi_templates/contrasttuning_calc.json create mode 100644 tests/+did2/fixtures/ndi_templates/oridirtuning_calc.json create mode 100644 tests/+did2/fixtures/ndi_templates/orientation_direction_tuning.json create mode 100644 tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning.json create mode 100644 tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning_calc.json create mode 100644 tests/+did2/fixtures/ndi_templates/stimulus_tuningcurve.json create mode 100644 tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning.json create mode 100644 tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning_calc.json create mode 100644 tests/+did2/fixtures/ndi_templates/tuningcurve_calc.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/contrastsensitivity_calc.mock.1.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/contrasttuning_calc.mock.1.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/oridirtuning_calc.mock.1.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/spatial_frequency_tuning_calc.mock.6.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/temporal_frequency_tuning_calc.mock.4.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/tuningcurve_calc.mock.1.json diff --git a/src/did/+did2/+convert/+migrators/Contents.m b/src/did/+did2/+convert/+migrators/Contents.m index 5d70fd76..a5ca42c3 100644 --- a/src/did/+did2/+convert/+migrators/Contents.m +++ b/src/did/+did2/+convert/+migrators/Contents.m @@ -71,10 +71,14 @@ % rename in did2.convert.universalRenames; the per-class wrapper does % not have to know its own calculator-name string. % -% tuningcurve_calc, oridirtuning_calc, hartley_calc, -% contrast_sensitivity_calc, contrast_tuning_calc, -% spatial_frequency_tuning_calc, speed_tuning_calc, -% temporal_frequency_tuning_calc, simple_calc +% hartley_calc, speed_tuning_calc, simple_calc +% +% The tuning family's wrappers (tuningcurve_calc, oridirtuning_calc, +% contrast_sensitivity_calc, contrast_tuning_calc, +% spatial_frequency_tuning_calc, temporal_frequency_tuning_calc) are +% deleted: each class has a +migrators_j migrator, so the wrapper was never +% reached, and the class now reads raw v1 (did2.convert.rawV1Classes; +% [early migration pieces fixed] (1), Jess Haley, 2026-10-26). % % See did-schema's % did-schema's per-class conversion notes (deleted with did-schema #88) for the diff --git a/src/did/+did2/+convert/+migrators/contrast_sensitivity_calc.m b/src/did/+did2/+convert/+migrators/contrast_sensitivity_calc.m deleted file mode 100644 index c064097c..00000000 --- a/src/did/+did2/+convert/+migrators/contrast_sensitivity_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = contrast_sensitivity_calc(preBody) -%CONTRAST_SENSITIVITY_CALC Base migrator: did_v1 contrast_sensitivity_calc body -> the class-preserving V2 shape. -% -% a contrast-sensitivity analysis. The v1 form -% carries `input_parameters` directly on the contrast_sensitivity_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'contrast_sensitivity_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/contrast_tuning_calc.m b/src/did/+did2/+convert/+migrators/contrast_tuning_calc.m deleted file mode 100644 index cc21a3b2..00000000 --- a/src/did/+did2/+convert/+migrators/contrast_tuning_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = contrast_tuning_calc(preBody) -%CONTRAST_TUNING_CALC Base migrator: did_v1 contrast_tuning_calc body -> the class-preserving V2 shape. -% -% a contrast tuning fit. The v1 form -% carries `input_parameters` directly on the contrast_tuning_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'contrast_tuning_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/oridirtuning_calc.m b/src/did/+did2/+convert/+migrators/oridirtuning_calc.m deleted file mode 100644 index 63a0dae7..00000000 --- a/src/did/+did2/+convert/+migrators/oridirtuning_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = oridirtuning_calc(preBody) -%ORIDIRTUNING_CALC Base migrator: did_v1 oridirtuning_calc body -> the class-preserving V2 shape. -% -% an orientation/direction tuning fit. The v1 form -% carries `input_parameters` directly on the oridirtuning_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'oridirtuning_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/spatial_frequency_tuning_calc.m b/src/did/+did2/+convert/+migrators/spatial_frequency_tuning_calc.m deleted file mode 100644 index 2a3fd969..00000000 --- a/src/did/+did2/+convert/+migrators/spatial_frequency_tuning_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = spatial_frequency_tuning_calc(preBody) -%SPATIAL_FREQUENCY_TUNING_CALC Base migrator: did_v1 spatial_frequency_tuning_calc body -> the class-preserving V2 shape. -% -% a spatial-frequency tuning fit. The v1 form -% carries `input_parameters` directly on the spatial_frequency_tuning_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'spatial_frequency_tuning_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/temporal_frequency_tuning_calc.m b/src/did/+did2/+convert/+migrators/temporal_frequency_tuning_calc.m deleted file mode 100644 index 866d0c3a..00000000 --- a/src/did/+did2/+convert/+migrators/temporal_frequency_tuning_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = temporal_frequency_tuning_calc(preBody) -%TEMPORAL_FREQUENCY_TUNING_CALC Base migrator: did_v1 temporal_frequency_tuning_calc body -> the class-preserving V2 shape. -% -% a temporal-frequency tuning fit. The v1 form -% carries `input_parameters` directly on the temporal_frequency_tuning_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'temporal_frequency_tuning_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/tuningcurve_calc.m b/src/did/+did2/+convert/+migrators/tuningcurve_calc.m deleted file mode 100644 index 90aa3cb9..00000000 --- a/src/did/+did2/+convert/+migrators/tuningcurve_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = tuningcurve_calc(preBody) -%TUNINGCURVE_CALC Base migrator: did_v1 tuningcurve_calc body -> the class-preserving V2 shape. -% -% a generic tuning-curve calculation. The v1 form -% carries `input_parameters` directly on the tuningcurve_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'tuningcurve_calc'); -end diff --git a/src/did/+did2/+convert/+migrators_j/contrast_sensitivity_calc.m b/src/did/+did2/+convert/+migrators_j/contrast_sensitivity_calc.m index 6ab65dae..e4286cde 100644 --- a/src/did/+did2/+convert/+migrators_j/contrast_sensitivity_calc.m +++ b/src/did/+did2/+convert/+migrators_j/contrast_sensitivity_calc.m @@ -14,9 +14,32 @@ % stimulus_presentation_id; v1 is_modulated_response (0/1) -> % value.significance.modulated_response (boolean), written only when present. % See did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (class `contrastsensitivity_calc`), with no universalRenames and no superclass +% migrator (none exists for its superclasses; the old +migrators/contrast_sensitivity_calc.m +% wrapper was never reached and is deleted, [early migration pieces fixed] +% (1)). Identity through jRawBody (did2.convert.v1read.readBase); depends_on +% in either spelling ({name, value} / {name, document_id}); the `app` block +% in either spelling ({name, version} / {app_name, app_version}; +% jSoftwareFromApp, checked by did2.convert.v1read.readApp); NDI's camelCase +% result fields (e.g. sensitivity_RBNS) read case- and underscore-insensitively +% (jTuningCurve / jContrastSensitivityValue), so the universalRenames path +% ('RawV1Classes', {}) converts the same way. Every other field is accounted +% for (jCalculation 'AccountForEveryField'); a carry is the untouched v1 +% source. did2.convert.roundtrip.contrastsensitivity_calc rebuilds the v1 document; +% testRawV1RoundTripTuning compares the two on the writer's output +% (ndi.calc.vis.contrast_sensitivity, NDIcalc-vis-matlab). + arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'contrast_sensitivity_calculation', 'csf', ... - 'contrast_sensitivity_calc', 'contrast sensitivity', 'ndi.calc.vis.contrast_sensitivity'); +body = jRawBody(preBody, 'contrastsensitivity_calc'); +bodies = jCalculation(body, 'contrast_sensitivity_calculation', 'csf', ... + char(body.document_class.class_name), 'contrast sensitivity', 'ndi.calc.vis.contrast_sensitivity', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source +end end diff --git a/src/did/+did2/+convert/+migrators_j/contrast_tuning_calc.m b/src/did/+did2/+convert/+migrators_j/contrast_tuning_calc.m index c1e8f59e..ffc2438b 100644 --- a/src/did/+did2/+convert/+migrators_j/contrast_tuning_calc.m +++ b/src/did/+did2/+convert/+migrators_j/contrast_tuning_calc.m @@ -12,9 +12,32 @@ % % Fold is 1 -> 1 with base.id + depends_on preserved. See % did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (class `contrasttuning_calc`), with no universalRenames and no superclass +% migrator (none exists for its superclasses; the old +migrators/contrast_tuning_calc.m +% wrapper was never reached and is deleted, [early migration pieces fixed] +% (1)). Identity through jRawBody (did2.convert.v1read.readBase); depends_on +% in either spelling ({name, value} / {name, document_id}); the `app` block +% in either spelling ({name, version} / {app_name, app_version}; +% jSoftwareFromApp, checked by did2.convert.v1read.readApp); NDI's camelCase +% result fields (e.g. naka_rushton_RB_parameters) read case- and underscore-insensitively +% (jTuningCurve / jContrastSensitivityValue), so the universalRenames path +% ('RawV1Classes', {}) converts the same way. Every other field is accounted +% for (jCalculation 'AccountForEveryField'); a carry is the untouched v1 +% source. did2.convert.roundtrip.contrasttuning_calc rebuilds the v1 document; +% testRawV1RoundTripTuning compares the two on the writer's output +% (ndi.calc.vis.contrast_tuning, NDIcalc-vis-matlab). + arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'contrast_tuning_calculation', 'contrast', ... - 'contrast_tuning', 'contrast tuning', 'ndi.calc.vis.contrast'); +body = jRawBody(preBody, 'contrasttuning_calc'); +bodies = jCalculation(body, 'contrast_tuning_calculation', 'contrast', ... + 'contrast_tuning', 'contrast tuning', 'ndi.calc.vis.contrast', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source +end end diff --git a/src/did/+did2/+convert/+migrators_j/oridirtuning_calc.m b/src/did/+did2/+convert/+migrators_j/oridirtuning_calc.m index 56beb5bd..3e54d559 100644 --- a/src/did/+did2/+convert/+migrators_j/oridirtuning_calc.m +++ b/src/did/+did2/+convert/+migrators_j/oridirtuning_calc.m @@ -16,9 +16,32 @@ % Fold is 1 -> 1 with base.id + depends_on preserved (downstream calc % references resolve) and the input document(s) consumed -> derived_from_#. % See did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (class `oridirtuning_calc`), with no universalRenames and no superclass +% migrator (none exists for its superclasses; the old +migrators/oridirtuning_calc.m +% wrapper was never reached and is deleted, [early migration pieces fixed] +% (1)). Identity through jRawBody (did2.convert.v1read.readBase); depends_on +% in either spelling ({name, value} / {name, document_id}); the `app` block +% in either spelling ({name, version} / {app_name, app_version}; +% jSoftwareFromApp, checked by did2.convert.v1read.readApp); NDI's camelCase +% result fields (e.g. vector.Hotelling2Test) read case- and underscore-insensitively +% (jTuningCurve / jContrastSensitivityValue), so the universalRenames path +% ('RawV1Classes', {}) converts the same way. Every other field is accounted +% for (jCalculation 'AccountForEveryField'); a carry is the untouched v1 +% source. did2.convert.roundtrip.oridirtuning_calc rebuilds the v1 document; +% testRawV1RoundTripTuning compares the two on the writer's output +% (ndi.calc.vis.oridir_tuning, NDIcalc-vis-matlab). + arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'orientation_direction_tuning_calculation', 'oridir', ... - 'orientation_direction_tuning', 'orientation/direction tuning', 'ndi.calc.vis.oridir'); +body = jRawBody(preBody, 'oridirtuning_calc'); +bodies = jCalculation(body, 'orientation_direction_tuning_calculation', 'oridir', ... + 'orientation_direction_tuning', 'orientation/direction tuning', 'ndi.calc.vis.oridir', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source +end end diff --git a/src/did/+did2/+convert/+migrators_j/private/jCalculation.m b/src/did/+did2/+convert/+migrators_j/private/jCalculation.m index 5270ec5e..edc315e4 100644 --- a/src/did/+did2/+convert/+migrators_j/private/jCalculation.m +++ b/src/did/+did2/+convert/+migrators_j/private/jCalculation.m @@ -68,6 +68,26 @@ % one did2.convert.reportNote('carried_as_v1', , , % 'unplaced: '). A folded document drops nothing. % +% ACCOUNTED FOR ('AccountForEveryField', true; the migrators switched to raw +% v1, did2.convert.rawV1Classes, [migrators read raw v1]): the fields the +% value mapping does not read are checked too, so that a folded document +% drops nothing ([generic stage is lossless], Jess Haley, 2026-10-25). Each +% of these, when it holds a value, is unplaced (carry-056) and carries the +% document whole as v1: +% - a top-level block other than document_class, depends_on, base, app, +% calculator, the calculator's own block and SOURCEBLOCK; +% - a field of the calculator's own block other than input_parameters and +% depends_on (tuningcurve_calc's `log` and `stim_property_list`); for +% 'csf' (the block IS the result), a field jContrastSensitivityValue +% does not read; +% - a field of the `calculator` block (NDI's calculator.json declares none); +% - an `app` field outside NDI's app.json, or `name` / `version` stated in +% both spellings with different values (did2.convert.v1read.readApp); +% - a depends_on edge the calculation does not write: one outside the +% subject edge and the input edges inputIds reads (and, for 'csf', +% stimulus_presentation_id), or a `subject_id` beside an `element_id`. +% Off by default: the classes not yet switched run exactly as before. +% % Returns {leaf, anchor, software..., run entities...}. arguments @@ -83,6 +103,7 @@ opts.DatumType = '' opts.SourceDatumType = '' opts.Dropped = {} % more dropped v1 field paths, reported verbatim + opts.AccountForEveryField (1,1) logical = false % see ACCOUNTED FOR below end srcBlk = struct(); @@ -140,6 +161,9 @@ reshape(dropped, 1, []), 'UniformOutput', false), ... cellfun(@(d) ['[carry-056] ' char(d)], reshape(opts.Dropped, 1, []), ... 'UniformOutput', false)]; +if opts.AccountForEveryField + unplaced = [unplaced, unaccounted(preBody, sourceBlock, family)]; +end % The calculator block's inner `depends_on` copy (e.g. % `oridirtuning_calc.depends_on`) is left unwritten only when it restates the % top-level edges ([restated values checked], Jess Haley, 2026-10-26; measured @@ -213,6 +237,112 @@ end end +function c = unaccounted(preBody, sourceBlock, family) +%UNACCOUNTED The fields of PREBODY the fold does not read and that hold a +% value, each as '[carry-056] ' (see ACCOUNTED FOR in the header). +c = {}; +leaf = classNameOf(preBody); +known = {'document_class', 'depends_on', 'base', 'app', 'calculator', leaf, sourceBlock}; +top = fieldnames(preBody); +for k = 1:numel(top) + if ~any(strcmp(top{k}, known)) && ~isEmptyValue(preBody.(top{k})) + c{end+1} = top{k}; %#ok + end +end +if strcmp(family, 'csf') + read = {'input_parameters', 'depends_on', 'spatial_frequencies', ... + 'fitless_interpolated_c50', 'is_modulated_response', ... + 'visual_response_p_bonferroni', 'response_varies_p_bonferroni', 'response_type'}; + for v = {'rb', 'rbn', 'rbns'} + for m = {'sensitivity', 'relative_max_gain', 'empirical_c50', 'saturation_index', 'parameters'} + read{end+1} = [m{1} '_' v{1}]; %#ok + end + end + c = [c, blockRest(preBody, leaf, read, true)]; +elseif ~strcmp(leaf, sourceBlock) + c = [c, blockRest(preBody, leaf, {'input_parameters', 'depends_on'}, false)]; +end +c = [c, blockRest(preBody, 'calculator', {}, false)]; +a = did2.convert.v1read.readApp(preBody); +for k = 1:numel(a.conflicts) + c{end+1} = sprintf('app.%s (app_%s differs)', a.conflicts{k}, a.conflicts{k}); %#ok +end +ex = fieldnames(a.extra); +for k = 1:numel(ex) + if ~isEmptyValue(a.extra.(ex{k})) + c{end+1} = ['app.' ex{k}]; %#ok + end +end +inputs = {'element_id', 'stimulus_tuningcurve_id', 'stimulus_response_scalar_id', ... + 'stimulus_response_id'}; +if strcmp(family, 'csf') + inputs{end+1} = 'stimulus_presentation_id'; +end +% the contrast tuning inputs inputIds reads: contrasttuning_id_1, _2, ... up +% to the first one missing +for k = 1:64 + if isempty(jDependency(preBody, sprintf('contrasttuning_id_%d', k))) + break; + end + inputs{end+1} = sprintf('contrasttuning_id_%d', k); %#ok +end +deps = did2.convert.v1read.readDependsOn(preBody); +for k = 1:numel(deps) + nm = deps(k).name; + if isempty(deps(k).document_id) || any(strcmp(nm, inputs)) + continue; + end + if strcmp(nm, 'subject_id') && isempty(jDependency(preBody, 'element_id')) + continue; % the subject when there is no element (jSubjectOf) + end + c{end+1} = ['depends_on ' nm]; %#ok +end +c = cellfun(@(x) ['[carry-056] ' x], c, 'UniformOutput', false); +end + +function c = blockRest(preBody, block, read, ignoreCase) +%BLOCKREST The fields of PREBODY.(BLOCK) outside READ that hold a value, as +% 'BLOCK.field'. +c = {}; +if ~isfield(preBody, block) || ~isstruct(preBody.(block)) || ~isscalar(preBody.(block)) + return; +end +b = preBody.(block); +fns = fieldnames(b); +for k = 1:numel(fns) + if ignoreCase + isRead = any(strcmpi(fns{k}, read)); + else + isRead = any(strcmp(fns{k}, read)); + end + if ~isRead && ~isEmptyValue(b.(fns{k})) + c{end+1} = [block '.' fns{k}]; %#ok + end +end +end + +function tf = isEmptyValue(v) +%ISEMPTYVALUE A value that states nothing: '', [], {}, an empty string, or a +% struct that is empty or has only empty fields (NDI's template blanks, +% e.g. stim_property_list {names: [], values: []}). +if isstruct(v) + tf = true; + for k = 1:numel(v) + fns = fieldnames(v(k)); + for j = 1:numel(fns) + if ~isEmptyValue(v(k).(fns{j})) + tf = false; + return; + end + end + end +elseif isstring(v) + tf = isempty(v) || all(strlength(v) == 0); +else + tf = isempty(v); +end +end + function ids = inputIds(preBody) ids = {}; names = {'stimulus_tuningcurve_id', 'stimulus_response_scalar_id', 'stimulus_response_id'}; diff --git a/src/did/+did2/+convert/+migrators_j/private/jTuningCurve.m b/src/did/+did2/+convert/+migrators_j/private/jTuningCurve.m index c4f5f14c..e60c2e18 100644 --- a/src/did/+did2/+convert/+migrators_j/private/jTuningCurve.m +++ b/src/did/+did2/+convert/+migrators_j/private/jTuningCurve.m @@ -155,10 +155,19 @@ % ---- significance (tuning_curve_calculation) ----------------------------- sig = sub(srcBlk, 'significance'); s = struct(); +usedS = {}; for f = {'visual_response_anova_p', 'across_stimuli_anova_p'} - x = getf(sig, f); - if isnumeric(x) && isscalar(x); s.(f{1}) = double(x); end + [x, nm] = getfn(sig, f); + if isnumeric(x) && isscalar(x) + s.(f{1}) = double(x); + usedS{end+1} = nm; %#ok + end end +% any other `significance` field (or one of the two that is not one number) +% was read by nothing and listed nowhere: it is unplaced too ([generic stage +% is lossless], Jess Haley, 2026-10-25; found by the round trip, +% testRawV1RoundTripTuning) +dropped = [dropped, prefixed('significance.', stated(sig, setdiff(fieldnames(sig), usedS)))]; if ~isempty(fieldnames(s)) % in the value, beside the fits (Jess Haley 2026-10-22 [significance % with results]; tuning_curve_calculation.significance until then) diff --git a/src/did/+did2/+convert/+migrators_j/spatial_frequency_tuning_calc.m b/src/did/+did2/+convert/+migrators_j/spatial_frequency_tuning_calc.m index 4019d204..fca93916 100644 --- a/src/did/+did2/+convert/+migrators_j/spatial_frequency_tuning_calc.m +++ b/src/did/+did2/+convert/+migrators_j/spatial_frequency_tuning_calc.m @@ -8,9 +8,32 @@ % % Fold is 1 -> 1 with base.id + depends_on preserved. See % did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (class `spatial_frequency_tuning_calc`), with no universalRenames and no superclass +% migrator (none exists for its superclasses; the old +migrators/spatial_frequency_tuning_calc.m +% wrapper was never reached and is deleted, [early migration pieces fixed] +% (1)). Identity through jRawBody (did2.convert.v1read.readBase); depends_on +% in either spelling ({name, value} / {name, document_id}); the `app` block +% in either spelling ({name, version} / {app_name, app_version}; +% jSoftwareFromApp, checked by did2.convert.v1read.readApp); NDI's camelCase +% result fields (e.g. fit_dog.L50, Pref, R2) read case- and underscore-insensitively +% (jTuningCurve / jContrastSensitivityValue), so the universalRenames path +% ('RawV1Classes', {}) converts the same way. Every other field is accounted +% for (jCalculation 'AccountForEveryField'); a carry is the untouched v1 +% source. did2.convert.roundtrip.spatial_frequency_tuning_calc rebuilds the v1 document; +% testRawV1RoundTripTuning compares the two on the writer's output +% (ndi.calc.vis.spatial_frequency_tuning, NDIcalc-vis-matlab). + arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'spatial_frequency_tuning_calculation', 'sf', ... - 'spatial_frequency_tuning', 'spatial frequency tuning', 'ndi.calc.vis.spatial_frequency_tuning'); +body = jRawBody(preBody, 'spatial_frequency_tuning_calc'); +bodies = jCalculation(body, 'spatial_frequency_tuning_calculation', 'sf', ... + 'spatial_frequency_tuning', 'spatial frequency tuning', 'ndi.calc.vis.spatial_frequency_tuning', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source +end end diff --git a/src/did/+did2/+convert/+migrators_j/temporal_frequency_tuning_calc.m b/src/did/+did2/+convert/+migrators_j/temporal_frequency_tuning_calc.m index bee25c87..ea11355e 100644 --- a/src/did/+did2/+convert/+migrators_j/temporal_frequency_tuning_calc.m +++ b/src/did/+did2/+convert/+migrators_j/temporal_frequency_tuning_calc.m @@ -8,9 +8,32 @@ % % Fold is 1 -> 1 with base.id + depends_on preserved. See % did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (class `temporal_frequency_tuning_calc`), with no universalRenames and no superclass +% migrator (none exists for its superclasses; the old +migrators/temporal_frequency_tuning_calc.m +% wrapper was never reached and is deleted, [early migration pieces fixed] +% (1)). Identity through jRawBody (did2.convert.v1read.readBase); depends_on +% in either spelling ({name, value} / {name, document_id}); the `app` block +% in either spelling ({name, version} / {app_name, app_version}; +% jSoftwareFromApp, checked by did2.convert.v1read.readApp); NDI's camelCase +% result fields (e.g. fitless.H50) read case- and underscore-insensitively +% (jTuningCurve / jContrastSensitivityValue), so the universalRenames path +% ('RawV1Classes', {}) converts the same way. Every other field is accounted +% for (jCalculation 'AccountForEveryField'); a carry is the untouched v1 +% source. did2.convert.roundtrip.temporal_frequency_tuning_calc rebuilds the v1 document; +% testRawV1RoundTripTuning compares the two on the writer's output +% (ndi.calc.vis.temporal_frequency_tuning, NDIcalc-vis-matlab). + arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'temporal_frequency_tuning_calculation', 'tf', ... - 'temporal_frequency_tuning', 'temporal frequency tuning', 'ndi.calc.vis.temporal_frequency_tuning'); +body = jRawBody(preBody, 'temporal_frequency_tuning_calc'); +bodies = jCalculation(body, 'temporal_frequency_tuning_calculation', 'tf', ... + 'temporal_frequency_tuning', 'temporal frequency tuning', 'ndi.calc.vis.temporal_frequency_tuning', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source +end end diff --git a/src/did/+did2/+convert/+migrators_j/tuningcurve_calc.m b/src/did/+did2/+convert/+migrators_j/tuningcurve_calc.m index c0fece40..c08074eb 100644 --- a/src/did/+did2/+convert/+migrators_j/tuningcurve_calc.m +++ b/src/did/+did2/+convert/+migrators_j/tuningcurve_calc.m @@ -17,9 +17,32 @@ % tuning_curve.value shape. % % See did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (class `tuningcurve_calc`), with no universalRenames and no superclass +% migrator (none exists for its superclasses; the old +migrators/tuningcurve_calc.m +% wrapper was never reached and is deleted, [early migration pieces fixed] +% (1)). Identity through jRawBody (did2.convert.v1read.readBase); depends_on +% in either spelling ({name, value} / {name, document_id}); the `app` block +% in either spelling ({name, version} / {app_name, app_version}; +% jSoftwareFromApp, checked by did2.convert.v1read.readApp); NDI's camelCase +% result fields (e.g. independent_variable_label) read case- and underscore-insensitively +% (jTuningCurve / jContrastSensitivityValue), so the universalRenames path +% ('RawV1Classes', {}) converts the same way. Every other field is accounted +% for (jCalculation 'AccountForEveryField'); a carry is the untouched v1 +% source. did2.convert.roundtrip.tuningcurve_calc rebuilds the v1 document; +% testRawV1RoundTripTuning compares the two on the writer's output +% (ndi.calc.stimulus.tuningcurve, NDI-matlab). + arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'tuning_curve_calculation', 'stimulus', ... - 'stimulus_tuningcurve', 'stimulus tuning curve', 'ndi.calc.stimulus.tuningcurve'); +body = jRawBody(preBody, 'tuningcurve_calc'); +bodies = jCalculation(body, 'tuning_curve_calculation', 'stimulus', ... + 'stimulus_tuningcurve', 'stimulus tuning curve', 'ndi.calc.stimulus.tuningcurve', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source +end end diff --git a/src/did/+did2/+convert/+roundtrip/contrastsensitivity_calc.m b/src/did/+did2/+convert/+roundtrip/contrastsensitivity_calc.m new file mode 100644 index 00000000..010b9814 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/contrastsensitivity_calc.m @@ -0,0 +1,25 @@ +function [v1, spec] = contrastsensitivity_calc(bodies) +%CONTRASTSENSITIVITY_CALC Rebuild a v1 `contrastsensitivity_calc` from what +% did2.convert.migrators_j.contrast_sensitivity_calc emitted when it CONVERTED it: the +% `contrast_sensitivity_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.contrastsensitivity_calc(BODIES). V1 is the document in +% the shape NDIcalc-vis-matlab ndi.calc.vis.contrast_sensitivity (contrastsensitivity_calc.json over NDI's +% calculator.json, app.json, base.json) +% writes it: +% +% identity, `app`, input_parameters calcParts +% depends_on element_id, the csf inputs +% (tuningInverse) +% contrastsensitivity_calc csfBlock +% +% The calculator block's inner depends_on copy is stated as restating the +% top-level edges (SPEC.equivalents); the v1 document_class beyond its +% class name is exempt (did2.convert.roundtrip.check). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.contrast_sensitivity_calc. + +[v1, spec] = tuningInverse(bodies, 'contrast_sensitivity_calculation', 'contrastsensitivity_calc', ... + 'ndi.calc.vis.contrast_sensitivity', 'csf', 'contrastsensitivity_calc', 'csf'); +end diff --git a/src/did/+did2/+convert/+roundtrip/contrasttuning_calc.m b/src/did/+did2/+convert/+roundtrip/contrasttuning_calc.m new file mode 100644 index 00000000..af713550 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/contrasttuning_calc.m @@ -0,0 +1,25 @@ +function [v1, spec] = contrasttuning_calc(bodies) +%CONTRASTTUNING_CALC Rebuild a v1 `contrasttuning_calc` from what +% did2.convert.migrators_j.contrast_tuning_calc emitted when it CONVERTED it: the +% `contrast_tuning_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.contrasttuning_calc(BODIES). V1 is the document in +% the shape NDIcalc-vis-matlab ndi.calc.vis.contrast_tuning (contrasttuning_calc.json over contrast_tuning.json +% and NDI's calculator.json, app.json, base.json) +% writes it: +% +% identity, `app`, input_parameters calcParts +% depends_on element_id, stimulus_tuningcurve_id +% (tuningInverse) +% contrast_tuning tuningBlock (family 'contrast') +% +% The calculator block's inner depends_on copy is stated as restating the +% top-level edges (SPEC.equivalents); the v1 document_class beyond its +% class name is exempt (did2.convert.roundtrip.check). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.contrast_tuning_calc. + +[v1, spec] = tuningInverse(bodies, 'contrast_tuning_calculation', 'contrasttuning_calc', ... + 'ndi.calc.vis.contrast', 'contrast', 'contrast_tuning', 'stimulus_tuningcurve_id'); +end diff --git a/src/did/+did2/+convert/+roundtrip/oridirtuning_calc.m b/src/did/+did2/+convert/+roundtrip/oridirtuning_calc.m new file mode 100644 index 00000000..1d7685bd --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/oridirtuning_calc.m @@ -0,0 +1,25 @@ +function [v1, spec] = oridirtuning_calc(bodies) +%ORIDIRTUNING_CALC Rebuild a v1 `oridirtuning_calc` from what +% did2.convert.migrators_j.oridirtuning_calc emitted when it CONVERTED it: the +% `orientation_direction_tuning_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.oridirtuning_calc(BODIES). V1 is the document in +% the shape NDIcalc-vis-matlab ndi.calc.vis.oridir_tuning (oridirtuning_calc.json over NDI's +% orientation_direction_tuning.json, calculator.json, app.json, base.json) +% writes it: +% +% identity, `app`, input_parameters calcParts +% depends_on element_id, stimulus_tuningcurve_id +% (tuningInverse) +% orientation_direction_tuning tuningBlock (family 'oridir') +% +% The calculator block's inner depends_on copy is stated as restating the +% top-level edges (SPEC.equivalents); the v1 document_class beyond its +% class name is exempt (did2.convert.roundtrip.check). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.oridirtuning_calc. + +[v1, spec] = tuningInverse(bodies, 'orientation_direction_tuning_calculation', 'oridirtuning_calc', ... + 'ndi.calc.vis.oridir', 'oridir', 'orientation_direction_tuning', 'stimulus_tuningcurve_id'); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/calcParts.m b/src/did/+did2/+convert/+roundtrip/private/calcParts.m new file mode 100644 index 00000000..a91e66af --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/calcParts.m @@ -0,0 +1,133 @@ +function [v1, leaf, inputs, spec] = calcParts(bodies, leafClass, v1Class, methodName) +%CALCPARTS The parts every tuning calculation inverse shares: the converted +% calculation, its v1 identity, its `app` block and its method parameters. +% +% [V1, LEAF, INPUTS, SPEC] = calcParts(BODIES, LEAFCLASS, V1CLASS, METHODNAME) +% reads what did2.convert.migrators_j.private.jCalculation emitted for one +% v1 calculator document (BODIES): the named calculation LEAFCLASS, its +% session anchor, and the `software` entities (with their version +% assertions) for the calculator, the operating system and the interpreter. +% +% V1 holds, in NDI's v1 shape (calculator.json + app.json + base.json at the +% locked NDI-matlab `main`, 3cb19a8): +% document_class.class_name V1CLASS (the v1 spelling) +% base.id, session_id, datestamp the calculation (rebuildBase); base.name +% is '' (V2 never writes it; #73 item 54) +% app.name, version, url the `software_id` entity: its name, its +% version assertion, its global_identifier +% app.os, os_version the `operating_system_id` entity +% app.interpreter, interpreter_version the `interpreter_id` entity +% .input_parameters method.parameters, read back by +% methodParameters +% An `app` block is written only when the calculation names software; a +% software entity named METHODNAME with no version and no url is the one +% jCalculation mints when the v1 `app` block names none, and writes no app. +% +% LEAF is the calculation (a struct; [] when none was emitted, and SPEC says +% so). INPUTS are its `input_id` edges, in order; the caller names them (the +% v1 edge names are not kept, only their order: jCalculation inputIds). +% SPEC.equivalents states the calculator block's inner `depends_on` copy: +% jCalculation leaves it unwritten only when every entry restates the +% top-level edge of the same name ([restated values checked], Jess Haley, +% 2026-10-26), so each entry can only have been one of the top-level edges; +% the caller adds those once it has named them (innerDependsOn). +% SPEC.unplaced names every emitted document with no role here. + +spec = emptySpec(); +v1 = struct(); +leaf = []; +inputs = {}; +n = numel(bodies); +used = false(1, n); +for k = 1:n + if strcmp(classNameOf(bodies{k}), leafClass) + leaf = bodies{k}; + used(k) = true; + break; + end +end +if isempty(leaf) + spec.unplaced{end+1} = sprintf('no %s was emitted', leafClass); + return; +end +base = rebuildBase(leaf); +inputs = edgeIds(leaf, 'input_id'); +anchors = edgeIds(leaf, 'time_reference_id'); +roles = {'software_id', 'operating_system_id', 'interpreter_id'}; +roleIds = cell(1, numel(roles)); +for r = 1:numel(roles) + roleIds{r} = edgeIds(leaf, roles{r}); +end +ents = repmat(struct('name', '', 'version', '', 'url', '', 'found', false), 1, numel(roles)); +for k = 1:n + if used(k); continue; end + b = bodies{k}; + id = char(getIn(b, 'base', 'id')); + switch classNameOf(b) + case 'relative_time_reference' + if any(strcmp(id, anchors)) + used(k) = true; + end + case 'entity' + for r = 1:numel(roles) + if any(strcmp(id, roleIds{r})) && ~ents(r).found + ents(r).found = true; + ents(r).name = fieldText(getIn(b, 'entity'), 'name'); + g = getIn(b, 'entity', 'global_identifier'); + if iscell(g) && ~isempty(g); g = g{1}; end + if ischar(g) || (isstring(g) && isscalar(g)) + ents(r).url = char(g); + end + used(k) = true; + break; + end + end + end +end +for k = 1:n + if used(k) || ~strcmp(classNameOf(bodies{k}), 'assertion'); continue; end + b = bodies{k}; + [~, variable] = termParts(getIn(b, 'statement', 'variable')); + if ~strcmpi(variable, 'version number'); continue; end + owner = edgeIds(b, 'entity_id'); + for r = 1:numel(roles) + if ents(r).found && isscalar(owner) && any(strcmp(owner{1}, roleIds{r})) ... + && isempty(ents(r).version) + ents(r).version = char(getIn(b, 'text', 'value', 'text')); + used(k) = true; + break; + end + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in a %s', ... + k, classNameOf(bodies{k}), v1Class); +end + +v1.document_class = struct('class_name', v1Class); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +minted = ents(1).found && strcmp(ents(1).name, methodName) ... + && isempty(ents(1).version) && isempty(ents(1).url); +if any([ents.found]) && ~(minted && ~ents(2).found && ~ents(3).found) + app = struct('name', '', 'version', '', 'url', '', 'os', '', 'os_version', '', ... + 'interpreter', '', 'interpreter_version', ''); + if ents(1).found && ~minted + app.name = ents(1).name; + app.version = ents(1).version; + app.url = ents(1).url; + end + app.os = ents(2).name; + app.os_version = ents(2).version; + app.interpreter = ents(3).name; + app.interpreter_version = ents(3).version; + v1.app = app; +end +[params, bad] = methodParameters(getIn(leaf, 'interaction', 'method', 'parameters')); +spec.unplaced = [spec.unplaced, bad]; +blk = struct(); +if ~isempty(fieldnames(params)) + blk.input_parameters = params; +end +v1.(v1Class) = blk; +end diff --git a/src/did/+did2/+convert/+roundtrip/private/column.m b/src/did/+did2/+convert/+roundtrip/private/column.m new file mode 100644 index 00000000..cf693d93 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/column.m @@ -0,0 +1,7 @@ +function x = column(x) +%COLUMN A numeric or logical vector as a column, the shape jsondecode gives a +% v1 JSON list of numbers; anything else unchanged. +if (isnumeric(x) || islogical(x)) && isvector(x) + x = x(:); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/csfBlock.m b/src/did/+did2/+convert/+roundtrip/private/csfBlock.m new file mode 100644 index 00000000..5a28545b --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/csfBlock.m @@ -0,0 +1,98 @@ +function [blk, bad] = csfBlock(leaf) +%CSFBLOCK The v1 contrastsensitivity_calc result fields rebuilt from the +% converted calculation (the inverse of jContrastSensitivityValue), in the +% writer's spelling (ndi.calc.vis.contrast_sensitivity, NDIcalc-vis-matlab): +% +% spatial_frequencies the covariate along the one dimension +% response_type value.response_type's label +% fitless_interpolated_c50 value.interpolated_values.c50 +% visual_response_p_bonferroni, response_varies_p_bonferroni +% value.significance.* +% is_modulated_response value.significance.modulated_response +% (0/1; v1 wrote 0 or 1) +% parameters_ the 'naka rushton ' fit's coefficients, +% 'parameter k, spatial frequency j' at (k, j) +% sensitivity_, relative_max_gain_, empirical_c50_ (V2 c50), +% saturation_index_ that fit's fields, as stored +% for each variant V of RB, RBN, RBNS. + +bad = {}; +blk = struct(); +value = getIn(leaf, 'contrast_sensitivity', 'value'); +if ~isstruct(value) + bad{end+1} = 'the calculation has no contrast_sensitivity.value'; + return; +end +covs = getIn(leaf, 'data', 'covariates'); +if iscell(covs); covs = [covs{:}]; end +if numel(covs) == 1 + blk.spatial_frequencies = column(getIn(covs, 'quantity', 'value')); +elseif numel(covs) > 1 + bad{end+1} = sprintf('%d covariates: one spatial frequency axis is rebuilt', numel(covs)); +end +if isfield(value, 'response_type') + [~, blk.response_type] = termParts(value.response_type); +end +if isfield(value, 'interpolated_values') && isstruct(value.interpolated_values) + iv = value.interpolated_values; + if isfield(iv, 'c50'); blk.fitless_interpolated_c50 = iv.c50; end + bad = [bad, others(iv, {'c50'}, 'value.interpolated_values')]; +end +if isfield(value, 'significance') && isstruct(value.significance) + sig = value.significance; + for f = {'visual_response_p_bonferroni', 'response_varies_p_bonferroni'} + if isfield(sig, f{1}); blk.(f{1}) = sig.(f{1}); end + end + if isfield(sig, 'modulated_response') + blk.is_modulated_response = double(sig.modulated_response); + end + bad = [bad, others(sig, {'visual_response_p_bonferroni', ... + 'response_varies_p_bonferroni', 'modulated_response'}, 'value.significance')]; +end +if isfield(value, 'model_fit') && ~isempty(value.model_fit) + fits = value.model_fit; + if isstruct(fits); fits = num2cell(reshape(fits, 1, [])); end + for k = 1:numel(fits) + e = fits{k}; + [~, model] = termParts(getIn(e, 'model')); + tok = regexp(model, '^naka rushton (RB|RBN|RBNS)$', 'tokens', 'once', 'ignorecase'); + if isempty(tok) + bad{end+1} = sprintf('model_fit %d: model "%s" is not a Naka-Rushton variant', k, model); %#ok + continue; + end + V = upper(tok{1}); + if isfield(e, 'coefficients') && ~isempty(e.coefficients) + [blk.(['parameters_' V]), b] = coefficientMatrix(e.coefficients, model); + bad = [bad, b]; %#ok + end + map = {'sensitivity', 'sensitivity'; 'relative_max_gain', 'relative_max_gain'; ... + 'c50', 'empirical_c50'; 'saturation_index', 'saturation_index'}; + for j = 1:size(map, 1) + if isfield(e, map{j, 1}) + blk.([map{j, 2} '_' V]) = e.(map{j, 1}); + end + end + bad = [bad, others(e, [{'model', 'coefficients'}, map(:, 1)'], ... + sprintf('model_fit %d', k))]; %#ok + end +end +bad = [bad, others(value, {'response_type', 'interpolated_values', 'significance', ... + 'model_fit'}, 'contrast_sensitivity.value')]; +end + +function [m, bad] = coefficientMatrix(c, model) +% ' parameter k, spatial frequency j' -> M(k, j) +m = []; +bad = {}; +if iscell(c); c = [c{:}]; end +for i = 1:numel(c) + [~, name] = termParts(c(i).variable); + tok = regexp(name, 'parameter (\d+), spatial frequency (\d+)$', 'tokens', 'once'); + if isempty(tok) || ~startsWith(name, model) + bad{end+1} = sprintf('coefficient "%s" is not "%s parameter k, spatial frequency j"', ... + name, model); %#ok + continue; + end + m(str2double(tok{1}), str2double(tok{2})) = c(i).value; %#ok +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/fitBlocks.m b/src/did/+did2/+convert/+roundtrip/private/fitBlocks.m new file mode 100644 index 00000000..350abc87 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/fitBlocks.m @@ -0,0 +1,104 @@ +function [blocks, bad] = fitBlocks(modelFit, family) +%FITBLOCKS The v1 fit block(s) rebuilt from a tuning curve's model_fit list +% (the inverse of jTuningCurve's fitEntries / oneFit). +% +% [BLOCKS, BAD] = fitBlocks(MODELFIT, FAMILY). BLOCKS is a struct of v1 +% blocks by name. Each entry's model label (spaces as '_') is the v1 field +% prefix or block name, in the writers' layouts (NDIcalc-vis-matlab): +% +% oridir block `fit`; _parameters, _fit_angles (x), +% _fit_values (y); metrics unprefixed: hwhh, +% orientation_angle_preference, direction_angle_preference, +% orientation_preferred_orthogonal_ratio(_rectified), +% direction_preferred_null_ratio(_rectified) +% contrast block `fit`; naka_rushton__parameters, _contrast (x), +% _values (y), _pref, _empirical_c50, _r2 +% sf, tf block `fit_`; parameters, values (x), fit (y), Pref, +% L50, H50, R2, bandwidth +% +% Coefficients are read back in order as a column (v1 stored an unnamed +% vector; jTuningCurve named entry k ' parameter k'). BAD lists what +% an entry holds that has no place in these layouts. + +blocks = struct(); +bad = {}; +if isempty(modelFit) + return; +end +if isstruct(modelFit) + modelFit = num2cell(reshape(modelFit, 1, [])); +end +for k = 1:numel(modelFit) + e = modelFit{k}; + [~, model] = termParts(getIn(e, 'model')); + stem = strrep(strtrim(model), ' ', '_'); + if isempty(stem) || ~isvarname(['x' stem]) + bad{end+1} = sprintf('model_fit %d: model "%s" names no v1 fit', k, model); %#ok + continue; + end + switch family + case 'oridir' + block = 'fit'; P = [stem '_']; M = ''; + names = {'parameters', [P 'parameters']; 'x', [P 'fit_angles']; 'y', [P 'fit_values']; ... + 'r2', 'r2'}; + metrics = {'half_width_at_half_maximum', 'hwhh'; ... + 'orientation_preference', 'orientation_angle_preference'; ... + 'direction_preference', 'direction_angle_preference'; ... + 'orientation_preferred_orthogonal_ratio', 'orientation_preferred_orthogonal_ratio'; ... + 'orientation_preferred_orthogonal_ratio_rectified', 'orientation_preferred_orthogonal_ratio_rectified'; ... + 'direction_preferred_null_ratio', 'direction_preferred_null_ratio'; ... + 'direction_preferred_null_ratio_rectified', 'direction_preferred_null_ratio_rectified'}; + case 'contrast' + block = 'fit'; P = [stem '_']; M = P; + names = {'parameters', [P 'parameters']; 'x', [P 'contrast']; 'y', [P 'values']; ... + 'r2', [P 'r2']}; + metrics = {'preferred_value', 'pref'; 'half_maximum_below', 'empirical_c50'}; + otherwise % 'sf', 'tf' + block = ['fit_' stem]; M = ''; + names = {'parameters', 'parameters'; 'x', 'values'; 'y', 'fit'; 'r2', 'R2'}; + metrics = {'preferred_value', 'Pref'; 'half_maximum_below', 'L50'; ... + 'half_maximum_above', 'H50'; 'bandwidth', 'bandwidth'}; + end + where = sprintf('model_fit %d (%s)', k, model); + b = struct(); + if isfield(blocks, block) + b = blocks.(block); + end + if isfield(e, 'coefficients') && ~isempty(e.coefficients) + c = e.coefficients; + if iscell(c); c = [c{:}]; end + b.(names{1, 2}) = reshape([c.value], [], 1); + end + if isfield(e, 'goodness') && isstruct(e.goodness) + if isfield(e.goodness, 'r2') + b.(names{4, 2}) = e.goodness.r2; + end + bad = [bad, others(e.goodness, {'r2'}, [where '.goodness'])]; %#ok + end + if isfield(e, 'sampled_fit') && isstruct(e.sampled_fit) + sf = e.sampled_fit; + if isfield(sf, 'independent_values') + x = sf.independent_values; + if size(x, 2) == 1 || isvector(x) + b.(names{2, 2}) = column(x); + else + bad{end+1} = [where '.sampled_fit.independent_values (more than one column)']; %#ok + end + end + if isfield(sf, 'response') + b.(names{3, 2}) = column(sf.response); + end + bad = [bad, others(sf, {'independent_values', 'response'}, [where '.sampled_fit'])]; %#ok + end + if isfield(e, 'metrics') && isstruct(e.metrics) + for j = 1:size(metrics, 1) + if isfield(e.metrics, metrics{j, 1}) + b.([M metrics{j, 2}]) = e.metrics.(metrics{j, 1}); + end + end + bad = [bad, others(e.metrics, metrics(:, 1)', [where '.metrics'])]; %#ok + end + bad = [bad, others(e, {'model', 'coefficients', 'goodness', 'sampled_fit', 'metrics'}, where)]; %#ok + blocks.(block) = b; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/methodParameters.m b/src/did/+did2/+convert/+roundtrip/private/methodParameters.m new file mode 100644 index 00000000..3ee7aa77 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/methodParameters.m @@ -0,0 +1,65 @@ +function [s, bad] = methodParameters(params) +%METHODPARAMETERS A v1 `input_parameters` struct rebuilt from a method's +% parameter entries (the inverse of +migrators_j/private/jParameterList). +% +% [S, BAD] = methodParameters(PARAMS). PARAMS is `method.parameters` (a +% struct array, a cell, or empty). jParameterList wrote one entry per +% non-empty v1 field, named by its path with '_' as ' ' and nested fields +% joined by '.', valued by: +% quantity.value a numeric or logical scalar (read back as the number) +% text a text value, or any other value as its JSON text +% (a struct array such as tuningcurve_calc's `selection`, +% a numeric vector): text that is a JSON array or object +% is read back with jsondecode +% The name is read back with ' ' as '_', the spelling every NDI calculator +% parameter has (a field name with a space cannot be a MATLAB field). An +% entry in another form (term, count, matrix, logical) is not one +% jParameterList writes: it is listed in BAD. + +s = struct(); +bad = {}; +if isempty(params) + return; +end +if isstruct(params) + params = num2cell(reshape(params, 1, [])); +end +for k = 1:numel(params) + e = params{k}; + [~, name] = termParts(getIn(e, 'variable')); + if isempty(name) + bad{end+1} = sprintf('method parameter %d has no name', k); %#ok + continue; + end + if isfield(e, 'quantity') && isstruct(e.quantity) && isfield(e.quantity, 'value') + v = e.quantity.value; + elseif isfield(e, 'text') + v = char(e.text); + if ~isempty(v) && any(v(1) == '[{') + try + v = jsondecode(v); + catch + % not JSON: the text itself + end + end + else + bad{end+1} = sprintf('method parameter "%s" is not a number or text', name); %#ok + continue; + end + steps = strsplit(strrep(name, ' ', '_'), '.'); + s = setPath(s, steps, v); +end +end + +function s = setPath(s, steps, v) +%SETPATH S with S.(STEPS{1}).(STEPS{2})... set to V. +if isscalar(steps) + s.(steps{1}) = v; + return; +end +inner = struct(); +if isfield(s, steps{1}) && isstruct(s.(steps{1})) && isscalar(s.(steps{1})) + inner = s.(steps{1}); +end +s.(steps{1}) = setPath(inner, steps(2:end), v); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/others.m b/src/did/+did2/+convert/+roundtrip/private/others.m new file mode 100644 index 00000000..79ecd4d2 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/others.m @@ -0,0 +1,14 @@ +function bad = others(s, known, where) +%OTHERS The fields of struct S outside KNOWN, each as 'WHERE.field': emitted +% content an inverse has no place for. +bad = {}; +if ~isstruct(s) || ~isscalar(s) + return; +end +fns = fieldnames(s); +for k = 1:numel(fns) + if ~any(strcmp(fns{k}, known)) + bad{end+1} = [where '.' fns{k}]; %#ok + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/rawCurveBlock.m b/src/did/+did2/+convert/+roundtrip/private/rawCurveBlock.m new file mode 100644 index 00000000..e5305df6 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/rawCurveBlock.m @@ -0,0 +1,77 @@ +function [blk, bad] = rawCurveBlock(leaf) +%RAWCURVEBLOCK The v1 `stimulus_tuningcurve` block rebuilt from a converted +% tuningcurve_calc (the inverse of jTuningCurve's rawCurve, one stimulus +% variable). +% +% [BLK, BAD] = rawCurveBlock(LEAF), in NDI's stimulus_tuningcurve.json shape +% as ndi.app.stimulus.tuning_response writes it (NDI-matlab locked `main`, +% 3cb19a8): +% +% independent_variable_label the dimension's term label, lower case, ' ' +% as '_' (the writer labels by the stimulus +% parameter's name: 'contrast'), one cell +% independent_variable_value the covariate's values +% response_mean, response_stddev, response_stderr value.* +% individual_responses_real / _imaginary value.individual, +% keys x trials x [real, imag] (or keys x +% trials), back to trials x keys per half +% control_response_*, control_individual_responses_* value.control.* +% response_units value.response_unit's label (a spelling +% jTuningCurve recognised carries the document) +% stimid, control_stimid and stimulus_presentation_number have no V2 home: a +% document stating them is carried, so a converted one stated none. + +bad = {}; +blk = struct(); +value = getIn(leaf, 'tuning_curve', 'value'); +if ~isstruct(value) + bad{end+1} = 'the calculation has no tuning_curve.value'; + return; +end +covs = getIn(leaf, 'data', 'covariates'); +if iscell(covs); covs = [covs{:}]; end +if numel(covs) == 1 + [~, label] = termParts(covs.variable); + blk.independent_variable_label = {lower(strrep(strtrim(label), ' ', '_'))}; + blk.independent_variable_value = column(getIn(covs, 'quantity', 'value')); +elseif numel(covs) > 1 + bad{end+1} = sprintf('%d covariates: only one stimulus variable is rebuilt', numel(covs)); +end +blk = take(blk, 'response_mean', value, 'mean'); +blk = take(blk, 'response_stddev', value, 'stddev'); +blk = take(blk, 'response_stderr', value, 'stderr'); +blk = halves(blk, 'individual_responses', value, 'individual'); +if isfield(value, 'response_unit') + [~, blk.response_units] = termParts(value.response_unit); +end +if isfield(value, 'control') && isstruct(value.control) + ctl = value.control; + blk = take(blk, 'control_response_mean', ctl, 'mean'); + blk = take(blk, 'control_response_stddev', ctl, 'stddev'); + blk = take(blk, 'control_response_stderr', ctl, 'stderr'); + blk = halves(blk, 'control_individual_responses', ctl, 'individual'); + bad = [bad, others(ctl, {'mean', 'stddev', 'stderr', 'individual'}, 'tuning_curve.value.control')]; +end +bad = [bad, others(value, {'mean', 'stddev', 'stderr', 'individual', 'control', ... + 'response_unit'}, 'tuning_curve.value')]; +end + +function blk = take(blk, name, src, field) +if isfield(src, field) + blk.(name) = column(src.(field)); +end +end + +function blk = halves(blk, stem, src, field) +% keys x trials x 2 ([real, imaginary] last) -> the two v1 halves +if ~isfield(src, field) + return; +end +x = src.(field); +if ndims(x) == 3 && size(x, 3) == 2 + blk.([stem '_real']) = trialsFirstOrient(x(:, :, 1)); + blk.([stem '_imaginary']) = trialsFirstOrient(x(:, :, 2)); +else + blk.([stem '_real']) = trialsFirstOrient(x); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/trialsFirstOrient.m b/src/did/+did2/+convert/+roundtrip/private/trialsFirstOrient.m new file mode 100644 index 00000000..8652a973 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/trialsFirstOrient.m @@ -0,0 +1,8 @@ +function x = trialsFirstOrient(x) +%TRIALSFIRSTORIENT A per-trial array back in v1's order, trials x stimuli: the +% migrator wrote stimuli x trials (#88 audit 2, D3) by transposing a matrix +% (a vector, one trial or one stimulus, was not transposed and is not here). +if (isnumeric(x) || islogical(x)) && ismatrix(x) && ~isvector(x) + x = x.'; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/tuningBlock.m b/src/did/+did2/+convert/+roundtrip/private/tuningBlock.m new file mode 100644 index 00000000..faeebdef --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/tuningBlock.m @@ -0,0 +1,197 @@ +function [blk, bad] = tuningBlock(leaf, family) +%TUNINGBLOCK A v1 tuning result block rebuilt from the converted calculation +% (the inverse of +migrators_j/private/jTuningCurve for one stimulus +% variable). +% +% [BLK, BAD] = tuningBlock(LEAF, FAMILY). FAMILY is 'oridir' (block +% orientation_direction_tuning), 'contrast' (contrast_tuning), 'sf' +% (spatial_frequency_tuning) or 'tf' (temporal_frequency_tuning). Field +% names are the WRITERS' spellings (NDIcalc-vis-matlab ndi.calc.vis.*; the +% writer wins over the template): `Hotelling2Test`, `L50` / `Pref` / `H50` / +% `R2`. BAD lists what is emitted but has no place in the block. +% +% properties.response_units value.response_unit (its label: a spelling +% jTuningCurve recognised carries the document) +% properties.response_type value.response_type (its label) +% properties.coordinates value.coordinates +% tuning_curve. the covariate along the one dimension: its +% term's label, lower case, ' ' as '_' +% ('Direction' -> direction, 'Spatial +% Frequency' -> spatial_frequency) +% tuning_curve.mean, stddev, stderr, individual, raw_individual +% value.*; the per-trial arrays back to trials +% x stimuli (v1's order) +% tuning_curve.control_mean, control_stddev, control_stderr, +% control_individual value.control.* +% tuning_curve.control_mean_stddev, control_mean_stderr +% value.control.pooled.* +% significance.* value.significance +% vector.* (oridir) the calculation's circular_statistics +% fitless.* (contrast, sf, tf) the calculation's interpolated_values +% fit / fit_ value.model_fit (fitBlocks) + +bad = {}; +blk = struct(); +value = getIn(leaf, 'tuning_curve', 'value'); +if ~isstruct(value) + bad{end+1} = 'the calculation has no tuning_curve.value'; + return; +end +seen = {}; + +props = struct(); +if isfield(value, 'response_unit') + [~, props.response_units] = termParts(value.response_unit); +end +if isfield(value, 'response_type') + [~, props.response_type] = termParts(value.response_type); +end +if isfield(value, 'coordinates') + props.coordinates = char(value.coordinates); +end +seen = [seen, {'response_unit', 'response_type', 'coordinates'}]; +if ~isempty(fieldnames(props)) + blk.properties = props; +end + +tc = struct(); +[axisName, axisValues, axisBad] = oneAxis(leaf); +bad = [bad, axisBad]; +if ~isempty(axisName) + tc.(axisName) = axisValues; +end +tc = put(tc, 'mean', value, {'mean'}, false); +tc = put(tc, 'stddev', value, {'stddev'}, false); +tc = put(tc, 'stderr', value, {'stderr'}, false); +tc = put(tc, 'individual', value, {'individual'}, true); +tc = put(tc, 'raw_individual', value, {'raw_individual'}, true); +seen = [seen, {'mean', 'stddev', 'stderr', 'individual', 'raw_individual'}]; +if isfield(value, 'control') + ctl = value.control; + tc = put(tc, 'control_mean', ctl, {'mean'}, false); + tc = put(tc, 'control_stddev', ctl, {'stddev'}, false); + tc = put(tc, 'control_stderr', ctl, {'stderr'}, false); + tc = put(tc, 'control_individual', ctl, {'individual'}, true); + tc = put(tc, 'control_mean_stddev', ctl, {'pooled', 'stddev'}, false); + tc = put(tc, 'control_mean_stderr', ctl, {'pooled', 'stderr'}, false); + bad = [bad, others(ctl, {'mean', 'stddev', 'stderr', 'individual', 'pooled'}, 'value.control')]; + seen{end+1} = 'control'; +end +if ~isempty(fieldnames(tc)) + blk.tuning_curve = tc; +end + +if isfield(value, 'significance') && isstruct(value.significance) + blk.significance = value.significance; + seen{end+1} = 'significance'; +end + +own = calcBlock(leaf); +if strcmp(family, 'oridir') + map = {'circular_variance', 'circular_variance'; ... + 'direction_circular_variance', 'direction_circular_variance'; ... + 'hotelling_t2_p', 'Hotelling2Test'; ... + 'direction_hotelling_t2_p', 'direction_hotelling2test'; ... + 'direction_dot_product_p', 'dot_direction_significance'; ... + 'orientation_preference', 'orientation_preference'; ... + 'direction_preference', 'direction_preference'}; + [vec, b] = renamed(getIn(own, 'circular_statistics'), map, 'circular_statistics'); + bad = [bad, b]; + if ~isempty(fieldnames(vec)); blk.vector = vec; end +else + if strcmp(family, 'contrast') + map = {'half_maximum_below', 'interpolated_c50'}; + else + map = {'preferred_value', 'Pref'; 'half_maximum_below', 'L50'; ... + 'half_maximum_above', 'H50'; 'bandwidth', 'bandwidth'; ... + 'low_pass_index', 'low_pass_index'; 'high_pass_index', 'high_pass_index'}; + end + [fl, b] = renamed(getIn(own, 'interpolated_values'), map, 'interpolated_values'); + bad = [bad, b]; + if ~isempty(fieldnames(fl)); blk.fitless = fl; end +end + +if isfield(value, 'model_fit') + [fits, b] = fitBlocks(value.model_fit, family); + bad = [bad, b]; + names = fieldnames(fits); + for k = 1:numel(names) + blk.(names{k}) = fits.(names{k}); + end + seen{end+1} = 'model_fit'; +end +bad = [bad, others(value, seen, 'tuning_curve.value')]; +end + +% ============================================================================= + +function own = calcBlock(leaf) +% the named calculation's own block (circular_statistics / interpolated_values) +own = struct(); +fns = fieldnames(leaf); +for k = 1:numel(fns) + b = leaf.(fns{k}); + if isstruct(b) && isscalar(b) && (isfield(b, 'circular_statistics') ... + || isfield(b, 'interpolated_values')) + own = b; + return; + end +end +end + +function [name, values, bad] = oneAxis(leaf) +% the one stimulus dimension: its covariate's label and values +name = ''; +values = []; +bad = {}; +covs = getIn(leaf, 'data', 'covariates'); +dims = getIn(leaf, 'data', 'dimensions'); +if isempty(covs) + return; +end +if iscell(covs); covs = [covs{:}]; end +if iscell(dims); dims = [dims{:}]; end +if numel(covs) ~= 1 || numel(dims) > 1 + bad{end+1} = sprintf('%d dimensions and %d covariates: only one stimulus variable is rebuilt', ... + numel(dims), numel(covs)); + return; +end +[~, label] = termParts(covs.variable); +name = lower(strrep(strtrim(label), ' ', '_')); +values = column(getIn(covs, 'quantity', 'value')); +if isempty(name) || ~isvarname(name) + bad{end+1} = sprintf('the stimulus variable "%s" is not a v1 field name', label); + name = ''; +end +end + +function s = put(s, name, src, steps, trialsFirst) +% S.(NAME) = SRC.(STEPS...) in v1's orientation, when SRC holds it +x = src; +for k = 1:numel(steps) + if ~(isstruct(x) && isscalar(x) && isfield(x, steps{k})) + return; + end + x = x.(steps{k}); +end +if trialsFirst + s.(name) = trialsFirstOrient(x); +else + s.(name) = column(x); +end +end + +function [out, bad] = renamed(s, map, where) +% OUT.(v1 name) = S.(V2 name) for each row of MAP; the rest of S is BAD +out = struct(); +bad = {}; +if ~isstruct(s) || isempty(fieldnames(s)) + return; +end +for k = 1:size(map, 1) + if isfield(s, map{k, 1}) + out.(map{k, 2}) = s.(map{k, 1}); + end +end +bad = others(s, map(:, 1)', where); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/tuningInverse.m b/src/did/+did2/+convert/+roundtrip/private/tuningInverse.m new file mode 100644 index 00000000..8e791225 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/tuningInverse.m @@ -0,0 +1,88 @@ +function [v1, spec] = tuningInverse(bodies, leafClass, v1Class, methodName, family, resultBlock, inputs) +%TUNINGINVERSE Rebuild a v1 tuning calculator document from what +% did2.convert.migrators_j.private.jCalculation emitted when it CONVERTED it. +% +% [V1, SPEC] = tuningInverse(BODIES, LEAFCLASS, V1CLASS, METHODNAME, FAMILY, +% RESULTBLOCK, INPUTS): the calculation LEAFCLASS and its run entities +% (calcParts) give the identity, `app` and input_parameters; the result +% block RESULTBLOCK is rebuilt for FAMILY by tuningBlock ('oridir', +% 'contrast', 'sf', 'tf'), rawCurveBlock ('stimulus') or csfBlock ('csf', +% RESULTBLOCK is the calculator's own block). +% +% depends_on, in the writers' order: element_id (the calculation's +% entity_id), then the input_id edges named by INPUTS: +% 'stimulus_tuningcurve_id' one input (ndi.calc.vis.* tuning fits) +% 'stimulus_response_scalar_id' one input (ndi.calc.stimulus.tuningcurve) +% 'csf' jCalculation's order [response, +% contrast tunings..., presentation] as +% ndi.calc.vis.contrast_sensitivity writes +% them: stimulus_presentation_id, +% stimulus_response_scalar_id, +% contrasttuning_id_1..N +% Only the order of the inputs is kept in V2, not their v1 names: a document +% whose edges were not the writer's set is named wrongly here, and the round +% trip reports it. + +[v1, leaf, ins, spec] = calcParts(bodies, leafClass, v1Class, methodName); +if isempty(leaf) + return; +end +switch family + case 'stimulus' + [blk, bad] = rawCurveBlock(leaf); + case 'csf' + [blk, bad] = csfBlock(leaf); + otherwise + [blk, bad] = tuningBlock(leaf, family); +end +spec.unplaced = [spec.unplaced, bad]; +if isfield(v1, resultBlock) + own = v1.(resultBlock); + fns = fieldnames(blk); + for k = 1:numel(fns) + own.(fns{k}) = blk.(fns{k}); + end + blk = own; +end +v1.(resultBlock) = blk; + +entity = edgeIds(leaf, 'entity_id'); +names = {'element_id'}; +values = {''}; +if isscalar(entity) + values = entity; +else + spec.unplaced{end+1} = sprintf('%d entity_id edges', numel(entity)); +end +if strcmp(inputs, 'csf') + if numel(ins) >= 2 + names = [names, {'stimulus_presentation_id', 'stimulus_response_scalar_id'}, ... + arrayfun(@(k) sprintf('contrasttuning_id_%d', k), 1:numel(ins) - 2, ... + 'UniformOutput', false)]; + values = [values, ins(end), ins(1), ins(2:end - 1)]; + elseif ~isempty(ins) + spec.unplaced{end+1} = 'one input_id: the response and the presentation are both written'; + end +else + if ~isempty(ins) + names{end+1} = inputs; + values{end+1} = ins{1}; + end + for k = 2:numel(ins) + spec.unplaced{end+1} = sprintf('input_id %s has no v1 edge name', ins{k}); + end +end +v1.depends_on = struct('name', names, 'value', values); + +% the inner copy of the edges in the calculator block: left unwritten only when +% each entry restated the top-level edge of its name ([restated values +% checked], Jess Haley, 2026-10-26; jCalculation innerDependsOnDiffers) +why = ['the calculator block''s inner depends_on copy restates a top-level ' ... + 'edge ([restated values checked], Jess Haley, 2026-10-26)']; +for k = 1:numel(names) + spec.equivalents(end+1) = struct('path', sprintf('%s.depends_on(%d).name', v1Class, k), ... + 'values', {names}, 'why', why); + spec.equivalents(end+1) = struct('path', sprintf('%s.depends_on(%d).value', v1Class, k), ... + 'values', {values}, 'why', why); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/spatial_frequency_tuning_calc.m b/src/did/+did2/+convert/+roundtrip/spatial_frequency_tuning_calc.m new file mode 100644 index 00000000..ff98f19c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/spatial_frequency_tuning_calc.m @@ -0,0 +1,25 @@ +function [v1, spec] = spatial_frequency_tuning_calc(bodies) +%SPATIAL_FREQUENCY_TUNING_CALC Rebuild a v1 `spatial_frequency_tuning_calc` from what +% did2.convert.migrators_j.spatial_frequency_tuning_calc emitted when it CONVERTED it: the +% `spatial_frequency_tuning_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.spatial_frequency_tuning_calc(BODIES). V1 is the document in +% the shape NDIcalc-vis-matlab ndi.calc.vis.spatial_frequency_tuning (spatial_frequency_tuning_calc.json +% over spatial_frequency_tuning.json and NDI's calculator.json, app.json, base.json) +% writes it: +% +% identity, `app`, input_parameters calcParts +% depends_on element_id, stimulus_tuningcurve_id +% (tuningInverse) +% spatial_frequency_tuning tuningBlock (family 'sf') +% +% The calculator block's inner depends_on copy is stated as restating the +% top-level edges (SPEC.equivalents); the v1 document_class beyond its +% class name is exempt (did2.convert.roundtrip.check). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.spatial_frequency_tuning_calc. + +[v1, spec] = tuningInverse(bodies, 'spatial_frequency_tuning_calculation', 'spatial_frequency_tuning_calc', ... + 'ndi.calc.vis.spatial_frequency_tuning', 'sf', 'spatial_frequency_tuning', 'stimulus_tuningcurve_id'); +end diff --git a/src/did/+did2/+convert/+roundtrip/temporal_frequency_tuning_calc.m b/src/did/+did2/+convert/+roundtrip/temporal_frequency_tuning_calc.m new file mode 100644 index 00000000..1083cc08 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/temporal_frequency_tuning_calc.m @@ -0,0 +1,25 @@ +function [v1, spec] = temporal_frequency_tuning_calc(bodies) +%TEMPORAL_FREQUENCY_TUNING_CALC Rebuild a v1 `temporal_frequency_tuning_calc` from what +% did2.convert.migrators_j.temporal_frequency_tuning_calc emitted when it CONVERTED it: the +% `temporal_frequency_tuning_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.temporal_frequency_tuning_calc(BODIES). V1 is the document in +% the shape NDIcalc-vis-matlab ndi.calc.vis.temporal_frequency_tuning (temporal_frequency_tuning_calc.json +% over temporal_frequency_tuning.json and NDI's calculator.json, app.json, base.json) +% writes it: +% +% identity, `app`, input_parameters calcParts +% depends_on element_id, stimulus_tuningcurve_id +% (tuningInverse) +% temporal_frequency_tuning tuningBlock (family 'tf') +% +% The calculator block's inner depends_on copy is stated as restating the +% top-level edges (SPEC.equivalents); the v1 document_class beyond its +% class name is exempt (did2.convert.roundtrip.check). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.temporal_frequency_tuning_calc. + +[v1, spec] = tuningInverse(bodies, 'temporal_frequency_tuning_calculation', 'temporal_frequency_tuning_calc', ... + 'ndi.calc.vis.temporal_frequency_tuning', 'tf', 'temporal_frequency_tuning', 'stimulus_tuningcurve_id'); +end diff --git a/src/did/+did2/+convert/+roundtrip/tuningcurve_calc.m b/src/did/+did2/+convert/+roundtrip/tuningcurve_calc.m new file mode 100644 index 00000000..c9cd59fc --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/tuningcurve_calc.m @@ -0,0 +1,28 @@ +function [v1, spec] = tuningcurve_calc(bodies) +%TUNINGCURVE_CALC Rebuild a v1 `tuningcurve_calc` from what +% did2.convert.migrators_j.tuningcurve_calc emitted when it CONVERTED it: the +% `tuning_curve_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.tuningcurve_calc(BODIES). V1 is the document in +% the shape NDI-matlab ndi.calc.stimulus.tuningcurve (tuningcurve_calc.json over stimulus_tuningcurve.json, +% calculator.json, app.json and base.json at the locked `main`, 3cb19a8) +% writes it: +% +% identity, `app`, input_parameters calcParts +% depends_on element_id, stimulus_response_scalar_id +% (tuningInverse) +% stimulus_tuningcurve rawCurveBlock +% +% The calculator block's inner depends_on copy is stated as restating the +% top-level edges (SPEC.equivalents); the v1 document_class beyond its +% class name is exempt (did2.convert.roundtrip.check). +% tuningcurve_calc.log and stim_property_list are not rebuilt: a converted +% document stated neither (jCalculation 'AccountForEveryField' carries one +% that does). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.tuningcurve_calc. + +[v1, spec] = tuningInverse(bodies, 'tuning_curve_calculation', 'tuningcurve_calc', ... + 'ndi.calc.stimulus.tuningcurve', 'stimulus', 'stimulus_tuningcurve', 'stimulus_response_scalar_id'); +end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index c13e6e54..89bf075e 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -1,4 +1,4 @@ -function names = rawV1Classes() +function [names, migrators] = rawV1Classes(v1Name) %RAWV1CLASSES The v1 classes whose migrator reads the RAW v1 document. % % NAMES = did2.convert.rawV1Classes() is a cellstr of v1 class names (the @@ -7,6 +7,22 @@ % +migrators_j migrator UNCHANGED: no did2.convert.universalRenames, no % superclass migrators. Every other class runs exactly as before. % +% [NAMES, MIGRATORS] = did2.convert.rawV1Classes() also returns, for each +% name, the +migrators_j migrator that converts it (the same name, except +% in the table below). +% +% MIGRATOR = did2.convert.rawV1Classes(V1NAME) is the +migrators_j migrator +% for the v1 class V1NAME: its row in the table below, else V1NAME itself. +% +% THE ONE TABLE OF v1 NAME -> MIGRATOR NAME. Two v1 classes are spelled +% differently from the migrator files that convert them: NDIcalc-vis-matlab +% writes `contrasttuning_calc` and `contrastsensitivity_calc`, and the +% migrators are +migrators_j/contrast_tuning_calc.m and +% contrast_sensitivity_calc.m, the names universalRenames gives those +% classes. THIS TABLE GOES when universalRenames is deleted and the two +% migrator files are renamed to the v1 names ([migrators read raw v1]); it +% is the only place the two spellings are joined for a switched class. +% % WHY. Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema % V_eta_go_forward_class_audit.md): a migrator reads v1 exactly as v1 defines % it (the NDI template and writer at the locked `main`), writes V2 only @@ -49,9 +65,47 @@ % the batch passes dissolve. Written by % ndi.element/addepoch. Round trips: % testRawV1RoundTripElementEpoch (the pass-1 carrier). +% tuningcurve_calc the tuning family: six calculator +% contrasttuning_calc outputs, superclasses `calculator` +% oridirtuning_calc (`base` + `app`) and a result class +% spatial_frequency_tuning_calc (stimulus_tuningcurve, +% temporal_frequency_tuning_calc contrast_tuning, +% contrastsensitivity_calc orientation_direction_tuning, +% spatial_frequency_tuning, temporal_frequency_tuning; +% none for contrastsensitivity_calc), none of which +% has a superclass migrator; the old +migrators/ +% wrappers (calcCommon) were never reached for them +% and are deleted. The `app` block is read through +% did2.convert.v1read.readApp. Written by +% ndi.calc.stimulus.tuningcurve (NDI-matlab) and +% ndi.calc.vis.* (NDIcalc-vis-matlab). Round trips: +% testRawV1RoundTripTuning. % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. names = {'subject', 'subject_group', 'treatment', 'treatment_drug', ... - 'treatment_transfer', 'virus_injection', 'element', 'element_epoch'}; + 'treatment_transfer', 'virus_injection', 'element', 'element_epoch', ... + 'tuningcurve_calc', 'contrasttuning_calc', 'oridirtuning_calc', ... + 'spatial_frequency_tuning_calc', 'temporal_frequency_tuning_calc', ... + 'contrastsensitivity_calc'}; + +% v1 name migrator (+migrators_j); TEMPORARY, see above +TABLE = { ... + 'contrasttuning_calc', 'contrast_tuning_calc'; ... + 'contrastsensitivity_calc', 'contrast_sensitivity_calc'}; + +if nargin >= 1 + names = migratorOf(char(v1Name), TABLE); + return; +end +migrators = cellfun(@(n) migratorOf(n, TABLE), names, 'UniformOutput', false); +end + +function m = migratorOf(v1Name, table) +hit = strcmp(table(:, 1), v1Name); +if any(hit) + m = table{find(hit, 1), 2}; +else + m = v1Name; +end end diff --git a/src/did/+did2/+convert/v1_to_v2.m b/src/did/+did2/+convert/v1_to_v2.m index aec65af6..c8a90ae8 100644 --- a/src/did/+did2/+convert/v1_to_v2.m +++ b/src/did/+did2/+convert/v1_to_v2.m @@ -885,7 +885,9 @@ function refuseUnknownSchemaVersion(body) % A class listed by did2.convert.rawV1Classes has its own +migrators_j % migrator by definition ([early migration pieces fixed] (1): no identity % fallback), so a missing one is an error, which quarantines the document. -fqn = ['did2.convert.migrators_j.', className]; +% The migrator's name is the v1 name, except where rawV1Classes' one table +% maps it (contrasttuning_calc -> contrast_tuning_calc, temporary). +fqn = ['did2.convert.migrators_j.', did2.convert.rawV1Classes(className)]; if isempty(which(fqn)) error('did2:convert:rawV1NoMigrator', ... ['%s is listed by did2.convert.rawV1Classes but has no ' ... diff --git a/tests/+did2/+unittest/testMigrators.m b/tests/+did2/+unittest/testMigrators.m index e81be02f..175999a8 100644 --- a/tests/+did2/+unittest/testMigrators.m +++ b/tests/+did2/+unittest/testMigrators.m @@ -176,29 +176,41 @@ function testCalcWrapperPipesThroughHelper(testCase) % wrapper produces the same shape (input_parameters preserved on % the subclass block, no calculator block) as a direct calcCommon % call. -v1 = wrap('oridirtuning_calc', 'oridirtuning_calc', struct( ... +v1 = wrap('speed_tuning_calc', 'speed_tuning_calc', struct( ... 'input_parameters', [])); -out = did2.convert.migrators.oridirtuning_calc( ... +out = did2.convert.migrators.speed_tuning_calc( ... did2.convert.universalRenames(v1)); -verifyTrue(testCase, isstruct(out.oridirtuning_calc.input_parameters)); +verifyTrue(testCase, isstruct(out.speed_tuning_calc.input_parameters)); verifyFalse(testCase, isfield(out, 'calculator')); end +function testTheOldTuningWrappersAreGone(testCase) +% [early migration pieces fixed] (1) (Jess Haley, 2026-10-26): one migrator +% per class. The tuning family reads raw v1 through its +migrators_j migrator +% (did2.convert.rawV1Classes); the old +migrators/.m wrappers were never +% reached for them (a class with a +migrators_j migrator skips its +migrators +% one, and no v1 class names these as a superclass) and are deleted. +for cls = {'tuningcurve_calc', 'oridirtuning_calc', 'contrast_sensitivity_calc', ... + 'contrast_tuning_calc', 'spatial_frequency_tuning_calc', ... + 'temporal_frequency_tuning_calc'} + verifyEmpty(testCase, which(['did2.convert.migrators.' cls{1}]), ... + sprintf('+migrators/%s.m is back', cls{1})); + verifyNotEmpty(testCase, which(['did2.convert.migrators_j.' cls{1}]), ... + sprintf('+migrators_j/%s.m is missing', cls{1})); +end +end + function testCalcMigratorWrappersAllResolve(testCase) % Smoke: every concrete *_calc wrapper exists and runs cleanly on a % minimal v1 body. The wrapper does not vary by class today (the % calculator-identity lookup is handled by app-block rename upstream), % but exercising each entry catches accidental deletions and ensures % the dispatcher can still resolve the migrator by class name. +% (the tuning family's wrappers are deleted: those classes read raw v1 with +% their +migrators_j migrator; testTheOldTuningWrappersAreGone) classes = { - 'tuningcurve_calc'; - 'oridirtuning_calc'; 'hartley_calc'; - 'contrast_sensitivity_calc'; - 'contrast_tuning_calc'; - 'spatial_frequency_tuning_calc'; 'speed_tuning_calc'; - 'temporal_frequency_tuning_calc'; 'simple_calc'; }; for k = 1:numel(classes) diff --git a/tests/+did2/+unittest/testRawV1RoundTrip.m b/tests/+did2/+unittest/testRawV1RoundTrip.m index 5e5c90c3..3ec7e44f 100644 --- a/tests/+did2/+unittest/testRawV1RoundTrip.m +++ b/tests/+did2/+unittest/testRawV1RoundTrip.m @@ -32,10 +32,14 @@ % ===================== the switch ====================================== function testEverySwitchedClassHasAMigratorAndAnInverse(testCase) -names = did2.convert.rawV1Classes(); +% the migrator by rawV1Classes' table (the v1 name, or its temporary mapping: +% contrasttuning_calc -> contrast_tuning_calc); the inverse by the v1 name +[names, migrators] = did2.convert.rawV1Classes(); verifyNotEmpty(testCase, names); +verifyEqual(testCase, numel(migrators), numel(names)); for k = 1:numel(names) - verifyNotEmpty(testCase, which(['did2.convert.migrators_j.' names{k}]), ... + verifyEqual(testCase, did2.convert.rawV1Classes(names{k}), migrators{k}); + verifyNotEmpty(testCase, which(['did2.convert.migrators_j.' migrators{k}]), ... sprintf('%s is switched to raw v1 but has no +migrators_j migrator', names{k})); verifyNotEmpty(testCase, which(['did2.convert.roundtrip.' names{k}]), ... sprintf('%s is switched to raw v1 but has no round-trip inverse', names{k})); diff --git a/tests/+did2/+unittest/testRawV1RoundTripTuning.m b/tests/+did2/+unittest/testRawV1RoundTripTuning.m new file mode 100644 index 00000000..7c4ec8f1 --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripTuning.m @@ -0,0 +1,370 @@ +function tests = testRawV1RoundTripTuning +%TESTRAWV1ROUNDTRIPTUNING The tuning family read as raw v1, and its round trip: +% tuningcurve_calc, contrasttuning_calc, oridirtuning_calc, +% spatial_frequency_tuning_calc, temporal_frequency_tuning_calc, +% contrastsensitivity_calc. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes), [early migration pieces +% fixed] (1) (one migrator per class: the old +migrators/ wrappers are +% deleted) and [migration reliability practices] (a) (a round trip per class, +% did2.convert.roundtrip.check). +% +% THE v1 DOCUMENTS ARE THE WRITERS' OWN OUTPUT. Each calculator's self-test +% stores the document it wrote as `mock.N.json` (ndi.mock.ctest +% mock_expected_filename: "the expected NDI document answer"); those files +% are copied verbatim to tests/+did2/fixtures/ndi_writer_outputs: +% +% tuningcurve_calc.mock.1.json NDI-matlab locked `main` 3cb19a8, +% +ndi/+calc/+stimulus/mock/tuningcurve +% oridirtuning_calc.mock.1.json NDIcalc-vis-matlab 00e3e0f (its `main`; +% contrasttuning_calc.mock.1.json not in did-schema's sibling lock), +% spatial_frequency_tuning_calc.mock.6.json +ndi/+calc/+vis/mock/ +% temporal_frequency_tuning_calc.mock.4.json +% contrastsensitivity_calc.mock.1.json +% +% The templates they are written over are in tests/+did2/fixtures/ +% ndi_templates, copied verbatim (NDI-matlab 3cb19a8: tuningcurve_calc, +% stimulus_tuningcurve, orientation_direction_tuning, calculator, app; +% NDIcalc-vis-matlab 00e3e0f: the five ndi.calc.vis calculators and +% contrast_tuning, spatial_frequency_tuning, temporal_frequency_tuning). +% Where a template and its writer disagree the writer wins: the writer +% spells `vector.Hotelling2Test` (the template `hotelling2test`) and writes +% a `calculator` block and `class_version` 2; the corpora (Soph, 20211116) +% hold the older shape with no `calculator` block and `class_version` 1 +% (the "corpus vintage" fixtures below). +% +% WHAT THE WRITERS' DOCUMENTS DO TODAY. oridirtuning_calc and +% contrastsensitivity_calc convert, and their round trips lose nothing. The +% other four carry whole as v1 (carry-056: the contrast fits' relative max +% gain, saturation index and sensitivity; the SF and TF `abs` block; +% tuningcurve_calc's stimid and stimulus_presentation_number have no V2 +% home), and a carry round-trips as itself. To prove their inverses, the +% same documents with exactly those fields removed (the "converted shape" +% fixtures, DID-side) convert and round trip with nothing lost. +% +% Every fixture converts or carries exactly as on the universalRenames path +% (testTheSwitchChangesNoConvertedTuning), and broken inputs must fail the +% round trip. No writer-shaped document here loses a field: there are no +% known findings for this family. +tests = functiontests(localfunctions); +end + +% ===================== the writers' documents round trip ================= + +function testWriterOutputsRoundTrip(testCase) +roundTripCases(testCase, { ... + 'oridir writer output', writerOutput('oridirtuning_calc'), false; ... + 'oridir corpus vintage', corpusVintage(writerOutput('oridirtuning_calc')), false; ... + 'contrast sensitivity writer output', writerOutput('contrastsensitivity_calc'), false; ... + 'contrast sensitivity corpus vintage', ... + corpusVintage(writerOutput('contrastsensitivity_calc')), false; ... + 'contrast tuning writer output', writerOutput('contrasttuning_calc'), true; ... + 'SF tuning writer output', writerOutput('spatial_frequency_tuning_calc'), true; ... + 'TF tuning writer output', writerOutput('temporal_frequency_tuning_calc'), true; ... + 'tuningcurve writer output', writerOutput('tuningcurve_calc'), true}); +end + +function testConvertedShapesRoundTrip(testCase) +% the writers' documents with exactly the fields that carry them removed: +% each converts, and its inverse rebuilds everything that is left +roundTripCases(testCase, { ... + 'contrast tuning, converted shape', convertedShape('contrasttuning_calc'), false; ... + 'SF tuning, converted shape', convertedShape('spatial_frequency_tuning_calc'), false; ... + 'TF tuning, converted shape', convertedShape('temporal_frequency_tuning_calc'), false; ... + 'tuningcurve, converted shape', convertedShape('tuningcurve_calc'), false}); +end + +function testEveryWriterFieldOfAConvertedOridirIsAccountedFor(testCase) +% each leaf of the writer's document is matched, restated, not set or exempt, +% by name (the denominator is the writer's document, not the inverse's) +v1 = writerOutput('oridirtuning_calc'); +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +accounted = [r.matched, r.restated, r.equivalent, r.not_set, r.exempt]; +verifyEqual(testCase, numel(accounted), r.fields_inspected); +for p = {'base.id', 'base.session_id', 'base.name', 'base.datestamp', ... + 'depends_on(1).value', 'depends_on(2).value', 'app.name', 'app.version', ... + 'app.url', 'app.os', 'app.os_version', 'app.interpreter', ... + 'app.interpreter_version', 'oridirtuning_calc.depends_on(1).value', ... + 'orientation_direction_tuning.properties.coordinates', ... + 'orientation_direction_tuning.tuning_curve.direction', ... + 'orientation_direction_tuning.tuning_curve.individual', ... + 'orientation_direction_tuning.tuning_curve.control_individual', ... + 'orientation_direction_tuning.vector.Hotelling2Test', ... + 'orientation_direction_tuning.fit.double_gaussian_parameters', ... + 'orientation_direction_tuning.fit.hwhh', 'document_class.class_name'} + verifyTrue(testCase, any(strcmp(p{1}, [r.matched, r.restated, r.not_set])), ... + sprintf('%s is not accounted for', p{1})); +end +end + +% ===================== the switch ====================================== + +function testBothSpellingsDispatch(testCase) +% rawV1Classes lists the v1 spelling and maps it to the migrator in ONE table +% (temporary: it goes with universalRenames). The v1 spelling is read raw; the +% migrator's spelling is not switched and reaches it through universalRenames; +% both give the same documents. +verifyEqual(testCase, did2.convert.rawV1Classes('contrasttuning_calc'), 'contrast_tuning_calc'); +verifyEqual(testCase, did2.convert.rawV1Classes('contrastsensitivity_calc'), ... + 'contrast_sensitivity_calc'); +verifyEqual(testCase, did2.convert.rawV1Classes('oridirtuning_calc'), 'oridirtuning_calc'); +names = did2.convert.rawV1Classes(); +verifyFalse(testCase, any(strcmp(names, 'contrast_tuning_calc'))); +verifyFalse(testCase, any(strcmp(names, 'contrast_sensitivity_calc'))); +pairs = {convertedShape('contrasttuning_calc'), 'contrast_tuning_calc'; ... + writerOutput('contrastsensitivity_calc'), 'contrast_sensitivity_calc'}; +for k = 1:size(pairs, 1) + v1 = pairs{k, 1}; + snake = respelled(v1, pairs{k, 2}); + a = runRaw(v1); + b = runRaw(snake); + label = v1.document_class.class_name; + verifyEqual(testCase, a.summary.legacy_ndi_document.bodies_read_raw_v1, 1, label); + verifyEqual(testCase, b.summary.legacy_ndi_document.bodies_read_raw_v1, 0, pairs{k, 2}); + verifyEmpty(testCase, a.passthrough, label); + verifyEmpty(testCase, b.passthrough, pairs{k, 2}); + verifyEqual(testCase, numel(a.migrated), numel(b.migrated), label); + for j = 1:min(numel(a.migrated), numel(b.migrated)) + verifyTrue(testCase, isequaln(a.migrated{j}.toStruct(), b.migrated{j}.toStruct()), ... + sprintf('%s: document %d differs between the two spellings', label, j)); + end +end +end + +function testTheSwitchChangesNoConvertedTuning(testCase) +% "keep behaviour identical": every document the raw path CONVERTS is the one +% the universalRenames path converted (ids are deterministic, practice (b)); +% a carry is carried on both paths, the raw one the untouched v1 source +fixtures = [cellfun(@writerOutput, familyNames(), 'UniformOutput', false), ... + cellfun(@convertedShape, {'contrasttuning_calc', 'spatial_frequency_tuning_calc', ... + 'temporal_frequency_tuning_calc', 'tuningcurve_calc'}, 'UniformOutput', false)]; +for k = 1:numel(fixtures) + v1 = fixtures{k}; + raw = runRaw(v1); + old = did2.convert.v1_to_v2(v1, 'Validate', false, ... + 'TargetVersion', 'V_eta', 'RawV1Classes', {}); + label = sprintf('fixture %d (%s)', k, v1.document_class.class_name); + verifyEqual(testCase, raw.summary.legacy_ndi_document.bodies_read_raw_v1, 1, label); + verifyEmpty(testCase, raw.quarantine, label); + verifyEqual(testCase, numel(raw.quarantine), numel(old.quarantine), label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), ... + [label ': carried on one path only']); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + if ~isempty(raw.passthrough) + verifyTrue(testCase, isequaln(stripStamp(raw.migrated{1}.toStruct()), v1), ... + [label ': the carry is not the v1 source']); + continue; + end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + verifyTrue(testCase, isequaln(raw.migrated{j}.toStruct(), old.migrated{j}.toStruct()), ... + sprintf('%s, document %d differs between the raw and the renamed path', label, j)); + end +end +end + +function testWriterOutputsValidate(testCase) +% the converted documents pass the V2 schema (the corpus run validates too) +for cls = {'oridirtuning_calc', 'contrastsensitivity_calc'} + v1 = writerOutput(cls{1}); + out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta'); + verifyEmpty(testCase, out.quarantine, cls{1}); + verifyGreaterThan(testCase, numel(out.migrated), 1, cls{1}); +end +end + +% ===================== every field accounted for ========================= + +function testAFieldTheFoldDoesNotReadCarriesTheDocument(testCase) +% jCalculation 'AccountForEveryField' (the switched migrators): a field the +% fold reads nowhere carries the document whole as v1 (carry-056) instead of +% being dropped from a converted one ([generic stage is lossless]) +v1 = convertedShape('tuningcurve_calc'); +v1.tuningcurve_calc.log = 'contrast best value is 1.'; +verifyCarriedFor(testCase, v1, 'tuningcurve_calc.log'); + +v1 = writerOutput('oridirtuning_calc'); +v1.calculator.note = 'a calculator field'; +verifyCarriedFor(testCase, v1, 'calculator.note'); + +v1 = writerOutput('oridirtuning_calc'); +v1.app.license = 'MIT'; +verifyCarriedFor(testCase, v1, 'app.license'); + +v1 = writerOutput('oridirtuning_calc'); +v1.depends_on(end + 1) = struct('name', 'stimulus_presentation_id', 'value', 'sp_1'); +verifyCarriedFor(testCase, v1, 'depends_on stimulus_presentation_id'); + +v1 = writerOutput('oridirtuning_calc'); +v1.orientation_direction_tuning.significance.f_test_p = 0.01; +verifyCarriedFor(testCase, v1, 'significance.f_test_p'); + +v1 = writerOutput('contrastsensitivity_calc'); +v1.contrastsensitivity_calc.bandwidth_RB = [1 2 3]; +verifyCarriedFor(testCase, v1, 'contrastsensitivity_calc.bandwidth_RB'); + +v1 = writerOutput('oridirtuning_calc'); +v1.extra_block = struct('x', 1); +verifyCarriedFor(testCase, v1, 'extra_block'); +end + +% ===================== a check that cannot fail proves nothing =========== + +function testAMissingVersionIsReportedLost(testCase) +v1 = writerOutput('oridirtuning_calc'); +docs = structs(runRaw(v1).migrated); +for k = 1:numel(docs) + d = docs{k}; + if strcmp(d.document_class.class_name, 'assertion') && isfield(d, 'text') ... + && strcmp(char(d.text.value.text), v1.app.version) + docs(k) = []; + break; + end +end +r = did2.convert.roundtrip.check(v1, docs); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, {r.lost.path}, {'app.version'}); +end + +function testAChangedResponseIsReportedLost(testCase) +v1 = writerOutput('oridirtuning_calc'); +docs = structs(runRaw(v1).migrated); +docs{1}.tuning_curve.value.mean(3) = docs{1}.tuning_curve.value.mean(3) + 1; +r = did2.convert.roundtrip.check(v1, docs); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, {r.lost.path}, {'orientation_direction_tuning.tuning_curve.mean'}); +end + +function testADifferentSourceIsReportedLost(testCase) +% the v1 document the emitted ones are compared with states another value +v1 = writerOutput('contrastsensitivity_calc'); +out = runRaw(v1); +v1.contrastsensitivity_calc.relative_max_gain_RBN(2) = 0; +v1.depends_on(4).value = 'another_contrast_tuning'; +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, sort({r.lost.path}), ... + {'contrastsensitivity_calc.relative_max_gain_RBN', 'depends_on(4).value'}); +end + +function testAnUnplacedDocumentFailsTheRoundTrip(testCase) +v1 = writerOutput('oridirtuning_calc'); +out = runRaw(v1); +extra = runRaw(writerOutput('contrastsensitivity_calc')).migrated; +r = did2.convert.roundtrip.check(v1, [out.migrated, extra(1)]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +% ===================== helpers ========================================= + +function roundTripCases(testCase, cases) +for k = 1:size(cases, 1) + [label, v1, carried] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, [label ': quarantined']); + if ~isempty(out.quarantine) + continue; + end + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); + verifyEqual(testCase, r.carried, carried, [label ': carried?']); + verifyEmpty(testCase, r.lost, sprintf('%s: lost: %s', label, describeLost(r))); + verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); + verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end +end + +function verifyCarriedFor(testCase, v1, path) +out = runRaw(v1); +label = sprintf('%s with %s', v1.document_class.class_name, path); +verifyEmpty(testCase, out.quarantine, label); +verifyEqual(testCase, numel(out.passthrough), 1, [label ': not carried']); +if numel(out.migrated) ~= 1 + return; +end +verifyTrue(testCase, isequaln(stripStamp(out.migrated{1}.toStruct()), v1), ... + [label ': the carry is not the v1 source']); +notes = out.summary.migration_notes; +assertTrue(testCase, isfield(notes, 'carried_as_v1'), [label ': no carried_as_v1 note']); +d = strjoin(cellstr(notes.carried_as_v1.distinct_details), ' || '); +verifyTrue(testCase, contains(d, ['[carry-056] ' path]) || contains(d, ['.' path]), ... + sprintf('%s: the note does not name it: %s', label, d)); +end + +function s = describeLost(r) +s = ''; +for k = 1:numel(r.lost) + s = [s, sprintf('%s; ', r.lost(k).path)]; %#ok +end +end + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function c = structs(docs) +c = cellfun(@(d) d.toStruct(), docs, 'UniformOutput', false); +end + +function s = stripStamp(s) +s.document_class = rmfield(s.document_class, 'schema_version'); +end + +function names = familyNames() +names = {'tuningcurve_calc', 'contrasttuning_calc', 'oridirtuning_calc', ... + 'spatial_frequency_tuning_calc', 'temporal_frequency_tuning_calc', ... + 'contrastsensitivity_calc'}; +end + +function v1 = writerOutput(cls) +% the calculator's own stored output (see the header), as a corpus delivers it +files = struct('tuningcurve_calc', 'tuningcurve_calc.mock.1.json', ... + 'contrasttuning_calc', 'contrasttuning_calc.mock.1.json', ... + 'oridirtuning_calc', 'oridirtuning_calc.mock.1.json', ... + 'spatial_frequency_tuning_calc', 'spatial_frequency_tuning_calc.mock.6.json', ... + 'temporal_frequency_tuning_calc', 'temporal_frequency_tuning_calc.mock.4.json', ... + 'contrastsensitivity_calc', 'contrastsensitivity_calc.mock.1.json'); +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_writer_outputs', files.(cls)); +v1 = jsondecode(fileread(f)); +end + +function v1 = corpusVintage(v1) +% the shape the Soph and 20211116 corpora hold: no `calculator` block, class +% version 1 (an earlier writer) +v1 = rmfield(v1, 'calculator'); +v1.document_class.class_version = 1; +end + +function v1 = convertedShape(cls) +% the writer's document with exactly the fields that carry it removed +v1 = writerOutput(cls); +switch cls + case 'tuningcurve_calc' + v1.stimulus_tuningcurve.stimid = []; + v1.stimulus_tuningcurve.stimulus_presentation_number = []; + case 'contrasttuning_calc' + for m = {'RB', 'RBN', 'RBNS'} + for x = {'relative_max_gain', 'saturation_index', 'sensitivity'} + v1.contrast_tuning.fit = rmfield(v1.contrast_tuning.fit, ... + ['naka_rushton_' m{1} '_' x{1}]); + end + end + case 'spatial_frequency_tuning_calc' + v1.spatial_frequency_tuning = rmfield(v1.spatial_frequency_tuning, 'abs'); + case 'temporal_frequency_tuning_calc' + v1.temporal_frequency_tuning = rmfield(v1.temporal_frequency_tuning, 'abs'); +end +end + +function s = respelled(v1, name) +% V1 with its class and block spelled NAME (the migrator's spelling) +s = v1; +old = s.document_class.class_name; +s.document_class.class_name = name; +s.document_class.property_list_name = name; +s.(name) = s.(old); +s = rmfield(s, old); +end diff --git a/tests/+did2/fixtures/ndi_templates/calculator.json b/tests/+did2/fixtures/ndi_templates/calculator.json new file mode 100644 index 00000000..1845ac36 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/calculator.json @@ -0,0 +1,15 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/calculator.json", + "validation": "$NDISCHEMAPATH\/calculator_schema.json", + "class_name": "calculator", + "property_list_name": "calculator", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/app.json" } + ] + }, + "calculator": { + } +} diff --git a/tests/+did2/fixtures/ndi_templates/contrast_tuning.json b/tests/+did2/fixtures/ndi_templates/contrast_tuning.json new file mode 100644 index 00000000..979f258a --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/contrast_tuning.json @@ -0,0 +1,73 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/vision\/contrast_tuning.json", + "validation": "$NDICALCSCHEMAPATH\/vision\/contrast_tuning_schema.json", + "class_name": "contrast_tuning", + "property_list_name": "contrast_tuning", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "element_id", + "value": "" + }, + { "name": "stimulus_tuningcurve_id", + "value": "" + } + ], + "contrast_tuning": { + "properties": { + "response_units": 0, + "response_type": "mean" + }, + "tuning_curve": { + "contrast": 0, + "mean": 0, + "stddev": 0, + "stderr": 0, + "individual": { + }, + "control_stddev": 0, + "control_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 1, + "across_stimuli_anova_p": 1 + }, + "fitless": { + "interpolated_c50": 0.5 + }, + "fit": { + "naka_rushton_RB_parameters": [0], + "naka_rushton_RB_contrast": [0], + "naka_rushton_RB_values": [0], + "naka_rushton_RB_pref": [0], + "naka_rushton_RB_empirical_c50": [0], + "naka_rushton_RB_r2": [0], + "naka_rushton_RB_relative_max_gain": [0], + "naka_rushton_RB_saturation_index": [0], + "naka_rushton_RB_sensitivity": [0], + "naka_rushton_RBN_parameters": [0], + "naka_rushton_RBN_contrast": [0], + "naka_rushton_RBN_values": [0], + "naka_rushton_RBN_pref": [0], + "naka_rushton_RBN_empirical_c50": [0], + "naka_rushton_RBN_r2": [0], + "naka_rushton_RBN_relative_max_gain": [0], + "naka_rushton_RBN_saturation_index": [0], + "naka_rushton_RBN_sensitivity": [0], + "naka_rushton_RBNS_parameters": [0], + "naka_rushton_RBNS_contrast": [0], + "naka_rushton_RBNS_values": [0], + "naka_rushton_RBNS_pref": [0], + "naka_rushton_RBNS_empirical_c50": [0], + "naka_rushton_RBNS_r2": [0], + "naka_rushton_RBNS_relative_max_gain": [0], + "naka_rushton_RBNS_saturation_index": [0], + "naka_rushton_RBNS_sensitivity": [0] + } + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/contrastsensitivity_calc.json b/tests/+did2/fixtures/ndi_templates/contrastsensitivity_calc.json new file mode 100644 index 00000000..24ce2a8b --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/contrastsensitivity_calc.json @@ -0,0 +1,57 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/contrastsensitivity_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/contrastsensitivity_calc_v2_schema.json", + "class_name": "contrastsensitivity_calc", + "property_list_name": "contrastsensitivity_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" } + ] + }, + "depends_on": [ + { + "name": "element_id", + "value": [] + }, + { "name": "stimulus_presentation_id", + "value": [] + }, + { + "name": "stimulus_response_scalar_id", + "value": [] + } + ], + "contrastsensitivity_calc": { + "input_parameters": { + }, + "depends_on": [ + { + "name": "element_id", + "value": [] + } + ], + "spatial_frequencies": [], + "sensitivity_RB": [], + "sensitivity_RBN": [], + "sensitivity_RBNS": [], + "relative_max_gain_RB": [], + "relative_max_gain_RBN": [], + "relative_max_gain_RBNS": [], + "empirical_c50_RB": [], + "empirical_c50_RBN": [], + "empirical_c50_RBNS": [], + "saturation_index_RB": [], + "saturation_index_RBN": [], + "saturation_index_RBNS": [], + "parameters_RB": [], + "parameters_RBN": [], + "parameters_RBNS": [], + "fitless_interpolated_c50": [], + "is_modulated_response": 0, + "visual_response_p_bonferroni": [], + "response_varies_p_bonferroni": [], + "response_type": [] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/contrasttuning_calc.json b/tests/+did2/fixtures/ndi_templates/contrasttuning_calc.json new file mode 100644 index 00000000..e7f72e47 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/contrasttuning_calc.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/contrasttuning_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/contrasttuning_calc_v2_schema.json", + "class_name": "contrasttuning_calc", + "property_list_name": "contrasttuning_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDICALCDOCUMENTPATH\/vision\/contrast_tuning.json"} + ] + }, + "contrasttuning_calc": { + "input_parameters": { + }, + "depends_on": [ + { + "name": "stimulus_tuningcurve_id", + "value": [] + } + ] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/oridirtuning_calc.json b/tests/+did2/fixtures/ndi_templates/oridirtuning_calc.json new file mode 100644 index 00000000..7b9c773e --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/oridirtuning_calc.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/oridirtuning_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/oridirtuning_calc_v2_schema.json", + "class_name": "oridirtuning_calc", + "property_list_name": "oridirtuning_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDIDOCUMENTPATH\/stimulus\/vision\/oridir\/orientation_direction_tuning.json"} + ] + }, + "oridirtuning_calc": { + "input_parameters": { + }, + "depends_on": [ + { + "name": "stimulus_tuningcurve_id", + "value": [] + } + ] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/orientation_direction_tuning.json b/tests/+did2/fixtures/ndi_templates/orientation_direction_tuning.json new file mode 100644 index 00000000..2bb9fd70 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/orientation_direction_tuning.json @@ -0,0 +1,66 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/stimulus\/vision\/oridir\/orientation_direction_tuning.json", + "validation": "$NDISCHEMAPATH\/stimulus\/vision\/oridir\/orientation_direction_tuning_schema.json", + "class_name": "orientation_direction_tuning", + "property_list_name": "orientation_direction_tuning", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { + "name": "element_id", + "value": "" + }, + { "name": "stimulus_tuningcurve_id", + "value": "" + } + ], + "orientation_direction_tuning": { + "properties": { + "coordinates": "compass", + "response_units": 0, + "response_type": "mean" + }, + "tuning_curve": { + "direction": 0, + "mean": 0, + "stddev": 0, + "stderr": 0, + "individual": { + }, + "raw_individual": { + }, + "control_individual": { + } + }, + "significance": { + "visual_response_anova_p": 1, + "across_stimuli_anova_p": 1 + }, + "vector": { + "circular_variance": 1, + "direction_circular_variance": 1, + "hotelling2test": 1, + "orientation_preference": 0, + "direction_preference": 0, + "direction_hotelling2test": 1, + "dot_direction_significance": 1 + }, + "fit": { + "double_gaussian_parameters": [0], + "double_gaussian_fit_angles": [0], + "double_gaussian_fit_values": [0], + "orientation_preferred_orthogonal_ratio": [0], + "direction_preferred_null_ratio": [0], + "orientation_preferred_orthogonal_ratio_rectified": [0], + "direction_preferred_null_ratio_rectified": [0], + "orientation_angle_preference": 0, + "direction_angle_preference": 0, + "hwhh": 0 + } + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning.json b/tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning.json new file mode 100644 index 00000000..49d981a1 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning.json @@ -0,0 +1,240 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/vision\/spatial_frequency_tuning.json", + "validation": "$NDICALCSCHEMAPATH\/vision\/spatial_frequency_tuning_schema.json", + "class_name": "spatial_frequency_tuning", + "property_list_name": "spatial_frequency_tuning", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "element_id", + "value": "" + }, + { "name": "stimulus_tuningcurve_id", + "value": "" + } + ], + "spatial_frequency_tuning": { + "properties": { + "response_units": 0, + "response_type": "mean" + }, + "tuning_curve": { + "spatial_frequency": 0, + "mean": 0, + "stddev": 0, + "stderr": 0, + "individual": {}, + "control_mean": 0, + "control_stddev": 0, + "control_stderr": 0, + "control_mean_stddev": 0, + "control_mean_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 1, + "across_stimuli_anova_p": 1 + }, + "fitless": { + "L50": 0, + "Pref": 0, + "H50": 0, + "bandwidth": 0, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon_c": { + "parameters": [ + 0, + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_spline": { + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "abs": { + "fitless": { + "L50": 0, + "Pref": 0, + "H50": 0, + "bandwidth": 0, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon_c": { + "parameters": [ + 0, + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_spline": { + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + } + } + } +} diff --git a/tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning_calc.json b/tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning_calc.json new file mode 100644 index 00000000..2da94b93 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/spatial_frequency_tuning_calc.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/spatial_frequency_tuning_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/spatial_frequency_tuning_calc_v2_schema.json", + "class_name": "spatial_frequency_tuning_calc", + "property_list_name": "spatial_frequency_tuning_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDICALCDOCUMENTPATH\/vision\/spatial_frequency_tuning.json"} + ] + }, + "spatial_frequency_tuning_calc": { + "input_parameters": { + }, + "depends_on": [ + { + "name": "stimulus_tuningcurve_id", + "value": [] + } + ] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/stimulus_tuningcurve.json b/tests/+did2/fixtures/ndi_templates/stimulus_tuningcurve.json new file mode 100644 index 00000000..1a588c3a --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/stimulus_tuningcurve.json @@ -0,0 +1,39 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/stimulus\/stimulus_tuningcurve.json", + "validation": "$NDISCHEMAPATH\/stimulus\/stimulus_tuningcurve_schema.json", + "class_name": "stimulus_tuningcurve", + "property_list_name": "stimulus_tuningcurve", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + { "name": "element_id", + "value": "" + }, + { "name": "stimulus_response_scalar_id", + "value": "" + } + ], + "stimulus_tuningcurve": { + "independent_variable_label": [[]], + "independent_variable_value": [], + "stimid": [], + "response_mean": [], + "response_stddev": [], + "response_stderr": [], + "individual_responses_real": [[]], + "individual_responses_imaginary": [[]], + "stimulus_presentation_number": [], + "control_stimid": [], + "control_response_mean": [], + "control_response_stddev": [], + "control_response_stderr": [], + "control_individual_responses_real": [[]], + "control_individual_responses_imaginary": [[]], + "response_units": "Spikes/s" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning.json b/tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning.json new file mode 100644 index 00000000..a3c4ad04 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning.json @@ -0,0 +1,242 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/vision\/temporal_frequency_tuning.json", + "validation": "$NDICALCSCHEMAPATH\/vision\/temporal_frequency_tuning_schema.json", + "class_name": "temporal_frequency_tuning", + "property_list_name": "temporal_frequency_tuning", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "element_id", + "value": "" + }, + { "name": "stimulus_tuningcurve_id", + "value": "" + } + ], + "temporal_frequency_tuning": { + "properties": { + "response_units": 0, + "response_type": "mean" + }, + "tuning_curve": { + "temporal_frequency": 0, + "mean": 0, + "stddev": 0, + "stderr": 0, + "individual": {}, + "control_mean": 0, + "control_stddev": 0, + "control_stderr": 0, + "control_mean_stddev": 0, + "control_mean_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 1, + "across_stimuli_anova_p": 1 + }, + "fitless": { + "L50": 0, + "Pref": 0, + "H50": 0, + "bandwidth": 0, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 0, + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon_c": { + "parameters": [ + 0, + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_spline": { + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "abs": { + "fitless": { + "L50": 0, + "Pref": 0, + "H50": 0, + "bandwidth": 0, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 0, + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_movshon_c": { + "parameters": [ + 0, + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_spline": { + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0, + 0, + 0 + ], + "values": [ + 0 + ], + "fit": [ + 0 + ], + "L50": 0, + "Pref": 0, + "H50": 0, + "R2": 0, + "bandwidth": 0 + } + } + } +} diff --git a/tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning_calc.json b/tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning_calc.json new file mode 100644 index 00000000..c0eb7356 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/temporal_frequency_tuning_calc.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/temporal_frequency_tuning_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/temporal_frequency_tuning_calc_v2_schema.json", + "class_name": "temporal_frequency_tuning_calc", + "property_list_name": "temporal_frequency_tuning_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDICALCDOCUMENTPATH\/vision\/temporal_frequency_tuning.json"} + ] + }, + "temporal_frequency_tuning_calc": { + "input_parameters": { + }, + "depends_on": [ + { + "name": "stimulus_tuningcurve_id", + "value": [] + } + ] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/tuningcurve_calc.json b/tests/+did2/fixtures/ndi_templates/tuningcurve_calc.json new file mode 100644 index 00000000..efd4588e --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/tuningcurve_calc.json @@ -0,0 +1,35 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/apps\/calculators\/tuningcurve_calc.json", + "validation": "$NDISCHEMAPATH\/apps\/calculations\/tuningcurve_calc_v2_schema.json", + "class_name": "tuningcurve_calc", + "property_list_name": "tuningcurve_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDIDOCUMENTPATH\/stimulus/stimulus_tuningcurve.json"} + ] + }, + "tuningcurve_calc": { + "input_parameters": { + "independent_label": [], + "independent_parameter": [], + "best_algorithm": "empirical_maximum", + "selection": [ + { + "property": [], + "operation": [], + "value": [] + } + ] + }, + "log": [], + "depends_on": [ + { + "name": "stimulus_response_scalar_id", + "value": [] + } + ] + } +} + diff --git a/tests/+did2/fixtures/ndi_writer_outputs/contrastsensitivity_calc.mock.1.json b/tests/+did2/fixtures/ndi_writer_outputs/contrastsensitivity_calc.mock.1.json new file mode 100644 index 00000000..b4546729 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/contrastsensitivity_calc.mock.1.json @@ -0,0 +1 @@ +{"app":{"name":"ndi.calc.vis.contrast_sensitivity","version":"c9478e1b2b2c712894d8b6a77901a924c201fd57","url":"https://github.com/VH-Lab/NDIcalc-vis-matlab","os":"MACA64","os_version":"26.6.2","interpreter":"MATLAB","interpreter_version":"24.2"},"base":{"id":"412696f9b4464d38_c0aa2c4e7eabc0c6","session_id":"412696f9abd9edc3_40dbbdf6582271b2","name":"","datestamp":"2026-08-27T00:27:01.341Z"},"calculator":{},"contrastsensitivity_calc":{"input_parameters":[],"depends_on":[],"spatial_frequencies":[0.05,0.1,0.2],"sensitivity_RB":[[56.497175141242934,27.548209366391184,4.7483380816714149],[27.548209366391184,13.037809647979138,1.4927601134497688],[17.889087656529515,8.2101806239737272,0],[13.054830287206267,5.793742757821553,0],[10.16260162601626,4.3440486533449167,0],[8.223684210526315,3.3772374197906108,0],[6.8446269678302532,2.6867275658248251,0],[5.807200929152148,2.1687269572760788,0],[5,1.7658484901995408,0],[4.3535045711797995,1.4436263894904,0]],"sensitivity_RBN":[[16.694490818030051,10.787486515641856,4.3402777777777777],[11.467889908256881,7.390983000739098,1.7724211272598369],[9.115770282588878,5.7870370370370363,0],[7.6863950807071486,4.7664442326024785,0],[6.6889632107023411,4.0176777822418641,0],[5.9347181008902075,3.4199726402188784,0],[5.333333333333333,2.9112081513828238,0],[4.8355899419729207,2.4551927326295115,0],[4.41306266548985,2.0230629172567265,0],[4.0436716538617059,1.5865460891638903,0]],"sensitivity_RBNS":[[17.21170395869191,10.787486515641856,4.3402777777777777],[11.682242990654204,7.390983000739098,1.77210703526493],[9.216589861751153,5.7870370370370363,0],[7.7399380804953557,4.7664442326024785,0],[6.7114093959731544,4.0176777822418641,0],[5.9417706476530006,3.4199726402188784,0],[5.3304904051172706,2.9112081513828238,0],[4.8262548262548259,2.4551927326295115,0],[4.401408450704225,2.0234722784297854,0],[4.0290088638195005,1.5867978419549349,0]],"relative_max_gain_RB":[2.4200326978604974,2.4215397680182953,2.7155794997262519],"relative_max_gain_RBN":[2.348160945229961,2.4356188935403247,3.2575627459463434],"relative_max_gain_RBNS":[2.3141973912783707,2.4346892410643184,3.2562346084853671],"empirical_c50_RB":[0.29,0.29,0.27],"empirical_c50_RBN":[0.28,0.28,0.25],"empirical_c50_RBNS":[0.28,0.28,0.25],"saturation_index_RB":[0,0,0],"saturation_index_RBN":[0,0,0],"saturation_index_RBNS":[0,0,0],"fitless_interpolated_c50":[0.28,0.28,0.26],"parameters_RB":[[16.2992549427411,8.1281981629007483,1.5077546754360518],[0.68716704516141791,0.68642793136917613,0.567064484716663]],"parameters_RBN":[[10.046596161853317,4.9086936910771231,0.90041773055001306],[0.29993416809125428,0.29292676996949074,0.24653059876646269],[1.9622461629263666,2.0853180208368709,2.748292127267582]],"parameters_RBNS":[[10.190715154212279,4.9100057316935883,0.90050918197558227],[0.32264134922444221,0.29339557761411506,0.24655788240245607],[1.884583080486737,2.0831873286245091,2.7469680115758939],[1.0242510670974359,1.0005082199125022,1.0000000000000222]],"is_modulated_response":0,"visual_response_p_bonferroni":3.1065701576993236E-76,"response_varies_p_bonferroni":1.8436396627747019E-67,"response_type":"mean"},"depends_on":[{"name":"element_id","value":"412696f9b4430405_40d48b08f81d4e38"},{"name":"stimulus_presentation_id","value":"412696f9b44361e8_c0d0944db64767ac"},{"name":"stimulus_response_scalar_id","value":"412696f9b4437d94_c0c7f21a0142ddf5"},{"name":"contrasttuning_id_1","value":"412696f9b444686d_c0bd8de1e9d9863f"},{"name":"contrasttuning_id_2","value":"412696f9b445123e_c090b967f41b1924"},{"name":"contrasttuning_id_3","value":"412696f9b4456dd3_40d81bded4aae5a2"}],"document_class":{"definition":"$NDICALCDOCUMENTPATH/calc/contrastsensitivity_calc.json","validation":"$NDICALCSCHEMAPATH/calc/contrastsensitivity_calc_v2_schema.json","class_name":"contrastsensitivity_calc","property_list_name":"contrastsensitivity_calc","class_version":2,"superclasses":[{"definition":"$NDIDOCUMENTPATH/app.json"},{"definition":"$NDIDOCUMENTPATH/base.json"},{"definition":"$NDIDOCUMENTPATH/calculator.json"},{"definition":"$NDIDOCUMENTPATH/base.json"}]}} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_writer_outputs/contrasttuning_calc.mock.1.json b/tests/+did2/fixtures/ndi_writer_outputs/contrasttuning_calc.mock.1.json new file mode 100644 index 00000000..1c643737 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/contrasttuning_calc.mock.1.json @@ -0,0 +1,875 @@ +{ + "app": { + "name": "ndi.calc.vis.contrast_tuning", + "version": "c9478e1b2b2c712894d8b6a77901a924c201fd57", + "url": "https://github.com/VH-Lab/NDIcalc-vis-matlab", + "os": "MACA64", + "os_version": "26.6.2", + "interpreter": "MATLAB", + "interpreter_version": "24.2" + }, + "base": { + "id": "412696f9b44bda28_c0de03423df89c4f", + "session_id": "412696f9abd9edc3_40dbbdf6582271b2", + "name": "", + "datestamp": "2026-08-27T00:27:05.000Z" + }, + "calculator": {}, + "contrast_tuning": { + "properties": { + "response_units": [], + "response_type": "mean" + }, + "tuning_curve": { + "contrast": [ + 0.1, + 0.12915496650148839, + 0.16681005372000587, + 0.21544346900318834, + 0.27825594022071243, + 0.35938136638046275, + 0.46415888336127786, + 0.599484250318941, + 0.774263682681127, + 1 + ], + "mean": [ + 0.94809430343622569, + 1.3338104411687386, + 1.841528479413856, + 2.4873210353024051, + 3.2727754030385916, + 4.1662257461708831, + 5.1179476341519416, + 6.0600098425804756, + 6.9336282926841593, + 7.6821236398246784 + ], + "stddev": [ + 0.0004907773221369358, + 0.0014028269022870346, + 0.0018366345667900923, + 0.0023030016894423451, + 0.0036159960435662442, + 0.001980910893555675, + 0.0017988546359471642, + 0.0040707858883730266, + 0.010723680716968177, + 0.0046264962821859637 + ], + "stderr": [ + 0.00021948229082270016, + 0.00062736326283585294, + 0.00082136794823370481, + 0.0010299336659779887, + 0.0016171225919568825, + 0.00088589028307206781, + 0.0008044722495236991, + 0.0018205107936497915, + 0.0047957758104289049, + 0.0020690320369235729 + ], + "individual": [ + [ + 0.94818097951137681, + 1.33222336297663, + 1.8423296724338896, + 2.4889771075170715, + 3.2699857482207992, + 4.1688817564914711, + 5.1178524295108048, + 6.0549872616571045, + 6.943296171027054, + 7.6815260588767114 + ], + [ + 0.948698042753498, + 1.3342201971487389, + 1.8390963300597907, + 2.4858204637459185, + 3.2754708661721312, + 4.1657894553230843, + 5.1194635746808119, + 6.0609729521777114, + 6.9408537148341107, + 7.6749735658371989 + ], + [ + 0.94816238458007041, + 1.3353790297440875, + 1.8437508716644206, + 2.4841474567246316, + 3.2679450650610842, + 4.1633594244865861, + 5.1200365608400542, + 6.0606317037077311, + 6.9176780026110292, + 7.6834686512975292 + ], + [ + 0.94810179931772987, + 1.3324641644024469, + 1.8421871512750116, + 2.4879370516431432, + 3.2742899461619221, + 4.1666640345325643, + 5.1164314364616708, + 6.0658417972375229, + 6.9277043417919923, + 7.6877571655835872 + ], + [ + 0.94732831101845327, + 1.33476545157179, + 1.8402783716361688, + 2.48972309688126, + 3.2761853895770203, + 4.1664340600207135, + 5.1159541692663675, + 6.0576154981223072, + 6.9386092331566083, + 7.6828927575283679 + ] + ], + "control_stddev": 0, + "control_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 6.9433830828881245E-121, + "across_stimuli_anova_p": 5.7709898431398533E-108 + }, + "fitless": { + "interpolated_c50": 0.33 + }, + "fit": { + "naka_rushton_RB_parameters": [ + 15.503498343709744, + 0.99999999999996669 + ], + "naka_rushton_RB_contrast": [ + 0, + 0.01, + 0.02, + 0.03, + 0.04, + 0.05, + 0.06, + 0.07, + 0.08, + 0.09, + 0.1, + 0.11, + 0.12, + 0.13, + 0.14, + 0.15, + 0.16, + 0.17, + 0.18, + 0.19, + 0.2, + 0.21, + 0.22, + 0.23, + 0.24, + 0.25, + 0.26, + 0.27, + 0.28, + 0.29, + 0.3, + 0.31, + 0.32, + 0.33, + 0.34, + 0.35000000000000003, + 0.36, + 0.37, + 0.38, + 0.39, + 0.4, + 0.41000000000000003, + 0.42, + 0.43, + 0.44, + 0.45, + 0.46, + 0.47000000000000003, + 0.48, + 0.49, + 0.5, + 0.51, + 0.52, + 0.53, + 0.54, + 0.55, + 0.56, + 0.57000000000000006, + 0.58000000000000007, + 0.59, + 0.6, + 0.61, + 0.62, + 0.63, + 0.64, + 0.64999999999999991, + 0.65999999999999992, + 0.66999999999999993, + 0.67999999999999994, + 0.69, + 0.7, + 0.71, + 0.72, + 0.73, + 0.74, + 0.75, + 0.76, + 0.77, + 0.78, + 0.79, + 0.8, + 0.81, + 0.82000000000000006, + 0.83, + 0.84, + 0.85, + 0.86, + 0.87, + 0.88, + 0.89, + 0.9, + 0.91, + 0.92, + 0.92999999999999994, + 0.94, + 0.95, + 0.96, + 0.97, + 0.98, + 0.99, + 1 + ], + "naka_rushton_RB_values": [ + 0, + 0.15349998360109163, + 0.3039901636021618, + 0.45155820418573528, + 0.5962883978350092, + 0.73826182589096356, + 0.87755651002133372, + 1.014247555195996, + 1.1484072847192757, + 1.280105367829284, + 1.409408940337292, + 1.5363827187460568, + 1.6610891082546646, + 1.7835883050286074, + 1.9039383930872171, + 2.0221954361361121, + 2.1384135646496811, + 2.2526450584878051, + 2.3649404253117225, + 2.4753484750461632, + 2.5839163906183629, + 2.6906897951893685, + 2.7957128160788827, + 2.8990281455718194, + 3.0006770987826115, + 3.1006996687420316, + 3.1991345788608254, + 3.2960193329147565, + 3.391390262686595, + 3.4852825733922028, + 3.5777303870100323, + 3.6687667836260629, + 3.7584238408994266, + 3.8467326717476267, + 3.9337234603443609, + 4.0194254965174405, + 4.1038672086291506, + 4.1870761950166013, + 4.2690792540651055, + 4.349902412983413, + 4.4295709553457465, + 4.5081094474618046, + 4.585541763632567, + 4.6618911103463958, + 4.7371800494669758, + 4.811430520461756, + 4.88466386171688, + 4.95690083098214, + 5.0281616249870567, + 5.0984658982670767, + 5.1678327812366964, + 5.2362808975444661, + 5.3038283807429236, + 5.3704928903047993, + 5.4362916270152226, + 5.5012413477680919, + 5.56535837979336, + 5.6286586343406, + 5.6911576198429383, + 5.7528704545842393, + 5.8138118788912747, + 5.873996266871516, + 5.9334376377161968, + 5.9921496665873244, + 6.0501456951063641, + 6.1074387414615368, + 6.16404151014978, + 6.2199664013687039, + 6.275225520073116, + 6.32983068471002, + 6.3837934356453134, + 6.4371250432948139, + 6.4898365159716453, + 6.5419386074614625, + 6.5934418243364536, + 6.6443564330185874, + 6.6946924666020617, + 6.7444597314444792, + 6.7936678135358584, + 6.8423260846541485, + 6.8904437083155692, + 6.9380296455276929, + 6.98509266035287, + 7.0316413252892458, + 7.0776840264763159, + 7.1232289687316319, + 7.1682841804250641, + 7.21285751819664, + 7.2569566715238389, + 7.3005891671438707, + 7.3437623733363235, + 7.3864835040712631, + 7.4287596230277151, + 7.4705976474872076, + 7.5120043521069118, + 7.5529863725766706, + 7.5935502091640847, + 7.6337022301516271, + 7.6734486751695981, + 7.7127956584285942, + 7.7517491718550007 + ], + "naka_rushton_RB_pref": 1, + "naka_rushton_RB_empirical_c50": 0.34, + "naka_rushton_RB_r2": 0.98514913360230971, + "naka_rushton_RB_relative_max_gain": 1.9801980198020124, + "naka_rushton_RB_saturation_index": 0, + "naka_rushton_RB_sensitivity": [ + 36.900369003690031, + 17.985611510791365, + 11.655011655011656, + 8.4889643463497446, + 6.5919578114700066, + 5.3276505061267976, + 4.4247787610619467, + 3.7467216185837389, + 3.2185387833923396, + 2.7972027972027971 + ], + "naka_rushton_RBN_parameters": [ + 9.9997709928953427, + 0.44979167674629589, + 1.5005647133505982 + ], + "naka_rushton_RBN_contrast": [ + 0, + 0.01, + 0.02, + 0.03, + 0.04, + 0.05, + 0.06, + 0.07, + 0.08, + 0.09, + 0.1, + 0.11, + 0.12, + 0.13, + 0.14, + 0.15, + 0.16, + 0.17, + 0.18, + 0.19, + 0.2, + 0.21, + 0.22, + 0.23, + 0.24, + 0.25, + 0.26, + 0.27, + 0.28, + 0.29, + 0.3, + 0.31, + 0.32, + 0.33, + 0.34, + 0.35000000000000003, + 0.36, + 0.37, + 0.38, + 0.39, + 0.4, + 0.41000000000000003, + 0.42, + 0.43, + 0.44, + 0.45, + 0.46, + 0.47000000000000003, + 0.48, + 0.49, + 0.5, + 0.51, + 0.52, + 0.53, + 0.54, + 0.55, + 0.56, + 0.57000000000000006, + 0.58000000000000007, + 0.59, + 0.6, + 0.61, + 0.62, + 0.63, + 0.64, + 0.64999999999999991, + 0.65999999999999992, + 0.66999999999999993, + 0.67999999999999994, + 0.69, + 0.7, + 0.71, + 0.72, + 0.73, + 0.74, + 0.75, + 0.76, + 0.77, + 0.78, + 0.79, + 0.8, + 0.81, + 0.82000000000000006, + 0.83, + 0.84, + 0.85, + 0.86, + 0.87, + 0.88, + 0.89, + 0.9, + 0.91, + 0.92, + 0.92999999999999994, + 0.94, + 0.95, + 0.96, + 0.97, + 0.98, + 0.99, + 1 + ], + "naka_rushton_RBN_values": [ + 0, + 0.032968958852889065, + 0.092727480548475891, + 0.16907713913019651, + 0.25799860452505213, + 0.35694670526151423, + 0.46405455138416352, + 0.577847541654394, + 0.69711037302757139, + 0.820815071706771, + 0.94807772388102751, + 1.0781302852815788, + 1.2103009832493932, + 1.3439999370250251, + 1.4787081192105616, + 1.6139685576985134, + 1.749379104287744, + 1.884586342296827, + 2.0192803528731256, + 2.1531901508013838, + 2.2860796584436192, + 2.4177441239927915, + 2.548006915103755, + 2.6767166357622689, + 2.8037445258013753, + 2.9289821105641005, + 3.0523390739928051, + 3.1737413326490356, + 3.2931292913287655, + 3.4104562633668114, + 3.5256870406427687, + 3.6387965998589769, + 3.7497689329606696, + 3.8585959906788938, + 3.965276729145621, + 4.0698162503901658, + 4.17222502829924, + 4.272518212325263, + 4.3707150018699963, + 4.4668380848610667, + 4.5609131345833154, + 4.6529683593295044, + 4.7430340998992895, + 4.8311424704043509, + 4.9173270382335641, + 5.0016225393974239, + 5.0840646258074322, + 5.1646896413557926, + 5.2435344239453316, + 5.3206361308806089, + 5.3960320852704857, + 5.4697596413113665, + 5.5418560665205439, + 5.6123584391717758, + 5.681303559351897, + 5.7487278722090629, + 5.8146674021014029, + 5.8791576964804193, + 5.9422337784575889, + 6.00393010710618, + 6.0642805446441548, + 6.1233183297291909, + 6.1810760561738691, + 6.2375856564588537, + 6.2928783894849385, + 6.3469848320619056, + 6.3999348736836037, + 6.4517577141852, + 6.5024818639205453, + 6.5521351461354564, + 6.6007447012468763, + 6.6483369927686162, + 6.6949378146521914, + 6.7405722998361153, + 6.7852649298196077, + 6.8290395450967782, + 6.8719193563056384, + 6.9139269559625323, + 6.95508433066734, + 6.9954128736779619, + 7.0349333977644113, + 7.0736661482635039, + 7.1116308162646034, + 7.14884655186546, + 7.1853319774447622, + 7.22110520090494, + 7.2561838288447635, + 7.2905849796268454, + 7.3243252963099765, + 7.3574209594205815, + 7.389887699541462, + 7.4217408096994619, + 7.452995157536729, + 7.4836651972529875, + 7.5137649813086504, + 7.5433081718807351, + 7.5723080520654307, + 7.6007775368228438, + 7.6287291836609068, + 7.6561752030567023, + 7.6831274686146278 + ], + "naka_rushton_RBN_pref": 1, + "naka_rushton_RBN_empirical_c50": 0.33, + "naka_rushton_RBN_r2": 0.99999979730708244, + "naka_rushton_RBN_relative_max_gain": 1.7624404533489664, + "naka_rushton_RBN_saturation_index": 0, + "naka_rushton_RBN_sensitivity": [ + 18.214936247723131, + 11.148272017837234, + 8.257638315441783, + 6.6006600660066006, + 5.5035773252614195, + 4.7058823529411757, + 4.0933278755628324, + 3.599712023038157, + 3.1928480204342269, + 2.846569883290635 + ], + "naka_rushton_RBNS_parameters": [ + 10.017591038596439, + 0.45228620638234829, + 1.4980105684831408, + 1.0019941056270711 + ], + "naka_rushton_RBNS_contrast": [ + 0, + 0.01, + 0.02, + 0.03, + 0.04, + 0.05, + 0.06, + 0.07, + 0.08, + 0.09, + 0.1, + 0.11, + 0.12, + 0.13, + 0.14, + 0.15, + 0.16, + 0.17, + 0.18, + 0.19, + 0.2, + 0.21, + 0.22, + 0.23, + 0.24, + 0.25, + 0.26, + 0.27, + 0.28, + 0.29, + 0.3, + 0.31, + 0.32, + 0.33, + 0.34, + 0.35000000000000003, + 0.36, + 0.37, + 0.38, + 0.39, + 0.4, + 0.41000000000000003, + 0.42, + 0.43, + 0.44, + 0.45, + 0.46, + 0.47000000000000003, + 0.48, + 0.49, + 0.5, + 0.51, + 0.52, + 0.53, + 0.54, + 0.55, + 0.56, + 0.57000000000000006, + 0.58000000000000007, + 0.59, + 0.6, + 0.61, + 0.62, + 0.63, + 0.64, + 0.64999999999999991, + 0.65999999999999992, + 0.66999999999999993, + 0.67999999999999994, + 0.69, + 0.7, + 0.71, + 0.72, + 0.73, + 0.74, + 0.75, + 0.76, + 0.77, + 0.78, + 0.79, + 0.8, + 0.81, + 0.82000000000000006, + 0.83, + 0.84, + 0.85, + 0.86, + 0.87, + 0.88, + 0.89, + 0.9, + 0.91, + 0.92, + 0.92999999999999994, + 0.94, + 0.95, + 0.96, + 0.97, + 0.98, + 0.99, + 1 + ], + "naka_rushton_RBNS_values": [ + 0, + 0.033154762042404091, + 0.093090372440346042, + 0.16957507036425618, + 0.25858921008433822, + 0.35759168803171382, + 0.46472080507047936, + 0.57850730665320116, + 0.6977410142493089, + 0.82139869124069786, + 0.94860070290549936, + 1.0785828031552427, + 1.2106765403364188, + 1.3442948966542647, + 1.4789212777462073, + 1.6141007477152056, + 1.7494328332396789, + 1.8845654673164762, + 2.019189791139802, + 2.1530356241109865, + 2.2858674700789323, + 2.417480965664514, + 2.5476997015530838, + 2.6763723645472894, + 2.8033701598019438, + 2.9285844808105432, + 3.0519248005348563, + 3.1733167613192119, + 3.2927004444082852, + 3.4100288023240348, + 3.525266239277947, + 3.6383873263502537, + 3.7493756394616908, + 3.8582227092657235, + 3.9649270730485688, + 4.0694934195738339, + 4.1719318185711964, + 4.2722570272602587, + 4.3704878669328924, + 4.4666466631979889, + 4.5607587440276172, + 4.6528519902374823, + 4.7429564334910106, + 4.831103897337961, + 4.9173276771879149, + 5.0016622554781964, + 5.0841430486269923, + 5.1648061826672382, + 5.2436882947370851, + 5.3208263578601294, + 5.3962575266844732, + 5.4700190020657891, + 5.5421479125771587, + 5.6126812112089759, + 5.6816555856869613, + 5.7491073809864108, + 5.8150725327576138, + 5.8795865105016265, + 5.9426842694487645, + 6.0044002101947127, + 6.0647681452423559, + 6.1238212716818952, + 6.1815921493183374, + 6.2381126836247311, + 6.2934141129622683, + 6.3475269995650585, + 6.40048122383869, + 6.4523059815679664, + 6.5030297836710993, + 6.5526804581753417, + 6.6012851541231123, + 6.6488703471484234, + 6.6954618464910274, + 6.7410848032407307, + 6.7857637196266829, + 6.8295224591867836, + 6.872384257670431, + 6.9143717345442663, + 6.9555069049852554, + 6.9958111922586657, + 7.03530544039034, + 7.074009927053388, + 7.1119443765988679, + 7.1491279731687039, + 7.1855793738367062, + 7.2213167217304255, + 7.25635765909276, + 7.290719340247712, + 7.3244184444396137, + 7.3574711885195114, + 7.389893339456326, + 7.42170022665389, + 7.4529067540580369, + 7.4835274120407149, + 7.5135762890505022, + 7.5430670830210591, + 7.5720131125310637, + 7.60042732771068, + 7.6283223208913231, + 7.655710336996596, + 7.6826032836735543 + ], + "naka_rushton_RBNS_pref": 1, + "naka_rushton_RBNS_empirical_c50": 0.33, + "naka_rushton_RBNS_r2": 0.99999982495935691, + "naka_rushton_RBNS_relative_max_gain": 1.7615394226078285, + "naka_rushton_RBNS_saturation_index": 0, + "naka_rushton_RBNS_sensitivity": [ + 18.214936247723131, + 11.148272017837234, + 8.257638315441783, + 6.6050198150594452, + 5.5035773252614195, + 4.7058823529411757, + 4.0916530278232406, + 3.599712023038157, + 3.1918289179699966, + 2.846569883290635 + ] + } + }, + "contrasttuning_calc": { + "input_parameters": [], + "depends_on": { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b44b273d_c09a9836653ea23a" + } + }, + "depends_on": [ + { + "name": "element_id", + "value": "412696f9b4475961_40b3af32d044e0a9" + }, + { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b44b273d_c09a9836653ea23a" + } + ], + "document_class": { + "definition": "$NDICALCDOCUMENTPATH/calc/contrasttuning_calc.json", + "validation": "$NDICALCSCHEMAPATH/calc/contrasttuning_calc_v2_schema.json", + "class_name": "contrasttuning_calc", + "property_list_name": "contrasttuning_calc", + "class_version": 2, + "superclasses": [ + { + "definition": "$NDICALCDOCUMENTPATH/vision/contrast_tuning.json" + }, + { + "definition": "$NDIDOCUMENTPATH/app.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/calculator.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + } + ] + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_writer_outputs/oridirtuning_calc.mock.1.json b/tests/+did2/fixtures/ndi_writer_outputs/oridirtuning_calc.mock.1.json new file mode 100644 index 00000000..d24cce5d --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/oridirtuning_calc.mock.1.json @@ -0,0 +1,1096 @@ +{ + "app": { + "name": "ndi.calc.vis.oridir_tuning", + "version": "6b1ac939f905baf95d213fc4b3d60a60c094f288", + "url": "https://github.com/VH-Lab/NDIcalc-vis-matlab", + "os": "MACA64", + "os_version": "26.6.2", + "interpreter": "MATLAB", + "interpreter_version": "24.2" + }, + "base": { + "id": "412696f9b29ecebe_c0a5cc6ea9646011", + "session_id": "412696f9abd9edc3_40dbbdf6582271b2", + "name": "", + "datestamp": "2026-08-27T00:22:22.182Z" + }, + "calculator": {}, + "depends_on": [ + { + "name": "element_id", + "value": "412696f9b29b5566_40ca0b773b4bc6c7" + }, + { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b29e28e7_40780631c908e376" + } + ], + "document_class": { + "definition": "$NDICALCDOCUMENTPATH/calc/oridirtuning_calc.json", + "validation": "$NDICALCSCHEMAPATH/calc/oridirtuning_calc_v2_schema.json", + "class_name": "oridirtuning_calc", + "property_list_name": "oridirtuning_calc", + "class_version": 2, + "superclasses": [ + { + "definition": "$NDIDOCUMENTPATH/app.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/calculator.json" + }, + { + "definition": "$NDIDOCUMENTPATH/stimulus/vision/oridir/orientation_direction_tuning.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + } + ] + }, + "oridirtuning_calc": { + "input_parameters": [], + "depends_on": { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b29e28e7_40780631c908e376" + } + }, + "orientation_direction_tuning": { + "properties": { + "coordinates": "compass", + "response_units": [], + "response_type": "mean" + }, + "tuning_curve": { + "direction": [ + 0, + 30, + 60, + 90, + 120, + 150, + 180, + 210, + 240, + 270, + 300, + 330 + ], + "mean": [ + 6.4956233212198216, + 17.648166968228441, + 17.637266696717916, + 6.4903943382490468, + 0.90119499285362914, + 0.48292707783316607, + 3.2480950112800286, + 8.819962772129383, + 8.824391319984354, + 3.2479748913314141, + 0.48335814331013854, + 0.90130171154183958 + ], + "stddev": [ + 0.010224083393384788, + 0.01224049941364321, + 0.0052856052455927081, + 0.00520442400999302, + 0.0011210916919746369, + 0.00029129585920989768, + 0.0050038857725241814, + 0.014014214253432362, + 0.011419967777830225, + 0.0024175315869596039, + 0.00028558143106821078, + 0.00038417063586280986 + ], + "stderr": [ + 0.0045723490950470222, + 0.0054741177534905067, + 0.0023637945262749531, + 0.0023274891740152877, + 0.00050136744645310871, + 0.00013027146855150787, + 0.0022378057478016238, + 0.0062673471443842454, + 0.0051071648504171195, + 0.0010811529932389236, + 0.00012771589859603792, + 0.00017180633134971228 + ], + "individual": [ + [ + 6.484404100791834, + 17.628163665608586, + 17.644368636951505, + 6.4912083633401538, + 0.90106991380956281, + 0.48320300371046015, + 3.2506200637917111, + 8.8131815659728083, + 8.8192308062124614, + 3.2490445553131804, + 0.48354090521188, + 0.90112015351750707 + ], + [ + 6.5095570662773294, + 17.655212447050523, + 17.641052856777353, + 6.497038729414804, + 0.89936365784547478, + 0.48299145813846911, + 3.2501588961063668, + 8.8423311338634374, + 8.8120003170515933, + 3.2504448498069078, + 0.48362725588521882, + 0.9007230952183648 + ], + [ + 6.4908360579785205, + 17.659100846856024, + 17.633830644410516, + 6.4831083978471868, + 0.9021728633410121, + 0.4831061045656917, + 3.2395771819610331, + 8.82218939641774, + 8.8226653411328915, + 3.2462956650377217, + 0.48288883480980532, + 0.90144381145871033 + ], + [ + 6.5027029245350088, + 17.652917291865741, + 17.635464856074282, + 6.492592147693089, + 0.90135038651182875, + 0.48245266817131621, + 3.2522098605034135, + 8.8172057280760487, + 8.8252920794452052, + 3.2446381789547312, + 0.48336612438152055, + 0.90168620654810017 + ], + [ + 6.4906164565164142, + 17.645440589761339, + 17.631616489375919, + 6.4880240529500064, + 0.90201814276026748, + 0.48288215457989331, + 3.2479090540376179, + 8.8049060363168827, + 8.8427680560796222, + 3.2494512075445274, + 0.48336759626226811, + 0.90153529096651552 + ] + ], + "raw_individual": [ + [ + 6.484404100791834, + 17.628163665608586, + 17.644368636951505, + 6.4912083633401538, + 0.90106991380956281, + 0.48320300371046015, + 3.2506200637917111, + 8.8131815659728083, + 8.8192308062124614, + 3.2490445553131804, + 0.48354090521188, + 0.90112015351750707 + ], + [ + 6.5095570662773294, + 17.655212447050523, + 17.641052856777353, + 6.497038729414804, + 0.89936365784547478, + 0.48299145813846911, + 3.2501588961063668, + 8.8423311338634374, + 8.8120003170515933, + 3.2504448498069078, + 0.48362725588521882, + 0.9007230952183648 + ], + [ + 6.4908360579785205, + 17.659100846856024, + 17.633830644410516, + 6.4831083978471868, + 0.9021728633410121, + 0.4831061045656917, + 3.2395771819610331, + 8.82218939641774, + 8.8226653411328915, + 3.2462956650377217, + 0.48288883480980532, + 0.90144381145871033 + ], + [ + 6.5027029245350088, + 17.652917291865741, + 17.635464856074282, + 6.492592147693089, + 0.90135038651182875, + 0.48245266817131621, + 3.2522098605034135, + 8.8172057280760487, + 8.8252920794452052, + 3.2446381789547312, + 0.48336612438152055, + 0.90168620654810017 + ], + [ + 6.4906164565164142, + 17.645440589761339, + 17.631616489375919, + 6.4880240529500064, + 0.90201814276026748, + 0.48288215457989331, + 3.2479090540376179, + 8.8049060363168827, + 8.8427680560796222, + 3.2494512075445274, + 0.48336759626226811, + 0.90153529096651552 + ] + ], + "control_individual": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + }, + "significance": { + "visual_response_anova_p": 1.4425305008188866E-149, + "across_stimuli_anova_p": 2.2671938171269795E-137 + }, + "vector": { + "circular_variance": 0.42, + "direction_circular_variance": 0.71, + "Hotelling2Test": 2.379763053284023E-12, + "orientation_preference": 89.98889082517131, + "direction_preference": 44.9787572050213, + "direction_hotelling2test": 1.5247125784156879E-10, + "dot_direction_significance": 3.22250573259817E-14 + }, + "fit": { + "double_gaussian_parameters": [ + -0.00019429201465911698, + 19.990951890070029, + 44.991319847582304, + 30.005977800289976, + 9.9967459152253113 + ], + "double_gaussian_fit_angles": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359 + ], + "double_gaussian_fit_values": [ + 6.4960459467079588, + 6.825045583311387, + 7.1627617495469478, + 7.5088560708608556, + 7.8629452376276738, + 8.2246005546118255, + 8.5933477291549778, + 8.9686669105322032, + 9.3499929915262214, + 9.7367161817096246, + 10.128182860208097, + 10.523696713854013, + 10.922520164642004, + 11.323876088281025, + 11.726949823417955, + 12.130891468804112, + 12.534818463309096, + 12.93781844127709, + 13.3389523532929, + 13.737257840002203, + 14.131752844237596, + 14.521439444364647, + 14.905307889505249, + 15.282340815145266, + 15.651517615613779, + 16.011818948057165, + 16.362231340845483, + 16.701751877862662, + 17.029392928866454, + 17.344186895076312, + 17.64519093837346, + 17.931491661990542, + 18.202209710338995, + 18.456504255677967, + 18.693577339674448, + 18.912678038540751, + 19.113106421361781, + 19.294217272434764, + 19.45542354993016, + 19.596199554933364, + 19.716083786926912, + 19.814681464005663, + 19.891666688561859, + 19.946784241810732, + 19.979850993324895, + 19.990756915212639, + 19.979465751591285, + 19.94601504039569, + 19.890516085501442, + 19.813153278615793, + 19.714183078682943, + 19.593932595564464, + 19.452797788943975, + 19.291241296337617, + 19.109789906886878, + 18.909031700240959, + 18.689612872276907, + 18.45223427163441, + 18.197647673038411, + 17.926651815128796, + 17.640088231997833, + 17.338836908841611, + 17.02381179305269, + 16.695956192712888, + 16.356238094785819, + 16.005645435359376, + 15.645181354054431, + 15.275859464204226, + 14.898699169630557, + 14.514721057810883, + 14.124942397960801, + 13.730372771066811, + 13.33200985721534, + 12.93083540369669, + 12.527811395340898, + 12.123876446389636, + 11.719942430950155, + 11.31689136673841, + 10.915572564425096, + 10.516800052475142, + 10.121350284943398, + 9.7299601372806936, + 9.34332519283822, + 8.96209832045591, + 8.58688854130265, + 8.2182601810209075, + 7.8567323012329222, + 7.5027784026043536, + 7.1568263899469917, + 6.81925878828564, + 6.49041319742357, + 6.17058297132255, + 5.8600181075712987, + 5.5589263313523567, + 5.2674743576315493, + 4.98578931478472, + 4.7139603125390392, + 4.4520401369358193, + 4.20004705501086, + 3.9579667120289979, + 3.7257541043915281, + 3.5033356117482941, + 3.2906110723786544, + 3.0874558865451243, + 2.8937231332575974, + 2.7092456867015819, + 2.533838319467689, + 2.3672997806586045, + 2.2094148379308973, + 2.0599562735396169, + 1.9186868254815661, + 1.7853610658665604, + 1.6597272096740283, + 1.5415288480645939, + 1.4305066014033634, + 1.3263996881049189, + 1.2289474063217756, + 1.1378905263615802, + 1.052972592527804, + 0.97394113382926617, + 0.90054878369169955, + 0.83255430942673392, + 0.7697235527682, + 0.71183028327128539, + 0.65865696678663188, + 0.60999545156932344, + 0.56564757486316319, + 0.525425693015522, + 0.48915313832993329, + 0.45666460595551089, + 0.42780647414781758, + 0.40243706121895817, + 0.38042682242982945, + 0.36165848996928557, + 0.34602715901843628, + 0.33344032271850144, + 0.32381785865288437, + 0.31709196922376193, + 0.31320707805591846, + 0.31211968430116088, + 0.31379817645079511, + 0.3182226069965407, + 0.32538442901703152, + 0.335286195512608, + 0.34794122207018119, + 0.36337321321700716, + 0.38161585262144782, + 0.40271235712410153, + 0.42671499443761951, + 0.45368456424125675, + 0.48368984231956957, + 0.51680698735599684, + 0.55311890999335778, + 0.59271460381599528, + 0.63568843799343766, + 0.68213941145352641, + 0.73217036862398277, + 0.78588717699480759, + 0.84339786700870389, + 0.90481173508123025, + 0.97023841088453977, + 1.0397868903955905, + 1.1135645366084872, + 1.1916760502372976, + 1.27422241318611, + 1.3612998080324921, + 1.4529985172537065, + 1.5494018064164572, + 1.650584796044569, + 1.7566133273686249, + 1.8675428276405577, + 1.983417181157813, + 2.1042676125790214, + 2.2301115895192045, + 2.3609517517803913, + 2.4967748748962997, + 2.63755087594079, + 2.783231869762631, + 2.9337512839577604, + 3.0890230409690704, + 3.2489408157076505, + 3.4133773770141245, + 3.5821840211202884, + 3.7551901050270104, + 3.9322026873820408, + 4.1130062840199786, + 4.2973627448160236, + 4.4850112579061721, + 4.6756684866411575, + 4.86902884387284, + 5.0647649073239664, + 5.2625279788705885, + 5.4619487895772973, + 5.6626383512760787, + 5.8641889543785561, + 6.0661753104677425, + 6.2681558370395729, + 6.4696740805669961, + 6.670260272852123, + 6.86943301442666, + 7.0667010775701362, + 7.2615653203518935, + 7.4535207019792953, + 7.6420583886637168, + 7.8266679382102131, + 8.00683955060827, + 8.18206637106162, + 8.3518468311550844, + 8.5156870132264579, + 8.6731030224999781, + 8.8236233511533566, + 8.9667912182388232, + 9.102166869266, + 9.229329819283878, + 9.3478810234735441, + 9.4574449595831247, + 9.5576716070005627, + 9.6482383078662615, + 9.72885149637165, + 9.79924828326608, + 9.85919788359539, + 9.9085028768126637, + 9.9470002896246257, + 9.9745624932546466, + 9.9910979082028142, + 9.99655151211559, + 9.990905263831495, + 9.9741778448565519, + 9.94642491642239, + 9.90773868875725, + 9.8582474108060651, + 9.79811466207766, + 9.7275384520967876, + 9.6467501344054618, + 9.5560131434562763, + 9.4556215640562549, + 9.34589854424114, + 9.2271945635750487, + 9.099885569869512, + 8.9643709981898212, + 8.82107168675843, + 8.67042770496898, + 8.512896109186384, + 8.3489486423255261, + 8.179069393373025, + 8.0037524330435783, + 7.8234994416471286, + 7.6388173449894214, + 7.4502159737415177, + 7.2582057612003483, + 7.0632954937303642, + 6.8659901274345847, + 6.6667886837622445, + 6.4661822358302654, + 6.2646519962289791, + 6.062667516010511, + 5.8606850034339857, + 5.6591457698775365, + 5.4584748091361028, + 5.259079515118497, + 5.0613485417500748, + 4.8656508076901135, + 4.6723346472975988, + 4.4817271081361687, + 4.2941333942087017, + 4.10983645306372, + 3.9290967039276743, + 3.7521519030968693, + 3.5792171419762759, + 3.4104849723853063, + 3.2461256530667515, + 3.0862875107376468, + 2.9310974085117176, + 2.7806613141032441, + 2.6350649598914004, + 2.4943745866813725, + 2.3586377628416231, + 2.2278842704227722, + 2.1021270498688009, + 1.9813631950114132, + 1.865574990188148, + 1.7547309815388008, + 1.6487870748066542, + 1.5476876522946676, + 1.4513667019953513, + 1.35974895231973, + 1.2727510062886012, + 1.190282469511281, + 1.1122470667562523, + 1.0385437424078436, + 0.96906774059675482, + 0.90371166128353808, + 0.84236648905715772, + 0.78492259187986169, + 0.73127068745963431, + 0.68130277535775974, + 0.63491303333724669, + 0.59199867682433938, + 0.55246078068684645, + 0.51620506282686618, + 0.48314262933957669, + 0.45319068120244532, + 0.42627318262950903, + 0.40232149135268935, + 0.38127495117651605, + 0.36308144719460167, + 0.34769792405678945, + 0.335090867636552, + 0.32523675037094163, + 0.31812244043252386, + 0.31374557474712633, + 0.31211489569604883, + 0.31325055114020611, + 0.31718435718038079, + 0.32396002282656466, + 0.33363333549473206, + 0.34627230598605041, + 0.36195727133640809, + 0.38078095365834586, + 0.40284847283825143, + 0.42827731070436126, + 0.45719722405108448, + 0.48975010369785765, + 0.52608977658146627, + 0.56638174773485583, + 0.61080287889799, + 0.65954100044226771, + 0.71279445327403068, + 0.77077155741918568, + 0.83369000408388394, + 0.90177616813916284, + 0.975264338193449, + 1.0543958616984346, + 1.1394182028828903, + 1.2305839117267032, + 1.328149502674302, + 1.4323742423423096, + 1.5435188460995972, + 1.6618440840869189, + 1.7876092979949236, + 1.9210708307298394, + 2.0624803719604632, + 2.212083223452713, + 2.3701164890518682, + 2.5368071951602471, + 2.7123703485707167, + 2.8970069395446187, + 3.0909018990562083, + 3.2942220201533128, + 3.5071138543942242, + 3.7297015953012784, + 3.9620849617097278, + 4.204337094773253, + 4.4565024832017075, + 4.71859493203921, + 4.99059559092858, + 5.2724510583385724, + 5.5640715786412418, + 5.8653293492064806, + 6.1760569548188187 + ], + "orientation_preferred_orthogonal_ratio": 0.9776415792686014, + "direction_preferred_null_ratio": 0.499941320351083, + "orientation_preferred_orthogonal_ratio_rectified": 0.9776415792686014, + "direction_preferred_null_ratio_rectified": 0.499941320351083, + "orientation_angle_preference": 44.991319847582304, + "direction_angle_preference": 44.991319847582304, + "hwhh": 35.329338997438256 + } + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_writer_outputs/spatial_frequency_tuning_calc.mock.6.json b/tests/+did2/fixtures/ndi_writer_outputs/spatial_frequency_tuning_calc.mock.6.json new file mode 100644 index 00000000..2f350256 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/spatial_frequency_tuning_calc.mock.6.json @@ -0,0 +1,3480 @@ +{ + "app": { + "name": "ndi.calc.vis.spatial_frequency_tuning", + "version": "6b1ac939f905baf95d213fc4b3d60a60c094f288", + "url": "https://github.com/VH-Lab/NDIcalc-vis-matlab", + "os": "MACA64", + "os_version": "26.6.2", + "interpreter": "MATLAB", + "interpreter_version": "24.2" + }, + "base": { + "id": "412696f9b2deeecb_c0cb2705238848b3", + "session_id": "412696f9abd9edc3_40dbbdf6582271b2", + "name": "", + "datestamp": "2026-08-27T00:23:04.452Z" + }, + "calculator": {}, + "depends_on": [ + { + "name": "element_id", + "value": "412696f9b2d97fb7_40d11a88f1f7b6e3" + }, + { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b2de4b76_c0c87d9fe8e2a749" + } + ], + "document_class": { + "definition": "$NDICALCDOCUMENTPATH/calc/spatial_frequency_tuning_calc.json", + "validation": "$NDICALCSCHEMAPATH/calc/spatial_frequency_tuning_calc_v2_schema.json", + "class_name": "spatial_frequency_tuning_calc", + "property_list_name": "spatial_frequency_tuning_calc", + "class_version": 2, + "superclasses": [ + { + "definition": "$NDICALCDOCUMENTPATH/vision/spatial_frequency_tuning.json" + }, + { + "definition": "$NDIDOCUMENTPATH/app.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/calculator.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + } + ] + }, + "spatial_frequency_tuning": { + "properties": { + "response_units": [], + "response_type": "mean" + }, + "tuning_curve": { + "spatial_frequency": [ + 0.01, + 0.010918504160990019, + 0.011921373311355642, + 0.013016356410475195, + 0.01421191416287026, + 0.015517284392293192, + 0.016942553420451877, + 0.018498734001899952, + 0.020197850417279228, + 0.022053031382411725, + 0.024078611491130587, + 0.026290241975677156, + 0.028705011640486566, + 0.031341578903791946, + 0.034220315967304939, + 0.03736346622794124, + 0.040795316147878666, + 0.044542382910951632, + 0.048633619315363641, + 0.053100637485880273, + 0.057977953134080634, + 0.063303252254014369, + 0.069117682313965714, + 0.075466170194302129, + 0.082397769328046877, + 0.089966038726457559, + 0.09822945681826166, + 0.10725187330019793, + 0.1171030024902186, + 0.12785896199538765, + 0.13960286085665055, + 0.15242544171494496, + 0.16642578196053692, + 0.181712059283214, + 0.19840238753858369, + 0.21662572938903818, + 0.23652289277117111, + 0.25824761888914294, + 0.28196777014068719, + 0.30786662715461721, + 0.33614430496176506, + 0.36701929924181315, + 0.40073017459353777, + 0.43753740787338014, + 0.47772540084542886, + 0.521604677694144, + 0.56951428437953722, + 0.621824408374123, + 0.67893923902380227, + 0.7413000906340782, + 0.8093888124130465, + 0.88373151161906183, + 0.96490261868107319, + 1.0535293257019469, + 1.150296432640171, + 1.2559516386153688, + 1.3713113192224147, + 1.4972668344942637, + 1.6347914162537982, + 1.7849476880717872, + 1.9488958759361332, + 2.1279027730744948, + 2.3233515281996087, + 2.5367523328089958, + 2.7697540901176172, + 3.0241571557868312, + 3.3019272488946276, + 3.6052106406342341, + 3.9363507381010354, + 4.2979061913072316, + 4.6926706633332795, + 5.123694416376023, + 5.5943078804842905, + 6.1081473870927017, + 6.6691832661912009, + 7.2817505242313674, + 7.95058233981114, + 8.6808466359521734, + 9.4781860115560068, + 10.348761340581159, + 11.299299375822811, + 12.337144725119334, + 13.47031660159516, + 14.70757078643696, + 16.058467282976729, + 17.533444184830358, + 19.143898328855663, + 20.902273356118034, + 22.822155861292568, + 24.91838037342858, + 27.207143979241181, + 29.706131474599957, + 32.434652011233638, + 35.413788294491795, + 38.666559484982805, + 42.218099062795311, + 46.09584902862197, + 50.329771942337693, + 54.952582437409255, + 60 + ], + "mean": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25737346115881676, + 0.31697559428297567, + 0.35699866477117226, + 0.37400854859386123, + 0.36908160605229351, + 0.34408700565428757, + 0.30336766640668333, + 0.25346514081266014, + 0.2000457173364884, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "stddev": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.00018494294023852528, + 0.00018242600029434451, + 0.00029012609326693213, + 0.00020506335821894074, + 0.00070891198397324382, + 0.00040108183813794795, + 0.00027752347203628219, + 0.00019688692062551469, + 8.1905693714968793E-5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "stderr": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8.2708997266404732E-5, + 8.1583387504310183E-5, + 0.00012974833331826086, + 9.1707121734388339E-5, + 0.0003170350772456829, + 0.00017936925092340385, + 0.00012411226976497778, + 8.8050507679851241E-5, + 3.66293397781895E-5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "individual": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25751451669771031, + 0.31693947960891444, + 0.3571255005956821, + 0.373922631925059, + 0.37024460861187908, + 0.34351433824626676, + 0.30306397161956611, + 0.25332171479410376, + 0.2, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25710278902599171, + 0.3170334831412252, + 0.35688701973466713, + 0.37390234914861015, + 0.36914150926738759, + 0.34398845167054792, + 0.30326926299865792, + 0.25340094617343389, + 0.2, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25727078085884864, + 0.31685845283296321, + 0.35705434546957432, + 0.37432882435559783, + 0.3686346993266425, + 0.34406731797941587, + 0.30357589349887132, + 0.25374971993609857, + 0.2, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25743424116450075, + 0.31725800330409187, + 0.35657430169834631, + 0.373805265831503, + 0.36897041744864723, + 0.34424978500880637, + 0.30319626277774758, + 0.25327431447067972, + 0.20003959859831777, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25754497804703241, + 0.31678855252768356, + 0.35735215635759149, + 0.374083671708536, + 0.36841679560691121, + 0.34461513536640082, + 0.30373294113857385, + 0.25357900868898464, + 0.20018898808412428, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + "control_mean": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "control_stddev": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "control_stderr": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "control_mean_stddev": 0, + "control_mean_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 0, + "across_stimuli_anova_p": 0 + }, + "fitless": { + "L50": 0.84986000000000006, + "Pref": 1.2098, + "H50": 2.04966, + "bandwidth": 1.2700875072030051, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 3.7215601022106433, + 0.99765737489582307, + 3.7400844139429612, + 0.89682953300184876 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.018478762533401305, + -0.018469245748474084, + -0.018457740743306417, + -0.018443832218991041, + -0.018427018163505338, + -0.018406691762156591, + -0.018382119541637376, + -0.018352414966876118, + -0.018316506549570732, + -0.018273099334810805, + -0.018220628401415251, + -0.018157202735384459, + -0.018080537506030225, + -0.017987872381577841, + -0.01787587305480498, + -0.017740512598472868, + -0.017576928622758725, + -0.017379251451139943, + -0.017140397656703943, + -0.016851822300902874, + -0.016503222090944458, + -0.016082180431748139, + -0.015573744024127478, + -0.014959919313566328, + -0.014219075831828132, + -0.013325242476500687, + -0.012247282328142539, + -0.010947932154860229, + -0.0093826949714626018, + -0.0074985789015427073, + -0.0052326845894636875, + -0.002510658608636529, + 0.00075494535584397227, + 0.0046663182697801453, + 0.0093419250831745515, + 0.01491769454128189, + 0.021547536343272, + 0.029402692196930147, + 0.038669212769015804, + 0.049542576820209572, + 0.062218133937759657, + 0.076875679846781786, + 0.093656122308659384, + 0.11262798983380895, + 0.13374170100989824, + 0.15677042164018351, + 0.1812385422838223, + 0.20634302402325311, + 0.230879809902794, + 0.25319750236480632, + 0.27121263194068335, + 0.28253155483358405, + 0.28472560802978131, + 0.27578613276452391, + 0.25473006270293985, + 0.22222912837740716, + 0.18101809620893483, + 0.13576885657272092, + 0.092207142604665018, + 0.055575444858657487, + 0.029019285507539662, + 0.01275403300476049, + 0.0045582307371172994, + 0.0012713659199891758, + 0.0002634923543449466, + 3.8270992063047547E-5, + 3.6322650498272557E-6, + 2.0710594279006361E-7, + 6.4100241110395667E-9, + 9.5221060376764316E-11, + 5.8448202983376886E-13, + 1.2353678975220252E-15, + 7.204389400822599E-19, + 8.8621572377862723E-23, + 1.6613727266414171E-27, + 3.20390319942102E-33, + 3.951816737733212E-40, + 1.7551548796709678E-48, + 1.4015156218414483E-58, + 8.6892099663269034E-71, + 1.5156628334243495E-85, + 2.1801586022659038E-103, + 5.8653700822086288E-125, + 4.90963583424006E-151, + 1.4622069634989415E-182, + 1.126310744594764E-220, + 9.4317145178072661E-267, + 1.82804288961261E-322, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.65008394829975535, + "Pref": 1.3886738277211363, + "H50": 2.231616199336572, + "R2": 0.80565503971345409, + "bandwidth": 1.7793909920200222 + }, + "fit_movshon": { + "parameters": [ + 0.71187240891078918, + 1.5877996310758231, + 0.89945268078820639, + 10.267772489557352 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 6.1571550420517876E-21, + 1.6309785809732316E-20, + 4.3203175927983363E-20, + 1.1444114130672943E-19, + 3.0314303042947395E-19, + 8.0299282807091406E-19, + 2.1270325619563045E-18, + 5.6342312508008065E-18, + 1.492426149107847E-17, + 3.953194593266806E-17, + 1.0471287982053803E-16, + 2.7736257833426987E-16, + 7.3466713449724828E-16, + 1.9459303616693042E-15, + 5.1541451573886847E-15, + 1.3651398172967582E-14, + 3.6156543648690525E-14, + 9.57599097656243E-14, + 2.5360913247624449E-13, + 6.71625406666185E-13, + 1.7785515465587542E-12, + 4.7095360552767446E-12, + 1.246970971300945E-11, + 3.3013693800217055E-11, + 8.73942786580792E-11, + 2.3131978345284098E-10, + 6.1216866153199008E-10, + 1.6197314655656976E-9, + 4.2846021660349348E-9, + 1.133056902016766E-8, + 2.9952997132730592E-8, + 7.9148791639928322E-8, + 2.0903795192556908E-7, + 5.5174212582018684E-7, + 1.4551934083335695E-6, + 3.83451245028355E-6, + 1.0093006068377861E-5, + 2.6530669172143907E-5, + 6.9624479959801418E-5, + 0.00018234239034894685, + 0.00047629222925641465, + 0.0012396707180408412, + 0.0032092252303936837, + 0.0082311124230021581, + 0.02072711172370972, + 0.050166921078351669, + 0.11151054173359409, + 0.21100964971618219, + 0.31703357208066707, + 0.38002457164830017, + 0.39013760536512981, + 0.36687078204608831, + 0.32750026839993185, + 0.2811271496494232, + 0.23236186340214834, + 0.18414549980684855, + 0.13889377467665759, + 0.098735425763438356, + 0.065349497846202989, + 0.03967725549032234, + 0.021704723361445296, + 0.010467000592933914, + 0.0043341963251004138, + 0.0014927441364979447, + 0.00041146702197618, + 8.6645635181656155E-5, + 1.3176085096705306E-5, + 1.3518071261250434E-6, + 8.6182699018175519E-8, + 3.0912132486608197E-9, + 5.5315497878118409E-11, + 4.2704454969408481E-13, + 1.193226302506211E-15, + 9.7582254306277882E-19, + 1.8068502548795752E-22, + 5.5537323782501108E-27, + 1.9471655806579553E-32, + 4.9473223772491649E-39, + 5.2640155896425E-47, + 1.2086730585602491E-56, + 2.6868711291617186E-68, + 2.1943111531757696E-82, + 2.0403173632467693E-99, + 5.240522027138528E-120, + 6.71026848844435E-145, + 5.4054694652481916E-175, + 2.2431514598631085E-211, + 2.3277413395494433E-255, + 1.5582890504983822E-308, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.9643772681919619, + "bandwidth": 1.2318860713984767 + }, + "fit_movshon_c": { + "parameters": [ + 0.71139716805869468, + 1.5950161812609389, + 0.89829886605377374, + 10.20859695073845, + -0.0018427346866119842 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.001842734686611984, + -0.0018427346866119838, + -0.0018427346866119832, + -0.0018427346866119814, + -0.0018427346866119771, + -0.0018427346866119654, + -0.0018427346866119346, + -0.0018427346866118535, + -0.0018427346866116397, + -0.0018427346866110768, + -0.0018427346866095938, + -0.0018427346866056885, + -0.0018427346865954022, + -0.0018427346865683119, + -0.0018427346864969662, + -0.001842734686309077, + -0.0018427346858142935, + -0.0018427346845114158, + -0.001842734681080882, + -0.0018427346720488987, + -0.0018427346482717264, + -0.0018427345856847888, + -0.0018427344209662735, + -0.0018427339875324361, + -0.0018427328472602957, + -0.001842729848237773, + -0.0018427219630412835, + -0.0018427012388330573, + -0.0018426467959643522, + -0.001842503854139527, + -0.0018421288106609856, + -0.0018411456020363847, + -0.0018385706105510961, + -0.0018318349659951832, + -0.0018142419522428307, + -0.0017683738592699039, + -0.0016490607012702382, + -0.0013396260706357997, + -0.00054047850042967128, + 0.0015098050013141111, + 0.0067071987909288529, + 0.019559071772594111, + 0.049621540227163252, + 0.11173593837075978, + 0.21156142524500454, + 0.31714085464733943, + 0.37970141200788804, + 0.38984068847186448, + 0.36680659795945331, + 0.3276591236343675, + 0.28142944575591722, + 0.23271030968206605, + 0.18443563144735275, + 0.13901990557355831, + 0.098601903476123576, + 0.064886370936600227, + 0.038855128932540527, + 0.020541887633930951, + 0.00902345877154637, + 0.0026927206761371519, + -0.00026556956976216237, + -0.0014029100251051194, + -0.0017488056758656575, + -0.0018282060679064556, + -0.0018412131563334253, + -0.0018426352424329576, + -0.0018427310109386025, + -0.0018427346184048284, + -0.0018427346860617753, + -0.0018427346866103631, + -0.0018427346866119827, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.96469189504598585, + "bandwidth": 1.2318860713984767 + }, + "fit_spline": { + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 0, + 1.030824584594279E-32, + -5.63081105842931E-32, + 3.6423968029418687E-31, + -2.1146486264604038E-30, + 1.1223876717247823E-29, + -5.5583939674642319E-29, + 2.5905988663052083E-28, + -1.1358667668558471E-27, + 4.6363680869064718E-27, + -1.7115578140621796E-26, + 5.26898243997134E-26, + -9.3585853264940189E-26, + -3.7618357854345995E-25, + 5.74691515089002E-24, + -4.4371186626961168E-23, + 2.7697736470316446E-22, + -1.5403422980576185E-21, + 7.9116672630344208E-21, + -3.8108189094671264E-20, + 1.729025311975981E-19, + -7.35646231758475E-19, + 2.8856124675092895E-18, + -9.9779277593630978E-18, + 2.63284078374109E-17, + -1.2072568597882165E-17, + -5.1831625144393543E-16, + 5.0983939430210522E-15, + -3.5064321434432071E-14, + 2.0642596522514042E-13, + -1.1045887726984902E-12, + 5.5058468213580657E-12, + -2.5816382077962151E-11, + 1.1392916491772292E-10, + -4.6883961830995779E-10, + 1.7525171595760627E-9, + -5.5358388688694984E-9, + 1.0942035399328019E-8, + 2.882515997998437E-8, + -5.312353482634625E-7, + 4.2417682102329487E-6, + -2.6888264090540791E-5, + 0.00015096942984382033, + -0.00078098493391295985, + 0.0037850525992770361, + -0.017278691152769143, + 0.13031049961299035, + 0.25277307886174849, + 0.30516286824334232, + 0.35454950129005974, + 0.37389406651193613, + 0.36804612057313035, + 0.33905492586675839, + 0.29310548938088771, + 0.23573656931114856, + 0.19165273887696177, + 0.2175412575985064, + 0.094214776129856639, + -0.01942657173803862, + 0.0047691377278212118, + -0.0010582477206748605, + 0.0001979918428327394, + -2.4168902653986075E-5, + -2.1517601804075142E-6, + 2.9041245985063634E-6, + -1.3795961135184889E-6, + 5.181972001756672E-7, + -1.7323780915844162E-7, + 5.3586133695544043E-8, + -1.5563141884871977E-8, + 4.2572617787966647E-9, + -1.0905456363540684E-9, + 2.571041409315597E-10, + -5.3546730523636959E-11, + 8.7774316001375525E-12, + -5.7165794479929359E-13, + -3.5095703140254995E-13, + 2.2701772162196495E-13, + -9.4556520188021335E-14, + 3.345345641369722E-14, + -1.07693128058121E-14, + 3.2349904087949543E-15, + -9.14735384226664E-16, + 2.4326031794247827E-16, + -6.0219306969592444E-17, + 1.3528264837917337E-17, + -2.5904173135807605E-18, + 3.4044309333204936E-19, + 1.5772959941398804E-20, + -3.3515532578813896E-20, + 1.8435764798318603E-20, + -1.924863952820502E-20, + 9.6899906055793342E-20, + 1.2693989157951187E-18, + 4.957251371109906E-18, + 1.3421454271216628E-17, + 3.0065162758262475E-17, + 5.9902644032388022E-17, + 1.1020302249454363E-16, + 1.9137072425565729E-16 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 2.231616199336572, + "R2": 1, + "bandwidth": 1.5056385317092489 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0.388025367735667, + 1.2488923413499886, + 0.13765178236973866 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 1.6469564987914465E-51, + 1.5038170247568972E-49, + 1.2554364353564822E-47, + 9.5825550436662115E-46, + 6.6873611690306766E-44, + 4.2669258724154761E-42, + 2.4892142564401551E-40, + 1.3276888979265207E-38, + 6.4746639181895474E-37, + 2.8868551902080154E-35, + 1.1768459879288067E-33, + 4.3863282133590023E-32, + 1.4947531660413177E-30, + 4.6571979884144585E-29, + 1.3266818354955726E-27, + 3.4553793002226492E-26, + 8.2283268386971991E-25, + 1.79148923719145E-23, + 3.5661839019969783E-22, + 6.4905295218436611E-21, + 1.0800488194399007E-19, + 1.6432116525010849E-18, + 2.2857592604986804E-17, + 2.9070622556953488E-16, + 3.3803762319988885E-15, + 3.5938720318684028E-14, + 3.4933897452718956E-13, + 3.1046906635299943E-12, + 2.5227632321590761E-11, + 1.8742240758211686E-10, + 1.2730732553166912E-9, + 7.9062790628578065E-9, + 4.4892908845539139E-8, + 2.3306132773267791E-7, + 1.1062404857097089E-6, + 4.8008235410870212E-6, + 1.904885169789946E-5, + 6.9104880536827257E-5, + 0.0002292110248148637, + 0.00069510297588950339, + 0.0019273014815721658, + 0.0048858150754592178, + 0.011324297174990942, + 0.023997851010994584, + 0.046496505077814956, + 0.082367356949819531, + 0.13340644549760228, + 0.19755378642673538, + 0.26747350308653062, + 0.331102939078841, + 0.37474182591064931, + 0.38778246212676, + 0.36688590003927157, + 0.31736625111238581, + 0.25100208241512856, + 0.18150173041647896, + 0.1199971904304197, + 0.072535105680804027, + 0.040087805355227817, + 0.02025644254238846, + 0.0093583855712850127, + 0.0039529885365006982, + 0.0015266414083019667, + 0.00053905786072611615, + 0.00017402858599965194, + 5.1368000614159521E-5, + 1.3862820350480767E-5, + 3.4205614025185462E-6, + 7.71667214613253E-7, + 1.5916573156173951E-7, + 3.0016216759360986E-8, + 5.1754628875301E-9, + 8.158856729659507E-10, + 1.1759700949884607E-10, + 1.5497088423904419E-11, + 1.8671998633095423E-12, + 2.0569245672458014E-13, + 2.0717282408216046E-14, + 1.9078053819714555E-15, + 1.6062835640685807E-16, + 1.2365088357066423E-17, + 8.7028018431495122E-19, + 5.6002553367160525E-20, + 3.2949090003228029E-21, + 1.772416903426288E-22, + 8.7171637527890473E-24, + 3.9198675071051942E-25, + 1.6115895184086763E-26, + 6.0579312847446965E-28, + 2.0820018641492842E-29, + 6.5422140255334816E-31, + 1.87955588878546E-32, + 4.9371077185524231E-34, + 1.185705472038208E-35, + 2.6035619026922258E-37, + 5.22692001506653E-39, + 9.59424188018404E-41, + 1.6101351637798284E-42, + 2.470591077430022E-44, + 3.4659816979617149E-46 + ], + "L50": NaN, + "Pref": 1.6469564987914465E-51, + "H50": NaN, + "R2": 0.95243162642428381, + "bandwidth": Infinity + }, + "abs": { + "fitless": { + "L50": 0.84986000000000006, + "Pref": 1.2098, + "H50": 2.04966, + "bandwidth": 1.2700875072030051, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 3.7215601022106433, + 0.99765737489582307, + 3.7400844139429612, + 0.89682953300184876 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.018478762533401305, + -0.018469245748474084, + -0.018457740743306417, + -0.018443832218991041, + -0.018427018163505338, + -0.018406691762156591, + -0.018382119541637376, + -0.018352414966876118, + -0.018316506549570732, + -0.018273099334810805, + -0.018220628401415251, + -0.018157202735384459, + -0.018080537506030225, + -0.017987872381577841, + -0.01787587305480498, + -0.017740512598472868, + -0.017576928622758725, + -0.017379251451139943, + -0.017140397656703943, + -0.016851822300902874, + -0.016503222090944458, + -0.016082180431748139, + -0.015573744024127478, + -0.014959919313566328, + -0.014219075831828132, + -0.013325242476500687, + -0.012247282328142539, + -0.010947932154860229, + -0.0093826949714626018, + -0.0074985789015427073, + -0.0052326845894636875, + -0.002510658608636529, + 0.00075494535584397227, + 0.0046663182697801453, + 0.0093419250831745515, + 0.01491769454128189, + 0.021547536343272, + 0.029402692196930147, + 0.038669212769015804, + 0.049542576820209572, + 0.062218133937759657, + 0.076875679846781786, + 0.093656122308659384, + 0.11262798983380895, + 0.13374170100989824, + 0.15677042164018351, + 0.1812385422838223, + 0.20634302402325311, + 0.230879809902794, + 0.25319750236480632, + 0.27121263194068335, + 0.28253155483358405, + 0.28472560802978131, + 0.27578613276452391, + 0.25473006270293985, + 0.22222912837740716, + 0.18101809620893483, + 0.13576885657272092, + 0.092207142604665018, + 0.055575444858657487, + 0.029019285507539662, + 0.01275403300476049, + 0.0045582307371172994, + 0.0012713659199891758, + 0.0002634923543449466, + 3.8270992063047547E-5, + 3.6322650498272557E-6, + 2.0710594279006361E-7, + 6.4100241110395667E-9, + 9.5221060376764316E-11, + 5.8448202983376886E-13, + 1.2353678975220252E-15, + 7.204389400822599E-19, + 8.8621572377862723E-23, + 1.6613727266414171E-27, + 3.20390319942102E-33, + 3.951816737733212E-40, + 1.7551548796709678E-48, + 1.4015156218414483E-58, + 8.6892099663269034E-71, + 1.5156628334243495E-85, + 2.1801586022659038E-103, + 5.8653700822086288E-125, + 4.90963583424006E-151, + 1.4622069634989415E-182, + 1.126310744594764E-220, + 9.4317145178072661E-267, + 1.82804288961261E-322, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.65008394829975535, + "Pref": 1.3886738277211363, + "H50": 2.231616199336572, + "R2": 0.80565503971345409, + "bandwidth": 1.7793909920200222 + }, + "fit_movshon": { + "parameters": [ + 0.71187240891078918, + 1.5877996310758231, + 0.89945268078820639, + 10.267772489557352 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 6.1571550420517876E-21, + 1.6309785809732316E-20, + 4.3203175927983363E-20, + 1.1444114130672943E-19, + 3.0314303042947395E-19, + 8.0299282807091406E-19, + 2.1270325619563045E-18, + 5.6342312508008065E-18, + 1.492426149107847E-17, + 3.953194593266806E-17, + 1.0471287982053803E-16, + 2.7736257833426987E-16, + 7.3466713449724828E-16, + 1.9459303616693042E-15, + 5.1541451573886847E-15, + 1.3651398172967582E-14, + 3.6156543648690525E-14, + 9.57599097656243E-14, + 2.5360913247624449E-13, + 6.71625406666185E-13, + 1.7785515465587542E-12, + 4.7095360552767446E-12, + 1.246970971300945E-11, + 3.3013693800217055E-11, + 8.73942786580792E-11, + 2.3131978345284098E-10, + 6.1216866153199008E-10, + 1.6197314655656976E-9, + 4.2846021660349348E-9, + 1.133056902016766E-8, + 2.9952997132730592E-8, + 7.9148791639928322E-8, + 2.0903795192556908E-7, + 5.5174212582018684E-7, + 1.4551934083335695E-6, + 3.83451245028355E-6, + 1.0093006068377861E-5, + 2.6530669172143907E-5, + 6.9624479959801418E-5, + 0.00018234239034894685, + 0.00047629222925641465, + 0.0012396707180408412, + 0.0032092252303936837, + 0.0082311124230021581, + 0.02072711172370972, + 0.050166921078351669, + 0.11151054173359409, + 0.21100964971618219, + 0.31703357208066707, + 0.38002457164830017, + 0.39013760536512981, + 0.36687078204608831, + 0.32750026839993185, + 0.2811271496494232, + 0.23236186340214834, + 0.18414549980684855, + 0.13889377467665759, + 0.098735425763438356, + 0.065349497846202989, + 0.03967725549032234, + 0.021704723361445296, + 0.010467000592933914, + 0.0043341963251004138, + 0.0014927441364979447, + 0.00041146702197618, + 8.6645635181656155E-5, + 1.3176085096705306E-5, + 1.3518071261250434E-6, + 8.6182699018175519E-8, + 3.0912132486608197E-9, + 5.5315497878118409E-11, + 4.2704454969408481E-13, + 1.193226302506211E-15, + 9.7582254306277882E-19, + 1.8068502548795752E-22, + 5.5537323782501108E-27, + 1.9471655806579553E-32, + 4.9473223772491649E-39, + 5.2640155896425E-47, + 1.2086730585602491E-56, + 2.6868711291617186E-68, + 2.1943111531757696E-82, + 2.0403173632467693E-99, + 5.240522027138528E-120, + 6.71026848844435E-145, + 5.4054694652481916E-175, + 2.2431514598631085E-211, + 2.3277413395494433E-255, + 1.5582890504983822E-308, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.9643772681919619, + "bandwidth": 1.2318860713984767 + }, + "fit_movshon_c": { + "parameters": [ + 0.71139716805869468, + 1.5950161812609389, + 0.89829886605377374, + 10.20859695073845, + -0.0018427346866119842 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.001842734686611984, + -0.0018427346866119838, + -0.0018427346866119832, + -0.0018427346866119814, + -0.0018427346866119771, + -0.0018427346866119654, + -0.0018427346866119346, + -0.0018427346866118535, + -0.0018427346866116397, + -0.0018427346866110768, + -0.0018427346866095938, + -0.0018427346866056885, + -0.0018427346865954022, + -0.0018427346865683119, + -0.0018427346864969662, + -0.001842734686309077, + -0.0018427346858142935, + -0.0018427346845114158, + -0.001842734681080882, + -0.0018427346720488987, + -0.0018427346482717264, + -0.0018427345856847888, + -0.0018427344209662735, + -0.0018427339875324361, + -0.0018427328472602957, + -0.001842729848237773, + -0.0018427219630412835, + -0.0018427012388330573, + -0.0018426467959643522, + -0.001842503854139527, + -0.0018421288106609856, + -0.0018411456020363847, + -0.0018385706105510961, + -0.0018318349659951832, + -0.0018142419522428307, + -0.0017683738592699039, + -0.0016490607012702382, + -0.0013396260706357997, + -0.00054047850042967128, + 0.0015098050013141111, + 0.0067071987909288529, + 0.019559071772594111, + 0.049621540227163252, + 0.11173593837075978, + 0.21156142524500454, + 0.31714085464733943, + 0.37970141200788804, + 0.38984068847186448, + 0.36680659795945331, + 0.3276591236343675, + 0.28142944575591722, + 0.23271030968206605, + 0.18443563144735275, + 0.13901990557355831, + 0.098601903476123576, + 0.064886370936600227, + 0.038855128932540527, + 0.020541887633930951, + 0.00902345877154637, + 0.0026927206761371519, + -0.00026556956976216237, + -0.0014029100251051194, + -0.0017488056758656575, + -0.0018282060679064556, + -0.0018412131563334253, + -0.0018426352424329576, + -0.0018427310109386025, + -0.0018427346184048284, + -0.0018427346860617753, + -0.0018427346866103631, + -0.0018427346866119827, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842, + -0.0018427346866119842 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.96469189504598585, + "bandwidth": 1.2318860713984767 + }, + "fit_spline": { + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 0, + 1.030824584594279E-32, + -5.63081105842931E-32, + 3.6423968029418687E-31, + -2.1146486264604038E-30, + 1.1223876717247823E-29, + -5.5583939674642319E-29, + 2.5905988663052083E-28, + -1.1358667668558471E-27, + 4.6363680869064718E-27, + -1.7115578140621796E-26, + 5.26898243997134E-26, + -9.3585853264940189E-26, + -3.7618357854345995E-25, + 5.74691515089002E-24, + -4.4371186626961168E-23, + 2.7697736470316446E-22, + -1.5403422980576185E-21, + 7.9116672630344208E-21, + -3.8108189094671264E-20, + 1.729025311975981E-19, + -7.35646231758475E-19, + 2.8856124675092895E-18, + -9.9779277593630978E-18, + 2.63284078374109E-17, + -1.2072568597882165E-17, + -5.1831625144393543E-16, + 5.0983939430210522E-15, + -3.5064321434432071E-14, + 2.0642596522514042E-13, + -1.1045887726984902E-12, + 5.5058468213580657E-12, + -2.5816382077962151E-11, + 1.1392916491772292E-10, + -4.6883961830995779E-10, + 1.7525171595760627E-9, + -5.5358388688694984E-9, + 1.0942035399328019E-8, + 2.882515997998437E-8, + -5.312353482634625E-7, + 4.2417682102329487E-6, + -2.6888264090540791E-5, + 0.00015096942984382033, + -0.00078098493391295985, + 0.0037850525992770361, + -0.017278691152769143, + 0.13031049961299035, + 0.25277307886174849, + 0.30516286824334232, + 0.35454950129005974, + 0.37389406651193613, + 0.36804612057313035, + 0.33905492586675839, + 0.29310548938088771, + 0.23573656931114856, + 0.19165273887696177, + 0.2175412575985064, + 0.094214776129856639, + -0.01942657173803862, + 0.0047691377278212118, + -0.0010582477206748605, + 0.0001979918428327394, + -2.4168902653986075E-5, + -2.1517601804075142E-6, + 2.9041245985063634E-6, + -1.3795961135184889E-6, + 5.181972001756672E-7, + -1.7323780915844162E-7, + 5.3586133695544043E-8, + -1.5563141884871977E-8, + 4.2572617787966647E-9, + -1.0905456363540684E-9, + 2.571041409315597E-10, + -5.3546730523636959E-11, + 8.7774316001375525E-12, + -5.7165794479929359E-13, + -3.5095703140254995E-13, + 2.2701772162196495E-13, + -9.4556520188021335E-14, + 3.345345641369722E-14, + -1.07693128058121E-14, + 3.2349904087949543E-15, + -9.14735384226664E-16, + 2.4326031794247827E-16, + -6.0219306969592444E-17, + 1.3528264837917337E-17, + -2.5904173135807605E-18, + 3.4044309333204936E-19, + 1.5772959941398804E-20, + -3.3515532578813896E-20, + 1.8435764798318603E-20, + -1.924863952820502E-20, + 9.6899906055793342E-20, + 1.2693989157951187E-18, + 4.957251371109906E-18, + 1.3421454271216628E-17, + 3.0065162758262475E-17, + 5.9902644032388022E-17, + 1.1020302249454363E-16, + 1.9137072425565729E-16 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 2.231616199336572, + "R2": 1, + "bandwidth": 1.5056385317092489 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0.388025367735667, + 1.2488923413499886, + 0.13765178236973866 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 1.6469564987914465E-51, + 1.5038170247568972E-49, + 1.2554364353564822E-47, + 9.5825550436662115E-46, + 6.6873611690306766E-44, + 4.2669258724154761E-42, + 2.4892142564401551E-40, + 1.3276888979265207E-38, + 6.4746639181895474E-37, + 2.8868551902080154E-35, + 1.1768459879288067E-33, + 4.3863282133590023E-32, + 1.4947531660413177E-30, + 4.6571979884144585E-29, + 1.3266818354955726E-27, + 3.4553793002226492E-26, + 8.2283268386971991E-25, + 1.79148923719145E-23, + 3.5661839019969783E-22, + 6.4905295218436611E-21, + 1.0800488194399007E-19, + 1.6432116525010849E-18, + 2.2857592604986804E-17, + 2.9070622556953488E-16, + 3.3803762319988885E-15, + 3.5938720318684028E-14, + 3.4933897452718956E-13, + 3.1046906635299943E-12, + 2.5227632321590761E-11, + 1.8742240758211686E-10, + 1.2730732553166912E-9, + 7.9062790628578065E-9, + 4.4892908845539139E-8, + 2.3306132773267791E-7, + 1.1062404857097089E-6, + 4.8008235410870212E-6, + 1.904885169789946E-5, + 6.9104880536827257E-5, + 0.0002292110248148637, + 0.00069510297588950339, + 0.0019273014815721658, + 0.0048858150754592178, + 0.011324297174990942, + 0.023997851010994584, + 0.046496505077814956, + 0.082367356949819531, + 0.13340644549760228, + 0.19755378642673538, + 0.26747350308653062, + 0.331102939078841, + 0.37474182591064931, + 0.38778246212676, + 0.36688590003927157, + 0.31736625111238581, + 0.25100208241512856, + 0.18150173041647896, + 0.1199971904304197, + 0.072535105680804027, + 0.040087805355227817, + 0.02025644254238846, + 0.0093583855712850127, + 0.0039529885365006982, + 0.0015266414083019667, + 0.00053905786072611615, + 0.00017402858599965194, + 5.1368000614159521E-5, + 1.3862820350480767E-5, + 3.4205614025185462E-6, + 7.71667214613253E-7, + 1.5916573156173951E-7, + 3.0016216759360986E-8, + 5.1754628875301E-9, + 8.158856729659507E-10, + 1.1759700949884607E-10, + 1.5497088423904419E-11, + 1.8671998633095423E-12, + 2.0569245672458014E-13, + 2.0717282408216046E-14, + 1.9078053819714555E-15, + 1.6062835640685807E-16, + 1.2365088357066423E-17, + 8.7028018431495122E-19, + 5.6002553367160525E-20, + 3.2949090003228029E-21, + 1.772416903426288E-22, + 8.7171637527890473E-24, + 3.9198675071051942E-25, + 1.6115895184086763E-26, + 6.0579312847446965E-28, + 2.0820018641492842E-29, + 6.5422140255334816E-31, + 1.87955588878546E-32, + 4.9371077185524231E-34, + 1.185705472038208E-35, + 2.6035619026922258E-37, + 5.22692001506653E-39, + 9.59424188018404E-41, + 1.6101351637798284E-42, + 2.470591077430022E-44, + 3.4659816979617149E-46 + ], + "L50": NaN, + "Pref": 1.6469564987914465E-51, + "H50": NaN, + "R2": 0.95243162642428381, + "bandwidth": Infinity + } + } + }, + "spatial_frequency_tuning_calc": { + "input_parameters": [], + "depends_on": { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b2de4b76_c0c87d9fe8e2a749" + } + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_writer_outputs/temporal_frequency_tuning_calc.mock.4.json b/tests/+did2/fixtures/ndi_writer_outputs/temporal_frequency_tuning_calc.mock.4.json new file mode 100644 index 00000000..dc02e0e0 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/temporal_frequency_tuning_calc.mock.4.json @@ -0,0 +1,3482 @@ +{ + "app": { + "name": "ndi.calc.vis.temporal_frequency_tuning", + "version": "6b1ac939f905baf95d213fc4b3d60a60c094f288", + "url": "https://github.com/VH-Lab/NDIcalc-vis-matlab", + "os": "MACA64", + "os_version": "26.6.2", + "interpreter": "MATLAB", + "interpreter_version": "24.2" + }, + "base": { + "id": "412696f9b3e7f01f_40d8ba944b372e54", + "session_id": "412696f9abd9edc3_40dbbdf6582271b2", + "name": "", + "datestamp": "2026-08-27T00:25:59.138Z" + }, + "calculator": {}, + "depends_on": [ + { + "name": "element_id", + "value": "412696f9b3e189c7_c0d3a82f9a74dcbc" + }, + { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b3e73659_c0c270c4d0bcfa1e" + } + ], + "document_class": { + "definition": "$NDICALCDOCUMENTPATH/calc/temporal_frequency_tuning_calc.json", + "validation": "$NDICALCSCHEMAPATH/calc/temporal_frequency_tuning_calc_v2_schema.json", + "class_name": "temporal_frequency_tuning_calc", + "property_list_name": "temporal_frequency_tuning_calc", + "class_version": 2, + "superclasses": [ + { + "definition": "$NDICALCDOCUMENTPATH/vision/temporal_frequency_tuning.json" + }, + { + "definition": "$NDIDOCUMENTPATH/app.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/calculator.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + } + ] + }, + "temporal_frequency_tuning": { + "properties": { + "response_units": [], + "response_type": "mean" + }, + "tuning_curve": { + "temporal_frequency": [ + 0.01, + 0.010918504160990019, + 0.011921373311355642, + 0.013016356410475195, + 0.01421191416287026, + 0.015517284392293192, + 0.016942553420451877, + 0.018498734001899952, + 0.020197850417279228, + 0.022053031382411725, + 0.024078611491130587, + 0.026290241975677156, + 0.028705011640486566, + 0.031341578903791946, + 0.034220315967304939, + 0.03736346622794124, + 0.040795316147878666, + 0.044542382910951632, + 0.048633619315363641, + 0.053100637485880273, + 0.057977953134080634, + 0.063303252254014369, + 0.069117682313965714, + 0.075466170194302129, + 0.082397769328046877, + 0.089966038726457559, + 0.09822945681826166, + 0.10725187330019793, + 0.1171030024902186, + 0.12785896199538765, + 0.13960286085665055, + 0.15242544171494496, + 0.16642578196053692, + 0.181712059283214, + 0.19840238753858369, + 0.21662572938903818, + 0.23652289277117111, + 0.25824761888914294, + 0.28196777014068719, + 0.30786662715461721, + 0.33614430496176506, + 0.36701929924181315, + 0.40073017459353777, + 0.43753740787338014, + 0.47772540084542886, + 0.521604677694144, + 0.56951428437953722, + 0.621824408374123, + 0.67893923902380227, + 0.7413000906340782, + 0.8093888124130465, + 0.88373151161906183, + 0.96490261868107319, + 1.0535293257019469, + 1.150296432640171, + 1.2559516386153688, + 1.3713113192224147, + 1.4972668344942637, + 1.6347914162537982, + 1.7849476880717872, + 1.9488958759361332, + 2.1279027730744948, + 2.3233515281996087, + 2.5367523328089958, + 2.7697540901176172, + 3.0241571557868312, + 3.3019272488946276, + 3.6052106406342341, + 3.9363507381010354, + 4.2979061913072316, + 4.6926706633332795, + 5.123694416376023, + 5.5943078804842905, + 6.1081473870927017, + 6.6691832661912009, + 7.2817505242313674, + 7.95058233981114, + 8.6808466359521734, + 9.4781860115560068, + 10.348761340581159, + 11.299299375822811, + 12.337144725119334, + 13.47031660159516, + 14.70757078643696, + 16.058467282976729, + 17.533444184830358, + 19.143898328855663, + 20.902273356118034, + 22.822155861292568, + 24.91838037342858, + 27.207143979241181, + 29.706131474599957, + 32.434652011233638, + 35.413788294491795, + 38.666559484982805, + 42.218099062795311, + 46.09584902862197, + 50.329771942337693, + 54.952582437409255, + 60 + ], + "mean": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.2572316099148414, + 0.31720177192722421, + 0.35689001288058414, + 0.37399422859872827, + 0.36907828816534866, + 0.34388729215040337, + 0.30365140747684954, + 0.25314508135672287, + 0.20006694347456144, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "stddev": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.000342399613238542, + 0.00038181371268250611, + 0.00040705768765446283, + 0.0005624388743343732, + 0.00032554082737593, + 0.00035852272207745236, + 0.00021948986704014884, + 0.0001979884725696499, + 9.4314249272982645E-5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "stderr": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.00015312576213420334, + 0.00017075228325993144, + 0.00018204173207185117, + 0.000251530311240024, + 0.00014558628389282078, + 0.00016033623560868961, + 9.8158852614832663E-5, + 8.854313668541793E-5, + 4.2178614524249861E-5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "individual": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25783230968978976, + 0.31775351982519051, + 0.35713552052975439, + 0.37471891094136134, + 0.36949225534547864, + 0.34377240112502572, + 0.30371700978299621, + 0.25306854418388058, + 0.20001576860920728, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25715090300858573, + 0.31686668573340926, + 0.35679321246758772, + 0.37439257091441958, + 0.36877898770168316, + 0.34396523054881151, + 0.30393581886075965, + 0.25312648314517683, + 0.20010084397817596, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25699524123061424, + 0.31735841603570913, + 0.35642051853833778, + 0.37353099759596819, + 0.36904241165062585, + 0.34435762953653914, + 0.30357335744064307, + 0.25346333772269647, + 0.2, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.25703733515801258, + 0.317205122116903, + 0.35664961821183466, + 0.37393751857093482, + 0.36875732011200768, + 0.34397039252906225, + 0.30369491908490742, + 0.252923032612962, + 0.2002181047854239, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.2, + 0.2571422604872044, + 0.31682511592490903, + 0.35745119465540626, + 0.37339114497095749, + 0.36932046601694768, + 0.34337080701257822, + 0.30333593221494115, + 0.25314400911889862, + 0.2, + 0.2, + 0.2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + "control_mean": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "control_stddev": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "control_stderr": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "control_mean_stddev": 0, + "control_mean_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 0, + "across_stimuli_anova_p": 0 + }, + "fitless": { + "L50": 0.84986000000000006, + "Pref": 1.2098, + "H50": 2.04966, + "bandwidth": 1.2700875072030051, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 0, + 3.7214185026161641, + 0.99764679739560391, + 3.7399412186439815, + 0.89682486452108012 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.018477170160946965, + -0.01846765407220774, + -0.018456149908678388, + -0.01844224240183534, + -0.018425429576384378, + -0.018405104662030158, + -0.018380534239132551, + -0.018350831837488535, + -0.01831492604720264, + -0.018271522008129093, + -0.018219054913620081, + -0.01815563388808128, + -0.018078974268083581, + -0.0179863159239404, + -0.017874324792586549, + -0.017738974241718442, + -0.017575402237731019, + -0.017377739534242931, + -0.017138903223624435, + -0.01685034899403659, + -0.016501774308772532, + -0.016080763484523697, + -0.015572364321036591, + -0.014958584587455359, + -0.014217795408635325, + -0.013324027597718224, + -0.012246146535880076, + -0.010946891750421184, + -0.0093817695596398742, + -0.0074977920339613924, + -0.0052320645210475192, + -0.0025102391812774627, + 0.00075512368963348564, + 0.0046662072737375659, + 0.0093414674117626717, + 0.014916822270174102, + 0.021546169382736569, + 0.029400736643620196, + 0.038666559294517011, + 0.049539099256824759, + 0.062213688309362691, + 0.07687010421135021, + 0.093649237934151142, + 0.11261960442103147, + 0.13373161489532626, + 0.1567584381296423, + 0.18122448342200359, + 0.20632675307896697, + 0.23086126145645736, + 0.25317671984805767, + 0.27118981045946189, + 0.28250708380594247, + 0.28470010357780828, + 0.27576044465305904, + 0.25470523702022119, + 0.22220630901308508, + 0.1809983605961743, + 0.13575300739155963, + 0.092195512614382955, + 0.0555677981998903, + 0.029014886076335605, + 0.012751880515490539, + 0.0045573654196093827, + 0.0012710916422567211, + 0.00026342711065143717, + 3.8260013535885923E-5, + 3.6310476526979519E-6, + 2.0702424470329662E-7, + 6.4070301096412057E-9, + 9.5168153481647411E-11, + 5.8409439872921743E-13, + 1.2343875442031404E-15, + 7.1975358491737124E-19, + 8.8520366027149659E-23, + 1.65909245983986E-27, + 3.1986131390604543E-33, + 3.9439611125361476E-40, + 1.7509516715185364E-48, + 1.3974701305167788E-58, + 8.6589657155403491E-71, + 1.5092993255582047E-85, + 2.1691147293296668E-103, + 5.8295154549839569E-125, + 4.8734144892505513E-151, + 1.4491869276055713E-182, + 1.1142062572571633E-220, + 9.30938407104502E-267, + 1.82804288961261E-322, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.65008394829975535, + "Pref": 1.3886738277211363, + "H50": 2.231616199336572, + "R2": 0.80563583750826684, + "bandwidth": 1.7793909920200222 + }, + "fit_movshon": { + "parameters": [ + 0.71165271320377232, + 1.5879013147383851, + 0.89937950276697765, + 10.273031395201311 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 6.0163521691949489E-21, + 1.5944764366322927E-20, + 4.2257345203781287E-20, + 1.1199158824947236E-19, + 2.9680246209249022E-19, + 7.86589719487852E-19, + 2.0846225260748746E-18, + 5.524648411135554E-18, + 1.4641295814763517E-17, + 3.8801770931024418E-17, + 1.0283007396612214E-16, + 2.7251135333056041E-16, + 7.2217763977934837E-16, + 1.9138037952211597E-15, + 5.0715820415960477E-15, + 1.3439423438150543E-14, + 3.561288083139114E-14, + 9.4367103183562547E-14, + 2.5004517732844408E-13, + 6.6251758776320167E-13, + 1.7553085007412064E-12, + 4.65030923330761E-12, + 1.2319037084998411E-11, + 3.2631065512209721E-11, + 8.6424497232490991E-11, + 2.2886710054080692E-10, + 6.0598018577659325E-10, + 1.6041578503851821E-9, + 4.2455244809207279E-9, + 1.1232834181026446E-8, + 2.9709456880479848E-8, + 7.85444568149834E-8, + 2.0754546414431847E-7, + 5.480764441775274E-7, + 1.4462475750863187E-6, + 3.8128442393921926E-6, + 1.0040989306957529E-5, + 2.640713776483619E-5, + 6.93349798803765E-5, + 0.00018167518470000357, + 0.00047478764069343841, + 0.0012363770032916609, + 0.0032023197756306542, + 0.008217597251980964, + 0.020703727041297016, + 0.050135663527970012, + 0.11149088132077473, + 0.21103184871911743, + 0.31707953734430205, + 0.38003742341402358, + 0.39010542897309791, + 0.36681582676483215, + 0.32744293491689525, + 0.28107808946281687, + 0.23232498462058648, + 0.18412106388757374, + 0.13888013501221938, + 0.098729977225353524, + 0.065349326835370369, + 0.03967968253479693, + 0.021707726996349243, + 0.010469426683664049, + 0.00433569043741106, + 0.0014934625806279427, + 0.00041173300153814408, + 8.6718944747220673E-5, + 1.3190414430471932E-5, + 1.353671935239334E-6, + 8.6332017519641786E-8, + 3.0978890688471316E-9, + 5.5463528389406055E-11, + 4.2845417736123163E-13, + 1.1980669068009356E-15, + 9.8067362406095227E-19, + 1.8178323172656823E-22, + 5.5949279363842368E-27, + 1.9647670772960225E-32, + 5.0017619414871178E-39, + 5.3344675057710689E-47, + 1.228336073816733E-56, + 2.7399812857755506E-68, + 2.2470006535885171E-82, + 2.0998290150383362E-99, + 5.4262242544642706E-120, + 6.9992427769014323E-145, + 5.6885119285573028E-175, + 2.3860704025534052E-211, + 2.5083743343360667E-255, + 1.7057509494316455E-308, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.96438109636275982, + "bandwidth": 1.2318860713984767 + }, + "fit_movshon_c": { + "parameters": [ + 0.71117919656949036, + 1.5951162953855815, + 0.89822656638468368, + 10.213833275596476, + -0.0018421199377224664 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224662, + -0.001842119937722466, + -0.0018421199377224654, + -0.0018421199377224638, + -0.0018421199377224595, + -0.001842119937722448, + -0.0018421199377224176, + -0.0018421199377223381, + -0.0018421199377221279, + -0.0018421199377215744, + -0.0018421199377201155, + -0.0018421199377162711, + -0.001842119937706141, + -0.0018421199376794481, + -0.0018421199376091144, + -0.0018421199374237987, + -0.0018421199369355488, + -0.0018421199356492375, + -0.00184211993226064, + -0.0018421199233346335, + -0.0018421198998247713, + -0.0018421198379106939, + -0.0018421196748820358, + -0.001842119245681559, + -0.0018421181159851087, + -0.0018421151433002663, + -0.0018421073234654365, + -0.0018420867608212709, + -0.0018420327155118034, + -0.0018418907468877289, + -0.00184151807144613, + -0.0018405405843855956, + -0.001837979302306315, + -0.0018312761795428818, + -0.0018137593775897692, + -0.0017680671774619667, + -0.0016491521008578055, + -0.001340595143155883, + -0.00054331228727069313, + 0.0015032286362627763, + 0.0066938160735805418, + 0.01953560170481498, + 0.049590119998036558, + 0.11171626995657055, + 0.21158345661976838, + 0.31718623950309333, + 0.37971408756157604, + 0.38980882427364016, + 0.36675198377528012, + 0.32760194093102385, + 0.28138034803375905, + 0.23267328305993257, + 0.18441102711900728, + 0.13900615790961532, + 0.0985964697890421, + 0.064886373177960838, + 0.0388578911419539, + 0.020545362224144867, + 0.0090264474685985627, + 0.0026948238019954412, + -0.0002642280600329539, + -0.0014020220660368977, + -0.0017481143650973714, + -0.001827576069804669, + -0.0018405963789951813, + -0.0018420203268663723, + -0.0018421162543639136, + -0.0018421198693384876, + -0.0018421199371704972, + -0.0018421199377208388, + -0.0018421199377224649, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.96469556083570551, + "bandwidth": 1.2318860713984767 + }, + "fit_spline": { + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 0, + 1.0311407411669256E-32, + -5.6325380427795667E-32, + 3.6435139354847357E-31, + -2.11529719467665E-30, + 1.1227319109336412E-29, + -5.5600987413049377E-29, + 2.59139340969398E-28, + -1.136215140138129E-27, + 4.6377900730191322E-27, + -1.7120827532811968E-26, + 5.2705984505462276E-26, + -9.3614556288770108E-26, + -3.7629895502230576E-25, + 5.748677744666448E-24, + -4.4384795384937922E-23, + 2.7706231437901998E-22, + -1.5408147250339776E-21, + 7.9140937918960548E-21, + -3.8119876975067212E-20, + 1.7295556085218952E-19, + -7.3587185636501716E-19, + 2.8864974923344133E-18, + -9.9809880156760135E-18, + 2.6336482828354608E-17, + -1.2076271285970945E-17, + -5.18475220382058E-16, + 5.0999576336616507E-15, + -3.5075075752724996E-14, + 2.0648927660386216E-13, + -1.1049275529388728E-12, + 5.5075354788528275E-12, + -2.5824300029277921E-11, + 1.1396410728797992E-10, + -4.6898341263642351E-10, + 1.7530546611325425E-9, + -5.5375367250029924E-9, + 1.0945391349953706E-8, + 2.8834000731283343E-8, + -5.3139827952207427E-7, + 4.2430691715403818E-6, + -2.68965107908488E-5, + 0.00015101573255936197, + -0.00078122446401699937, + 0.0037862134847224914, + -0.01728399057214303, + 0.13033320602403781, + 0.25262650898598132, + 0.30535111055322944, + 0.35447280493616584, + 0.373876182660716, + 0.36802636782014475, + 0.33890642218691519, + 0.2933273952810464, + 0.23541220703534899, + 0.1917390036395103, + 0.21751707874381329, + 0.094221571817752786, + -0.01942836702622705, + 0.0047695784631577066, + -0.0010583455176335277, + 0.00019801014006097143, + -2.4171136200184861E-5, + -2.1519590332822439E-6, + 2.9043929804246863E-6, + -1.3797236075838764E-6, + 5.1824508887807463E-7, + -1.7325381876614641E-7, + 5.3591085807228252E-8, + -1.556458013785751E-8, + 4.2576552096031724E-9, + -1.0906464180939609E-9, + 2.5712790096671386E-10, + -5.3551678993914289E-11, + 8.7782427581477059E-12, + -5.7171077402566438E-13, + -3.5098946476349639E-13, + 2.2703870124923492E-13, + -9.4565258539086253E-14, + 3.3456547983119367E-14, + -1.0770308041633364E-14, + 3.2352893673630935E-15, + -9.1481991862897667E-16, + 2.4328279861387034E-16, + -6.0224872079688888E-17, + 1.3529515039672022E-17, + -2.5906567045380985E-18, + 3.404745550573884E-19, + 1.577441758452089E-20, + -3.3518629884945918E-20, + 1.8437468522024144E-20, + -1.9250418372957185E-20, + 9.6908860968639007E-20, + 1.2695162260910731E-18, + 4.9577094907901955E-18, + 1.3422694602174143E-17, + 3.0067941201742459E-17, + 5.990817987837974E-17, + 1.1021320680226837E-16, + 1.9138840959950003E-16 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 2.231616199336572, + "R2": 1, + "bandwidth": 1.5056385317092489 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0.38799796124024982, + 1.2488634312445057, + 0.13765022491606529 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 1.6443515570799493E-51, + 1.5015590404253772E-49, + 1.2536495069609559E-47, + 9.56964522038052E-46, + 6.6788474247566221E-44, + 4.2618012192062838E-42, + 2.4863990903150592E-40, + 1.3262777050017047E-38, + 6.4682095600844687E-37, + 2.8841621738221883E-35, + 1.1758211112408765E-33, + 4.3827713309095392E-32, + 1.4936276778384973E-30, + 4.6539517385096826E-29, + 1.325828590047698E-27, + 3.45333624091356E-26, + 8.2238718604046023E-25, + 1.7906049682435272E-23, + 3.5645869884464974E-22, + 6.4879072368669234E-21, + 1.0796575547023696E-19, + 1.6426816515507457E-18, + 2.285108187102942E-17, + 2.9063379203925076E-16, + 3.379647710495639E-15, + 3.5932111478493234E-14, + 3.4928507319732854E-13, + 3.1042972216996984E-12, + 2.522507975521038E-11, + 1.8740785150287872E-10, + 1.2730017408189286E-9, + 7.9059888084213086E-9, + 4.4892043477657661E-8, + 2.3306042626421939E-7, + 1.1062510093701044E-6, + 4.8009237173216256E-6, + 1.9049426828574319E-5, + 6.91074713307466E-5, + 0.00022922082621291273, + 0.000695134953753702, + 0.0019273924884579223, + 0.0048860418139400766, + 0.011324790545930032, + 0.023998779721964788, + 0.046497983871277057, + 0.082369241633773335, + 0.13340803716147545, + 0.19755357957794306, + 0.26746920948406094, + 0.33109198449121308, + 0.37472228497920745, + 0.38775406402164564, + 0.36685055204471062, + 0.31732769530132848, + 0.25096476988641453, + 0.18146945065653011, + 0.11997210279654132, + 0.072517529341236633, + 0.040076677489629516, + 0.020250064084762164, + 0.0093550707472925248, + 0.0039514249011001392, + 0.001525971317112781, + 0.00053879677872719159, + 0.00017393604573656438, + 5.1338145509390556E-5, + 1.3854049738713092E-5, + 3.41821432897334E-6, + 7.710948813387365E-7, + 1.5903852235458923E-7, + 2.9990439187299363E-8, + 5.1706995276287694E-9, + 8.1508285694454222E-10, + 1.1747357852731057E-10, + 1.5479774153624526E-11, + 1.8649836278421268E-12, + 2.0543356797042436E-13, + 2.0689680132635519E-14, + 1.905119076458606E-15, + 1.6038969333906338E-16, + 1.2345729872194438E-17, + 8.6884651892841175E-19, + 5.5905603825568928E-20, + 3.2889222102055677E-21, + 1.7690407729661647E-22, + 8.6997759000649118E-24, + 3.9116885658954736E-25, + 1.6080755822375136E-26, + 6.0441415443820425E-28, + 2.0770587320866948E-29, + 6.526027654264463E-31, + 1.8747140079677519E-32, + 4.9238761555556823E-34, + 1.1824021198759327E-35, + 2.5960273297937811E-37, + 5.21121873640771E-39, + 9.5643470645471713E-41, + 1.6049345763378724E-42, + 2.4623247012885449E-44, + 3.4539758135622209E-46 + ], + "L50": NaN, + "Pref": 1.6443515570799493E-51, + "H50": NaN, + "R2": 0.95241641761661544, + "bandwidth": Infinity + }, + "abs": { + "fitless": { + "L50": 0.84986000000000006, + "Pref": 1.2098, + "H50": 2.04966, + "bandwidth": 1.2700875072030051, + "low_pass_index": 0, + "high_pass_index": 0 + }, + "fit_dog": { + "parameters": [ + 0, + 3.7214185026161641, + 0.99764679739560391, + 3.7399412186439815, + 0.89682486452108012 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.018477170160946965, + -0.01846765407220774, + -0.018456149908678388, + -0.01844224240183534, + -0.018425429576384378, + -0.018405104662030158, + -0.018380534239132551, + -0.018350831837488535, + -0.01831492604720264, + -0.018271522008129093, + -0.018219054913620081, + -0.01815563388808128, + -0.018078974268083581, + -0.0179863159239404, + -0.017874324792586549, + -0.017738974241718442, + -0.017575402237731019, + -0.017377739534242931, + -0.017138903223624435, + -0.01685034899403659, + -0.016501774308772532, + -0.016080763484523697, + -0.015572364321036591, + -0.014958584587455359, + -0.014217795408635325, + -0.013324027597718224, + -0.012246146535880076, + -0.010946891750421184, + -0.0093817695596398742, + -0.0074977920339613924, + -0.0052320645210475192, + -0.0025102391812774627, + 0.00075512368963348564, + 0.0046662072737375659, + 0.0093414674117626717, + 0.014916822270174102, + 0.021546169382736569, + 0.029400736643620196, + 0.038666559294517011, + 0.049539099256824759, + 0.062213688309362691, + 0.07687010421135021, + 0.093649237934151142, + 0.11261960442103147, + 0.13373161489532626, + 0.1567584381296423, + 0.18122448342200359, + 0.20632675307896697, + 0.23086126145645736, + 0.25317671984805767, + 0.27118981045946189, + 0.28250708380594247, + 0.28470010357780828, + 0.27576044465305904, + 0.25470523702022119, + 0.22220630901308508, + 0.1809983605961743, + 0.13575300739155963, + 0.092195512614382955, + 0.0555677981998903, + 0.029014886076335605, + 0.012751880515490539, + 0.0045573654196093827, + 0.0012710916422567211, + 0.00026342711065143717, + 3.8260013535885923E-5, + 3.6310476526979519E-6, + 2.0702424470329662E-7, + 6.4070301096412057E-9, + 9.5168153481647411E-11, + 5.8409439872921743E-13, + 1.2343875442031404E-15, + 7.1975358491737124E-19, + 8.8520366027149659E-23, + 1.65909245983986E-27, + 3.1986131390604543E-33, + 3.9439611125361476E-40, + 1.7509516715185364E-48, + 1.3974701305167788E-58, + 8.6589657155403491E-71, + 1.5092993255582047E-85, + 2.1691147293296668E-103, + 5.8295154549839569E-125, + 4.8734144892505513E-151, + 1.4491869276055713E-182, + 1.1142062572571633E-220, + 9.30938407104502E-267, + 1.82804288961261E-322, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.65008394829975535, + "Pref": 1.3886738277211363, + "H50": 2.231616199336572, + "R2": 0.80563583750826684, + "bandwidth": 1.7793909920200222 + }, + "fit_movshon": { + "parameters": [ + 0.71165271320377232, + 1.5879013147383851, + 0.89937950276697765, + 10.273031395201311 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 6.0163521691949489E-21, + 1.5944764366322927E-20, + 4.2257345203781287E-20, + 1.1199158824947236E-19, + 2.9680246209249022E-19, + 7.86589719487852E-19, + 2.0846225260748746E-18, + 5.524648411135554E-18, + 1.4641295814763517E-17, + 3.8801770931024418E-17, + 1.0283007396612214E-16, + 2.7251135333056041E-16, + 7.2217763977934837E-16, + 1.9138037952211597E-15, + 5.0715820415960477E-15, + 1.3439423438150543E-14, + 3.561288083139114E-14, + 9.4367103183562547E-14, + 2.5004517732844408E-13, + 6.6251758776320167E-13, + 1.7553085007412064E-12, + 4.65030923330761E-12, + 1.2319037084998411E-11, + 3.2631065512209721E-11, + 8.6424497232490991E-11, + 2.2886710054080692E-10, + 6.0598018577659325E-10, + 1.6041578503851821E-9, + 4.2455244809207279E-9, + 1.1232834181026446E-8, + 2.9709456880479848E-8, + 7.85444568149834E-8, + 2.0754546414431847E-7, + 5.480764441775274E-7, + 1.4462475750863187E-6, + 3.8128442393921926E-6, + 1.0040989306957529E-5, + 2.640713776483619E-5, + 6.93349798803765E-5, + 0.00018167518470000357, + 0.00047478764069343841, + 0.0012363770032916609, + 0.0032023197756306542, + 0.008217597251980964, + 0.020703727041297016, + 0.050135663527970012, + 0.11149088132077473, + 0.21103184871911743, + 0.31707953734430205, + 0.38003742341402358, + 0.39010542897309791, + 0.36681582676483215, + 0.32744293491689525, + 0.28107808946281687, + 0.23232498462058648, + 0.18412106388757374, + 0.13888013501221938, + 0.098729977225353524, + 0.065349326835370369, + 0.03967968253479693, + 0.021707726996349243, + 0.010469426683664049, + 0.00433569043741106, + 0.0014934625806279427, + 0.00041173300153814408, + 8.6718944747220673E-5, + 1.3190414430471932E-5, + 1.353671935239334E-6, + 8.6332017519641786E-8, + 3.0978890688471316E-9, + 5.5463528389406055E-11, + 4.2845417736123163E-13, + 1.1980669068009356E-15, + 9.8067362406095227E-19, + 1.8178323172656823E-22, + 5.5949279363842368E-27, + 1.9647670772960225E-32, + 5.0017619414871178E-39, + 5.3344675057710689E-47, + 1.228336073816733E-56, + 2.7399812857755506E-68, + 2.2470006535885171E-82, + 2.0998290150383362E-99, + 5.4262242544642706E-120, + 6.9992427769014323E-145, + 5.6885119285573028E-175, + 2.3860704025534052E-211, + 2.5083743343360667E-255, + 1.7057509494316455E-308, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.96438109636275982, + "bandwidth": 1.2318860713984767 + }, + "fit_movshon_c": { + "parameters": [ + 0.71117919656949036, + 1.5951162953855815, + 0.89822656638468368, + 10.213833275596476, + -0.0018421199377224664 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224662, + -0.001842119937722466, + -0.0018421199377224654, + -0.0018421199377224638, + -0.0018421199377224595, + -0.001842119937722448, + -0.0018421199377224176, + -0.0018421199377223381, + -0.0018421199377221279, + -0.0018421199377215744, + -0.0018421199377201155, + -0.0018421199377162711, + -0.001842119937706141, + -0.0018421199376794481, + -0.0018421199376091144, + -0.0018421199374237987, + -0.0018421199369355488, + -0.0018421199356492375, + -0.00184211993226064, + -0.0018421199233346335, + -0.0018421198998247713, + -0.0018421198379106939, + -0.0018421196748820358, + -0.001842119245681559, + -0.0018421181159851087, + -0.0018421151433002663, + -0.0018421073234654365, + -0.0018420867608212709, + -0.0018420327155118034, + -0.0018418907468877289, + -0.00184151807144613, + -0.0018405405843855956, + -0.001837979302306315, + -0.0018312761795428818, + -0.0018137593775897692, + -0.0017680671774619667, + -0.0016491521008578055, + -0.001340595143155883, + -0.00054331228727069313, + 0.0015032286362627763, + 0.0066938160735805418, + 0.01953560170481498, + 0.049590119998036558, + 0.11171626995657055, + 0.21158345661976838, + 0.31718623950309333, + 0.37971408756157604, + 0.38980882427364016, + 0.36675198377528012, + 0.32760194093102385, + 0.28138034803375905, + 0.23267328305993257, + 0.18441102711900728, + 0.13900615790961532, + 0.0985964697890421, + 0.064886373177960838, + 0.0388578911419539, + 0.020545362224144867, + 0.0090264474685985627, + 0.0026948238019954412, + -0.0002642280600329539, + -0.0014020220660368977, + -0.0017481143650973714, + -0.001827576069804669, + -0.0018405963789951813, + -0.0018420203268663723, + -0.0018421162543639136, + -0.0018421198693384876, + -0.0018421199371704972, + -0.0018421199377208388, + -0.0018421199377224649, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664, + -0.0018421199377224664 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 1.8459154439030661, + "R2": 0.96469556083570551, + "bandwidth": 1.2318860713984767 + }, + "fit_spline": { + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 0, + 1.0311407411669256E-32, + -5.6325380427795667E-32, + 3.6435139354847357E-31, + -2.11529719467665E-30, + 1.1227319109336412E-29, + -5.5600987413049377E-29, + 2.59139340969398E-28, + -1.136215140138129E-27, + 4.6377900730191322E-27, + -1.7120827532811968E-26, + 5.2705984505462276E-26, + -9.3614556288770108E-26, + -3.7629895502230576E-25, + 5.748677744666448E-24, + -4.4384795384937922E-23, + 2.7706231437901998E-22, + -1.5408147250339776E-21, + 7.9140937918960548E-21, + -3.8119876975067212E-20, + 1.7295556085218952E-19, + -7.3587185636501716E-19, + 2.8864974923344133E-18, + -9.9809880156760135E-18, + 2.6336482828354608E-17, + -1.2076271285970945E-17, + -5.18475220382058E-16, + 5.0999576336616507E-15, + -3.5075075752724996E-14, + 2.0648927660386216E-13, + -1.1049275529388728E-12, + 5.5075354788528275E-12, + -2.5824300029277921E-11, + 1.1396410728797992E-10, + -4.6898341263642351E-10, + 1.7530546611325425E-9, + -5.5375367250029924E-9, + 1.0945391349953706E-8, + 2.8834000731283343E-8, + -5.3139827952207427E-7, + 4.2430691715403818E-6, + -2.68965107908488E-5, + 0.00015101573255936197, + -0.00078122446401699937, + 0.0037862134847224914, + -0.01728399057214303, + 0.13033320602403781, + 0.25262650898598132, + 0.30535111055322944, + 0.35447280493616584, + 0.373876182660716, + 0.36802636782014475, + 0.33890642218691519, + 0.2933273952810464, + 0.23541220703534899, + 0.1917390036395103, + 0.21751707874381329, + 0.094221571817752786, + -0.01942836702622705, + 0.0047695784631577066, + -0.0010583455176335277, + 0.00019801014006097143, + -2.4171136200184861E-5, + -2.1519590332822439E-6, + 2.9043929804246863E-6, + -1.3797236075838764E-6, + 5.1824508887807463E-7, + -1.7325381876614641E-7, + 5.3591085807228252E-8, + -1.556458013785751E-8, + 4.2576552096031724E-9, + -1.0906464180939609E-9, + 2.5712790096671386E-10, + -5.3551678993914289E-11, + 8.7782427581477059E-12, + -5.7171077402566438E-13, + -3.5098946476349639E-13, + 2.2703870124923492E-13, + -9.4565258539086253E-14, + 3.3456547983119367E-14, + -1.0770308041633364E-14, + 3.2352893673630935E-15, + -9.1481991862897667E-16, + 2.4328279861387034E-16, + -6.0224872079688888E-17, + 1.3529515039672022E-17, + -2.5906567045380985E-18, + 3.404745550573884E-19, + 1.577441758452089E-20, + -3.3518629884945918E-20, + 1.8437468522024144E-20, + -1.9250418372957185E-20, + 9.6908860968639007E-20, + 1.2695162260910731E-18, + 4.9577094907901955E-18, + 1.3422694602174143E-17, + 3.0067941201742459E-17, + 5.990817987837974E-17, + 1.1021320680226837E-16, + 1.9138840959950003E-16 + ], + "L50": 0.78591783537328452, + "Pref": 1.1486627789744879, + "H50": 2.231616199336572, + "R2": 1, + "bandwidth": 1.5056385317092489 + }, + "fit_gausslog": { + "parameters": [ + 0, + 0.38799796124024982, + 1.2488634312445057, + 0.13765022491606529 + ], + "values": [ + 0.01, + 0.010995218165011596, + 0.012089482249620098, + 0.013292649483660822, + 0.014615558106387948, + 0.016070124998313926, + 0.017669453029546821, + 0.019427949091629249, + 0.021361453876120245, + 0.023487384568977469, + 0.025824891746143414, + 0.028395031883665423, + 0.03122095703633615, + 0.034328123393496987, + 0.037744520590693775, + 0.041500923842845025, + 0.045631171170161265, + 0.050172468214091062, + 0.055165723389104096, + 0.060655916389388276, + 0.066692503370002626, + 0.073329862452395034, + 0.080627783567437564, + 0.0886520070485313, + 0.097474815826474784, + 0.10717568656064153, + 0.1178420055719155, + 0.12956985602657231, + 0.14246488346213057, + 0.15664324745190783, + 0.17223266798096232, + 0.18937357595926882, + 0.20822037823605558, + 0.22894284851066646, + 0.25172765666939778, + 0.27678005032471653, + 0.30432570370431467, + 0.33461275054496192, + 0.36791401930364592, + 0.40452949082098744, + 0.4447890005757813, + 0.48905520987281864, + 0.53772687272871744, + 0.59124242788416725, + 0.65008394829975535, + 0.714781483712793, + 0.78591783537328452, + 0.86413380597029321, + 0.95013397204051742, + 1.0446930308574516, + 1.1486627789744879, + 1.2629797852852982, + 1.3886738277211363, + 1.526877169583563, + 1.6788347590746675, + 1.8459154439030661, + 2.0296243019878446, + 2.231616199336572, + 2.4537106972279625, + 2.6979084429844149, + 2.9664091919840407, + 3.2616316232560312, + 3.5862351271600952, + 3.9431437614153371, + 4.3355725912766045, + 4.767056651133089, + 5.2414827884177972, + 5.7631246766807021, + 6.3366813132266211, + 6.9673193481078846, + 7.66071962577526, + 8.4231283586385022, + 9.2614133935126315, + 10.183126077803173, + 11.196569282726491, + 12.310872196324524, + 13.536072560016354, + 14.883207089480676, + 16.364410894388737, + 17.99302679256968, + 19.783725503320237, + 21.752637802570973, + 23.917499830374666, + 26.297812859659746, + 28.915018965460625, + 31.792694177068729, + 34.956760853036464, + 38.4357211921273, + 42.260913983699908, + 46.466796910356955, + 51.091256945866178, + 56.17595164444635, + 61.766684395782924, + 67.913817026105036, + 74.672723462070437, + 82.104288544104477, + 90.27545648254906, + 99.259833897163674, + 109.13835287221285, + 119.99999999999996 + ], + "fit": [ + 1.6443515570799493E-51, + 1.5015590404253772E-49, + 1.2536495069609559E-47, + 9.56964522038052E-46, + 6.6788474247566221E-44, + 4.2618012192062838E-42, + 2.4863990903150592E-40, + 1.3262777050017047E-38, + 6.4682095600844687E-37, + 2.8841621738221883E-35, + 1.1758211112408765E-33, + 4.3827713309095392E-32, + 1.4936276778384973E-30, + 4.6539517385096826E-29, + 1.325828590047698E-27, + 3.45333624091356E-26, + 8.2238718604046023E-25, + 1.7906049682435272E-23, + 3.5645869884464974E-22, + 6.4879072368669234E-21, + 1.0796575547023696E-19, + 1.6426816515507457E-18, + 2.285108187102942E-17, + 2.9063379203925076E-16, + 3.379647710495639E-15, + 3.5932111478493234E-14, + 3.4928507319732854E-13, + 3.1042972216996984E-12, + 2.522507975521038E-11, + 1.8740785150287872E-10, + 1.2730017408189286E-9, + 7.9059888084213086E-9, + 4.4892043477657661E-8, + 2.3306042626421939E-7, + 1.1062510093701044E-6, + 4.8009237173216256E-6, + 1.9049426828574319E-5, + 6.91074713307466E-5, + 0.00022922082621291273, + 0.000695134953753702, + 0.0019273924884579223, + 0.0048860418139400766, + 0.011324790545930032, + 0.023998779721964788, + 0.046497983871277057, + 0.082369241633773335, + 0.13340803716147545, + 0.19755357957794306, + 0.26746920948406094, + 0.33109198449121308, + 0.37472228497920745, + 0.38775406402164564, + 0.36685055204471062, + 0.31732769530132848, + 0.25096476988641453, + 0.18146945065653011, + 0.11997210279654132, + 0.072517529341236633, + 0.040076677489629516, + 0.020250064084762164, + 0.0093550707472925248, + 0.0039514249011001392, + 0.001525971317112781, + 0.00053879677872719159, + 0.00017393604573656438, + 5.1338145509390556E-5, + 1.3854049738713092E-5, + 3.41821432897334E-6, + 7.710948813387365E-7, + 1.5903852235458923E-7, + 2.9990439187299363E-8, + 5.1706995276287694E-9, + 8.1508285694454222E-10, + 1.1747357852731057E-10, + 1.5479774153624526E-11, + 1.8649836278421268E-12, + 2.0543356797042436E-13, + 2.0689680132635519E-14, + 1.905119076458606E-15, + 1.6038969333906338E-16, + 1.2345729872194438E-17, + 8.6884651892841175E-19, + 5.5905603825568928E-20, + 3.2889222102055677E-21, + 1.7690407729661647E-22, + 8.6997759000649118E-24, + 3.9116885658954736E-25, + 1.6080755822375136E-26, + 6.0441415443820425E-28, + 2.0770587320866948E-29, + 6.526027654264463E-31, + 1.8747140079677519E-32, + 4.9238761555556823E-34, + 1.1824021198759327E-35, + 2.5960273297937811E-37, + 5.21121873640771E-39, + 9.5643470645471713E-41, + 1.6049345763378724E-42, + 2.4623247012885449E-44, + 3.4539758135622209E-46 + ], + "L50": NaN, + "Pref": 1.6443515570799493E-51, + "H50": NaN, + "R2": 0.95241641761661544, + "bandwidth": Infinity + } + } + }, + "temporal_frequency_tuning_calc": { + "input_parameters": [], + "depends_on": { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b3e73659_c0c270c4d0bcfa1e" + } + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_writer_outputs/tuningcurve_calc.mock.1.json b/tests/+did2/fixtures/ndi_writer_outputs/tuningcurve_calc.mock.1.json new file mode 100644 index 00000000..43a1e809 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/tuningcurve_calc.mock.1.json @@ -0,0 +1,360 @@ +{ + "app": { + "name": "ndi.calc.stimulus.tuningcurve", + "version": "58046c5cd610bf20c7437c955e5a8a6c8735eb4e", + "url": "https://github.com/VH-Lab/NDI-matlab", + "os": "MACA64", + "os_version": "26.6.2", + "interpreter": "MATLAB", + "interpreter_version": "24.2" + }, + "base": { + "session_id": "412696f9abd9edc3_40dbbdf6582271b2", + "id": "412696f9abe1cc49_40d3ea983b22d91f", + "name": "", + "datestamp": "2026-08-27T00:03:25.091Z" + }, + "calculator": {}, + "depends_on": [ + { + "name": "element_id", + "value": "412696f9abdf3dca_40dfb6a27433d45f" + }, + { + "name": "stimulus_response_scalar_id", + "value": "412696f9abe1595f_40c2e3dda9144214" + } + ], + "document_class": { + "definition": "$NDIDOCUMENTPATH/apps/calculators/tuningcurve_calc.json", + "validation": "$NDISCHEMAPATH/apps/calculations/tuningcurve_calc_v2_schema.json", + "class_name": "tuningcurve_calc", + "property_list_name": "tuningcurve_calc", + "class_version": 2, + "superclasses": [ + { + "definition": "$NDIDOCUMENTPATH/app.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/calculator.json" + }, + { + "definition": "$NDIDOCUMENTPATH/stimulus/stimulus_tuningcurve.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + } + ] + }, + "stimulus_tuningcurve": { + "independent_variable_label": [ + "contrast" + ], + "independent_variable_value": [ + 0, + 0.2, + 0.4, + 0.6, + 0.8, + 1 + ], + "stimid": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "response_mean": [ + 1, + 2.37931034482759, + 4.9024390243902491, + 6.9016393442622928, + 8.1910112359550631, + 9 + ], + "response_stddev": [ + 0, + 3.85232991570949E-15, + 1.7090223818255851E-14, + 2.0490759302765808E-14, + 2.467793789664406E-14, + 0 + ], + "response_stderr": [ + 0, + 1.7228143126564908E-15, + 7.6429804416612189E-15, + 9.1637461423141075E-15, + 1.1036309336282859E-14, + 0 + ], + "individual_responses_real": [ + [ + 1, + 2.3793103448275867, + 4.902439024390242, + 6.9016393442622981, + 8.19101123595505, + 9 + ], + [ + 1, + 2.3793103448275845, + 4.902439024390242, + 6.9016393442622981, + 8.19101123595505, + 9 + ], + [ + 1, + 2.3793103448275925, + 4.902439024390242, + 6.9016393442622732, + 8.19101123595505, + 9 + ], + [ + 1, + 2.3793103448275925, + 4.902439024390242, + 6.9016393442622732, + 8.19101123595505, + 9 + ], + [ + 1, + 2.3793103448275925, + 4.90243902439028, + 6.9016393442623221, + 8.1910112359551057, + 9 + ] + ], + "individual_responses_imaginary": [ + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + "stimulus_presentation_number": [ + [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + [ + 7, + 8, + 9, + 10, + 11, + 12 + ], + [ + 13, + 14, + 15, + 16, + 17, + 18 + ], + [ + 19, + 20, + 21, + 22, + 23, + 24 + ], + [ + 25, + 26, + 27, + 28, + 29, + 30 + ] + ], + "control_stimid": [], + "control_response_mean": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "control_response_stddev": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "control_response_stderr": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "control_individual_responses_real": [ + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ] + ], + "control_individual_responses_imaginary": [ + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + "response_units": [] + }, + "tuningcurve_calc": { + "input_parameters": { + "independent_label": "contrast", + "independent_parameter": "contrast", + "best_algorithm": "empirical_maximum", + "selection": { + "property": "contrast", + "operation": "hasfield", + "value": "varies" + } + }, + "depends_on": [ + { + "name": "stimulus_response_scalar_id", + "value": "412696f9abe1595f_40c2e3dda9144214" + }, + { + "name": "stimulus_response_scalar_id", + "value": "412696f9abe1595f_40c2e3dda9144214" + } + ], + "log": "", + "stim_property_list": { + "names": [], + "values": [] + } + } +} \ No newline at end of file From 53e07145615776a4a0a133c6aca157e925069847 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 04:21:55 +0000 Subject: [PATCH 13/45] imageStack reads raw v1; round trips of the Haley and Babu writer shapes Decided by Jess Haley, 2026-10-26 (did-schema V_eta_go_forward_class_audit.md): [migrators read raw v1], [renames carry is temporary], [migration reliability practices] (a), [image file details placed], [one-reading quick answers] (Q3), [dependents of a carried document carry]. - imageStack added to did2.convert.rawV1Classes (one line), with its row in the v1 name -> migrator table (imageStack -> image_stack). The table also maps ontologyLabel -> ontology_label, for a caller that passes it. - +migrators_j/image_stack.m reads either spelling (the raw imageStack / imageStack_parameters blocks and formatOntology, or the renamed ones a v1 `image` still arrives with). On the raw path: what universalRenames would have discarded carries the document, carry-049; the superclass migrator's timestamp refusals run on the raw block (it is called, not copied: the v1 `image` still uses it); identity through jRawBody; every carry or passthrough is the untouched v1 source. Carry notes keep their class names. - Not switched, with the reason in rawV1Classes: `image` (no writer, no corpus document, and its raw passthrough would meet the renamed-shape `image` tombstone) and `ontologyLabel` (NDI's second pass and foldGenericFiles find labels by the name `ontology_label`; siblings first). ontology_label's guard reads either spelling and +roundtrip/ontologyLabel.m is its inverse. - +roundtrip/imageStack.m: the passthrough, or the observation + sampled_body + anchor of a converted stack. - NDI templates imageStack.json, imageStack_parameters.json, ontologyLabel.json copied verbatim from locked main 3cb19a8. testRawV1RoundTripImage: Haley behaviour shapes carried (carry-052), Haley E. coli shapes passed through, Babu shapes converted; lost paths equal the listed findings; broken inputs fail; raw and renamed paths agree. testTemplateLiteralTypeTraps pins the superclass migrator on the renamed path, where it still runs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+super/image_stack_parameters.m | 9 + .../+did2/+convert/+migrators_j/image_stack.m | 106 ++- .../+convert/+migrators_j/ontology_label.m | 14 + .../+did2/+convert/+roundtrip/imageStack.m | 305 ++++++++ .../+did2/+convert/+roundtrip/ontologyLabel.m | 49 ++ src/did/+did2/+convert/rawV1Classes.m | 44 +- .../+did2/+unittest/testRawV1RoundTripImage.m | 659 ++++++++++++++++++ .../+unittest/testTemplateLiteralTypeTraps.m | 13 +- .../fixtures/ndi_templates/imageStack.json | 24 + .../ndi_templates/imageStack_parameters.json | 28 + .../fixtures/ndi_templates/ontologyLabel.json | 18 + 11 files changed, 1249 insertions(+), 20 deletions(-) create mode 100644 src/did/+did2/+convert/+roundtrip/imageStack.m create mode 100644 src/did/+did2/+convert/+roundtrip/ontologyLabel.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripImage.m create mode 100644 tests/+did2/fixtures/ndi_templates/imageStack.json create mode 100644 tests/+did2/fixtures/ndi_templates/imageStack_parameters.json create mode 100644 tests/+did2/fixtures/ndi_templates/ontologyLabel.json diff --git a/src/did/+did2/+convert/+migrators_j/+super/image_stack_parameters.m b/src/did/+did2/+convert/+migrators_j/+super/image_stack_parameters.m index f1fb4e41..8027c09c 100644 --- a/src/did/+did2/+convert/+migrators_j/+super/image_stack_parameters.m +++ b/src/did/+did2/+convert/+migrators_j/+super/image_stack_parameters.m @@ -12,6 +12,15 @@ % `image_stack_parameters` -- i.e. on every `image_stack` document. There is % no base (+migrators) migrator of this name, so nothing is being displaced. % +% SINCE 2026-10-27 a v1 `imageStack` reads RAW v1 (did2.convert.rawV1Classes, +% [migrators read raw v1]) and no superclass migrator runs on it: its leaf, +% did2.convert.migrators_j.image_stack, calls this function on the raw +% `imageStack_parameters` block for the REFUSALS below (same documents +% quarantine, same identifiers). The empty-placeholder strip has no raw +% counterpart: a raw passthrough is the untouched v1 source. This file stays +% for the v1 `image` (not switched), which runs renamed and shares the block; +% it goes when `image` switches or leaves. +% % --------------------------------------------------------------------- % WHY A SUPERCLASS MIGRATOR AND NOT A CONCRETE ONE % --------------------------------------------------------------------- diff --git a/src/did/+did2/+convert/+migrators_j/image_stack.m b/src/did/+did2/+convert/+migrators_j/image_stack.m index ef948f67..bd68690c 100644 --- a/src/did/+did2/+convert/+migrators_j/image_stack.m +++ b/src/did/+did2/+convert/+migrators_j/image_stack.m @@ -181,12 +181,66 @@ % testImageStackBabuShapeOmitsTheSlotRatherThanEmittingItBlank pins the babu % population. testImageStackDocumentIdReferentSurvivesTheBatch now runs the % REAL emitted edge through did2.validate.references instead of a probe. +% +% --------------------------------------------------------------------- +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27) +% --------------------------------------------------------------------- +% Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md). A v1 `imageStack` reaches this migrator +% exactly as NDI wrote it (imageStack.json + imageStack_parameters.json + +% base.json at the locked NDI-matlab `main`, 3cb19a8): the `imageStack` and +% `imageStack_parameters` blocks, `formatOntology`, edges in v1's `value` +% key. No universalRenames and no superclass migrator run on it, so: +% - what universalRenames would have DISCARDED (a depends_on `version` or +% second id, an `ndi_document` beside `base`, `formatOntology` beside a +% different `format_ontology`, an `imageStack` / `imageStack_parameters` +% block beside a different snake_case twin) carries the document, +% carry-049, as the renamed path carried it ([renames carry is +% temporary]); +% - the superclass migrator's work (+super/image_stack_parameters: a +% non-scalar, non-empty char or non-numeric `timestamp` is refused) is +% done here by calling it on the parameters block, so the same documents +% quarantine with the same identifiers; its other job, stripping an +% empty `timestamp` so a passthrough validates under the `image_stack` +% tombstone, has no raw counterpart (a raw passthrough is the untouched v1 +% source, which V_eta keeps no schema for under the name `imageStack`); +% - identity is read through jRawBody (a legacy-only `ndi_document`); +% - every carry or passthrough returns PREBODY, the untouched v1 source. +% A v1 `image` (did2.convert.migrators_j.image, NOT switched) and a body +% already spelled the renamed way (class `image_stack`) still arrive renamed; +% every read below takes either spelling. Carry notes keep the class names +% they had ('image_stack', 'image'). The round trip is +% did2.convert.roundtrip.imageStack (testRawV1RoundTripImage). arguments preBody (1,1) struct end -params = getBlock(preBody, 'image_stack_parameters'); +srcClass = classNameOf(preBody); +isRaw = strcmp(srcClass, 'imageStack'); +noteClass = 'image_stack'; +if strcmp(srcClass, 'image') + noteClass = 'image'; +end +if isRaw + collision = jResponseRenameCollisions(preBody, ... + {'imageStack', 'formatOntology', 'format_ontology'}); + collision = [collision, blockTwins(preBody, ... + {'imageStack', 'image_stack'; 'imageStack_parameters', 'image_stack_parameters'})]; + if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', noteClass, ... + baseField(preBody, 'id', ''), ['[carry-049] universalRenames would discard: ' ... + strjoin(collision, ', ')]); + bodies = {preBody}; + return; + end + % the superclass migrator's refusals, on the raw block (see the header) + did2.convert.migrators_j.super.image_stack_parameters(struct( ... + 'image_stack_parameters', getBlock(preBody, 'imageStack_parameters'))); +end +params = getBlockAny(preBody, {'imageStack_parameters', 'image_stack_parameters'}); +stackBlk = getBlockAny(preBody, {'imageStack', 'image_stack'}); subjectId = dependencyValue(preBody, 'subject_id'); if isempty(subjectId) bodies = {preBody}; @@ -234,7 +288,7 @@ end if ~isempty(unplaced) % carry-register: carry-011 carry-012 carry-013 (the items above) - did2.convert.reportNote('carried_as_v1', classNameOf(preBody), ... + did2.convert.reportNote('carried_as_v1', noteClass, ... baseField(preBody, 'id', ''), ['unplaced: ' strjoin(unplaced, ', ')]); bodies = {preBody}; return; @@ -271,10 +325,10 @@ % recognised by label words too, so it is carried the same way ([one-reading % quick answers] (Q3), Jess Haley, 2026-10-26: "mask or map detection" chosen % from label words carries as needs_mapping). -label = getCharField(getBlock(preBody, 'image_stack'), 'label'); +label = getCharField(stackBlk, 'label'); if isMaskOrMap(label) % carry-register: carry-025 (imageStack; the register has no row for image) - did2.convert.reportNote('carried_as_v1', classNameOf(preBody), ... + did2.convert.reportNote('carried_as_v1', noteClass, ... baseField(preBody, 'id', ''), [carryRowOf(preBody, '', '[carry-025] ') ... 'needs_mapping: calculation (logical ' ... 'mask | label map) or observation (intensity); decided by what the ' ... @@ -283,7 +337,13 @@ return; end -stackId = baseField(preBody, 'id', did.ido.unique_id()); +% the identity a raw body states, a legacy-only `ndi_document` read into `base` +% (jRawBody; universalRenames' wholesale move did this on the renamed path) +src = preBody; +if isRaw + src = jRawBody(preBody, 'imageStack'); +end +stackId = baseField(src, 'id', did.ido.unique_id()); dataType = getCharField(params, 'data_type'); % [no invented values] (Jess Haley, 2026-10-25): a dimension order or data type % the source does not state is not assumed. No order means no honest key, so @@ -296,7 +356,7 @@ return; end -anchor = jSessionAnchor(preBody, 'during'); +anchor = jSessionAnchor(src, 'during'); [datumType, sourceDatumType] = jDatumType(dataType); conds = []; ts = getField(params, 'timestamp'); @@ -310,19 +370,19 @@ end extra = {}; software = {}; -obs = jStatement(preBody, 'observation', subjectId, ... +obs = jStatement(src, 'observation', subjectId, ... jLabel('image intensity'), [], ... 'DataBody', true, 'DatumType', datumType, 'SourceDatumType', sourceDatumType, ... 'Conditions', conds, 'Notes', label, ... 'TimeReferenceIds', {anchor.base.id}, 'Id', stackId, extra{:}, 'ValueKind', 'intensity'); % DATUM ORDER 'F': the stack is a MATLAB array in the source's dimension order, % column-major (a judgment call, recorded in the port report). -o = jOpts(preBody, 'DatumOrder', 'F'); +o = jOpts(src, 'DatumOrder', 'F'); % the file's format and compression ([image file details placed]): an % imageStack's `formatOntology`, an image's `format` and `compression` imageBlk = getBlock(preBody, 'image'); -fileFormat = firstNonEmpty(getCharField(getBlock(preBody, 'image_stack'), 'format_ontology'), ... - getCharField(getBlock(preBody, 'image_stack'), 'formatOntology'), ... +fileFormat = firstNonEmpty(getCharField(stackBlk, 'format_ontology'), ... + getCharField(stackBlk, 'formatOntology'), ... getCharField(imageBlk, 'format')); if ~isempty(strtrim(fileFormat)) o = [o, {'Format', formatOf(strtrim(fileFormat))}]; @@ -464,6 +524,32 @@ if isfield(bodyStruct, name) && isstruct(bodyStruct.(name)); b = bodyStruct.(name); end end +function b = getBlockAny(bodyStruct, names) +%GETBLOCKANY The first of NAMES the body holds as a block: the raw v1 spelling +% (`imageStack_parameters`) or the renamed one (`image_stack_parameters`, a +% v1 `image` or a body already renamed). A raw body holding both with +% different values was carried (blockTwins) before this is read. +b = struct(); +for k = 1:numel(names) + if isfield(bodyStruct, names{k}) && isstruct(bodyStruct.(names{k})) + b = bodyStruct.(names{k}); + return; + end +end +end + +function c = blockTwins(bodyStruct, pairs) +%BLOCKTWINS Each {CAMEL, SNAKE} row of PAIRS whose two blocks are both present +% with different values: universalRenames kept SNAKE and discarded CAMEL. +c = {}; +for k = 1:size(pairs, 1) + if isfield(bodyStruct, pairs{k, 1}) && isfield(bodyStruct, pairs{k, 2}) ... + && ~isequaln(bodyStruct.(pairs{k, 1}), bodyStruct.(pairs{k, 2})) + c{end+1} = pairs{k, 1}; %#ok + end +end +end + function v = getField(bodyStruct, name) v = []; if isfield(bodyStruct, name); v = bodyStruct.(name); end diff --git a/src/did/+did2/+convert/+migrators_j/ontology_label.m b/src/did/+did2/+convert/+migrators_j/ontology_label.m index 177fe61f..2768a832 100644 --- a/src/did/+did2/+convert/+migrators_j/ontology_label.m +++ b/src/did/+did2/+convert/+migrators_j/ontology_label.m @@ -177,11 +177,25 @@ % names; this guard is on the V_eta path only.) % % See V_eta_migrator_vocabulary_audit.md for the evidence. +% +% READY TO READ RAW v1, NOT SWITCHED (2026-10-27). [migrators read raw v1] +% (Jess Haley, 2026-10-26): the guard reads the block in either spelling, so +% a raw v1 `ontologyLabel` (block `ontologyLabel`, field `ontologyNode`, +% edge in v1's `value` key) is handed back untouched, as a switched class's +% passthrough must be; did2.convert.roundtrip.ontologyLabel is its inverse +% (testRawV1RoundTripImage runs it through the 'RawV1Classes' option). It is +% NOT in did2.convert.rawV1Classes: the passthrough is for NDI's second pass, +% which finds labels by the renamed class name `ontology_label` +% (NDI-matlab +migrate/+internal/ontologyLabelSubjects.m, +migrate/local.m), +% as does did2.convert.foldGenericFiles. Those read the v1 spelling first. arguments preBody (1,1) struct end blk = getBlock(preBody, 'ontology_label'); +if isempty(fieldnames(blk)) + blk = getBlock(preBody, 'ontologyLabel'); +end if isfield(blk, 'ontology_name') || isfield(blk, 'label_id') || isfield(blk, 'label') error('did2:convert:ontologyLabelInventedShape', ... ['ontology_label body carries `ontology_name`/`label_id`/`label`, ' ... diff --git a/src/did/+did2/+convert/+roundtrip/imageStack.m b/src/did/+did2/+convert/+roundtrip/imageStack.m new file mode 100644 index 00000000..bc3cb60c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/imageStack.m @@ -0,0 +1,305 @@ +function [v1, spec] = imageStack(bodies) +%IMAGESTACK Rebuild a v1 `imageStack` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.imageStack(BODIES). V1 is the stack in +% NDI's v1 shape (imageStack.json + imageStack_parameters.json + base.json at +% the locked NDI-matlab `main`, 3cb19a8, as +setup/+conv/+babu/import.m and +% +haley/doImport.m write it). BODIES is one of: +% +% PASSED THROUGH (pass 1): one `imageStack` document, the migrator's +% passthrough of the raw v1 source (a stack with no subject) as v1_to_v2 +% padded and stamped it: the document itself, its session edge read back +% into base.session_id and its creation_timestamp into base.datestamp. +% +% CONVERTED (did2.convert.migrators_j.image_stack): the `observation` (value +% kind intensity, id preserved), its `sampled_body` and its session anchor: +% base.id, session_id, datestamp the observation (rebuildBase) +% depends_on document_id '' (a stack naming one is +% carried, carry-052) and subject_id, +% the observation's entity_id, in the +% order NDI's template merge gives them +% (sorted: document_id, subject_id) +% files the body's files +% imageStack.label the observation's notes +% imageStack.formatOntology the body's format node (else its +% name); a CURIE's prefix case is +% notation ([spelling is notation]) +% imageStack_parameters +% dimension_size each dimension's n +% dimension_labels each dimension's term name, joined +% by ','; '' when every axis is a +% coordinate axis named by its letter +% dimension_order each dimension's letter, from its +% term node (X, Y, Z, T: the nodes +% did2.convert.axisTerm writes); NOT +% rebuilt when an axis has no such node +% (a label such as 'height': the fold +% writes the label, not the letter) +% dimension_scale each covariate's spacing, by `along` +% (0 for an axis with none) +% dimension_scale_units each covariate's source_unit name +% data_type value.source_data_type, else +% value.data_type +% data_limits the body's "value range" condition +% (EMPTY:0000402); without one, the data +% type's range ([image file details +% placed]: left unwritten when it is +% that range), stated as an equivalent +% timestamp, clocktype the observation's "acquisition +% timestamp ()" condition +% The anchor is the stack's own (minted by the migration); anything else +% emitted is unplaced. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.image_stack. + +arguments + bodies cell +end + +CLASS = 'imageStack'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = passedThrough(bodies{1}); + return; +end + +used = false(1, numel(bodies)); +obs = []; +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'observation') + obs = bodies{k}; + used(k) = true; + break; + end +end +if isempty(obs) + spec.unplaced{end+1} = 'no observation was emitted'; + return; +end +[base, ~] = rebuildBase(obs); +anchorIds = edgeIds(obs, 'time_reference_id'); +body = []; +for k = 1:numel(bodies) + if used(k); continue; end + b = bodies{k}; + cn = classNameOf(b); + if strcmp(cn, 'sampled_body') && isempty(body) && any(strcmp(base.id, edgeIds(b, 'owner_id'))) + body = b; + used(k) = true; + elseif strcmp(cn, 'relative_time_reference') && any(strcmp(idOf(b), anchorIds)) + used(k) = true; + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in an imageStack', ... + k, classNameOf(bodies{k})); +end +if isempty(body) + spec.unplaced{end+1} = 'no sampled_body names the observation as its owner'; + return; +end + +v1.document_class = struct('class_name', CLASS); +v1.depends_on = struct('name', {'document_id', 'subject_id'}, ... + 'value', {'', firstId(edgeIds(obs, 'entity_id'))}); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +if isfield(body, 'files') + v1.files = body.files; +end + +% ---- imageStack: label, formatOntology +stack = struct(); +stack.label = fieldText(getIn(obs, 'statement'), 'notes'); +[fnode, fname] = termParts(getIn(body, 'data_body', 'format')); +stack.formatOntology = fnode; +if isempty(fnode) + stack.formatOntology = fname; +end +v1.imageStack = stack; +spec.same(end+1) = struct('path', 'imageStack.formatOntology', 'fn', @sameCurie, ... + 'why', ['a CURIE''s prefix case is notation ([spelling is notation], Jess ' ... + 'Haley, 2026-10-26); did2.build.formatTerm writes the registered spelling']); + +% ---- imageStack_parameters +p = struct(); +dims = asCell(getIn(body, 'data', 'dimensions')); +covs = asCell(getIn(body, 'data', 'covariates')); +n = numel(dims); +sizes = zeros(n, 1); +names = cell(1, n); +letters = blanks(n); +for k = 1:n + sizes(k) = numberOf(getIn(dims{k}, 'n')); + [node, names{k}] = termParts(getIn(dims{k}, 'term')); + letters(k) = letterOf(node); +end +scales = zeros(n, 1); +units = repmat({''}, 1, n); +anyCov = false; +for c = 1:numel(covs) + along = numberOf(getIn(covs{c}, 'along')); + if isempty(along) || along < 0 || along >= n + spec.unplaced{end+1} = sprintf('covariate %d names no dimension of the stack', c); + continue; + end + k = along + 1; + sp = numberOf(getIn(covs{c}, 'spacing', 'value')); + if isempty(sp) + spec.unplaced{end+1} = sprintf('covariate %d states no spacing', c); + continue; + end + scales(k) = sp; + [~, units{k}] = termParts(getIn(covs{c}, 'source_unit')); + anyCov = true; +end +if all(letters ~= ' ') + p.dimension_order = letters; +end +if all(letters ~= ' ') && all(cellfun(@(nm, L) isLetterName(nm, L), names, num2cell(letters))) + p.dimension_labels = ''; +else + p.dimension_labels = strjoin(names, ','); +end +p.dimension_size = sizes; +if anyCov + p.dimension_scale = scales; + p.dimension_scale_units = strjoin(units, ','); +end +dataType = fieldText(getIn(obs, 'value'), 'source_data_type'); +if isempty(dataType) + dataType = fieldText(getIn(obs, 'value'), 'data_type'); +end +p.data_type = dataType; +range = conditionMatrix(getIn(body, 'data_body', 'conditions'), 'EMPTY:0000402'); +if ~isempty(range) + p.data_limits = column(range); + spec.same(end+1) = struct('path', 'imageStack_parameters.data_limits', ... + 'fn', @(a, b) isnumeric(a) && isnumeric(b) && isequal(double(a(:)), double(b(:))), ... + 'why', 'the value range condition holds the [minimum maximum] pair as one matrix'); +else + r = typeRange(dataType); + if ~isempty(r) + spec.equivalents(end+1) = struct('path', 'imageStack_parameters.data_limits', ... + 'values', {{r(:), r(:)'}}, 'why', ['the data type''s range, left ' ... + 'unwritten ([image file details placed], Jess Haley, 2026-10-26)']); + end +end +[ts, clk, extra] = acquisitionTime(getIn(obs, 'statement', 'conditions')); +spec.unplaced = [spec.unplaced, extra]; +if ~isempty(ts) + p.timestamp = ts; + p.clocktype = clk; +end +v1.imageStack_parameters = p; +end + +% ===================== helpers ========================================= + +function v1 = passedThrough(body) +%PASSEDTHROUGH A passed-through v1 document as v1 stated it (v1_to_v2's +% outbound renames undone: the session edge, creation_timestamp). +v1 = body; +sid = char(did2.schema.cache.sessionIdOf(body)); +if isfield(v1, 'depends_on') && isstruct(v1.depends_on) && ~isempty(v1.depends_on) + keep = true(1, numel(v1.depends_on)); + for k = 1:numel(v1.depends_on) + keep(k) = ~strcmp(char(v1.depends_on(k).name), 'session_id'); + end + v1.depends_on = v1.depends_on(keep); +end +if isfield(v1, 'base') && isstruct(v1.base) && ~isfield(v1.base, 'session_id') && ~isempty(sid) + v1.base.session_id = sid; +end +if isfield(v1, 'base') && isstruct(v1.base) && isfield(v1.base, 'creation_timestamp') ... + && ~isfield(v1.base, 'datestamp') + v1.base.datestamp = v1.base.creation_timestamp; + v1.base = rmfield(v1.base, 'creation_timestamp'); +end +end + +function L = letterOf(node) +% the coordinate axes did2.convert.axisTerm writes by node +switch char(node) + case 'NCIT:C44477', L = 'X'; + case 'NCIT:C44478', L = 'Y'; + case 'NCIT:C44479', L = 'Z'; + case 'om:Time', L = 'T'; + otherwise, L = ' '; +end +end + +function tf = isLetterName(name, letter) +% a dimension named from its LETTER (no dimension_labels): axisTerm wrote the +% registry's label for the letter's node ('X-Coordinate', 'time') +switch letter + case 'X', tf = strcmp(name, 'X-Coordinate'); + case 'Y', tf = strcmp(name, 'Y-Coordinate'); + case 'Z', tf = strcmp(name, 'Z-Coordinate'); + case 'T', tf = false; % 't' and 'time' both write om:Time 'time' + otherwise, tf = false; +end +end + +function r = typeRange(dataType) +r = []; +cls = lower(strtrim(char(dataType))); +switch cls + case {'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64'} + r = double([intmin(cls) intmax(cls)]); + case {'logical', 'bool'} + r = [0 1]; +end +end + +function m = conditionMatrix(conds, node) +m = []; +conds = asCell(conds); +for k = 1:numel(conds) + [n, ~] = termParts(getIn(conds{k}, 'variable')); + if strcmp(n, node) + m = getIn(conds{k}, 'matrix'); + if iscell(m); m = cell2mat(m); end + m = double(m); + return; + end +end +end + +function [ts, clk, extra] = acquisitionTime(conds) +% the "acquisition timestamp ()" condition jLabel names; any other +% condition on the observation is unplaced +ts = []; +clk = ''; +extra = {}; +conds = asCell(conds); +for k = 1:numel(conds) + [~, name] = termParts(getIn(conds{k}, 'variable')); + tok = regexp(name, '^acquisition timestamp \((.*)\)$', 'tokens', 'once'); + if isempty(tok) || ~isempty(ts) + extra{end+1} = sprintf('observation condition "%s" has no role in an imageStack', name); %#ok + continue; + end + ts = numberOf(getIn(conds{k}, 'quantity', 'value')); + clk = tok{1}; + if strcmp(clk, 'unspecified clock') + clk = ''; % the migrator's words for a stack that names no clock + end +end +end + +function id = idOf(b) +id = ''; +[v, ok] = getIn(b, 'base', 'id'); +if ok + id = char(v); +end +end + +function id = firstId(ids) +id = ''; +if ~isempty(ids) + id = ids{1}; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/ontologyLabel.m b/src/did/+did2/+convert/+roundtrip/ontologyLabel.m new file mode 100644 index 00000000..c1993fc3 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/ontologyLabel.m @@ -0,0 +1,49 @@ +function [v1, spec] = ontologyLabel(bodies) +%ONTOLOGYLABEL Rebuild a v1 `ontologyLabel` from what pass 1 made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.ontologyLabel(BODIES). V1 is the label +% in NDI's v1 shape (ontologyLabel.json + base.json at the locked NDI-matlab +% `main`, 3cb19a8: one field, `ontologyNode`, one edge, `document_id`, as +% +setup/+conv/+haley/doImport.m and +babu/import.m write it). +% +% Pass 1 hands every label to NDI's second pass unchanged +% (did2.convert.migrators_j.ontology_label), so BODIES is one `ontologyLabel` +% document: the raw v1 source as v1_to_v2 padded and stamped it, its session +% edge read back into base.session_id and its creation_timestamp into +% base.datestamp. (A label pass 1 carries, carry-064, is stamped did_v1 and +% is its own round trip in did2.convert.roundtrip.check.) The label is read +% raw only when a caller passes it in v1_to_v2's 'RawV1Classes' option: it is +% not in did2.convert.rawV1Classes (see there for why). What NDI's second +% pass makes of a label is NDI's round trip, not this one. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.ontology_label. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +if ~isscalar(bodies) || ~strcmp(classNameOf(bodies{1}), 'ontologyLabel') + spec.unplaced{end+1} = sprintf(['pass 1 hands an ontologyLabel back unchanged; ' ... + 'got %d document(s)'], numel(bodies)); + return; +end +v1 = bodies{1}; +sid = char(did2.schema.cache.sessionIdOf(v1)); +if isfield(v1, 'depends_on') && isstruct(v1.depends_on) && ~isempty(v1.depends_on) + keep = true(1, numel(v1.depends_on)); + for k = 1:numel(v1.depends_on) + keep(k) = ~strcmp(char(v1.depends_on(k).name), 'session_id'); + end + v1.depends_on = v1.depends_on(keep); +end +if isfield(v1, 'base') && isstruct(v1.base) && ~isfield(v1.base, 'session_id') && ~isempty(sid) + v1.base.session_id = sid; +end +if isfield(v1, 'base') && isstruct(v1.base) && isfield(v1.base, 'creation_timestamp') ... + && ~isfield(v1.base, 'datestamp') + v1.base.datestamp = v1.base.creation_timestamp; + v1.base = rmfield(v1.base, 'creation_timestamp'); +end +end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index 2584e31a..9500801d 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -14,14 +14,18 @@ % MIGRATOR = did2.convert.rawV1Classes(V1NAME) is the +migrators_j migrator % for the v1 class V1NAME: its row in the table below, else V1NAME itself. % -% THE ONE TABLE OF v1 NAME -> MIGRATOR NAME. Two v1 classes are spelled +% THE ONE TABLE OF v1 NAME -> MIGRATOR NAME. Some v1 classes are spelled % differently from the migrator files that convert them: NDIcalc-vis-matlab % writes `contrasttuning_calc` and `contrastsensitivity_calc`, and the % migrators are +migrators_j/contrast_tuning_calc.m and -% contrast_sensitivity_calc.m, the names universalRenames gives those -% classes. THIS TABLE GOES when universalRenames is deleted and the two -% migrator files are renamed to the v1 names ([migrators read raw v1]); it -% is the only place the two spellings are joined for a switched class. +% contrast_sensitivity_calc.m; NDI writes `imageStack` and `ontologyLabel`, +% and the migrators are +migrators_j/image_stack.m and ontology_label.m: the +% names universalRenames gives those classes. THIS TABLE GOES when +% universalRenames is deleted and the migrator files are renamed to the v1 +% names ([migrators read raw v1]); it is the only place the two spellings are +% joined for a switched class. A row may name a class not (yet) in the list +% below: it is read only for a listed class, or for one a caller passes in +% v1_to_v2's 'RawV1Classes' option. % % WHY. Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema % V_eta_go_forward_class_audit.md): a migrator reads v1 exactly as v1 defines @@ -89,6 +93,28 @@ % pass-1 passthrough that resolveResponseParameters % turns into a `method`. Round trips: % testRawV1RoundTripStimulusResponse. +% imageStack the imaging family: superclasses `base` + +% `imageStack_parameters`, no `app` block. The +% superclass migrator (+super/image_stack_parameters) +% is called by the leaf on the raw block, and stays for +% the v1 `image` (not switched), which still runs +% renamed. Written by +setup/+conv/+haley/doImport.m +% and +babu/import.m. Round trips: +% testRawV1RoundTripImage. +% NOT LISTED, and why: +% image no NDI writer at the locked main constructs it and no +% corpus holds one; its subject-less passthrough has no +% register row, and as raw v1 it would meet the +% renamed-shape `image` tombstone under its own name +% and quarantine. It stays on the renamed path. +% ontologyLabel ready (its migrator reads either spelling; inverse +% did2.convert.roundtrip.ontologyLabel), but NDI's +% second pass finds labels by the RENAMED class name +% (NDI-matlab +migrate/+internal/ontologyLabelSubjects.m +% and +migrate/local.m compare 'ontology_label'), and +% so does did2.convert.foldGenericFiles: a raw label +% would reach neither. Siblings first (did-schema +% CLAUDE.md, a name that code compares). % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. @@ -97,12 +123,16 @@ 'tuningcurve_calc', 'contrasttuning_calc', 'oridirtuning_calc', ... 'spatial_frequency_tuning_calc', 'temporal_frequency_tuning_calc', ... 'contrastsensitivity_calc', 'stimulus_response_scalar', ... - 'stimulus_response_scalar_parameters_basic'}; + 'stimulus_response_scalar_parameters_basic', ... + 'imageStack', ... + }; % v1 name migrator (+migrators_j); TEMPORARY, see above TABLE = { ... 'contrasttuning_calc', 'contrast_tuning_calc'; ... - 'contrastsensitivity_calc', 'contrast_sensitivity_calc'}; + 'contrastsensitivity_calc', 'contrast_sensitivity_calc'; ... + 'imageStack', 'image_stack'; ... + 'ontologyLabel', 'ontology_label'}; if nargin >= 1 names = migratorOf(char(v1Name), TABLE); diff --git a/tests/+did2/+unittest/testRawV1RoundTripImage.m b/tests/+did2/+unittest/testRawV1RoundTripImage.m new file mode 100644 index 00000000..0732206a --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripImage.m @@ -0,0 +1,659 @@ +function tests = testRawV1RoundTripImage +%TESTRAWV1ROUNDTRIPIMAGE The imaging family read as raw v1, and its round trip: +% imageStack (switched); ontologyLabel (ready, not switched); image (not +% switched). +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes), [migration reliability +% practices] (a) (a round trip per class, did2.convert.roundtrip.check), +% [renames carry is temporary] (what universalRenames would discard is still +% carried, carry-049), [image file details placed], [one-reading quick +% answers] (Q3) and [dependents of a carried document carry]. The test of the +% round trip is [lossless means round trip]. +% +% THE v1 DOCUMENTS are built from NDI's templates at the locked NDI-matlab +% `main` (3cb19a8; tests/+did2/fixtures/ndi_templates, copied verbatim: +% imageStack.json, imageStack_parameters.json, ontologyLabel.json, +% base.json) in the shapes the two writers at that commit give them, and pass +% through jsonencode/jsondecode as a corpus delivers them: +% Haley behaviour +setup/+conv/+haley/doImport.m, the plate loop: a video +% (YXT, uint8, EMPTY:0000129, NCIT:C190180), an arena mask +% and a bacteria mask (YX, logical, [0 1], EMPTY:0000130 / +% 0000131, NCIT:C85437) and a closest-patch map (YX, +% uint8, EMPTY:0000132); `document_id` (the plate row) AND +% `subject_id` (the subject group) set +% Haley E. coli the image loop: an image (YX, its bit depth, +% EMPTY:0000133, NCIT:C70631), a mask and a map; +% `document_id` ONLY +% Babu +setup/+conv/+babu/import.m step 6: a video (YXT, +% 'pixel,pixel,second', scale [1 1 FrameRate], +% EMPTY:0000257, NCIT:C190180) or an image (YX, +% EMPTY:0000258, NCIT:C70631); `subject_id` ONLY +% The template merge sorts the edges (document_id, subject_id), as every JH +% corpus document has them. The 7,007 JH imageStacks of the corpora are the +% Haley shapes: 2,444 behaviour (carried, carry-052) and 4,563 E. coli +% (passed through); no corpus holds a Babu stack (census of the corpus zips, +% 2026-10-27). +% +% WHAT V2 DOES NOT KEEP is listed per fixture as KNOWN FINDINGS: open +% questions for the team, not rules made here. Each fixture's lost paths +% must be EXACTLY its listed findings. +tests = functiontests(localfunctions); +end + +function setupOnce(testCase) +prev = did2.schema.cache.strictMode('TermRegistry', false); +testCase.addTeardown(@() did2.schema.cache.strictMode('TermRegistry', prev)); +end + +% ===================== the known findings =============================== + +function f = knownFindings() +% {fixture, path, why}. Open questions, reported to the team; nothing here is +% decided. +P = 'imageStack_parameters.'; +why = ['the fold names each dimension by its dimension_labels entry ' ... + '(''height'', ''width''), so the axis letter (Y, X) is kept nowhere; ' ... + 'only a coordinate or time axis is recoverable from its term node']; +f = { ... + 'Babu video', [P 'dimension_order'], why; ... + 'Babu image', [P 'dimension_order'], why; ... + 'DID brightfield, labels', [P 'dimension_order'], why}; +end + +function paths = findingsFor(fixture) +f = knownFindings(); +paths = reshape(sort(f(strcmp(f(:, 1), fixture), 2)), 1, []); +end + +function testEveryKnownFindingNamesAFixtureThatIsRun(testCase) +f = knownFindings(); +names = {'Babu video', 'Babu image', 'DID brightfield, labels'}; +for k = 1:size(f, 1) + verifyTrue(testCase, any(strcmp(f{k, 1}, names)), f{k, 1}); +end +end + +% ===================== the switch ====================================== + +function testImageStackIsSwitchedAndImageAndLabelAreNot(testCase) +names = did2.convert.rawV1Classes(); +verifyTrue(testCase, any(strcmp(names, 'imageStack'))); +verifyEqual(testCase, did2.convert.rawV1Classes('imageStack'), 'image_stack'); +% not switched: see did2.convert.rawV1Classes for why +verifyFalse(testCase, any(strcmp(names, 'image'))); +verifyFalse(testCase, any(strcmp(names, 'ontologyLabel'))); +verifyEqual(testCase, did2.convert.rawV1Classes('ontologyLabel'), 'ontology_label'); +r = runRaw({babuStack('is_b1', 'video'), haleyLabel('lab_1', 'is_b1', 'EMPTY:0000257')}); +L = r.summary.legacy_ndi_document; +verifyEqual(testCase, L.bodies_read_raw_v1, 1, 'the stack is read raw'); +verifyEqual(testCase, L.bodies_reaching_universal_renames, 1, 'the label is not'); +end + +% ===================== Haley behaviour: carried, carry-052 =============== + +function testHaleyBehaviourStacksAreCarriedAndRoundTrip(testCase) +for kind = {'video', 'arena mask', 'bacteria mask', 'closest patch'} + v1 = haleyBehaviourStack(['is_' strrep(kind{1}, ' ', '_')], kind{1}); + out = runRaw(v1); + label = ['Haley behaviour ' kind{1}]; + verifyCarriedUntouched(testCase, v1, out, label); + d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, startsWith(d, '[carry-052] '), [label ': ' d]); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyTrue(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, {}); +end +end + +% ===================== Haley E. coli: passed through ===================== + +function testHaleyEColiStacksPassThroughAndRoundTrip(testCase) +for kind = {'image', 'mask', 'closest patch'} + v1 = haleyEColiStack(['is_e_' strrep(kind{1}, ' ', '_')], kind{1}); + out = runRaw(v1); + label = ['Haley E. coli ' kind{1}]; + verifyEmpty(testCase, out.quarantine, label); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEqual(testCase, numel(out.passthrough), 1, [label ': a pass-1 passthrough']); + verifyFalse(testCase, isfield(out.summary.migration_notes, 'carried_as_v1') ... + && out.summary.migration_notes.carried_as_v1.count > 0, ... + [label ': no carry note (today''s behaviour: a stack with no subject passes through)']); + emitted = out.migrated{1}.toStruct(); + verifyEqual(testCase, emitted.document_class.class_name, 'imageStack', label); + verifyEqual(testCase, emitted.imageStack_parameters, v1.imageStack_parameters, ... + [label ': the passthrough is the raw v1 source']); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyFalse(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, {}); +end +end + +function testAnEColiStackWithNoTimestampIsTheUntouchedSource(testCase) +% the template's own [] placeholder: the renamed path's superclass migrator +% stripped it so the passthrough validated under the `image_stack` tombstone; +% the raw passthrough is the v1 source, kept as v1 wrote it +v1 = haleyEColiStack('is_e_nots', 'image'); +v1.imageStack_parameters.timestamp = []; +out = runRaw(v1); +verifyEmpty(testCase, out.quarantine); +emitted = out.migrated{1}.toStruct(); +verifyTrue(testCase, isfield(emitted.imageStack_parameters, 'timestamp')); +verifyRoundTrip(testCase, did2.convert.roundtrip.check(v1, out.migrated), ... + 'E. coli, empty timestamp', {}); +end + +% ===================== Babu: converted =================================== + +function testBabuStacksConvertAndRoundTrip(testCase) +cases = {'Babu video', babuStack('is_b_v', 'video'); ... + 'Babu image', babuStack('is_b_i', 'image')}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + verifyEmpty(testCase, out.passthrough, [label ': converted, not carried']); + verifyEqual(testCase, numel(out.migrated), 3, [label ': observation, sampled_body, anchor']); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyFalse(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, findingsFor(label)); + accounted = [r.matched, r.not_set, r.restated, r.equivalent]; + P = 'imageStack_parameters.'; + for p = {'base.id', 'base.session_id', 'base.datestamp', 'document_class.class_name', ... + 'depends_on(2).value', 'imageStack.label', 'imageStack.formatOntology', ... + [P 'dimension_labels'], [P 'dimension_size'], [P 'dimension_scale'], ... + [P 'dimension_scale_units'], [P 'data_type'], [P 'data_limits'], ... + [P 'timestamp'], [P 'clocktype'], 'files.file_list'} + verifyTrue(testCase, any(strcmp(p{1}, accounted)), ... + sprintf('%s: %s is not accounted for', label, p{1})); + end + verifyTrue(testCase, any(strcmp([P 'data_limits'], r.restated)), ... + [label ': the type''s range is left unwritten and restated']); +end +end + +function testAConvertedStackOnCoordinateAxesKeepsItsOrder(testCase) +% no dimension_labels: each axis is named by its letter's term (X, Y: the +% coordinate nodes did2.convert.axisTerm writes), so the order IS recoverable +v1 = didBrightfield('is_d_xy', ''); +out = runRaw(v1); +verifyEmpty(testCase, out.passthrough); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyRoundTrip(testCase, r, 'DID brightfield, letters', {}); +v1 = didBrightfield('is_d_lab', 'height,width'); +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyRoundTrip(testCase, r, 'DID brightfield, labels', findingsFor('DID brightfield, labels')); +end + +function testAValueRangeOtherThanTheTypesRoundTrips(testCase) +v1 = didBrightfield('is_d_rng', ''); +v1.imageStack_parameters.data_limits = [10; 200]; +out = runRaw(v1); +verifyEmpty(testCase, out.passthrough); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyRoundTrip(testCase, r, 'value range', {}); +verifyTrue(testCase, any(strcmp('imageStack_parameters.data_limits', r.equivalent))); +end + +% ===================== the other carries, on the raw shape =============== + +function testTheRawShapeCarriesAsTheRenamedOneDid(testCase) +% a mask with a subject and no plate row (carry-025), a collection edge +% (carry-013), a data_limits that is not a pair (carry-012) +mask = haleyBehaviourStack('is_m', 'arena mask'); +mask.depends_on(1).value = ''; +coll = babuStack('is_c', 'image'); +coll.depends_on(end+1) = struct('name', 'imageCollection_id', 'value', 'coll_1'); +lim = babuStack('is_l', 'image'); +lim.imageStack_parameters.data_limits = 'not a pair'; +cases = {'mask', mask, '[carry-025] '; 'collection', coll, '[carry-013] '; ... + 'limits', lim, '[carry-012] '}; +for k = 1:size(cases, 1) + [label, v1, row] = cases{k, :}; + v1 = jsondecode(jsonencode(v1)); + out = runRaw(v1); + verifyCarriedUntouched(testCase, v1, out, label); + d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, contains(d, row), [label ': ' d]); + old = runRenamed(v1); + verifyEqual(testCase, old.migrated{1}.get('document_class.schema_version'), 'did_v1', ... + [label ': the renamed path carried it too']); + verifyRoundTrip(testCase, did2.convert.roundtrip.check(v1, out.migrated), label, {}); +end +end + +function testATimestampTheSuperclassMigratorRefusesStillQuarantines(testCase) +% the superclass migrator's refusals (+super/image_stack_parameters), called by +% the leaf on the raw block: the same documents quarantine, with its identifiers +cases = {[739038.5; 739039.5], 'did2:convert:imageStackParametersNonScalarTimestamp'; ... + '2024-06-01', 'did2:convert:imageStackParametersCharTimestamp'}; +for k = 1:size(cases, 1) + v1 = haleyEColiStack(sprintf('is_t%d', k), 'image'); + v1.imageStack_parameters.timestamp = cases{k, 1}; + raw = runRaw(v1); + old = runRenamed(v1); + verifyEqual(testCase, numel(raw.quarantine), 1, cases{k, 2}); + verifyEmpty(testCase, raw.migrated, cases{k, 2}); + verifyEqual(testCase, raw.quarantine(1).identifier, cases{k, 2}); + verifyEqual(testCase, numel(old.quarantine), 1, ['renamed: ' cases{k, 2}]); +end +end + +% ===================== what universalRenames would discard =============== + +function testWhatTheRenamesWouldDiscardIsCarriedOnBothPaths(testCase) +ver = babuStack('is_v', 'video'); +deps = num2cell(ver.depends_on); +for k = 1:numel(deps) + deps{k}.version = ''; +end +deps{2}.version = 2; +ver.depends_on = [deps{:}]; +fmt = babuStack('is_f', 'video'); +fmt.imageStack.format_ontology = 'NCIT:C70631'; +blk = babuStack('is_k', 'video'); +blk.image_stack_parameters = blk.imageStack_parameters; +blk.image_stack_parameters.clocktype = 'dev_local_time'; +cases = {'depends_on version', ver; 'formatOntology twin', fmt; 'parameters block twin', blk}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + v1 = jsondecode(jsonencode(v1)); + raw = runRaw(v1); + old = runRenamed(v1); + verifyCarriedUntouched(testCase, v1, raw, label); + d = raw.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, startsWith(d, '[carry-049] '), [label ': ' d]); + verifyEqual(testCase, numel(old.passthrough), 1, [label ': renamed path carried it']); + verifyEqual(testCase, old.migrated{1}.get('document_class.schema_version'), 'did_v1', label); +end +end + +% ===================== the switch changes no outcome ====================== + +function testTheSwitchChangesNoOutcome(testCase) +% a converted document is the one the renamed path converted (ids are +% deterministic, practice (b)); a carry is carried on both paths; a passthrough +% passes through on both, the raw one the untouched v1 source with the same +% edges and identity +fixtures = {babuStack('is_b_v', 'video'), babuStack('is_b_i', 'image'), ... + didBrightfield('is_d_xy', ''), didBrightfield('is_d_lab', 'height,width'), ... + haleyBehaviourStack('is_h_v', 'video'), haleyBehaviourStack('is_h_c', 'closest patch'), ... + haleyEColiStack('is_e_i', 'image'), haleyEColiStack('is_e_m', 'mask')}; +for k = 1:numel(fixtures) + v1 = fixtures{k}; + raw = runRaw(v1); + old = runRenamed(v1); + label = sprintf('fixture %d (%s)', k, v1.base.id); + verifyEmpty(testCase, raw.quarantine, label); + verifyEmpty(testCase, old.quarantine, label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), [label ': passed through on one path only']); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + if ~isempty(raw.passthrough) + a = raw.migrated{1}.toStruct(); + b = old.migrated{1}.toStruct(); + verifyEqual(testCase, a.document_class.schema_version, b.document_class.schema_version, label); + verifyEqual(testCase, edgeMap(a), edgeMap(b), [label ': the edges differ']); + verifyEqual(testCase, a.base, b.base, [label ': the identity differs']); + continue; + end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + verifyTrue(testCase, isequaln(a, b), sprintf('%s, document %d: raw %s; renamed %s', ... + label, j, jsonencode(a), jsonencode(b))); + end +end +end + +% ===================== the round trip can fail =========================== + +function testAChangedScaleIsReportedLost(testCase) +v1 = babuStack('is_b_x', 'video'); +out = runRaw(v1); +v1b = v1; +v1b.imageStack_parameters.dimension_scale(3) = 99; +r = did2.convert.roundtrip.check(v1b, out.migrated); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, sort({r.lost.path}), ... + sort([{'imageStack_parameters.dimension_scale'}, findingsFor('Babu video')])); +end + +function testAFieldOutsideTheTemplateIsReportedLost(testCase) +% OPEN (a team question): the fold reads the template's fields only, and the +% register has no imageStack row for a field it has no home for (as carry-056 +% is for a calculator), so one more field is dropped on both paths, as before +% the switch; the round trip names it +v1 = babuStack('is_b_extra', 'image'); +v1.imageStack.magnification = 40; +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(strcmp('imageStack.magnification', {r.lost.path}))); +end + +function testANonEmptyBaseNameIsReportedLost(testCase) +% OPEN (a team question): no writer at the locked main sets base.name on a +% stack; V2 keeps no base.name (#73 item 54), so it is dropped, as before +v1 = babuStack('is_b_name', 'image'); +v1.base.name = 'worm plate 3'; +r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(strcmp('base.name', {r.lost.path}))); +end + +function testADroppedBodyIsUnplaced(testCase) +v1 = babuStack('is_b_drop', 'video'); +out = runRaw(v1); +kept = {}; +for k = 1:numel(out.migrated) + if ~strcmp(out.migrated{k}.className(), 'sampled_body') + kept{end+1} = out.migrated{k}; %#ok + end +end +r = did2.convert.roundtrip.check(v1, kept); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +function testAnExtraDocumentIsUnplaced(testCase) +v1 = babuStack('is_b_one', 'video'); +out = runRaw(v1); +other = runRaw(babuStack('is_b_two', 'image')).migrated; +r = did2.convert.roundtrip.check(v1, [out.migrated, other(1)]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +% ===================== ontologyLabel: ready, not switched ================= + +function testLabelsFollowTheirStack(testCase) +% the default path: a label on a carried stack is carried (carry-064); a label +% on a stack that passes through is handed to NDI's second pass, renamed +beh = haleyBehaviourStack('is_h1', 'video'); +eco = haleyEColiStack('is_e1', 'image'); +out = runRaw({beh, haleyLabel('lab_h1', 'is_h1', 'EMPTY:0000129'), ... + eco, haleyLabel('lab_e1', 'is_e1', 'EMPTY:0000133')}); +verifyEmpty(testCase, out.quarantine); +lh = docWithId(out, 'lab_h1'); +le = docWithId(out, 'lab_e1'); +verifyEqual(testCase, lh.document_class.schema_version, 'did_v1', 'a label on a carried stack is carried'); +verifyEqual(testCase, le.document_class.class_name, 'ontology_label', ... + 'the label is not switched: NDI''s second pass finds it by the renamed name'); +d = out.summary.migration_notes.carried_as_v1.distinct_details; +verifyTrue(testCase, any(startsWith(d, '[carry-064] ')), strjoin(d, ' | ')); +end + +function testAWriterShapedLabelReadRawRoundTrips(testCase) +% with the label switched by the option (what rawV1Classes will list once NDI +% reads the v1 spelling): handed back untouched, round trip exact +names = [did2.convert.rawV1Classes(), {'ontologyLabel'}]; +for node = {'EMPTY:0000129', 'EMPTY:0000131', 'EMPTY:0000257'} + v1 = haleyLabel(['lab_' node{1}(end-2:end)], 'is_x', node{1}); + out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', names); + verifyEmpty(testCase, out.quarantine, node{1}); + verifyEqual(testCase, out.summary.legacy_ndi_document.bodies_read_raw_v1, 1); + verifyEqual(testCase, numel(out.passthrough), 1, node{1}); + verifyEqual(testCase, out.migrated{1}.get('document_class.class_name'), 'ontologyLabel'); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyRoundTrip(testCase, r, ['label ' node{1}], {}); +end +% and on a carried stack, carried down the chain as the raw source +beh = haleyBehaviourStack('is_h2', 'video'); +lab = haleyLabel('lab_h2', 'is_h2', 'EMPTY:0000129'); +out = did2.convert.v1_to_v2({beh, lab}, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', names); +l = docWithId(out, 'lab_h2'); +verifyEqual(testCase, l.document_class.schema_version, 'did_v1'); +l.document_class = rmfield(l.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(l, lab), 'the carried label is not the raw v1 source'); +end + +function testAnInventedLabelShapeIsStillRefusedInEitherSpelling(testCase) +v1 = haleyLabel('lab_bad', 'is_x', 'EMPTY:0000129'); +v1.ontologyLabel.label_id = 12; +names = [did2.convert.rawV1Classes(), {'ontologyLabel'}]; +raw = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', names); +old = runRenamed(v1); +verifyEqual(testCase, numel(raw.quarantine), 1); +verifyEqual(testCase, numel(old.quarantine), 1); +verifyEqual(testCase, raw.quarantine(1).identifier, 'did2:convert:ontologyLabelInventedShape'); +end + +% ===================== helpers ========================================= + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function out = runRenamed(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); +end + +function verifyCarriedUntouched(testCase, v1, out, label) +verifyEmpty(testCase, out.quarantine, label); +verifyEqual(testCase, numel(out.migrated), 1, label); +verifyEqual(testCase, numel(out.passthrough), 1, [label ': carried']); +emitted = out.migrated{1}.toStruct(); +verifyEqual(testCase, emitted.document_class.schema_version, 'did_v1', label); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), [label ': the carry is not the v1 source']); +end + +function b = docWithId(out, id) +b = struct(); +for k = 1:numel(out.migrated) + if strcmp(char(out.migrated{k}.get('base.id')), id) + b = out.migrated{k}.toStruct(); + return; + end +end +end + +function m = edgeMap(b) +% name -> id, whichever key holds it +m = struct(); +if ~isfield(b, 'depends_on'); return; end +d = b.depends_on; +if isstruct(d); d = num2cell(d); end +for k = 1:numel(d) + e = d{k}; + v = ''; + for key = {'document_id', 'value', 'id'} + if isfield(e, key{1}) && ~isempty(e.(key{1})) + v = char(e.(key{1})); + break; + end + end + m.(matlab.lang.makeValidName(char(e.name))) = v; +end +end + +function verifyRoundTrip(testCase, r, label, expectedLost) +verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); +lost = reshape(sort({r.lost.path}), 1, []); +verifyEqual(testCase, lost, reshape(sort(expectedLost), 1, []), ... + sprintf('%s: lost paths are not the listed findings; lost: %s', label, describeLost(r))); +verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); +verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + show(r.lost(k).v1), show(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function s = show(v) +try + s = jsonencode(v); +catch + s = class(v); +end +end + +% ---- the writers' shapes ------------------------------------------------ + +function v1 = stackShell(id, sessionId, datestamp) +% ndi.document('imageStack', ...) + session.newdocument: the template merge +% (imageStack.json, its superclasses base.json and imageStack_parameters.json), +% the edges sorted and unique (document_id, subject_id) +tpl = loadTemplate('imageStack'); +ptpl = loadTemplate('imageStack_parameters'); +btpl = loadTemplate('base'); +v1 = struct(); +v1.base = btpl.base; +v1.base.id = id; +v1.base.session_id = sessionId; +v1.base.datestamp = datestamp; +deps = [reshape(tpl.depends_on, [], 1); reshape(ptpl.depends_on, [], 1)]; +[~, ix] = unique({deps.name}); +v1.depends_on = reshape(deps(ix), 1, []); +v1.document_class = tpl.document_class; +v1.files = struct('file_list', {{'imageStack'}}, 'file_info', struct( ... + 'name', 'imageStack', 'locations', struct('delete_original', 0, ... + 'uid', [id '_f'], 'location', ['ndic://682e7772cdf3f24938176fac/' id '_f'], ... + 'parameters', '', 'location_type', 'ndicloud', 'ingest', 0))); +v1.imageStack = tpl.imageStack; +v1.imageStack_parameters = ptpl.imageStack_parameters; +end + +function v1 = setEdge(v1, name, value) +v1.depends_on(strcmp({v1.depends_on.name}, name)).value = value; +end + +function v1 = haleyBehaviourStack(id, kind) +% +haley/doImport.m, the behaviour plate loop +v1 = stackShell(id, '41269430c597c3e6_c0c9895d35d19b54', '2025-09-04T16:17:17.990Z'); +v1 = setEdge(v1, 'document_id', '41269430c5a381ab_40d18c40b982f557'); +v1 = setEdge(v1, 'subject_id', '41269430c60a3940_40df6475b28be4df'); +p = struct('dimension_order', 'YX', 'dimension_labels', 'height,width', ... + 'dimension_size', [1024 1024], 'dimension_scale', [32.930891045367005 32.930891045367005], ... + 'dimension_scale_units', 'micrometer,micrometer', 'data_type', 'logical', ... + 'data_limits', [0 1], 'timestamp', 738637.4600694445, 'clocktype', 'exp_global_time'); +switch kind + case 'video' + p.dimension_order = 'YXT'; + p.dimension_labels = 'height,width,time'; + p.dimension_size = [1024 1024 10797]; + p.dimension_scale = [32.930891045367005 32.930891045367005 0.33342891628933624]; + p.dimension_scale_units = 'micrometer,micrometer,second'; + p.data_type = 'uint8'; + p.data_limits = [0 255]; + s = struct('label', ['A video recording capturing the behavior of C. ' ... + 'elegans during an experimental assay.'], 'formatOntology', 'NCIT:C190180'); + case 'arena mask' + s = struct('label', ['A binary image mask (logical matrix) that defines ' ... + 'the boundaries of the experimental arena.'], 'formatOntology', 'NCIT:C85437'); + case 'bacteria mask' + s = struct('label', ['A binary image mask (logical matrix) representing ' ... + 'the union of all individually detected bacterial patch areas on an ' ... + 'assay plate. This mask defines all food-containing regions.'], ... + 'formatOntology', 'NCIT:C85437'); + case 'closest patch' + p.data_type = 'uint8'; + p.data_limits = [0 255]; + s = struct('label', ['An image or map where each pixel''s value is the ' ... + 'identifier of the bacterial patch closest to that pixel''s location.'], ... + 'formatOntology', 'NCIT:C85437'); +end +v1.imageStack = s; +v1.imageStack_parameters = p; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = haleyEColiStack(id, kind) +% +haley/doImport.m, the E. coli image loop: document_id only +v1 = stackShell(id, '41269430c5983d0e_40902179ad27b308', '2025-09-05T02:42:39.891Z'); +v1 = setEdge(v1, 'document_id', '41269431a441f675_c0c69cac575a6e6b'); +p = struct('dimension_order', 'YX', 'dimension_labels', 'height,width', ... + 'dimension_size', [2208 2752], 'dimension_scale', [96.4409082312986 96.4409082312986], ... + 'dimension_scale_units', 'micrometer,micrometer', 'data_type', 'uint16', ... + 'data_limits', [0 65535], 'timestamp', 739254.536875, 'clocktype', 'exp_global_time'); +switch kind + case 'image' + s = struct('label', 'A brightfield image of an E. coli patch on an assay plate.', ... + 'formatOntology', 'NCIT:C70631'); + case 'mask' + p.data_type = 'logical'; + p.data_limits = [0 1]; + s = struct('label', ['A binary image mask (logical matrix) representing ' ... + 'the union of all individually detected bacterial patch areas on an ' ... + 'assay plate. This mask defines all food-containing regions.'], ... + 'formatOntology', 'NCIT:C85437'); + case 'closest patch' + p.data_type = 'uint8'; + p.data_limits = [0 255]; + s = struct('label', ['An image or map where each pixel''s value is the ' ... + 'identifier of the bacterial patch closest to that pixel''s location.'], ... + 'formatOntology', 'NCIT:C85437'); +end +v1.imageStack = s; +v1.imageStack_parameters = p; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = babuStack(id, kind) +% +babu/import.m step 6: subject_id only (the subject group), no document_id +v1 = stackShell(id, '4126aa00c0000000_0000000000000b01', '2025-03-11T09:30:00.000Z'); +v1 = setEdge(v1, 'subject_id', '4126aa00c0000000_00000000000005a1'); +switch kind + case 'video' + p = struct('dimension_order', 'YXT', 'dimension_labels', 'height,width,time', ... + 'dimension_size', [480 640 1800], 'dimension_scale', [1 1 30], ... + 'dimension_scale_units', 'pixel,pixel,second'); + s = struct('label', ['A video recording capturing the behavior of C. ' ... + 'elegans during a chemotaxis assay.'], 'formatOntology', 'NCIT:C190180'); + case 'image' + p = struct('dimension_order', 'YX', 'dimension_labels', 'height,width', ... + 'dimension_size', [1024 1344], 'dimension_scale', [1 1], ... + 'dimension_scale_units', 'pixel,pixel'); + s = struct('label', 'An image or video acquired using fluorescence microscopy.', ... + 'formatOntology', 'NCIT:C70631'); +end +p.data_type = 'uint8'; +p.data_limits = [0 255]; +p.timestamp = 739321.4166666666; +p.clocktype = 'exp_global_time'; +v1.imageStack = s; +v1.imageStack_parameters = p; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = didBrightfield(id, labels) +% a DID-side shape: a subject, no plate row, an intensity image; LABELS '' +% names the axes by their letters +v1 = babuStack(id, 'image'); +v1.imageStack.label = 'A brightfield image of a plate.'; +v1.imageStack_parameters.dimension_labels = labels; +v1.imageStack_parameters.dimension_scale = [2; 2]; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = haleyLabel(id, stackId, node) +% ndi.document('ontologyLabel', 'ontologyLabel', struct('ontologyNode', ...)) +% + session.newdocument, then set_dependency_value('document_id', ...) +tpl = loadTemplate('ontologyLabel'); +btpl = loadTemplate('base'); +v1 = struct(); +v1.base = btpl.base; +v1.base.id = id; +v1.base.session_id = '41269430c597c3e6_c0c9895d35d19b54'; +v1.base.datestamp = '2025-09-04T16:17:18.000Z'; +v1.depends_on = tpl.depends_on; +v1.depends_on.value = stackId; +v1.document_class = tpl.document_class; +v1.ontologyLabel = struct('ontologyNode', node); +v1 = jsondecode(jsonencode(v1)); +end + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end diff --git a/tests/+did2/+unittest/testTemplateLiteralTypeTraps.m b/tests/+did2/+unittest/testTemplateLiteralTypeTraps.m index b678a98f..1670059e 100644 --- a/tests/+did2/+unittest/testTemplateLiteralTypeTraps.m +++ b/tests/+did2/+unittest/testTemplateLiteralTypeTraps.m @@ -87,14 +87,21 @@ % snake-cases `imageStack_parameters` -> `image_stack_parameters` before any % migrator runs (universalRenames.m:302-334), and a direct call would hand the % migrator a block key it never sees on the real pipeline. -out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +% ON THE RENAMED PATH ('RawV1Classes', {}): `imageStack` reads raw v1 since +% 2026-10-27 (did2.convert.rawV1Classes), where no superclass migrator runs +% and a passthrough is the untouched v1 source. The superclass migrator +% these tests pin still runs for the v1 `image` (not switched), which shares +% the block; the raw path's refusals are pinned by testRawV1RoundTripImage. +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); end function out = runJValidated(v1) %RUNJVALIDATED The same, with the validator ARMED. This is the assertion that % actually matters: the placeholder is only worth dropping if dropping it is -% what lets the document through. -out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta'); +% what lets the document through. On the renamed path, as RUNJ. +out = did2.convert.v1_to_v2(v1, 'Validate', true, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); end function d = onlyClass(testCase, out, className) diff --git a/tests/+did2/fixtures/ndi_templates/imageStack.json b/tests/+did2/fixtures/ndi_templates/imageStack.json new file mode 100644 index 00000000..2ce60416 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/imageStack.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/data\/imageStack.json", + "validation": "$NDISCHEMAPATH\/data\/imageStack_schema.json", + "class_name": "imageStack", + "property_list_name": "imageStack", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"}, + { "definition": "$NDIDOCUMENTPATH\/data\/imageStack_parameters.json"} + ] + }, + "depends_on": [ + { "name": "subject_id", "value": "" }, + { "name": "document_id", "value": "" } + ], + "files": { + "file_list": [ "imageStack" ] + }, + "imageStack": { + "label": "", + "formatOntology": "" + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_templates/imageStack_parameters.json b/tests/+did2/fixtures/ndi_templates/imageStack_parameters.json new file mode 100644 index 00000000..3571a586 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/imageStack_parameters.json @@ -0,0 +1,28 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/data\/imageStack_parameters.json", + "validation": "$NDISCHEMAPATH\/data\/imageStack_parameters_schema.json", + "class_name": "imageStack_parameters", + "property_list_name": "imageStack_parameters", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + { "name": "document_id", + "value": "" + } + ], + "imageStack_parameters" : { + "dimension_order": "", + "dimension_labels": "", + "dimension_size": [], + "dimension_scale": [], + "dimension_scale_units": [], + "data_type": [], + "data_limits": [], + "timestamp": [], + "clocktype": "" + } +} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_templates/ontologyLabel.json b/tests/+did2/fixtures/ndi_templates/ontologyLabel.json new file mode 100644 index 00000000..179547be --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/ontologyLabel.json @@ -0,0 +1,18 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/data\/ontologyLabel.json", + "validation": "$NDISCHEMAPATH\/data\/ontologyLabel_schema.json", + "class_name": "ontologyLabel", + "property_list_name": "ontologyLabel", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "document_id", "value": "" } + ], + "ontologyLabel": { + "ontologyNode": "" + } +} \ No newline at end of file From 5dab317dee8154b9bccabcfc947ec9aab7caf4b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 04:26:22 +0000 Subject: [PATCH 14/45] Ingested-epoch / sync family reads raw v1; round trips of all four classes Phase 2 of the generic migration, the ingested-epoch / sync family (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [renames carry is temporary], [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - did2.convert.rawV1Classes: + daqreader_mfdaq_epochdata_ingested, epochfiles_ingested, syncrule_mapping, daqmetadatareader_epochdata_ingested (v1 spelling = migrator name; no superclass migrator exists for base, epochid or daqreader_epochdata_ingested, so nothing is folded or deleted). - daqreader_mfdaq_epochdata_ingested reads the raw document (jRawBody, v1read.readDependsOn / readStamp) and emits exactly the body the renamed path emitted (edges as {name, document_id}); a depends_on version or second id, or an ndi_document beside base, is carried (carry-049) as before; a field of the mfdaq block other than `parameters`, which the old migrator dropped silently, or a legacy identity field outside base.json's four, now carries the document (no register row yet: marker `none`). - epochfiles_ingested: still a pass-1 passthrough, on the raw body; what universalRenames would discard (incl. an epochId twin) is carried, carry-049. - syncrule_mapping: pass 1 carries the raw v1 (carry-036, id via readBase). When epochMint re-runs it armed, the fold first accounts for every v1 field (unplacedInFold): base.name, an extra edge or version, a file, an extra block or node field, a non-finite cost, or an epoch_session_id other than the document's own keep the mapping carried instead of being dropped. - daqmetadatareader_epochdata_ingested: carried untouched (carry-046), id via readBase. - +roundtrip: inverses for the four classes (the de-encoded mfdaq cache and its lift; the manifest passthrough; the mapping's fold from the clock_alignment, its references, epochs, acquisition systems, software and manifests; the stimulus file, which pass 1 never converts) and private/undoOutbound. - Fixtures: NDI templates copied verbatim from NDI-matlab locked main 3cb19a8 (daqreader_mfdaq_epochdata_ingested, daqreader_epochdata_ingested, epochfiles_ingested, syncrule_mapping, daqmetadatareader_epochdata_ingested). - testRawV1RoundTripIngested: writer-shaped fixtures (mfdaq.m, navigator.m, syncgraph.m, metadatareader.m) round trip with nothing lost, invented or unplaced; the fold round trips on epochMint's output (two epochs, and one epoch with two systems); raw and renamed paths agree or both carry; unread fields carry; broken inputs fail. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../daqmetadatareader_epochdata_ingested.m | 21 +- .../daqreader_mfdaq_epochdata_ingested.m | 120 +++- .../+migrators_j/epochfiles_ingested.m | 26 + .../+convert/+migrators_j/syncrule_mapping.m | 135 +++- .../daqmetadatareader_epochdata_ingested.m | 29 + .../daqreader_mfdaq_epochdata_ingested.m | 78 ++ .../+convert/+roundtrip/epochfiles_ingested.m | 39 + .../+roundtrip/private/undoOutbound.m | 31 + .../+convert/+roundtrip/syncrule_mapping.m | 190 +++++ src/did/+did2/+convert/rawV1Classes.m | 18 +- .../+unittest/testRawV1RoundTripIngested.m | 677 ++++++++++++++++++ .../daqmetadatareader_epochdata_ingested.json | 26 + .../daqreader_epochdata_ingested.json | 28 + .../daqreader_mfdaq_epochdata_ingested.json | 43 ++ .../ndi_templates/epochfiles_ingested.json | 23 + .../ndi_templates/syncrule_mapping.json | 48 ++ 16 files changed, 1527 insertions(+), 5 deletions(-) create mode 100644 src/did/+did2/+convert/+roundtrip/daqmetadatareader_epochdata_ingested.m create mode 100644 src/did/+did2/+convert/+roundtrip/daqreader_mfdaq_epochdata_ingested.m create mode 100644 src/did/+did2/+convert/+roundtrip/epochfiles_ingested.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/undoOutbound.m create mode 100644 src/did/+did2/+convert/+roundtrip/syncrule_mapping.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripIngested.m create mode 100644 tests/+did2/fixtures/ndi_templates/daqmetadatareader_epochdata_ingested.json create mode 100644 tests/+did2/fixtures/ndi_templates/daqreader_epochdata_ingested.json create mode 100644 tests/+did2/fixtures/ndi_templates/daqreader_mfdaq_epochdata_ingested.json create mode 100644 tests/+did2/fixtures/ndi_templates/epochfiles_ingested.json create mode 100644 tests/+did2/fixtures/ndi_templates/syncrule_mapping.json diff --git a/src/did/+did2/+convert/+migrators_j/daqmetadatareader_epochdata_ingested.m b/src/did/+did2/+convert/+migrators_j/daqmetadatareader_epochdata_ingested.m index cd4cc8f3..19deff91 100644 --- a/src/did/+did2/+convert/+migrators_j/daqmetadatareader_epochdata_ingested.m +++ b/src/did/+did2/+convert/+migrators_j/daqmetadatareader_epochdata_ingested.m @@ -72,10 +72,29 @@ % existence-only (declarative), so the edge resolves against the migrated % reader document whatever the target class ends up being called. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI daqmetadatareader_epochdata_ingested.json + epochid.json +% + base.json at the locked NDI-matlab `main`, 3cb19a8, as +% +ndi/+daq/metadatareader.m ingest_epochfiles writes it), and pass 1 carries +% it UNTOUCHED, whatever it holds: every field reaches NDI's second pass, +% which places it or carries it (carry-086, carry-087, carry-088; [extra field +% on an ingested stimulus file is malformed]). Its id is read through +% did2.convert.v1read.readBase, so a legacy `ndi_document` identity is read +% too. The renamed path carried a document universalRenames would have +% changed with carry-049 instead; both carry it. +% did2.convert.roundtrip.daqmetadatareader_epochdata_ingested holds no +% inverse of a conversion, because pass 1 converts nothing: +% testRawV1RoundTripIngested checks the carry. + arguments preBody (1,1) struct end +b = did2.convert.v1read.readBase(preBody); +id = b.id; +if ~ischar(id); id = ''; end % did-schema #88 RETIRED `acquisition_metadata_file` (#73 review item 61): the % bytes become an opaque_body OWNED BY the stimulator term_manipulation of the % same epoch, which resolveEpochProbemap mints in a batch pass. A single @@ -90,7 +109,7 @@ % stimulus-presentation manipulation (or keeps it as v1 with none). % carry-register: carry-046 did2.convert.reportNote('carried_as_v1', 'daqmetadatareader_epochdata_ingested', ... - char(preBody.base.id), ['[carry-046] retired class: a body of the presentation, made ' ... + id, ['[carry-046] retired class: a body of the presentation, made ' ... 'by the NDI second pass ([ingested stimulus file is a body of the presentation])']); bodies = {preBody}; end diff --git a/src/did/+did2/+convert/+migrators_j/daqreader_mfdaq_epochdata_ingested.m b/src/did/+did2/+convert/+migrators_j/daqreader_mfdaq_epochdata_ingested.m index 6c755891..72698707 100644 --- a/src/did/+did2/+convert/+migrators_j/daqreader_mfdaq_epochdata_ingested.m +++ b/src/did/+did2/+convert/+migrators_j/daqreader_mfdaq_epochdata_ingested.m @@ -27,12 +27,68 @@ % afterwards. did2.convert.v1_to_v2 accepts either % (normaliseMigratorOutput), and callers that invoke this migrator function % directly keep getting the struct they get today. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI daqreader_mfdaq_epochdata_ingested.json + +% daqreader_epochdata_ingested.json + epochid.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+daq/+reader/mfdaq.m ingest_epochfiles +% writes it), identity through jRawBody. Every v1 field and where it goes; +% did2.convert.roundtrip.daqreader_mfdaq_epochdata_ingested rebuilds the v1 +% document and testRawV1RoundTripIngested compares the two: +% +% base.* -> kept (v1_to_v2 renames datestamp and makes +% session_id the edge on the way out) +% depends_on daqreader_id -> kept, as {name, document_id}: the shape +% universalRenames gave it, which the batch +% passes read. An entry with a `version` or a +% second, different id is carried, as the +% renamed path carried it (carry-049) +% files.file_list, file_info -> kept (the recording archives) +% epochid.epochid -> kept +% daqreader_epochdata_ingested.epochtable -> kept (lifted when an epoch +% edge exists, the parent migrator) +% daqreader_mfdaq_epochdata_ingested.parameters +% -> daqreader_epochdata_ingested.parameters +% +% An `ndi_document` block beside `base` is carried too (carry-049: the +% renamed path discarded it and carried the document). A field of the mfdaq +% block other than `parameters`, which the renamed path dropped without a +% word, or a legacy identity field outside base.json's four, now carries the +% document whole as v1 (no register row yet: a question for the team). arguments preBody (1,1) struct end -v2Body = preBody; +body = jRawBody(preBody, 'daqreader_mfdaq_epochdata_ingested'); +[deps, collision] = renamedDependsOn(body); +unplaced = unreadFields(preBody); +if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'daqreader_mfdaq_epochdata_ingested', ... + char(body.base.id), ['[carry-049] universalRenames would discard: ' ... + strjoin(collision, ', ')]); + bodies = preBody; + return; +end +if ~isempty(unplaced) + % carry-register: none (a field the de-encode does not read; no row yet) + did2.convert.reportNote('carried_as_v1', 'daqreader_mfdaq_epochdata_ingested', ... + char(body.base.id), ['unplaced: ' strjoin(unplaced, ', ')]); + bodies = preBody; + return; +end + +v2Body = body; +if isfield(v2Body, 'depends_on') + v2Body.depends_on = deps; +end +% the superclass list by name (did2.convert.v1read.readStamp: v1 names a +% superclass by its definition path); v1_to_v2's ensureClassBlocks rebuilds +% the V_eta chain from the class name, as on the renamed path +stamp = did2.convert.v1read.readStamp(body); +v2Body.document_class.superclasses = struct('class_name', stamp.superclasses); v2Body.document_class.class_name = 'daqreader_epochdata_ingested'; v2Body.document_class.class_version = '2.0.0'; @@ -65,3 +121,65 @@ % lifted here exactly as they are for a plain daqreader_epochdata_ingested. bodies = did2.convert.migrators_j.daqreader_epochdata_ingested(v2Body); end + +% ===================== the raw read ======================================== + +function [deps, collision] = renamedDependsOn(body) +%RENAMEDDEPENDSON depends_on as {name, document_id}, the shape the +% universalRenames pass wrote and the batch passes read, from the raw v1 +% entries (did2.convert.v1read.readDependsOn). COLLISION lists what that pass +% would have discarded: an entry's `version`, or a second id that differs, +% and an `ndi_document` block beside `base`. (The depends_on read is +% +migrators_j/element_epoch.m's.) +deps = struct('name', {}, 'document_id', {}); +collision = {}; +if isfield(body, 'ndi_document') && isfield(body, 'base') && ~isempty(body.ndi_document) + collision{end+1} = 'ndi_document'; +end +if ~isfield(body, 'depends_on') || isempty(body.depends_on) + if isfield(body, 'depends_on') + deps = body.depends_on; % an empty list stays as written, as the pass left it + end + return; +end +raw = did2.convert.v1read.readDependsOn(body); +for k = 1:numel(raw) + deps(end+1) = struct('name', raw(k).name, 'document_id', raw(k).document_id); %#ok + if ~isempty(raw(k).version) + collision{end+1} = sprintf('depends_on(%s).version', raw(k).name); %#ok + end + others = fieldnames(raw(k).other); + for j = 1:numel(others) + collision{end+1} = sprintf('depends_on(%s).%s', raw(k).name, others{j}); %#ok + end +end +end + +function unplaced = unreadFields(preBody) +%UNREADFIELDS What the de-encode does not read and the renamed path dropped +% or moved where nothing reads it: a field of the mfdaq block other than +% `parameters`; a legacy identity field outside base.json's four (jRawBody +% keeps only those four). +unplaced = {}; +blk = 'daqreader_mfdaq_epochdata_ingested'; +if isfield(preBody, blk) + sub = preBody.(blk); + if isstruct(sub) && isscalar(sub) + fns = fieldnames(sub); + for k = 1:numel(fns) + if ~strcmp(fns{k}, 'parameters') + unplaced{end+1} = [blk '.' fns{k}]; %#ok + end + end + elseif ~isempty(sub) + unplaced{end+1} = blk; + end +end +b = did2.convert.v1read.readBase(preBody); +if strcmp(b.source, 'ndi_document') + extra = fieldnames(b.extra); + for k = 1:numel(extra) + unplaced{end+1} = ['ndi_document.' extra{k}]; %#ok + end +end +end diff --git a/src/did/+did2/+convert/+migrators_j/epochfiles_ingested.m b/src/did/+did2/+convert/+migrators_j/epochfiles_ingested.m index cd017a28..fa911985 100644 --- a/src/did/+did2/+convert/+migrators_j/epochfiles_ingested.m +++ b/src/did/+did2/+convert/+migrators_j/epochfiles_ingested.m @@ -238,6 +238,21 @@ % 2026-08-12, which is the corpus-wide find-or-create the mint is MODELLED on, % not where it lives), did2.validate.epochStrings (which reads this class's % `epoch_id` as a mint key). +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI epochfiles_ingested.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+file/navigator.m ingest writes it: +% base, the `filenavigator_id` edge, epoch_id / files / epochprobemap) and +% pass 1 still hands it back UNCHANGED: a passthrough, which v1_to_v2 pads +% and stamps as before. The batch passes (epochMint, resolveEpochProbemap) +% read its block by name and its edge with either key, so the raw `value` +% key where the renamed path had `document_id` changes nothing they read. +% What universalRenames would have discarded (a depends_on `version` or +% second id, an `ndi_document` beside `base`, an `epochId` beside a differing +% `epoch_id`) is carried, carry-049, as the renamed path carried it. +% did2.convert.roundtrip.epochfiles_ingested rebuilds the v1 document from +% the passthrough; testRawV1RoundTripIngested compares. arguments preBody (1,1) struct @@ -271,6 +286,17 @@ 'came from the V_alpha snapshot or a fixture built against it.']); end +collision = jResponseRenameCollisions(preBody, ... + {'epochfiles_ingested', 'epochId', 'epoch_id'}); +if ~isempty(collision) + b = did2.convert.v1read.readBase(preBody); + id = b.id; + if ~ischar(id); id = ''; end + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'epochfiles_ingested', id, ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); +end + % Deliberate passthrough. `bodies = {preBody}` is how a migrator says % "nothing to do here"; v1_to_v2 counts it in `unconverted_by_class`, which is % where this deferral should be visible. diff --git a/src/did/+did2/+convert/+migrators_j/syncrule_mapping.m b/src/did/+did2/+convert/+migrators_j/syncrule_mapping.m index 1c75fc3c..68cf3f91 100644 --- a/src/did/+did2/+convert/+migrators_j/syncrule_mapping.m +++ b/src/did/+did2/+convert/+migrators_j/syncrule_mapping.m @@ -97,6 +97,35 @@ % the phantom instead, empty on all 5,316 corpus documents. The body always % carried the real pair through (depends_on is copied verbatim); it was the % SCHEMA that named the wrong edge, so nothing pointed the query at anything. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it (NDI syncrule_mapping.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+time/syncgraph.m ingest writes it), and +% pass 1 carries it untouched (carry-036): no did_v1 document states the two +% endpoint references. When did2.convert.epochMint re-runs this migrator with +% the references stamped, the fold accounts for every v1 field before it +% folds; anything it does not place keeps the mapping carried +% (unplacedInFold below): +% +% base.id, session_id, datestamp -> the clock_alignment +% base.name -> not written; folded only when empty (the +% writer's newdocument leaves it '') +% depends_on syncgraph_id -> clock_alignment_policy_id +% depends_on syncrule_id -> clock_alignment_configuration_id +% (the edges epochMint stamps: epoch_id_1/_2, time_reference_id_1/_2) +% files -> folded only when it lists no file (the +% writer attaches none) +% syncrule_mapping.cost -> cost (a finite number) +% syncrule_mapping.mapping -> value.coefficients (finite numbers) +% epochnode_a / epochnode_b -> the two per-system references; epochMint +% checked epoch_id, epoch_clock, t0_t1, +% objectname, objectclass and epochprobemap +% against them; epoch_session_id is folded +% only when it is the document's own session +% +% did2.convert.roundtrip.syncrule_mapping rebuilds the v1 document from the +% fold; testRawV1RoundTripIngested compares. arguments preBody (1,1) struct @@ -111,7 +140,7 @@ % BRANCH 1 -- the signed model, gated on the epoch documents existing. % --------------------------------------------------------------------- [epochA, epochB] = epochDocIds(preBody); -if ~isempty(epochA) && ~isempty(epochB) +if ~isempty(epochA) && ~isempty(epochB) && isempty(unplacedInFold(preBody, block)) converted = jClockAlignmentBodies(preBody, block, epochA, epochB); if ~isempty(converted) bodies = converted; @@ -136,7 +165,7 @@ % epochMint's syncrule arming reads the endpoint strings from either shape. % carry-register: carry-036 did2.convert.reportNote('carried_as_v1', 'syncrule_mapping', ... - char(preBody.base.id), ['[carry-036] unplaced: the two ends are not per-system ' ... + sourceId(preBody), ['[carry-036] unplaced: the two ends are not per-system ' ... 'references on the epochs ([device clocks on one epoch])']); bodies = {preBody}; end @@ -160,3 +189,105 @@ end + +% ===================== the raw read ======================================== + +function id = sourceId(preBody) +%SOURCEID The v1 id, read through did2.convert.v1read.readBase (a legacy +% `ndi_document` identity too); '' when there is none. +b = did2.convert.v1read.readBase(preBody); +id = b.id; +if ~ischar(id); id = ''; end +end + +function unplaced = unplacedInFold(preBody, block) +%UNPLACEDINFOLD The v1 fields the fold would not keep, as paths ({} when it +% keeps them all). Read off the raw v1 document (or the body the renamed path +% gave epochMint: its depends_on read with either key, its stamp ignored). +unplaced = {}; +b = did2.convert.v1read.readBase(preBody); +if ~strcmp(b.source, 'base') || ~isempty(fieldnames(b.extra)) ... + || ~isempty(fieldnames(b.legacy)) + unplaced{end+1} = 'base'; % a legacy or extended identity block +end +if ~isempty(b.name) + unplaced{end+1} = 'base.name'; +end +known = {'syncgraph_id', 'syncrule_id', 'epoch_id_1', 'epoch_id_2', ... + 'time_reference_id_1', 'time_reference_id_2', 'session_id'}; +try + deps = did2.convert.v1read.readDependsOn(preBody); +catch + deps = []; + unplaced{end+1} = 'depends_on'; +end +for k = 1:numel(deps) + if ~any(strcmp(deps(k).name, known)) && ~isempty(deps(k).document_id) + unplaced{end+1} = sprintf('depends_on(%s)', deps(k).name); %#ok + end + if ~isempty(deps(k).version) || ~isempty(fieldnames(deps(k).other)) + unplaced{end+1} = sprintf('depends_on(%s) beyond its id', deps(k).name); %#ok + end +end +top = setdiff(fieldnames(preBody), {'document_class', 'base', 'depends_on', ... + 'files', 'syncrule_mapping'}); +for k = 1:numel(top) + if ~isEmptyValue(preBody.(top{k})) + unplaced{end+1} = top{k}; %#ok + end +end +if isfield(preBody, 'files') && ~isEmptyValue(preBody.files) + f = preBody.files; + if ~isstruct(f) || ~isscalar(f) + unplaced{end+1} = 'files'; + else + fns = fieldnames(f); + for k = 1:numel(fns) + if ~isEmptyValue(f.(fns{k})) + unplaced{end+1} = ['files.' fns{k}]; %#ok + end + end + end +end +if ~isstruct(block) || ~isscalar(block) + unplaced{end+1} = 'syncrule_mapping'; + return; +end +rest = setdiff(fieldnames(block), {'cost', 'mapping', 'epochnode_a', 'epochnode_b'}); +for k = 1:numel(rest) + unplaced{end+1} = ['syncrule_mapping.' rest{k}]; %#ok +end +if isfield(block, 'cost') && ~(isnumeric(block.cost) && isscalar(block.cost) ... + && isfinite(block.cost)) + unplaced{end+1} = 'syncrule_mapping.cost'; +end +nodeFields = {'epoch_id', 'epoch_session_id', 'epochprobemap', 'epoch_clock', ... + 't0_t1', 'objectname', 'objectclass'}; +for nd = {'epochnode_a', 'epochnode_b'} + if ~isfield(block, nd{1}) || ~isstruct(block.(nd{1})) || ~isscalar(block.(nd{1})) + unplaced{end+1} = ['syncrule_mapping.' nd{1}]; %#ok + continue; + end + node = block.(nd{1}); + extra = setdiff(fieldnames(node), nodeFields); + for k = 1:numel(extra) + unplaced{end+1} = sprintf('syncrule_mapping.%s.%s', nd{1}, extra{k}); %#ok + end + if isfield(node, 'epoch_session_id') && ~isEmptyValue(node.epoch_session_id) ... + && ~isequal(char(node.epoch_session_id), char(b.session_id)) + unplaced{end+1} = sprintf('syncrule_mapping.%s.epoch_session_id', nd{1}); %#ok + end +end +end + +function tf = isEmptyValue(v) +%ISEMPTYVALUE Empty, or a struct whose every field is empty (the writer's +% `files` block with no file: {file_list: [], file_info: []}). +if isempty(v) + tf = true; +elseif isstruct(v) && isscalar(v) + tf = all(cellfun(@(f) isEmptyValue(v.(f)), fieldnames(v))); +else + tf = false; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/daqmetadatareader_epochdata_ingested.m b/src/did/+did2/+convert/+roundtrip/daqmetadatareader_epochdata_ingested.m new file mode 100644 index 00000000..b3dbedae --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/daqmetadatareader_epochdata_ingested.m @@ -0,0 +1,29 @@ +function [v1, spec] = daqmetadatareader_epochdata_ingested(bodies) +%DAQMETADATAREADER_EPOCHDATA_INGESTED The round trip of a v1 +% `daqmetadatareader_epochdata_ingested` in DID's pass 1. +% +% [V1, SPEC] = did2.convert.roundtrip.daqmetadatareader_epochdata_ingested(BODIES). +% Pass 1 carries every such document whole as v1 (carry-046, [ingested +% stimulus file is a body of the presentation]): did2.convert.roundtrip.check +% compares a carry itself and never calls this inverse. The opaque_body it +% becomes is made by NDI's second pass, in NDI-matlab, and is inverted there +% if anywhere. So anything handed here is a pass-1 emission that should not +% exist, and every document is reported unplaced. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.daqmetadatareader_epochdata_ingested. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +for k = 1:numel(bodies) + spec.unplaced{end+1} = sprintf(['emitted document %d (%s): pass 1 carries a ' ... + 'daqmetadatareader_epochdata_ingested whole as v1'], k, classNameOf(bodies{k})); +end +if isempty(bodies) + spec.unplaced{end+1} = 'nothing was emitted'; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/daqreader_mfdaq_epochdata_ingested.m b/src/did/+did2/+convert/+roundtrip/daqreader_mfdaq_epochdata_ingested.m new file mode 100644 index 00000000..0309c4ec --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/daqreader_mfdaq_epochdata_ingested.m @@ -0,0 +1,78 @@ +function [v1, spec] = daqreader_mfdaq_epochdata_ingested(bodies) +%DAQREADER_MFDAQ_EPOCHDATA_INGESTED Rebuild a v1 +% `daqreader_mfdaq_epochdata_ingested` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.daqreader_mfdaq_epochdata_ingested(BODIES). +% V1 is the ingested epoch cache in NDI's v1 shape +% (daqreader_mfdaq_epochdata_ingested.json + daqreader_epochdata_ingested.json +% + epochid.json + base.json at the locked NDI-matlab `main`, 3cb19a8, as +% +ndi/+daq/+reader/mfdaq.m ingest_epochfiles writes it). BODIES holds: +% +% the de-encoded cache, one `daqreader_epochdata_ingested` document as +% v1_to_v2 padded and stamped it: +% base.* the document's (the session edge read +% back into base.session_id, its +% creation_timestamp into base.datestamp) +% depends_on its edges, each {name, value} as v1 +% writes them (the session edge removed) +% files, epochid, epochtable the document's +% daqreader_mfdaq_epochdata_ingested.parameters +% daqreader_epochdata_ingested.parameters +% and, when the cache had an `epoch_id` edge (never on a v1 document; the +% parent migrator's lift), the relative_time_references it lifted: each must +% restate one clock of the epochtable, or it is unplaced. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.daqreader_mfdaq_epochdata_ingested. + +arguments + bodies cell +end + +CLASS = 'daqreader_mfdaq_epochdata_ingested'; +PARENT = 'daqreader_epochdata_ingested'; +spec = emptySpec(); +v1 = struct(); +cache = []; +refs = {}; +for k = 1:numel(bodies) + cn = classNameOf(bodies{k}); + if strcmp(cn, PARENT) && isempty(cache) + cache = bodies{k}; + elseif strcmp(cn, 'relative_time_reference') + refs{end+1} = bodies{k}; %#ok + else + spec.unplaced{end+1} = sprintf('emitted document %d (%s) is not the de-encoded cache', ... + k, cn); + end +end +if isempty(cache) + spec.unplaced{end+1} = 'no daqreader_epochdata_ingested was emitted'; + return; +end + +v1 = undoOutbound(cache); +v1.document_class.class_name = CLASS; +if isfield(v1, 'depends_on') && isstruct(v1.depends_on) + d = struct('name', {}, 'value', {}); + for k = 1:numel(v1.depends_on) + ids = edgeIds(struct('depends_on', v1.depends_on(k)), char(v1.depends_on(k).name)); + if isempty(ids); ids = {''}; end + d(end+1) = struct('name', char(v1.depends_on(k).name), 'value', ids{1}); %#ok + end + v1.depends_on = d; +end +if isfield(v1, PARENT) && isstruct(v1.(PARENT)) && isfield(v1.(PARENT), 'parameters') + v1.(CLASS) = struct('parameters', v1.(PARENT).parameters); + v1.(PARENT) = rmfield(v1.(PARENT), 'parameters'); +end + +% the lifted references restate the epochtable; each must name one of its clocks +clocks = asCell(getIn(v1, PARENT, 'epochtable', 'epochclock')); +for k = 1:numel(refs) + [~, clk] = termParts(getIn(refs{k}, 'relative_time_reference', 'value', 'clock')); + if ~any(strcmp(clk, cellfun(@char, clocks, 'UniformOutput', false))) + spec.unplaced{end+1} = sprintf('a relative_time_reference on clock "%s" restates no clock of the epochtable', clk); + end +end +end diff --git a/src/did/+did2/+convert/+roundtrip/epochfiles_ingested.m b/src/did/+did2/+convert/+roundtrip/epochfiles_ingested.m new file mode 100644 index 00000000..3dd0afe8 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/epochfiles_ingested.m @@ -0,0 +1,39 @@ +function [v1, spec] = epochfiles_ingested(bodies) +%EPOCHFILES_INGESTED Rebuild a v1 `epochfiles_ingested` from what pass 1 made +% of it. +% +% [V1, SPEC] = did2.convert.roundtrip.epochfiles_ingested(BODIES). V1 is the +% manifest in NDI's v1 shape (epochfiles_ingested.json + base.json at the +% locked NDI-matlab `main`, 3cb19a8, as +ndi/+file/navigator.m writes it: +% epoch_id, files, epochprobemap and the filenavigator_id edge). BODIES is +% the pass-1 passthrough, one `epochfiles_ingested` document as v1_to_v2 +% padded and stamped it: the document itself, its session edge read back into +% base.session_id and its creation_timestamp into base.datestamp. +% +% THIS IS THE PASS-1 ROUND TRIP. The batch passes (epochMint, +% resolveEpochProbemap) then decompose the manifest into an +% ingestion_manifest, observations and data bodies when every probe-map row +% has a home; that decomposition is not inverted here. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.epochfiles_ingested. + +arguments + bodies cell +end + +CLASS = 'epochfiles_ingested'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +for k = 1:numel(bodies) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) is not the pass-1 passthrough', ... + k, classNameOf(bodies{k})); +end +if isempty(bodies) + spec.unplaced{end+1} = 'nothing was emitted'; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/undoOutbound.m b/src/did/+did2/+convert/+roundtrip/private/undoOutbound.m new file mode 100644 index 00000000..2a29496d --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/undoOutbound.m @@ -0,0 +1,31 @@ +function v1 = undoOutbound(body) +%UNDOOUTBOUND A pass-1 body as v1 stated it: v1_to_v2's outbound renames +% undone. The `session_id` edge goes back to base.session_id and +% base.creation_timestamp back to base.datestamp; an empty `depends_on` left +% by removing the edge is removed. Nothing else is changed. +% +% See also did2.convert.roundtrip.epochfiles_ingested, +% did2.convert.roundtrip.daqreader_mfdaq_epochdata_ingested. +v1 = body; +sid = char(did2.schema.cache.sessionIdOf(body)); +if isfield(v1, 'depends_on') && isstruct(v1.depends_on) + if ~isempty(v1.depends_on) + keep = true(1, numel(v1.depends_on)); + for k = 1:numel(v1.depends_on) + keep(k) = ~strcmp(char(v1.depends_on(k).name), 'session_id'); + end + v1.depends_on = v1.depends_on(keep); + end + if isempty(v1.depends_on) + v1 = rmfield(v1, 'depends_on'); + end +end +if isfield(v1, 'base') && isstruct(v1.base) && ~isfield(v1.base, 'session_id') && ~isempty(sid) + v1.base.session_id = sid; +end +if isfield(v1, 'base') && isstruct(v1.base) && isfield(v1.base, 'creation_timestamp') ... + && ~isfield(v1.base, 'datestamp') + v1.base.datestamp = v1.base.creation_timestamp; + v1.base = rmfield(v1.base, 'creation_timestamp'); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/syncrule_mapping.m b/src/did/+did2/+convert/+roundtrip/syncrule_mapping.m new file mode 100644 index 00000000..814b0c06 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/syncrule_mapping.m @@ -0,0 +1,190 @@ +function [v1, spec] = syncrule_mapping(bodies) +%SYNCRULE_MAPPING Rebuild a v1 `syncrule_mapping` from its fold. +% +% [V1, SPEC] = did2.convert.roundtrip.syncrule_mapping(BODIES). V1 is the +% mapping in NDI's v1 shape (syncrule_mapping.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+time/syncgraph.m ingest writes it). +% +% Pass 1 carries every v1 mapping whole (carry-036); did2.convert.roundtrip. +% check compares a carry itself and never calls this inverse. This inverts +% the FOLD did2.convert.epochMint makes ([device clocks on one epoch] (3)): +% BODIES holds the `clock_alignment` and the documents its two ends are read +% back from: +% +% base.id, session_id, datestamp the clock_alignment (rebuildBase) +% depends_on syncgraph_id its clock_alignment_policy_id +% depends_on syncrule_id its clock_alignment_configuration_id +% syncrule_mapping.cost its cost +% syncrule_mapping.mapping its polynomial coefficients +% epochnode_a / _b, from the relative_time_reference its input_id / +% output_id names: +% epoch_clock, t0_t1 the reference's clock, and [start, +% start + duration] in seconds +% objectname the acquisition_system the reference +% is on (its referent): its name +% objectclass that system's software entity: its +% local_identifier before any '@' +% epoch_id, epoch_session_id the epoch entity whose time_reference_id +% names the reference: its +% local_identifier and its session +% epochprobemap the epoch's manifest: the v1 +% epochfiles_ingested of that session and +% epoch read by the system's file navigator +% (its epoch_file_pattern_id) +% +% base.name is not rebuilt (V2 writes none; the fold takes only an empty +% one); `files` is not rebuilt (the fold takes only one that lists no file). +% Any other document in BODIES, or a missing one, is unplaced. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.syncrule_mapping, did2.convert.epochMint. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +used = false(1, numel(bodies)); +ca = []; +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'clock_alignment') + if isempty(ca) + ca = bodies{k}; + used(k) = true; + end + end +end +if isempty(ca) + spec.unplaced{end+1} = 'no clock_alignment was emitted'; + return; +end +[base, ~] = rebuildBase(ca); + +coeffs = getIn(ca, 'polynomial', 'value', 'coefficients'); +if isempty(coeffs) + coeffs = getIn(ca, 'clock_alignment', 'value', 'coefficients'); +end +cost = getIn(ca, 'clock_alignment', 'cost'); + +blk = struct(); +blk.cost = cost; +blk.mapping = reshape(double(coeffs), [], 1); % jsondecode's column +ends = {'input_id', 'epochnode_a'; 'output_id', 'epochnode_b'}; +for e = 1:size(ends, 1) + [node, used, why] = endpoint(bodies, used, firstId(ca, ends{e, 1}), base.session_id); + if ~isempty(why) + spec.unplaced{end+1} = sprintf('%s: %s', ends{e, 2}, why); %#ok + end + blk.(ends{e, 2}) = node; +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in the mapping', ... + k, classNameOf(bodies{k})); +end + +v1.document_class = struct('class_name', 'syncrule_mapping'); +v1.depends_on = struct('name', {'syncgraph_id', 'syncrule_id'}, ... + 'value', {firstId(ca, 'clock_alignment_policy_id'), ... + firstId(ca, 'clock_alignment_configuration_id')}); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'datestamp', base.datestamp); +v1.syncrule_mapping = blk; +end + +% ===================== helpers ========================================= + +function [node, used, why] = endpoint(bodies, used, refId, sessionId) +%ENDPOINT One epochnode, read back from the reference REFID and the documents +% it is tied to; WHY says what could not be read ('' when all of it was). +node = struct('epoch_id', '', 'epoch_session_id', '', 'epochprobemap', '', ... + 'epoch_clock', '', 't0_t1', [], 'objectname', '', 'objectclass', ''); +why = ''; +[ref, i] = withId(bodies, refId); +if isempty(ref) + why = 'its relative_time_reference is not among the documents'; + return; +end +used(i) = true; +[~, node.epoch_clock] = termParts(getIn(ref, 'relative_time_reference', 'value', 'clock')); +t0 = numberOf(getIn(ref, 'relative_time_reference', 'value', 'start', 'seconds')); +dt = numberOf(getIn(ref, 'relative_time_reference', 'value', 'duration', 'seconds')); +if isempty(t0) || isempty(dt) + why = 'its reference states no start or duration in seconds'; +else + node.t0_t1 = [t0; t0 + dt]; +end + +% the epoch holding the reference +epoch = []; +for k = 1:numel(bodies) + if isEntityOfType(bodies{k}, 'epoch') && any(strcmp(edgeIds(bodies{k}, 'time_reference_id'), refId)) + epoch = bodies{k}; + used(k) = true; + break; + end +end +if isempty(epoch) + why = 'no epoch entity holds its reference'; +else + node.epoch_id = fieldText(epoch.entity, 'local_identifier'); + node.epoch_session_id = char(did2.schema.cache.sessionIdOf(epoch)); +end + +% the acquisition system the reference is on, and its software +sysIds = edgeIds(ref, 'referent_id'); +sys = []; +if ~isempty(sysIds) + [sys, i] = withId(bodies, sysIds{1}); +end +if isempty(sys) || ~strcmp(classNameOf(sys), 'acquisition_system') + why = 'its referent acquisition_system is not among the documents'; + return; +end +used(i) = true; +node.objectname = fieldText(getIn(sys, 'acquisition_system'), 'name'); +if isempty(node.objectname) + node.objectname = fieldText(sys.base, 'name'); +end +swIds = edgeIds(sys, 'software_id'); +if ~isempty(swIds) + [sw, i] = withId(bodies, swIds{1}); + if ~isempty(sw) + used(i) = true; + node.objectclass = regexprep(fieldText(getIn(sw, 'entity'), 'local_identifier'), '@.*$', ''); + end +end + +% the epoch's manifest, read by the system's file navigator +navIds = edgeIds(sys, 'epoch_file_pattern_id'); +for k = 1:numel(bodies) + b = bodies{k}; + if ~strcmp(classNameOf(b), 'epochfiles_ingested') || isempty(navIds); continue; end + if strcmp(fieldText(getIn(b, 'epochfiles_ingested'), 'epoch_id'), node.epoch_id) ... + && strcmp(char(did2.schema.cache.sessionIdOf(b)), char(sessionId)) ... + && any(strcmp(edgeIds(b, 'filenavigator_id'), navIds{1})) + node.epochprobemap = fieldText(b.epochfiles_ingested, 'epochprobemap'); + used(k) = true; + break; + end +end +end + +function [b, idx] = withId(bodies, id) +b = []; +idx = 0; +for k = 1:numel(bodies) + if isfield(bodies{k}, 'base') && isfield(bodies{k}.base, 'id') ... + && strcmp(char(bodies{k}.base.id), char(id)) + b = bodies{k}; + idx = k; + return; + end +end +end + +function id = firstId(body, name) +ids = edgeIds(body, name); +id = ''; +if ~isempty(ids); id = ids{1}; end +end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index 2584e31a..b045f911 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -89,6 +89,18 @@ % pass-1 passthrough that resolveResponseParameters % turns into a `method`. Round trips: % testRawV1RoundTripStimulusResponse. +% daqreader_mfdaq_epochdata_ingested the ingested-epoch / sync family: +% epochfiles_ingested superclasses `base` (+ `epochid`, +% syncrule_mapping + daqreader_epochdata_ingested for +% daqmetadatareader_epochdata_ingested the mfdaq cache), no `app` block, +% no superclass migrator. Pass 1: the mfdaq cache +% de-encodes to daqreader_epochdata_ingested; the +% manifest passes through; the mapping and the stimulus +% file are carried (carry-036, carry-046) for +% epochMint and NDI's second pass. Written by +% +daq/+reader/mfdaq.m, +file/navigator.m, +% +time/syncgraph.m, +daq/metadatareader.m. Round +% trips: testRawV1RoundTripIngested. % % See also did2.convert.v1_to_v2, did2.convert.roundtrip.check. @@ -97,7 +109,11 @@ 'tuningcurve_calc', 'contrasttuning_calc', 'oridirtuning_calc', ... 'spatial_frequency_tuning_calc', 'temporal_frequency_tuning_calc', ... 'contrastsensitivity_calc', 'stimulus_response_scalar', ... - 'stimulus_response_scalar_parameters_basic'}; + 'stimulus_response_scalar_parameters_basic', ... + 'daqreader_mfdaq_epochdata_ingested', ... + 'epochfiles_ingested', ... + 'syncrule_mapping', ... + 'daqmetadatareader_epochdata_ingested'}; % v1 name migrator (+migrators_j); TEMPORARY, see above TABLE = { ... diff --git a/tests/+did2/+unittest/testRawV1RoundTripIngested.m b/tests/+did2/+unittest/testRawV1RoundTripIngested.m new file mode 100644 index 00000000..917241ec --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripIngested.m @@ -0,0 +1,677 @@ +function tests = testRawV1RoundTripIngested +%TESTRAWV1ROUNDTRIPINGESTED The ingested-epoch / sync family read as raw v1, +% and its round trip: daqreader_mfdaq_epochdata_ingested, +% epochfiles_ingested, syncrule_mapping and +% daqmetadatareader_epochdata_ingested. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes), [migration reliability +% practices] (a) (a round trip per class, did2.convert.roundtrip.check), and +% [renames carry is temporary] (what universalRenames would discard is still +% carried, carry-049). The test of the round trip is [lossless means round +% trip]. +% +% THE v1 DOCUMENTS are built from NDI's templates at the locked NDI-matlab +% `main` (3cb19a8; tests/+did2/fixtures/ndi_templates, copied verbatim: +% daqreader_mfdaq_epochdata_ingested.json, daqreader_epochdata_ingested.json, +% epochid.json, epochfiles_ingested.json, syncrule_mapping.json, +% daqmetadatareader_epochdata_ingested.json, base.json) in the shapes their +% writers give them, and pass through jsonencode/jsondecode as a corpus +% delivers them: +% mfdaq cache +daq/+reader/mfdaq.m ingest_epochfiles: parameters 1e6 / +% 1e7 (the writer, not the template's 1e6 / 1e6); epochtable +% {epochclock, t0_t1 2xN}; epochid; daqreader_id; the +% recording archives in files +% manifest +file/navigator.m: epoch_id, files ('epochid://...' first), +% epochprobemap (serialised), filenavigator_id; no files block +% mapping +time/syncgraph.m: cost, mapping, the two epochnodes of +% seven fields; syncgraph_id, syncrule_id; files with none +% stimulus file +daq/metadatareader.m ingest_epochfiles: epochid, +% daqmetadatareader_id, data.bin; an empty block +% These are the shapes of all 4,438 / 4,437 / 2,832 / 1,417 documents of the +% corpora (Dab and Soph; census of the corpus zips, 2026-10-27). +% +% Pass 1 converts the mfdaq cache (renamed to daqreader_epochdata_ingested), +% passes the manifest through, and carries the mapping (carry-036) and the +% stimulus file (carry-046). The mapping's fold is did2.convert.epochMint's; +% its round trip is tested here on epochMint's output. +% +% WHAT V2 DOES NOT KEEP would be listed per fixture as KNOWN FINDINGS; every +% writer-shaped fixture here round trips with none. +tests = functiontests(localfunctions); +end + +function setupOnce(testCase) +prev = did2.schema.cache.strictMode('TermRegistry', false); +testCase.addTeardown(@() did2.schema.cache.strictMode('TermRegistry', prev)); +end + +% ===================== the switch ====================================== + +function testAllFourClassesAreSwitched(testCase) +names = did2.convert.rawV1Classes(); +for c = {'daqreader_mfdaq_epochdata_ingested', 'epochfiles_ingested', ... + 'syncrule_mapping', 'daqmetadatareader_epochdata_ingested'} + verifyTrue(testCase, any(strcmp(names, c{1})), c{1}); +end +r = runRaw({writerMfdaq('mf_1', 1), writerManifest('efi_1', 't00001', 'nav_1', probemap('a')), ... + writerMapping('map_1', identityNodes()), writerStimulusFile('sf_1')}); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_read_raw_v1, 4); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_reaching_universal_renames, 0); +end + +% ===================== the mfdaq cache: converted ======================== + +function testWriterMfdaqCachesConvertAndRoundTrip(testCase) +cases = {'one clock', writerMfdaq('mf_1', 1); 'two clocks', writerMfdaq('mf_2', 2)}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEmpty(testCase, out.passthrough, [label ': converted, not passed through']); + doc = out.migrated{1}; + verifyEqual(testCase, char(doc.get('document_class.class_name')), ... + 'daqreader_epochdata_ingested', label); + verifyEqual(testCase, char(doc.get('document_class.schema_version')), 'did_v2', label); + verifyEqual(testCase, doc.get('daqreader_epochdata_ingested.parameters.sample_digital_segment'), ... + 1e7, label); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyFalse(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, findingsFor(label)); + accounted = [r.matched, r.not_set]; + for p = {'base.id', 'base.session_id', 'base.datestamp', 'base.name', ... + 'document_class.class_name', 'depends_on(1).name', 'depends_on(1).value', ... + 'epochid.epochid', 'daqreader_epochdata_ingested.epochtable.epochclock', ... + 'daqreader_epochdata_ingested.epochtable.t0_t1', ... + 'daqreader_mfdaq_epochdata_ingested.parameters.sample_analog_segment', ... + 'daqreader_mfdaq_epochdata_ingested.parameters.sample_digital_segment', ... + 'files.file_list', 'files.file_info(1).name'} + verifyTrue(testCase, any(strcmp(p{1}, accounted)), ... + sprintf('%s: %s is not accounted for', label, p{1})); + end +end +end + +function testTheMfdaqLiftRoundTrips(testCase) +% with an `epoch_id` edge (never on a v1 document; the parent's lift) the +% epochtable also becomes references, which restate it +v1 = writerMfdaq('mf_3', 2); +v1.depends_on = [v1.depends_on; struct('name', 'epoch_id', 'value', 'epochdoc_1')]; +v1 = jsondecode(jsonencode(v1)); +out = runRaw(v1); +verifyEmpty(testCase, out.quarantine); +verifyGreaterThan(testCase, numel(out.migrated), 1); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyRoundTrip(testCase, r, 'mfdaq cache with its lift', {}); +end + +function testAnUnreadMfdaqFieldIsCarried(testCase) +% before the switch the migrator dropped a field of the mfdaq block other than +% `parameters` without a word; now it carries the document whole (no register +% row yet) +v1 = writerMfdaq('mf_4', 1); +v1.daqreader_mfdaq_epochdata_ingested.segment_format = 'nbf'; +raw = runRaw(v1); +verifyEqual(testCase, numel(raw.passthrough), 1); +emitted = raw.migrated{1}.toStruct(); +verifyEqual(testCase, emitted.document_class.schema_version, 'did_v1'); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carry is not the v1 source'); +d = raw.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, contains(d, 'daqreader_mfdaq_epochdata_ingested.segment_format'), d); +verifyTrue(testCase, did2.convert.roundtrip.check(v1, raw.migrated).ok); +% the migrator runs on both paths now, so the renamed path carries it too +old = runRenamed(v1); +verifyEqual(testCase, numel(old.passthrough), 1); +end + +function testAMfdaqDependencyVersionIsCarriedOnBothPaths(testCase) +v1 = writerMfdaq('mf_5', 1); +v1.depends_on.version = 2; +v1 = jsondecode(jsonencode(v1)); +raw = runRaw(v1); +old = runRenamed(v1); +verifyEqual(testCase, numel(raw.passthrough), 1, 'raw: carried'); +verifyEqual(testCase, numel(old.passthrough), 1, 'renamed: carried'); +d = raw.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, startsWith(d, '[carry-049] '), d); +emitted = raw.migrated{1}.toStruct(); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carry is not the v1 source'); +end + +% ===================== the manifest: passed through ====================== + +function testWriterManifestsPassThroughAndRoundTrip(testCase) +cases = {'three files', writerManifest('efi_1', 't00001', 'nav_1', probemap('a')); ... + 'one file', writerManifest('efi_2', 'epoch_4126945aeeb60250_40b32508ea91cbb2', 'nav_2', probemap('b'), 1)}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEqual(testCase, numel(out.passthrough), 1, [label ': a pass-1 passthrough']); + verifyEqual(testCase, char(out.migrated{1}.get('document_class.schema_version')), 'did_v2', label); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyFalse(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, findingsFor(label)); +end +end + +function testAManifestEpochIdTwinIsCarriedOnBothPaths(testCase) +v1 = writerManifest('efi_3', 't00001', 'nav_1', probemap('a')); +v1.epochfiles_ingested.epochId = 't00002'; +raw = runRaw(v1); +old = runRenamed(v1); +verifyEqual(testCase, numel(raw.passthrough), 1); +verifyEqual(testCase, numel(old.passthrough), 1); +verifyEqual(testCase, char(raw.migrated{1}.get('document_class.schema_version')), 'did_v1'); +verifyEqual(testCase, char(old.migrated{1}.get('document_class.schema_version')), 'did_v1'); +end + +% ===================== the mapping: carried, then folded ================= + +function testWriterMappingsAreCarriedAndRoundTrip(testCase) +cases = {'identity (Dab)', writerMapping('map_d', identityNodes()); ... + 'drift (Soph)', writerMapping('map_s', driftNodes(), [1.00000241750492, -4.33176506573082])}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + for path = {'raw', 'renamed'} + if strcmp(path{1}, 'raw'); out = runRaw(v1); else; out = runRenamed(v1); end + verifyEmpty(testCase, out.quarantine, label); + verifyEqual(testCase, numel(out.passthrough), 1, [label ', ' path{1} ': carried']); + verifyEqual(testCase, char(out.migrated{1}.get('document_class.schema_version')), ... + 'did_v1', [label ', ' path{1}]); + end + out = runRaw(v1); + emitted = out.migrated{1}.toStruct(); + emitted.document_class = rmfield(emitted.document_class, 'schema_version'); + verifyTrue(testCase, isequaln(emitted, v1), [label ': the carry is not the v1 source']); + d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, startsWith(d, '[carry-036] '), d); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyTrue(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, {}); +end +end + +function testTheMappingFoldRoundTrips(testCase) +% epochMint folds the carried mapping into a clock_alignment between the two +% per-system references ([device clocks on one epoch] (3)); the mapping is +% rebuilt from the alignment and the documents its ends are tied to +for c = {'two epochs', 'one epoch, two systems'} + [batch, mapping] = foldBatch(c{1}); + [out, rep] = did2.convert.epochMint(runRaw(batch), 'Validate', false, 'TargetVersion', 'V_eta'); + verifyEqual(testCase, rep.syncrule_folds_emitted, 1, c{1}); + docs = foldDocs(out); + verifyNotEmpty(testCase, docs, c{1}); + r = did2.convert.roundtrip.check(mapping, docs); + verifyFalse(testCase, r.carried, c{1}); + verifyRoundTrip(testCase, r, ['the fold, ' c{1}], {}); + for p = {'syncrule_mapping.cost', 'syncrule_mapping.mapping', ... + 'syncrule_mapping.epochnode_a.epoch_id', 'syncrule_mapping.epochnode_a.epoch_session_id', ... + 'syncrule_mapping.epochnode_a.epochprobemap', 'syncrule_mapping.epochnode_a.epoch_clock', ... + 'syncrule_mapping.epochnode_a.t0_t1', 'syncrule_mapping.epochnode_a.objectname', ... + 'syncrule_mapping.epochnode_a.objectclass', 'syncrule_mapping.epochnode_b.objectname', ... + 'depends_on(1).value', 'depends_on(2).value'} + verifyTrue(testCase, any(strcmp(p{1}, r.matched)), sprintf('%s: %s not matched', c{1}, p{1})); + end +end +end + +function testTheFoldIsTheSameOnBothPaths(testCase) +% the same clock_alignment from either path (the references epochMint mints +% get fresh ids each run, so the two ends are compared by what they state), +% and both folds round trip to the same v1 mapping +[batch, mapping] = foldBatch('two epochs'); +a = did2.convert.epochMint(runRaw(batch), 'Validate', false, 'TargetVersion', 'V_eta'); +b = did2.convert.epochMint(runRenamed(batch), 'Validate', false, 'TargetVersion', 'V_eta'); +ca = ofClass(a, 'clock_alignment'); +cb = ofClass(b, 'clock_alignment'); +verifyNumElements(testCase, ca, 1); +verifyNumElements(testCase, cb, 1); +verifyTrue(testCase, isequaln(endsBlanked(ca{1}), endsBlanked(cb{1})), ... + 'the clock_alignment differs between the raw and the renamed path'); +ra = did2.convert.roundtrip.check(mapping, foldDocs(a)); +rb = did2.convert.roundtrip.check(mapping, foldDocs(b)); +verifyTrue(testCase, ra.ok, 'raw path'); +verifyTrue(testCase, rb.ok, 'renamed path'); +verifyEqual(testCase, sort(ra.matched), sort(rb.matched)); +end + +function s = endsBlanked(doc) +s = doc.toStruct(); +for k = 1:numel(s.depends_on) + if any(strcmp(char(s.depends_on(k).name), {'input_id', 'output_id'})) + s.depends_on(k).document_id = ''; + end +end +end + +function testAFieldTheFoldDoesNotPlaceKeepsTheMappingCarried(testCase) +% unread by the fold: the mapping is not folded, it stays carried +breaks = {'base.name', @(m) setIn(m, {'base', 'name'}, 'a named mapping'); ... + 'an extra node field', @(m) setIn(m, {'syncrule_mapping', 'epochnode_a', 'note'}, 'x'); ... + 'another session', @(m) setIn(m, {'syncrule_mapping', 'epochnode_b', 'epoch_session_id'}, 'sess_other'); ... + 'a file', @(m) setIn(m, {'files', 'file_list'}, {'mapping.bin'})}; +for k = 1:size(breaks, 1) + [batch, mapping] = foldBatch('two epochs'); + batch{end} = jsondecode(jsonencode(breaks{k, 2}(mapping))); + [out, rep] = did2.convert.epochMint(runRaw(batch), 'Validate', false, 'TargetVersion', 'V_eta'); + verifyEqual(testCase, rep.syncrule_folds_emitted, 0, breaks{k, 1}); + verifyEqual(testCase, rep.syncrule_refused_migrator_declined, 1, breaks{k, 1}); + verifyEmpty(testCase, ofClass(out, 'clock_alignment'), breaks{k, 1}); + verifyNumElements(testCase, ofClass(out, 'syncrule_mapping'), 1, breaks{k, 1}); +end +end + +% ===================== the stimulus file: carried ====================== + +function testWriterStimulusFilesAreCarriedAndRoundTrip(testCase) +v1 = writerStimulusFile('sf_2'); +for path = {'raw', 'renamed'} + if strcmp(path{1}, 'raw'); out = runRaw(v1); else; out = runRenamed(v1); end + verifyEmpty(testCase, out.quarantine, path{1}); + verifyEqual(testCase, numel(out.passthrough), 1, [path{1} ': carried']); + verifyEqual(testCase, char(out.migrated{1}.get('document_class.schema_version')), 'did_v1', path{1}); +end +out = runRaw(v1); +emitted = out.migrated{1}.toStruct(); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carry is not the v1 source'); +d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, startsWith(d, '[carry-046] '), d); +r = did2.convert.roundtrip.check(v1, out.migrated); +verifyTrue(testCase, r.carried); +verifyRoundTrip(testCase, r, 'stimulus file', {}); +end + +% ===================== the switch changes no outcome ====================== + +function testTheSwitchChangesNoOutcome(testCase) +% a converted document is the one the renamed path converted; a passthrough is +% the same document but for v1's `value` edge key; a carry is carried on both +fixtures = {writerMfdaq('mf_1', 1), writerMfdaq('mf_2', 2), ... + writerManifest('efi_1', 't00001', 'nav_1', probemap('a')), ... + writerMapping('map_1', identityNodes()), writerStimulusFile('sf_1')}; +for k = 1:numel(fixtures) + v1 = fixtures{k}; + raw = runRaw(v1); + old = runRenamed(v1); + label = sprintf('fixture %d (%s %s)', k, v1.document_class.class_name, v1.base.id); + verifyEmpty(testCase, raw.quarantine, label); + verifyEqual(testCase, numel(raw.quarantine), numel(old.quarantine), label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), label); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + if strcmp(char(raw.migrated{1}.get('document_class.schema_version')), 'did_v1') + verifyEqual(testCase, char(old.migrated{1}.get('document_class.schema_version')), 'did_v1', label); + continue; + end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + if ~isempty(raw.passthrough) + verifyEqual(testCase, edgeMap(a), edgeMap(b), label); + a = rmfield(a, 'depends_on'); + b = rmfield(b, 'depends_on'); + end + verifyTrue(testCase, isequaln(a, b), sprintf('%s, document %d: raw %s; renamed %s', ... + label, j, jsonencode(a), jsonencode(b))); + end +end +end + +% ===================== the round trip can fail =========================== + +function testAChangedValueIsReportedLost(testCase) +v1 = writerMfdaq('mf_6', 1); +out = runRaw(v1); +v1b = v1; +v1b.daqreader_epochdata_ingested.epochtable.t0_t1(2) = 1; +r = did2.convert.roundtrip.check(v1b, out.migrated); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, {r.lost.path}, {'daqreader_epochdata_ingested.epochtable.t0_t1'}); +end + +function testAMissingOrExtraDocumentIsUnplaced(testCase) +[batch, mapping] = foldBatch('two epochs'); +out = did2.convert.epochMint(runRaw(batch), 'Validate', false, 'TargetVersion', 'V_eta'); +docs = foldDocs(out); +% without the epochs the ends' epoch ids cannot be read back +keep = cellfun(@(d) ~strcmp(did2.unittest.helpers.classKey(d), 'epoch'), docs); +r = did2.convert.roundtrip.check(mapping, docs(keep)); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +% a document with no role in the mapping +r = did2.convert.roundtrip.check(mapping, [docs, runRaw(writerStimulusFile('sf_9')).migrated]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +% the mfdaq cache with a stray document +mf = writerMfdaq('mf_7', 1); +r = did2.convert.roundtrip.check(mf, [runRaw(mf).migrated, runRaw(writerManifest('efi_9', 't1', 'n', 'x')).migrated]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +function testTheStimulusFileInverseRefusesAConversion(testCase) +% pass 1 never converts it, so anything handed to its inverse is unplaced +v1 = writerStimulusFile('sf_3'); +fake = runRaw(writerManifest('efi_8', 't00001', 'nav_1', probemap('a'))).migrated; +r = did2.convert.roundtrip.check(v1, fake); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +% ===================== known findings =================================== + +function f = knownFindings() +% {fixture, path, why}: none. Every writer-shaped fixture round trips. +f = cell(0, 3); +end + +function paths = findingsFor(fixture) +f = knownFindings(); +paths = reshape(sort(f(strcmp(f(:, 1), fixture), 2)), 1, []); +end + +% ===================== helpers ========================================= + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function out = runRenamed(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); +end + +function verifyRoundTrip(testCase, r, label, expectedLost) +verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); +lost = reshape(sort({r.lost.path}), 1, []); +verifyEqual(testCase, lost, reshape(sort(expectedLost), 1, []), ... + sprintf('%s: lost paths are not the listed findings; lost: %s', label, describeLost(r))); +verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); +verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + show(r.lost(k).v1), show(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function s = show(v) +try + s = jsonencode(v); +catch + s = class(v); +end +end + +function m = edgeMap(b) +% name -> id, whichever key holds it +m = struct(); +if ~isfield(b, 'depends_on'); return; end +d = b.depends_on; +if isstruct(d); d = num2cell(d); end +for k = 1:numel(d) + e = d{k}; + v = ''; + for key = {'document_id', 'value', 'id'} + if isfield(e, key{1}) && ~isempty(e.(key{1})) + v = char(e.(key{1})); + break; + end + end + m.(matlab.lang.makeValidName(char(e.name))) = v; +end +end + +function docs = ofClass(out, className) +docs = {}; +for k = 1:numel(out.migrated) + if strcmp(char(did2.unittest.helpers.classKey(out.migrated{k})), className) + docs{end+1} = out.migrated{k}; %#ok + end +end +end + +function doc = docWithId(out, id) +doc = []; +for k = 1:numel(out.migrated) + if strcmp(char(out.migrated{k}.get('base.id')), id) + doc = out.migrated{k}; + return; + end +end +end + +function ids = edgesOf(doc, name) +ids = {}; +deps = doc.get('depends_on'); +if isstruct(deps); deps = num2cell(deps); end +for k = 1:numel(deps) + e = deps{k}; + if ~strcmp(char(e.name), name); continue; end + for key = {'document_id', 'value', 'id'} + if isfield(e, key{1}) && ~isempty(e.(key{1})) + ids{end+1} = char(e.(key{1})); %#ok + break; + end + end +end +end + +function docs = foldDocs(out) +%FOLDDOCS The clock_alignment and the documents its ends are read back from: +% its two references, the epochs holding them, the acquisition systems they +% are on, those systems' software, and the manifests. +docs = {}; +align = ofClass(out, 'clock_alignment'); +if isempty(align); return; end +docs = align(1); +refIds = [edgesOf(align{1}, 'input_id'), edgesOf(align{1}, 'output_id')]; +sysIds = {}; +for k = 1:numel(refIds) + ref = docWithId(out, refIds{k}); + if isempty(ref); continue; end + docs{end+1} = ref; %#ok + sysIds = [sysIds, edgesOf(ref, 'referent_id')]; %#ok +end +for e = ofClass(out, 'epoch') + if any(ismember(edgesOf(e{1}, 'time_reference_id'), refIds)) + docs{end+1} = e{1}; %#ok + end +end +sysIds = unique(sysIds, 'stable'); +for k = 1:numel(sysIds) + sys = docWithId(out, sysIds{k}); + if isempty(sys); continue; end + docs{end+1} = sys; %#ok + for sw = edgesOf(sys, 'software_id') + s = docWithId(out, sw{1}); + if ~isempty(s) && ~any(cellfun(@(d) strcmp(char(d.get('base.id')), sw{1}), docs)) + docs{end+1} = s; %#ok + end + end +end +docs = [docs, ofClass(out, 'epochfiles_ingested')]; +end + +function s = setIn(s, path, value) +s = setfield(s, path{:}, value); %#ok +end + +% ===================== fixtures, from the WRITERS ========================= + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end + +function b = writerBase(id) +tpl = loadTemplate('base'); +b = tpl.base; +b.id = id; +b.session_id = 'sess_0001'; +b.datestamp = '2025-05-27T15:47:23.738Z'; +end + +function v1 = writerMfdaq(id, nClocks) +% +daq/+reader/mfdaq.m ingest_epochfiles: ndi.document(...) merges the +% template with its superclasses (base, epochid, daqreader_epochdata_ingested, +% in that order on every corpus document), then sets the three blocks, the +% daqreader_id edge, and attaches the channel list and the segment files +tpl = loadTemplate('daqreader_mfdaq_epochdata_ingested'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.document_class.superclasses = struct('definition', { ... + '$NDIDOCUMENTPATH/base.json', '$NDIDOCUMENTPATH/epochid.json', ... + '$NDIDOCUMENTPATH/ingestion/daqreader_epochdata_ingested.json'}); +v1.depends_on = struct('name', 'daqreader_id', 'value', 'rdr_vhintan'); +v1.base = writerBase(id); +v1.epochid = struct('epochid', 't00003'); +clocks = {'dev_local_time', 'exp_global_time'}; +t0t1 = [0 739000.5; 863.17431 739000.51]; +v1.daqreader_epochdata_ingested = struct('epochtable', struct( ... + 'epochclock', {clocks(1:nClocks)}, 't0_t1', t0t1(:, 1:nClocks))); +v1.daqreader_mfdaq_epochdata_ingested = struct('parameters', struct( ... + 'sample_analog_segment', 1e6, 'sample_digital_segment', 1e7)); +loc = @(uid) struct('delete_original', 0, 'uid', uid, ... + 'location', ['ndic://66140c237dbc358954ddffb9/' uid], 'parameters', '', ... + 'location_type', 'ndicloud', 'ingest', 0); +v1.files = struct('file_list', {tpl.files.file_list}, 'file_info', struct( ... + 'name', {'channel_list.bin', 'ai_group1_seg.nbf_1'}, ... + 'locations', {loc('4126900e087c50b9_c0d1467da3eb9532'), loc('4126900e087c50b9_c0d1467da3eb9533')})); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerManifest(id, epochId, navId, pm, nFiles) +% +file/navigator.m: epoch_id, files ('epochid://' first), the serialised +% probe map, the filenavigator_id edge; the template declares no files block +if nargin < 5; nFiles = 3; end +tpl = loadTemplate('epochfiles_ingested'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = struct('name', 'filenavigator_id', 'value', navId); +v1.base = writerBase(id); +files = {['epochid://' epochId], ['/data/' epochId '/experiment002trial006.mat'], ... + ['/data/' epochId '/experiment002trial006.epochprobemap.txt']}; +v1.epochfiles_ingested = struct('epoch_id', epochId, 'files', {files(1:nFiles)}, ... + 'epochprobemap', pm); +v1 = jsondecode(jsonencode(v1)); +end + +function pm = probemap(which) +switch which + case 'a' + pm = sprintf('name\treference\ttype\tdevicestring\tsubjectstring\nRightcortex\t1\tn-trode\tvhtaste_sync:ai1-32\tferret_385.1618@vhlab.org\n'); + otherwise + pm = sprintf('name\treference\ttype\tdevicestring\tsubjectstring\nvhvis_spike2\t1\tstimulator\tvhtaste_bpod:mk1\tferret_385.1618@vhlab.org\n'); +end +end + +function nodes = identityNodes() +nodes = {node('t00001', 'vhtaste_sync', probemap('a'), [0 479.692213]), ... + node('t00002', 'vhtaste_bpod', probemap('b'), [0 479.7])}; +end + +function nodes = driftNodes() +nodes = {node('t00001', 'vhtaste_sync', probemap('a'), [0 4429.871950000001]), ... + node('t00001', 'vhtaste_bpod', probemap('b'), [0 4429.86])}; +end + +function n = node(epochId, objectName, pm, t0t1) +% syncgraph.m: the seven epoch_node_fields, the probe map serialised and the +% clock as its char +n = struct('epoch_id', epochId, 'epoch_session_id', 'sess_0001', ... + 'epochprobemap', pm, 'epoch_clock', 'dev_local_time', 't0_t1', t0t1, ... + 'objectname', objectName, 'objectclass', 'ndi.daq.system.mfdaq'); +end + +function v1 = writerMapping(id, nodes, mapping) +% +time/syncgraph.m ingest: cost, mapping, the two nodes; the two edges; the +% files block ndi.document gives a template that declares one, with no file +if nargin < 3; mapping = [1 0]; end +tpl = loadTemplate('syncrule_mapping'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = struct('name', {'syncgraph_id', 'syncrule_id'}, ... + 'value', {'graph_0001', 'rule_ctoe'}); +v1.base = writerBase(id); +v1.files = struct('file_list', {{}}, 'file_info', {{}}); +v1.syncrule_mapping = struct('cost', 1, 'mapping', mapping, ... + 'epochnode_a', nodes{1}, 'epochnode_b', nodes{2}); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerStimulusFile(id) +% +daq/metadatareader.m ingest_epochfiles: the epochid block, the +% daqmetadatareader_id edge, data.bin; the template's block is empty +tpl = loadTemplate('daqmetadatareader_epochdata_ingested'); +v1 = struct(); +v1.document_class = tpl.document_class; +v1.depends_on = struct('name', 'daqmetadatareader_id', 'value', 'mdr_1'); +v1.base = writerBase(id); +v1.daqmetadatareader_epochdata_ingested = struct(); +v1.epochid = struct('epochid', 't00001'); +v1.files = struct('file_list', {{'data.bin'}}, 'file_info', struct('name', 'data.bin', ... + 'locations', struct('delete_original', 0, 'uid', '4126936f64faca84_c0d3f57ec1fd3843', ... + 'location', 'ndic://68839b1fbf243809c0800a01/4126936f64faca84_c0d3f57ec1fd3843', ... + 'parameters', '', 'location_type', 'ndicloud', 'ingest', 0))); +v1 = jsondecode(jsonencode(v1)); +end + +function [batch, mapping] = foldBatch(kind) +%FOLDBATCH A session, the two acquisition systems the mapping's ends name, the +% manifests of their epochs (each read by its system's navigator, with the +% endpoint's own probe map), and the writer-shaped mapping. 'two epochs': +% t00001 / t00002 (identity); 'one epoch, two systems': both ends on t00001 +% (Soph's shape, a drifting clock). +if strcmp(kind, 'two epochs') + mapping = writerMapping('map_0001', identityNodes()); + e2 = 't00002'; +else + mapping = writerMapping('map_0001', driftNodes(), [1.00000241750492, -4.33176506573082]); + e2 = 't00001'; +end +batch = {sessionBody('sd_A', 'sess_0001', 'exp1'), daqsystemBody('sync'), daqsystemBody('bpod'), ... + writerManifest('efi_1', 't00001', 'nav_sync', probemap('a')), ... + writerManifest('efi_2', e2, 'nav_bpod', probemap('b')), mapping}; +end + +function v1 = daqsystemBody(rig) +% as testEpochMintSyncruleArming: a daqsystem named vhtaste_ (base.id +% daq_, preserved onto its acquisition_system), its navigator nav_ +v1 = struct(); +v1.document_class = struct('class_name', 'daqsystem', 'class_version', '1.0.0', ... + 'superclasses', struct('class_name', 'base', 'class_version', '1.0.0')); +v1.base = struct('id', ['daq_' rig], 'session_id', 'sess_0001', ... + 'name', ['vhtaste_' rig], 'datestamp', '2024-05-01T00:00:00.000Z'); +v1.daqsystem = struct('ndi_daqsystem_class', 'ndi.daq.system.mfdaq'); +v1.depends_on = struct('name', {'filenavigator_id', 'daqreader_id'}, ... + 'id', {['nav_' rig], ['rdr_' rig]}); +end + +function v1 = sessionBody(docId, sessionId, reference) +% as testEpochMint: a did_v1 `session` document +v1 = struct(); +v1.document_class = struct( ... + 'definition', '$NDIDOCUMENTPATH/session.json', ... + 'validation', '$NDISCHEMAPATH/session.json', ... + 'class_name', 'session', ... + 'property_list_name', 'session', ... + 'class_version', 1, ... + 'superclasses', struct('definition', '$NDIDOCUMENTPATH/base.json')); +v1.depends_on = struct('name', {}, 'value', {}); +v1.base = struct('id', docId, 'session_id', sessionId, ... + 'name', '', 'datestamp', '2024-03-23T13:47:40.237Z'); +v1.session = struct('reference', reference); +end diff --git a/tests/+did2/fixtures/ndi_templates/daqmetadatareader_epochdata_ingested.json b/tests/+did2/fixtures/ndi_templates/daqmetadatareader_epochdata_ingested.json new file mode 100644 index 00000000..9226a25d --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqmetadatareader_epochdata_ingested.json @@ -0,0 +1,26 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/ingestion\/daqmetadatareader_epochdata_ingested.json", + "validation": "$NDISCHEMAPATH\/ingestion\/daqmetadatareader_epochdata_ingested_schema.json", + "class_name": "daqmetadatareader_epochdata_ingested", + "property_list_name": "daqmetadatareader_epochdata_ingested", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/epochid.json"} + ] + }, + "depends_on": [ + { "name": "daqmetadatareader_id", + "value": "" + } + ], + "files": { + "file_list": [ + "data.bin" + ] + }, + "daqmetadatareader_epochdata_ingested": { + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/daqreader_epochdata_ingested.json b/tests/+did2/fixtures/ndi_templates/daqreader_epochdata_ingested.json new file mode 100644 index 00000000..d4e8cce4 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqreader_epochdata_ingested.json @@ -0,0 +1,28 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/ingestion\/daqreader_epochdata_ingested.json", + "validation": "$NDISCHEMAPATH\/ingestion\/daqreader_epochdata_ingested_schema.json", + "class_name": "daqreader_epochdata_ingested", + "property_list_name": "daqreader_epochdata_ingested", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/epochid.json" } + ] + }, + "depends_on": [ + { "name": "daqreader_id", + "value": "" + } + ], + "files": { + "file_list": [ ] + }, + "daqreader_epochdata_ingested": { + "epochtable": { + "epochclock": "", + "t0_t1": "" + } + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/daqreader_mfdaq_epochdata_ingested.json b/tests/+did2/fixtures/ndi_templates/daqreader_mfdaq_epochdata_ingested.json new file mode 100644 index 00000000..ab21e117 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqreader_mfdaq_epochdata_ingested.json @@ -0,0 +1,43 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/ingestion\/daqreader_mfdaq_epochdata_ingested.json", + "validation": "$NDISCHEMAPATH\/ingestion\/daqreader_mfdaq_epochdata_ingested_schema.json", + "class_name": "daqreader_mfdaq_epochdata_ingested", + "property_list_name": "daqreader_mfdaq_epochdata_ingested", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/ingestion\/daqreader_epochdata_ingested.json" } + ] + }, + "depends_on": [ + { "name": "daqreader_id", + "value": "" + } + ], + "files": { + "file_list": [ + "channel_list.bin", + "ai_group1_seg.nbf_#", "ai_group2_seg.nbf_#", "ai_group3_seg.nbf_#", "ai_group4_seg.nbf_#", "ai_group5_seg.nbf_#", + "ai_group6_seg.nbf_#", "ai_group7_seg.nbf_#", "ai_group8_seg.nbf_#", "ai_group9_seg.nbf_#", "ai_group10_seg.nbf_#", + "ao_group1_seg.nbf_#", "ao_group2_seg.nbf_#", "ao_group3_seg.nbf_#", "ao_group4_seg.nbf_#", "ao_group5_seg.nbf_#", + "ao_group6_seg.nbf_#", "ao_group7_seg.nbf_#", "ao_group8_seg.nbf_#", "ao_group9_seg.nbf_#", "ao_group10_seg.nbf_#", + "ax_group1_seg.nbf_#", "ax_group2_seg.nbf_#", "ax_group3_seg.nbf_#", "ax_group4_seg.nbf_#", "ax_group5_seg.nbf_#", + "ax_group6_seg.nbf_#", "ax_group7_seg.nbf_#", "ax_group8_seg.nbf_#", "ax_group9_seg.nbf_#", "ax_group10_seg.nbf_#", + "di_group1_seg.nbf_#", "di_group2_seg.nbf_#", "di_group3_seg.nbf_#", "di_group4_seg.nbf_#", "di_group5_seg.nbf_#", + "di_group6_seg.nbf_#", "di_group7_seg.nbf_#", "di_group8_seg.nbf_#", "di_group9_seg.nbf_#", "di_group10_seg.nbf_#", + "do_group1_seg.nbf_#", "do_group2_seg.nbf_#", "do_group3_seg.nbf_#", "do_group4_seg.nbf_#", "do_group5_seg.nbf_#", + "do_group6_seg.nbf_#", "do_group7_seg.nbf_#", "do_group8_seg.nbf_#", "do_group9_seg.nbf_#", "do_group10_seg.nbf_#", + "ti_group1_seg.nbf_#", "ti_group2_seg.nbf_#", "ti_group3_seg.nbf_#", "ti_group4_seg.nbf_#", "ti_group5_seg.nbf_#", + "ti_group6_seg.nbf_#", "ti_group7_seg.nbf_#", "ti_group8_seg.nbf_#", "ti_group9_seg.nbf_#", "ti_group10_seg.nbf_#", + "evmktx_group1_seg.nbf_#" + ] + }, + "daqreader_mfdaq_epochdata_ingested": { + "parameters": { + "sample_analog_segment": 1000000, + "sample_digital_segment": 1000000 + } + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/epochfiles_ingested.json b/tests/+did2/fixtures/ndi_templates/epochfiles_ingested.json new file mode 100644 index 00000000..476b73be --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/epochfiles_ingested.json @@ -0,0 +1,23 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/ingestion\/epochfiles_ingested.json", + "validation": "$NDISCHEMAPATH\/ingestion\/epochfiles_ingested_schema.json", + "class_name": "epochfiles_ingested", + "property_list_name": "epochfiles_ingested", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + { "name": "filenavigator_id", + "value": "" + } + ], + "epochfiles_ingested": { + "epoch_id": "", + "files": [ "filename1", "filename2" ], + "epochprobemap": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/syncrule_mapping.json b/tests/+did2/fixtures/ndi_templates/syncrule_mapping.json new file mode 100644 index 00000000..267bbb3a --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/syncrule_mapping.json @@ -0,0 +1,48 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/ingestion\/syncrule_mapping.json", + "validation": "$NDISCHEMAPATH\/ingestion\/syncrule_mapping_schema.json", + "class_name": "syncrule_mapping", + "property_list_name": "syncrule_mapping", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + { "name": "syncgraph_id", + "value": "" + }, + { + "name": "syncrule_id", + "value": "" + } + ], + "files": { + "file_list": [ ] + }, + "syncrule_mapping": { + "cost": 0, + "mapping": [1,0], + "epochnode_a": { + "epoch_id": "", + "epoch_session_id": "", + "epochprobemap": "", + "epoch_clock": "", + "t0_t1": [0,0], + "objectname": "", + "objectclass": "" + }, + "epochnode_b": { + "epoch_id": "", + "epoch_session_id": "", + "epochprobemap": "", + "epoch_clock": "", + "t0_t1": [0,0], + "objectname": "", + "objectclass": "" + } + + } +} + From c6bdec4e1999a72beff86e5e52890bf8896b350e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 04:27:04 +0000 Subject: [PATCH 15/45] testRawV1RoundTripImage: a value range round trips matched or equivalent Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- tests/+did2/+unittest/testRawV1RoundTripImage.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/+did2/+unittest/testRawV1RoundTripImage.m b/tests/+did2/+unittest/testRawV1RoundTripImage.m index 0732206a..485c4bc5 100644 --- a/tests/+did2/+unittest/testRawV1RoundTripImage.m +++ b/tests/+did2/+unittest/testRawV1RoundTripImage.m @@ -193,7 +193,8 @@ function testAValueRangeOtherThanTheTypesRoundTrips(testCase) verifyEmpty(testCase, out.passthrough); r = did2.convert.roundtrip.check(v1, out.migrated); verifyRoundTrip(testCase, r, 'value range', {}); -verifyTrue(testCase, any(strcmp('imageStack_parameters.data_limits', r.equivalent))); +% kept as the pair: matched (same shape) or equivalent (another shape) +verifyTrue(testCase, any(strcmp('imageStack_parameters.data_limits', [r.matched, r.equivalent]))); end % ===================== the other carries, on the raw shape =============== From 0d8d0cf32b6875be95e425f44aad752040785031 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 05:08:07 +0000 Subject: [PATCH 16/45] Acquisition-system family reads raw v1; round trips of all eight classes Phase 2 of the generic migration, the acquisition-system family (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [renames carry is temporary], [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - did2.convert.rawV1Classes: + daqsystem, filenavigator, daqreader, daqreader_ndr, daqmetadatareader, syncrule, syncgraph, probe_location (one line each; the v1 spelling is the migrator name, so no table row). No superclass migrator exists for `base` or `daqreader`, so nothing is folded or deleted. - Each migrator reads the raw document through private/jRawAccount (identity via v1read.readBase, a legacy ndi_document read as base; edges with either key via v1read.readDependsOn) and emits exactly what the renamed path emitted. What universalRenames would discard (a depends_on version or second id, an ndi_document beside base, a camelCase twin with another value) is carried, carry-049, as before. A field, block or edge the migrator does not read, which the renamed path dropped without a word, now carries the document whole as v1 (private/jRawCarry; marker `none`: no register row yet). Passthroughs and carries return the untouched v1 source. Bodies the batch pass re-runs (stamped did_v2: resolveClockAlignment's syncgraph and filefind arms) were accounted for in pass 1. - +roundtrip inverses for the eight classes (and private/daqParts, cell2strOf, allEmpty): the acquisition_system / epoch_file_pattern / acquisition_reader / epoch_parameter_reader / clock_alignment_policy / clock_alignment_configuration and its software; the filefind fold with its acquisition_channels and systems; the probe-location observation and its session anchor; each pass-1 passthrough. - Fixtures: NDI templates copied verbatim from NDI-matlab locked main 3cb19a8 (daqsystem, filenavigator, daqreader, daqreader_ndr, daqmetadatareader, syncrule, syncgraph, probe_location). - testRawV1RoundTripDaq: fifteen writer-shaped fixtures (system.m, navigator.m, reader.m, mfdaq/ndr.m, metadatareader.m, syncrule.m for three rules, syncgraph.m, the Dabrowska and probeLocations4probes probe locations) round trip with nothing lost, invented or unplaced; the filefind fold round trips on resolveClockAlignment's output on both paths; raw and renamed paths agree; unread fields carry; broken inputs fail; three known findings (shapes no writer makes) are reported lost. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- .../+convert/+migrators_j/daqmetadatareader.m | 29 +- .../+did2/+convert/+migrators_j/daqreader.m | 30 +- .../+convert/+migrators_j/daqreader_ndr.m | 36 +- .../+did2/+convert/+migrators_j/daqsystem.m | 38 +- .../+convert/+migrators_j/filenavigator.m | 34 +- .../+migrators_j/private/jRawAccount.m | 195 ++++++ .../+convert/+migrators_j/private/jRawCarry.m | 36 + .../+convert/+migrators_j/probe_location.m | 31 + .../+did2/+convert/+migrators_j/syncgraph.m | 33 +- .../+did2/+convert/+migrators_j/syncrule.m | 43 +- .../+convert/+roundtrip/daqmetadatareader.m | 45 ++ src/did/+did2/+convert/+roundtrip/daqreader.m | 48 ++ .../+did2/+convert/+roundtrip/daqreader_ndr.m | 43 ++ src/did/+did2/+convert/+roundtrip/daqsystem.m | 66 ++ .../+did2/+convert/+roundtrip/filenavigator.m | 51 ++ .../+convert/+roundtrip/private/allEmpty.m | 20 + .../+convert/+roundtrip/private/cell2strOf.m | 17 + .../+convert/+roundtrip/private/daqParts.m | 57 ++ .../+convert/+roundtrip/probe_location.m | 91 +++ src/did/+did2/+convert/+roundtrip/syncgraph.m | 45 ++ src/did/+did2/+convert/+roundtrip/syncrule.m | 193 ++++++ src/did/+did2/+convert/rawV1Classes.m | 20 + tests/+did2/+unittest/testRawV1RoundTripDaq.m | 643 ++++++++++++++++++ .../ndi_templates/daqmetadatareader.json | 18 + .../fixtures/ndi_templates/daqreader.json | 15 + .../fixtures/ndi_templates/daqreader_ndr.json | 18 + .../fixtures/ndi_templates/daqsystem.json | 27 + .../fixtures/ndi_templates/filenavigator.json | 19 + .../ndi_templates/probe_location.json | 22 + .../fixtures/ndi_templates/syncgraph.json | 18 + .../fixtures/ndi_templates/syncrule.json | 17 + 31 files changed, 1989 insertions(+), 9 deletions(-) create mode 100644 src/did/+did2/+convert/+migrators_j/private/jRawAccount.m create mode 100644 src/did/+did2/+convert/+migrators_j/private/jRawCarry.m create mode 100644 src/did/+did2/+convert/+roundtrip/daqmetadatareader.m create mode 100644 src/did/+did2/+convert/+roundtrip/daqreader.m create mode 100644 src/did/+did2/+convert/+roundtrip/daqreader_ndr.m create mode 100644 src/did/+did2/+convert/+roundtrip/daqsystem.m create mode 100644 src/did/+did2/+convert/+roundtrip/filenavigator.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/allEmpty.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/cell2strOf.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/daqParts.m create mode 100644 src/did/+did2/+convert/+roundtrip/probe_location.m create mode 100644 src/did/+did2/+convert/+roundtrip/syncgraph.m create mode 100644 src/did/+did2/+convert/+roundtrip/syncrule.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripDaq.m create mode 100644 tests/+did2/fixtures/ndi_templates/daqmetadatareader.json create mode 100644 tests/+did2/fixtures/ndi_templates/daqreader.json create mode 100644 tests/+did2/fixtures/ndi_templates/daqreader_ndr.json create mode 100644 tests/+did2/fixtures/ndi_templates/daqsystem.json create mode 100644 tests/+did2/fixtures/ndi_templates/filenavigator.json create mode 100644 tests/+did2/fixtures/ndi_templates/probe_location.json create mode 100644 tests/+did2/fixtures/ndi_templates/syncgraph.json create mode 100644 tests/+did2/fixtures/ndi_templates/syncrule.json diff --git a/src/did/+did2/+convert/+migrators_j/daqmetadatareader.m b/src/did/+did2/+convert/+migrators_j/daqmetadatareader.m index 5e682868..fbf68cff 100644 --- a/src/did/+did2/+convert/+migrators_j/daqmetadatareader.m +++ b/src/did/+did2/+convert/+migrators_j/daqmetadatareader.m @@ -91,11 +91,38 @@ % are both REAL and both convert -- the second simply omits software_id rather % than writing it empty, because +did2/+validate/references.m:90 SKIPS empty % edges, so an empty edge is invisible rather than absent. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI daqmetadatareader.json + base.json at the +% locked NDI-matlab `main`, 3cb19a8, as +ndi/+daq/metadatareader.m +% newdocument writes it). Every v1 field and where it goes; +% did2.convert.roundtrip.daqmetadatareader rebuilds the v1 document and +% testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the epoch_parameter_reader's +% base.name -> not written (the writer leaves '') +% ndi_daqmetadatareader_class -> the software entity's name +% tab_separated_file_parameter -> file_regex +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads now carries the +% document whole as v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above) +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, struct('daqmetadatareader', ... + {{'ndi_daqmetadatareader_class', 'tab_separated_file_parameter'}}), {}); +if jRawCarry('daqmetadatareader', src, collision, unplaced) + bodies = {src}; + return; +end + blk = struct(); if isfield(preBody, 'daqmetadatareader') && isstruct(preBody.daqmetadatareader) ... && isscalar(preBody.daqmetadatareader) @@ -106,7 +133,7 @@ filePattern = jGetChar(blk, 'tab_separated_file_parameter'); if isempty(implClass) && isempty(filePattern) - bodies = {preBody}; % see THE GUARD above + bodies = {src}; % see THE GUARD above return; end diff --git a/src/did/+did2/+convert/+migrators_j/daqreader.m b/src/did/+did2/+convert/+migrators_j/daqreader.m index 83081d88..679edd96 100644 --- a/src/did/+did2/+convert/+migrators_j/daqreader.m +++ b/src/did/+did2/+convert/+migrators_j/daqreader.m @@ -100,11 +100,39 @@ % in private/jSoftware.m. Here the merge is additionally CONSTRAINED: base.id % is preserved, so this software document's id is load-bearing for four other % classes and a merger must RETARGET rather than delete. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI daqreader.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+daq/reader.m newdocument writes it). +% Every v1 field and where it goes; did2.convert.roundtrip.daqreader rebuilds +% the v1 document and testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the acquisition_reader's (the session +% is often ndi.session.empty_id()) +% base.name -> not written (the writer leaves '') +% daqreader.ndi_daqreader_class -> the software entity's name +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads now carries the +% document whole as v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above). `reader_string` is not a field of +% NDI's daqreader template; it is what daqreader_ndr.m de-encodes onto the +% block before it hands the document on, and it is placed below. +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, struct('daqreader', ... + {{'ndi_daqreader_class', 'reader_string'}}), {}); +if jRawCarry('daqreader', src, collision, unplaced) + bodies = {src}; + return; +end + blk = struct(); if isfield(preBody, 'daqreader') && isstruct(preBody.daqreader) ... && isscalar(preBody.daqreader) @@ -122,7 +150,7 @@ % a body with NEITHER a class name NOR a reader string says nothing at all, % and minting entities from it would be the hollow-document defect. if isempty(implClass) && isempty(readerString) - bodies = {preBody}; + bodies = {src}; return; end diff --git a/src/did/+did2/+convert/+migrators_j/daqreader_ndr.m b/src/did/+did2/+convert/+migrators_j/daqreader_ndr.m index 6e2b4597..90bda32f 100644 --- a/src/did/+did2/+convert/+migrators_j/daqreader_ndr.m +++ b/src/did/+did2/+convert/+migrators_j/daqreader_ndr.m @@ -16,11 +16,45 @@ % is the stale-header trap in the header of the very file whose allow-list % entry was retired for it -- a docstring claiming MORE was carried than is, % which is the reassuring direction. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI daqreader_ndr.json + daqreader.json + base.json +% at the locked NDI-matlab `main`, 3cb19a8, as +daq/+reader/+mfdaq/ndr.m and +% +daq/+reader/+image/ndr.m newdocument write it). It has NO superclass +% migrator to fold: neither `base` nor `daqreader` has one (+migrators_j/ +% daqreader.m is the concrete migrator this one hands on to). Every v1 field +% and where it goes; did2.convert.roundtrip.daqreader_ndr rebuilds the v1 +% document and testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the acquisition_reader's +% base.name -> not written (the writer leaves '') +% daqreader.ndi_daqreader_class -> the software entity's name +% daqreader_ndr.ndr_reader_string -> acquisition_reader.reader_string +% daqreader_ndr.ndi_daqreader_ndr_class +% -> not written: it restates the +% reader class (carry-017 otherwise) +% daqreader_ndr.file_extension -> carried (carry-039) +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads now carries the +% document whole as v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above) +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, struct( ... + 'daqreader', {{'ndi_daqreader_class'}}, ... + 'daqreader_ndr', {{'ndr_reader_string', 'ndi_daqreader_ndr_class', 'file_extension'}}), {}); +if jRawCarry('daqreader_ndr', src, collision, unplaced) + v2Body = {src}; + return; +end + % `ndi_daqreader_ndr_class` is dropped only when it restates % `daqreader.ndi_daqreader_class` ([restated values checked], Jess Haley, % 2026-10-26; TEAM-SIGN-OFF [daq configuration], "dropped as redundant"). @@ -44,7 +78,7 @@ % carry-register: carry-017 (the reader class item); carry-039 (file_extension) did2.convert.reportNote('carried_as_v1', 'daqreader_ndr', char(preBody.base.id), ... ['unplaced: ' strjoin(unplaced, ', ')]); - v2Body = {preBody}; + v2Body = {src}; return; end diff --git a/src/did/+did2/+convert/+migrators_j/daqsystem.m b/src/did/+did2/+convert/+migrators_j/daqsystem.m index 71d19207..e174d730 100644 --- a/src/did/+did2/+convert/+migrators_j/daqsystem.m +++ b/src/did/+did2/+convert/+migrators_j/daqsystem.m @@ -244,11 +244,47 @@ % it by hand". It needs a hand edit by someone who may make one. The stale % direction is the safe one (it claims LESS progress than exists), but it is % recorded here rather than left to be found. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI daqsystem.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+daq/system.m newdocument writes it). +% Every v1 field and where it goes; did2.convert.roundtrip.daqsystem rebuilds +% the v1 document and testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the acquisition_system's +% base.name -> acquisition_system.name (the join key) +% daqsystem.ndi_daqsystem_class -> the software entity's name (software_id) +% depends_on filenavigator_id -> epoch_file_pattern_id +% depends_on daqreader_id -> reader_id +% depends_on daqmetadatareader_id, _1.._N +% -> epoch_parameter_reader_id, in order (the +% template's bare entry is empty on every +% writer document) +% +% Edges are read with either key (`value`, as v1 writes them, or `id` / +% `document_id`). What the renamed path would have discarded (a depends_on +% `version`, a second id, an `ndi_document` beside `base`) is carried, +% carry-049, as before; a field or edge no part of this migrator reads, which +% the renamed path dropped without a word, now carries the document whole as +% v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above): what the migrator does not read +% carries the untouched v1 document; a legacy identity block is read as base. +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, ... + struct('daqsystem', {{'ndi_daqsystem_class'}}), ... + {'^filenavigator_id$', '^daqreader_id$', '^daqmetadatareader_id(_\d+)?$'}); +if jRawCarry('daqsystem', src, collision, unplaced) + bodies = {src}; + return; +end + blk = struct(); if isfield(preBody, 'daqsystem') && isstruct(preBody.daqsystem) ... && isscalar(preBody.daqsystem) @@ -288,7 +324,7 @@ % that can carry a document on its own, via the software_id edge, so it has % to be counted as something-to-declare or a class-name-only daqsystem would % fall into a passthrough that is no longer warranted. - bodies = {preBody}; + bodies = {src}; return; end diff --git a/src/did/+did2/+convert/+migrators_j/filenavigator.m b/src/did/+did2/+convert/+migrators_j/filenavigator.m index b24ff65b..bce7bf3e 100644 --- a/src/did/+did2/+convert/+migrators_j/filenavigator.m +++ b/src/did/+did2/+convert/+migrators_j/filenavigator.m @@ -112,11 +112,43 @@ % % 1 -> 2 (epoch_file_pattern + software), or 1 -> 1 when the implementation % class name is absent, or a passthrough when there is nothing to declare. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI filenavigator.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+file/navigator.m newdocument writes +% it). Every v1 field and where it goes; did2.convert.roundtrip.filenavigator +% rebuilds the v1 document and testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the epoch_file_pattern's +% base.name -> not written (the writer leaves the +% template's '') +% ndi_filenavigator_class -> the software entity's name +% fileparameters -> file_pattern (the writer's +% cell2str list, parsed) +% epochprobemap_fileparameters -> epoch_map_pattern (the same) +% epochprobemap_class -> epoch_map_format +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads, which the renamed +% path dropped without a word, now carries the document whole as v1 +% (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above) +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, struct('filenavigator', ... + {{'ndi_filenavigator_class', 'fileparameters', 'epochprobemap_class', ... + 'epochprobemap_fileparameters'}}), {}); +if jRawCarry('filenavigator', src, collision, unplaced) + bodies = {src}; + return; +end + blk = struct(); if isfield(preBody, 'filenavigator') && isstruct(preBody.filenavigator) ... && isscalar(preBody.filenavigator) @@ -129,7 +161,7 @@ mapList = jFileMatchList(rawField(blk, 'epochprobemap_fileparameters')); if isempty(implClass) && isempty(mapFormat) && isempty(dataList) && isempty(mapList) - bodies = {preBody}; % nothing to declare -- see THE GUARD above + bodies = {src}; % nothing to declare -- see THE GUARD above return; end diff --git a/src/did/+did2/+convert/+migrators_j/private/jRawAccount.m b/src/did/+did2/+convert/+migrators_j/private/jRawAccount.m new file mode 100644 index 00000000..f2e27d93 --- /dev/null +++ b/src/did/+did2/+convert/+migrators_j/private/jRawAccount.m @@ -0,0 +1,195 @@ +function [body, collision, unplaced] = jRawAccount(preBody, blocks, edges) +%JRAWACCOUNT The raw v1 read of an acquisition-system family document: its +% identity, and every v1 field its migrator does not read. +% +% [BODY, COLLISION, UNPLACED] = jRawAccount(PREBODY, BLOCKS, EDGES). +% PREBODY is the RAW v1 document (did2.convert.rawV1Classes: no +% universalRenames). BLOCKS is a struct: one field per property block the +% migrator reads, holding the cellstr of that block's fields it reads (the +% NDI template's fields at the locked NDI-matlab `main`, 3cb19a8, as the +% writer sets them). EDGES is a cellstr of regular expressions: the +% depends_on names the migrator reads. +% +% BODY is PREBODY, except that a pre-2023 document whose only identity block +% is the legacy `ndi_document` gets a `base` holding the four fields +% did2.convert.v1read.readBase reads from it, and the legacy block is removed +% (what universalRenames' wholesale move gave the migrator; the legacy +% block's other fields come back in UNPLACED), and a depends_on that +% jsondecode gave as a cell (entries with different keys) is read into a +% struct array of {name, value}. BODY is the migrator's reading copy; a +% carry or passthrough returns PREBODY. +% +% COLLISION lists what the renamed path (universalRenames) would have +% discarded, so the document is carried on both paths with the same row, +% carry-049 ([renames carry is temporary]): +% - an `ndi_document` block beside `base`; +% - a depends_on entry's `version`, or a second, different id; +% - a camelCase field of a read block beside its snake_case twin, holding a +% different value (an equal twin restates it and is neither). +% +% UNPLACED lists the v1 fields no part of the migrator reads, each as a path +% (the caller carries the document whole as v1; there is no register row for +% these yet): +% - a top-level block other than document_class, base, depends_on and +% BLOCKS, when it holds anything; +% - a field of a read block outside its list, when it holds anything; +% - a `base` field outside base.json's four (or a legacy identity field +% outside them), when it holds anything; a stale `base.schema_version` +% is the stamp, not a field; +% - a depends_on entry whose name EDGES does not match and which names a +% document. +% An EMPTY value is never unplaced: nothing is lost by not writing it +% ([writer default is not set]). +% +% A body that a batch pass hands back to a migrator after pass 1 (stamped +% did_v2: did2.convert.resolveClockAlignment re-runs syncgraph and syncrule +% with transient stamps) was accounted for in pass 1: COLLISION and UNPLACED +% are empty for it. +% +% Decided by Jess Haley, 2026-10-26 [migrators read raw v1] (did-schema +% V_eta_go_forward_class_audit.md): a migrator reads v1 exactly as v1 defines +% it and accounts for every v1 field. +% +% See also jRawBody, did2.convert.v1read.readBase, +% did2.convert.v1read.readDependsOn, did2.convert.rawV1Classes. + +body = preBody; +collision = {}; +unplaced = {}; + +b = did2.convert.v1read.readBase(preBody); +if strcmp(b.source, 'ndi_document') && any(strcmp(b.present, 'id')) + base = struct(); + for f = {'id', 'session_id', 'name', 'datestamp'} + if any(strcmp(b.present, f{1})) + base.(f{1}) = b.(f{1}); + end + end + body.base = base; + body = rmfield(body, 'ndi_document'); +end + +stamp = did2.convert.v1read.readStamp(preBody); +if stamp.is_v2 + return; % a pass-1 body a batch pass re-runs: accounted for in pass 1 +end + +% --- identity -------------------------------------------------------------- +if ~isempty(fieldnames(b.legacy)) + collision{end+1} = 'ndi_document'; +end +extra = fieldnames(b.extra); +for k = 1:numel(extra) + if strcmp(b.source, 'base') && strcmp(extra{k}, 'schema_version') + continue; % a stale stamp an early draft migrator wrote on base: the + % stamp (universalRenames moved it to document_class) + end + if ~isEmptyValue(b.extra.(extra{k})) + unplaced{end+1} = [b.source '.' extra{k}]; %#ok + end +end + +% --- depends_on ------------------------------------------------------------ +deps = did2.convert.v1read.readDependsOn(preBody); +if isfield(body, 'depends_on') && iscell(body.depends_on) + % jsondecode's shape for entries with different keys: the migrators' edge + % reads take a struct array, so the reading copy gets one (same names, same + % ids, in order); nothing is emitted from it but the edges read by name + body.depends_on = struct('name', {deps.name}, 'value', {deps.document_id}); +end +for k = 1:numel(deps) + nm = deps(k).name; + if ~isempty(deps(k).version) + collision{end+1} = sprintf('depends_on(%s).version', nm); %#ok + end + others = fieldnames(deps(k).other); + for j = 1:numel(others) + collision{end+1} = sprintf('depends_on(%s).%s', nm, others{j}); %#ok + end + known = ischar(nm) && any(cellfun(@(re) ~isempty(regexp(nm, re, 'once')), edges)); + if ~known && ~isempty(deps(k).document_id) + unplaced{end+1} = sprintf('depends_on(%s)', char(nm)); %#ok + end +end + +% --- the property blocks ----------------------------------------------------- +read = fieldnames(blocks); +top = setdiff(fieldnames(preBody), [{'document_class', 'base', 'depends_on', ... + 'ndi_document'}, read(:)'], 'stable'); +for k = 1:numel(top) + if ~isEmptyValue(preBody.(top{k})) + unplaced{end+1} = top{k}; %#ok + end +end +for k = 1:numel(read) + name = read{k}; + if ~isfield(preBody, name) || isEmptyValue(preBody.(name)) + continue; + end + blk = preBody.(name); + if ~isstruct(blk) || ~isscalar(blk) + unplaced{end+1} = name; %#ok + continue; + end + fields = blocks.(name); + fns = fieldnames(blk); + for j = 1:numel(fns) + fn = fns{j}; + if any(strcmp(fn, fields)) + continue; + end + sc = snakeCase(fn); + if ~strcmp(sc, fn) && isfield(blk, sc) + if ~isequaln(blk.(sc), blk.(fn)) + collision{end+1} = [name '.' fn]; %#ok + end + % an equal twin restates the field the migrator reads + elseif ~isEmptyValue(blk.(fn)) + unplaced{end+1} = [name '.' fn]; %#ok + end + end +end +end + +% ===================== helpers ============================================= + +function tf = isEmptyValue(v) +%ISEMPTYVALUE Empty, or a struct whose every field is empty (a template +% block the writer did not fill). +if isempty(v) + tf = true; +elseif isstruct(v) && isscalar(v) + tf = all(cellfun(@(f) isEmptyValue(v.(f)), fieldnames(v))); +else + tf = false; +end +end + +function out = snakeCase(name) +%SNAKECASE The snake_case spelling universalRenames gives a camelCase field +% (its acronym-aware rule, copied: fooBar -> foo_bar, XMLParser -> +% xml_parser), used only to find a twin. +name = char(name); +n = numel(name); +if n == 0 + out = name; + return; +end +result = lower(name(1)); +for k = 2:n + c = name(k); + if ~(c >= 'A' && c <= 'Z') + result = [result, c]; %#ok + continue; + end + prev = name(k-1); + prevUpper = prev >= 'A' && prev <= 'Z'; + nextLower = (k < n) && (name(k+1) >= 'a' && name(k+1) <= 'z'); + if (~prevUpper || nextLower) && result(end) ~= '_' + result = [result, '_', char(c + ('a' - 'A'))]; %#ok + else + result = [result, char(c + ('a' - 'A'))]; %#ok + end +end +out = result; +end diff --git a/src/did/+did2/+convert/+migrators_j/private/jRawCarry.m b/src/did/+did2/+convert/+migrators_j/private/jRawCarry.m new file mode 100644 index 00000000..e1238a42 --- /dev/null +++ b/src/did/+did2/+convert/+migrators_j/private/jRawCarry.m @@ -0,0 +1,36 @@ +function carried = jRawCarry(className, preBody, collision, unplaced) +%JRAWCARRY Note the carry of a raw v1 document whose fields its migrator +% cannot all account for (jRawAccount), and say whether it is carried. +% +% CARRIED = jRawCarry(CLASSNAME, PREBODY, COLLISION, UNPLACED) writes ONE +% `carried_as_v1` note for the v1 document PREBODY and returns true when +% COLLISION or UNPLACED is not empty; false (and no note) otherwise. The +% caller then returns {PREBODY}: the carry is the untouched v1 source +% ([migrators read raw v1]). +% +% COLLISION what universalRenames would have discarded: the renamed path +% carried the document for it too, carry-049 ([renames carry is +% temporary]); cited first +% UNPLACED a v1 field no part of the migrator reads, which the renamed +% path dropped without a word. No register row yet (a question +% for the team); the note says `unplaced:` and names the paths. +% +% See also jRawAccount. + +carried = ~isempty(collision) || ~isempty(unplaced); +if ~carried + return; +end +b = did2.convert.v1read.readBase(preBody); +id = b.id; +if ~ischar(id); id = ''; end +if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', className, id, ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); + return; +end +% carry-register: none (a v1 field the migrator does not read; no row yet) +did2.convert.reportNote('carried_as_v1', className, id, ... + ['unplaced: ' strjoin(unplaced, ', ')]); +end diff --git a/src/did/+did2/+convert/+migrators_j/probe_location.m b/src/did/+did2/+convert/+migrators_j/probe_location.m index 10fb4fce..c5c128fe 100644 --- a/src/did/+did2/+convert/+migrators_j/probe_location.m +++ b/src/did/+did2/+convert/+migrators_j/probe_location.m @@ -19,11 +19,42 @@ % part for this region (one part per subject and region, `part_of` the % subject, shared with an injection into the same region). A single-document % migrator cannot see the recordings, so nothing here changes. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI probe_location.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +fun/+doc/+probe/probeLocations4probes.m, +% +setup/+conv/+dabrowska/doImport.m and +marder/marderprobe2uberon.m write +% it). Every v1 field and where it goes; did2.convert.roundtrip.probe_location +% rebuilds the v1 document and testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the observation's (the session also +% names the anchor's referent) +% base.name -> not written (the writers leave '') +% depends_on probe_id -> the observation's entity_id +% probe_location.ontology_name -> the value term's node +% probe_location.name -> the value term's name (the registry's +% label when the node is registered) +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads now carries the +% document whole as v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above) +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, ... + struct('probe_location', {{'ontology_name', 'name'}}), ... + {'^probe_id$', '^element_id$', '^subject_id$'}); +if jRawCarry('probe_location', src, collision, unplaced) + v2Body = {src}; + return; +end + if ~isfield(preBody, 'probe_location') || ~isstruct(preBody.probe_location) error('did2:convert:missingBlock', ... 'probe_location body is missing the probe_location property block.'); diff --git a/src/did/+did2/+convert/+migrators_j/syncgraph.m b/src/did/+did2/+convert/+migrators_j/syncgraph.m index 12948cee..2125ad28 100644 --- a/src/did/+did2/+convert/+migrators_j/syncgraph.m +++ b/src/did/+did2/+convert/+migrators_j/syncgraph.m @@ -119,11 +119,42 @@ % % base.id IS PRESERVED ON BOTH BRANCHES, so `syncrule_mapping`'s `syncgraph_id` % edge -- and the live NDI query built on it -- resolves either way. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI syncgraph.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+time/syncgraph.m newdocument writes +% it; the template declares no edge, the writer adds syncrule_id_1.._N). +% Every v1 field and where it goes; did2.convert.roundtrip.syncgraph rebuilds +% the v1 document and testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the clock_alignment_policy's +% base.name -> not written (the writer leaves '') +% syncgraph.ndi_syncgraph_class -> the software entity's name +% depends_on syncrule_id_1.._N -> clock_alignment_configuration_id, in +% order (a bare syncrule_id first) +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads now carries the +% document whole as v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above). A body did2.convert. +% resolveClockAlignment hands back (stamped did_v2) was accounted for in pass +% 1; its transient `session_document_id` stamp is read, never emitted. +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, ... + struct('syncgraph', {{'ndi_syncgraph_class'}}), ... + {'^syncrule_id(_\d+)?$', '^session_document_id$'}); +if jRawCarry('syncgraph', src, collision, unplaced) + bodies = {src}; + return; +end + block = struct(); if isfield(preBody, 'syncgraph') && isstruct(preBody.syncgraph) block = preBody.syncgraph; @@ -135,7 +166,7 @@ sessionId = char(preBody.base.session_id); end if isempty(sessionId) || isEmptySessionSentinel(sessionId) - bodies = {preBody}; % THE GUARD -- see the header + bodies = {src}; % THE GUARD -- see the header return; end diff --git a/src/did/+did2/+convert/+migrators_j/syncrule.m b/src/did/+did2/+convert/+migrators_j/syncrule.m index 67bbd3f7..e01f75ea 100644 --- a/src/did/+did2/+convert/+migrators_j/syncrule.m +++ b/src/did/+did2/+convert/+migrators_j/syncrule.m @@ -91,11 +91,48 @@ % .m files are the constructor read and the writer). The one live QUERY in % this cluster reads `syncrule_mapping`, which this build leaves untouched -- % see syncrule_mapping.m. +% +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1], did-schema +% V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator the document +% exactly as v1 wrote it (NDI syncrule.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+time/syncrule.m newdocument writes it +% for the four rules). Every v1 field and where it goes; +% did2.convert.roundtrip.syncrule rebuilds the v1 document and +% testRawV1RoundTripDaq compares the two: +% +% base.id, session_id, datestamp -> the clock_alignment_configuration's +% base.name -> not written (the writer leaves '') +% syncrule.ndi_syncrule_class -> the software entity's name +% syncrule.parameters.* -> the method parameters (named), the +% clock (epochclocktype), and, on the +% resolved filefind fold, the two +% acquisition_channels (daqsystem1/2) +% A rule that does not fold (a channel-based rule; a filefind rule in pass 1) +% passes through unchanged, as before. +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads now carries the +% document whole as v1 (private/jRawAccount, jRawCarry; no register row yet). arguments preBody (1,1) struct end +% THE RAW READ (see READS RAW v1 above). Every field inside `parameters` is +% accounted for below (read, or a method parameter, or carry-008). A body +% did2.convert.resolveClockAlignment hands back (stamped did_v2) was accounted +% for in pass 1; its transient `resolved_acquisition_system_id` stamps are +% read, never emitted. +src = preBody; +[preBody, collision, unplaced] = jRawAccount(src, ... + struct('syncrule', {{'ndi_syncrule_class', 'parameters'}}), ... + {'^resolved_acquisition_system_id$'}); +if jRawCarry('syncrule', src, collision, unplaced) + bodies = {src}; + return; +end + block = struct(); if isfield(preBody, 'syncrule') && isstruct(preBody.syncrule) block = preBody.syncrule; @@ -168,7 +205,7 @@ if numel(resolved) == 2 && ~isempty(name1) && ~isempty(name2) ... && isempty(ch1) && isempty(ch2) if carryUnwritable(preBody, params, true) - bodies = {preBody}; + bodies = {src}; return; end channelDocs = cell(1, 2); @@ -184,12 +221,12 @@ end if ~(haveNeither && isFileBased) - bodies = {preBody}; + bodies = {src}; return; end if carryUnwritable(preBody, params, false) - bodies = {preBody}; + bodies = {src}; return; end [cfg, software] = configuration(preBody, block, {}, false); diff --git a/src/did/+did2/+convert/+roundtrip/daqmetadatareader.m b/src/did/+did2/+convert/+roundtrip/daqmetadatareader.m new file mode 100644 index 00000000..3eb650fb --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/daqmetadatareader.m @@ -0,0 +1,45 @@ +function [v1, spec] = daqmetadatareader(bodies) +%DAQMETADATAREADER Rebuild a v1 `daqmetadatareader` from what the migration +% made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.daqmetadatareader(BODIES). V1 is the +% metadata reader in NDI's v1 shape (daqmetadatareader.json + base.json at +% the locked NDI-matlab `main`, 3cb19a8, as +ndi/+daq/metadatareader.m +% newdocument writes it). BODIES holds the `epoch_parameter_reader` and its +% `software` entity: +% +% base.id, session_id, datestamp the epoch_parameter_reader's +% base.name '' (the writer sets none) +% ndi_daqmetadatareader_class the software entity's name +% tab_separated_file_parameter file_regex +% +% Or the pass-1 passthrough (a reader with nothing to declare), its outbound +% renames undone. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.daqmetadatareader. + +arguments + bodies cell +end + +CLASS = 'daqmetadatareader'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +[doc, ~, swName, spec] = daqParts(bodies, 'epoch_parameter_reader', spec); +if isempty(doc) + return; +end +blk = getIn(doc, 'epoch_parameter_reader'); +spec.unplaced = [spec.unplaced, others(blk, {'file_regex'}, 'epoch_parameter_reader')]; +base = rebuildBase(doc); +v1.document_class = struct('class_name', CLASS); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +v1.daqmetadatareader = struct('ndi_daqmetadatareader_class', swName, ... + 'tab_separated_file_parameter', fieldText(blk, 'file_regex')); +end diff --git a/src/did/+did2/+convert/+roundtrip/daqreader.m b/src/did/+did2/+convert/+roundtrip/daqreader.m new file mode 100644 index 00000000..c06531ba --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/daqreader.m @@ -0,0 +1,48 @@ +function [v1, spec] = daqreader(bodies) +%DAQREADER Rebuild a v1 `daqreader` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.daqreader(BODIES). V1 is the reader in +% NDI's v1 shape (daqreader.json + base.json at the locked NDI-matlab +% `main`, 3cb19a8, as +ndi/+daq/reader.m newdocument writes it). BODIES holds +% the `acquisition_reader` and its `software` entity: +% +% base.id, session_id, datestamp the acquisition_reader's +% base.name '' (the writer sets none) +% daqreader.ndi_daqreader_class the software entity's name +% daqreader.reader_string acquisition_reader.reader_string, when +% it has one (not a template field; only a +% de-encoded daqreader_ndr states one) +% +% Or the pass-1 passthrough (a reader with nothing to declare), its outbound +% renames undone. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.daqreader, +% did2.convert.roundtrip.daqreader_ndr. + +arguments + bodies cell +end + +CLASS = 'daqreader'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +[doc, ~, swName, spec] = daqParts(bodies, 'acquisition_reader', spec); +if isempty(doc) + return; +end +blk = getIn(doc, 'acquisition_reader'); +spec.unplaced = [spec.unplaced, others(blk, {'reader_string'}, 'acquisition_reader')]; +base = rebuildBase(doc); +v1.document_class = struct('class_name', CLASS); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +v1.daqreader = struct('ndi_daqreader_class', swName); +rs = fieldText(blk, 'reader_string'); +if ~isempty(rs) + v1.daqreader.reader_string = rs; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/daqreader_ndr.m b/src/did/+did2/+convert/+roundtrip/daqreader_ndr.m new file mode 100644 index 00000000..e2231952 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/daqreader_ndr.m @@ -0,0 +1,43 @@ +function [v1, spec] = daqreader_ndr(bodies) +%DAQREADER_NDR Rebuild a v1 `daqreader_ndr` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.daqreader_ndr(BODIES). V1 is the NDR +% reader in NDI's v1 shape (daqreader_ndr.json + daqreader.json + base.json +% at the locked NDI-matlab `main`, 3cb19a8, as +daq/+reader/+mfdaq/ndr.m and +% +daq/+reader/+image/ndr.m newdocument write it). The migrator de-encodes it +% onto the daqreader and hands it on, so BODIES holds the +% `acquisition_reader` and its `software` entity: +% +% base.id, session_id, datestamp the acquisition_reader's +% base.name '' (the writers set none) +% daqreader.ndi_daqreader_class the software entity's name +% daqreader_ndr.ndr_reader_string acquisition_reader.reader_string +% daqreader_ndr.ndi_daqreader_ndr_class the software entity's name again: +% the migrator converts only a +% document where the two are equal +% (carry-017 otherwise; [restated +% values checked]) +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.daqreader_ndr. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +[doc, ~, swName, spec] = daqParts(bodies, 'acquisition_reader', spec); +if isempty(doc) + return; +end +blk = getIn(doc, 'acquisition_reader'); +spec.unplaced = [spec.unplaced, others(blk, {'reader_string'}, 'acquisition_reader')]; +base = rebuildBase(doc); +v1.document_class = struct('class_name', 'daqreader_ndr'); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +v1.daqreader = struct('ndi_daqreader_class', swName); +v1.daqreader_ndr = struct('ndr_reader_string', fieldText(blk, 'reader_string'), ... + 'ndi_daqreader_ndr_class', swName); +end diff --git a/src/did/+did2/+convert/+roundtrip/daqsystem.m b/src/did/+did2/+convert/+roundtrip/daqsystem.m new file mode 100644 index 00000000..f5abd8c3 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/daqsystem.m @@ -0,0 +1,66 @@ +function [v1, spec] = daqsystem(bodies) +%DAQSYSTEM Rebuild a v1 `daqsystem` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.daqsystem(BODIES). V1 is the +% acquisition system in NDI's v1 shape (daqsystem.json + base.json at the +% locked NDI-matlab `main`, 3cb19a8, as +ndi/+daq/system.m newdocument writes +% it). BODIES holds the `acquisition_system` and its `software` entity: +% +% base.id, session_id, datestamp the acquisition_system's (rebuildBase) +% base.name acquisition_system.name +% daqsystem.ndi_daqsystem_class the software entity's name +% depends_on, in the writer's order: +% filenavigator_id epoch_file_pattern_id +% daqreader_id reader_id +% daqmetadatareader_id '' (the template's own entry, which +% add_dependency_value_n never fills) +% daqmetadatareader_id_1.._N epoch_parameter_reader_id, in order +% +% Or the pass-1 passthrough (a daqsystem with nothing to declare), its +% outbound renames undone. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.daqsystem. + +arguments + bodies cell +end + +CLASS = 'daqsystem'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +[doc, ~, swName, spec] = daqParts(bodies, 'acquisition_system', spec); +if isempty(doc) + return; +end +spec.unplaced = [spec.unplaced, others(getIn(doc, 'acquisition_system'), {'name'}, ... + 'acquisition_system')]; +base = rebuildBase(doc); +names = {'filenavigator_id', 'daqreader_id', 'daqmetadatareader_id'}; +values = {firstId(doc, 'epoch_file_pattern_id'), firstId(doc, 'reader_id'), ''}; +md = edgeIds(doc, 'epoch_parameter_reader_id'); +for k = 1:numel(md) + names{end+1} = sprintf('daqmetadatareader_id_%d', k); %#ok + values{end+1} = md{k}; %#ok +end +for e = {'device_id'} + if ~isempty(edgeIds(doc, e{1})) + spec.unplaced{end+1} = sprintf('the acquisition_system has a %s edge', e{1}); + end +end +v1.document_class = struct('class_name', CLASS); +v1.depends_on = struct('name', names, 'value', values); +v1.base = struct('id', base.id, 'session_id', base.session_id, ... + 'name', fieldText(getIn(doc, 'acquisition_system'), 'name'), ... + 'datestamp', base.datestamp); +v1.daqsystem = struct('ndi_daqsystem_class', swName); +end + +function id = firstId(body, name) +ids = edgeIds(body, name); +id = ''; +if ~isempty(ids); id = ids{1}; end +end diff --git a/src/did/+did2/+convert/+roundtrip/filenavigator.m b/src/did/+did2/+convert/+roundtrip/filenavigator.m new file mode 100644 index 00000000..4021d54d --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/filenavigator.m @@ -0,0 +1,51 @@ +function [v1, spec] = filenavigator(bodies) +%FILENAVIGATOR Rebuild a v1 `filenavigator` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.filenavigator(BODIES). V1 is the file +% navigator in NDI's v1 shape (filenavigator.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +ndi/+file/navigator.m newdocument writes +% it). BODIES holds the `epoch_file_pattern` and its `software` entity: +% +% base.id, session_id, datestamp the epoch_file_pattern's +% base.name '' (the writer sets none; V2 writes +% none) +% ndi_filenavigator_class the software entity's name +% fileparameters file_pattern, written back as the +% writer's cell2str ('' for none) +% epochprobemap_fileparameters epoch_map_pattern, the same +% epochprobemap_class epoch_map_format +% +% Or the pass-1 passthrough (a navigator with nothing to declare), its +% outbound renames undone. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.filenavigator. + +arguments + bodies cell +end + +CLASS = 'filenavigator'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +[doc, ~, swName, spec] = daqParts(bodies, 'epoch_file_pattern', spec); +if isempty(doc) + return; +end +blk = getIn(doc, 'epoch_file_pattern'); +spec.unplaced = [spec.unplaced, others(blk, ... + {'file_pattern', 'epoch_map_pattern', 'epoch_map_format'}, 'epoch_file_pattern')]; +base = rebuildBase(doc); +v1.document_class = struct('class_name', CLASS); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +v1.filenavigator = struct( ... + 'ndi_filenavigator_class', swName, ... + 'fileparameters', cell2strOf(getIn(doc, 'epoch_file_pattern', 'file_pattern')), ... + 'epochprobemap_class', fieldText(blk, 'epoch_map_format'), ... + 'epochprobemap_fileparameters', cell2strOf(getIn(doc, 'epoch_file_pattern', 'epoch_map_pattern'))); +end diff --git a/src/did/+did2/+convert/+roundtrip/private/allEmpty.m b/src/did/+did2/+convert/+roundtrip/private/allEmpty.m new file mode 100644 index 00000000..51aa0a58 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/allEmpty.m @@ -0,0 +1,20 @@ +function tf = allEmpty(v) +%ALLEMPTY Empty, or a struct (array) whose every field is empty all the way +% down: a block the builder padded and nothing filled. +if isEmptyValue(v) + tf = true; +elseif isstruct(v) + tf = true; + for k = 1:numel(v) + fns = fieldnames(v(k)); + for f = 1:numel(fns) + if ~allEmpty(v(k).(fns{f})) + tf = false; + return; + end + end + end +else + tf = false; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/cell2strOf.m b/src/did/+did2/+convert/+roundtrip/private/cell2strOf.m new file mode 100644 index 00000000..87c1625c --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/cell2strOf.m @@ -0,0 +1,17 @@ +function s = cell2strOf(list) +%CELL2STROF A pattern list as NDI writes it: did.datastructures.cell2str / +% vhlab cell2str, '{ ''a'', ''b'' }' (the inverse of private/jFileMatchList +% for every list cell2str writes). '' for no list: +file/navigator.m +% newdocument writes '' when the object has no parameters. +% +% See also did2.convert.roundtrip.filenavigator. +if isempty(list) + s = ''; + return; +end +if ischar(list) || (isstring(list) && isscalar(list)) + list = {char(list)}; +end +parts = cellfun(@(p) ['''' char(p) ''''], list, 'UniformOutput', false); +s = ['{ ' strjoin(reshape(parts, 1, []), ', ') ' }']; +end diff --git a/src/did/+did2/+convert/+roundtrip/private/daqParts.m b/src/did/+did2/+convert/+roundtrip/private/daqParts.m new file mode 100644 index 00000000..d92c02f9 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/daqParts.m @@ -0,0 +1,57 @@ +function [doc, sw, swName, spec] = daqParts(bodies, className, spec) +%DAQPARTS The one document of class CLASSNAME a converted acquisition-system +% family document became, and the `software` entity its `software_id` edge +% names (its name: the v1 implementation class). +% +% [DOC, SW, SWNAME, SPEC] = daqParts(BODIES, CLASSNAME, SPEC). DOC is the +% first emitted document of CLASSNAME ([] when none, which is unplaced); SW +% the software entity ([] when the document names none); SWNAME its +% entity.name ('' when none). Every other emitted document is unplaced in +% SPEC: the migrators emit exactly the document and, when the v1 document +% names its class, its one software entity (private/jSoftware). +% +% See also did2.convert.roundtrip.daqsystem, .filenavigator, .daqreader, +% .daqreader_ndr, .daqmetadatareader, .syncgraph. +doc = []; +sw = []; +swName = ''; +used = false(1, numel(bodies)); +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), className) + doc = bodies{k}; + used(k) = true; + break; + end +end +if isempty(doc) + spec.unplaced{end+1} = sprintf('no %s was emitted', className); + return; +end +swIds = edgeIds(doc, 'software_id'); +if numel(swIds) > 1 + spec.unplaced{end+1} = sprintf('the %s names %d software entities', className, numel(swIds)); +end +if ~isempty(swIds) + for k = 1:numel(bodies) + b = bodies{k}; + if ~used(k) && isEntityOfType(b, 'software') && strcmp(char(getIn(b, 'base', 'id')), swIds{1}) + sw = b; + used(k) = true; + swName = fieldText(b.entity, 'name'); + break; + end + end + if isempty(sw) + spec.unplaced{end+1} = sprintf('the software entity %s the %s names was not emitted', ... + swIds{1}, className); + elseif ~strcmp(fieldText(sw.entity, 'local_identifier'), swName) + % pass 1 writes the class name as both name and local identifier (no + % version); anything else is not what the migrator made + spec.unplaced{end+1} = 'the software entity''s local identifier is not its name'; + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in a v1 %s', ... + k, classNameOf(bodies{k}), className); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/probe_location.m b/src/did/+did2/+convert/+roundtrip/probe_location.m new file mode 100644 index 00000000..c652bff8 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/probe_location.m @@ -0,0 +1,91 @@ +function [v1, spec] = probe_location(bodies) +%PROBE_LOCATION Rebuild a v1 `probe_location` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.probe_location(BODIES). V1 is the +% location in NDI's v1 shape (probe_location.json + base.json at the locked +% NDI-matlab `main`, 3cb19a8, as +fun/+doc/+probe/probeLocations4probes.m, +% +setup/+conv/+dabrowska/doImport.m and +marder/marderprobe2uberon.m write +% it). BODIES holds the `observation` (variable Anatomic Site, NCIT:C13717) +% and the session anchor its time_reference_id names: +% +% base.id, session_id, datestamp the observation's +% base.name '' (the writers set none) +% depends_on probe_id the observation's entity_id +% probe_location.ontology_name the value term's node (a CURIE's prefix +% case is notation) +% probe_location.name the value term's name +% +% The anchor must be the session anchor the migrator makes (a +% relative_time_reference `intervalDuring` the observation's session, with +% no time of its own); anything else, or any other document, is unplaced. +% +% See also did2.convert.roundtrip.check, +% did2.convert.migrators_j.probe_location. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +obs = []; +used = false(1, numel(bodies)); +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'observation') + obs = bodies{k}; + used(k) = true; + break; + end +end +if isempty(obs) + spec.unplaced{end+1} = 'no observation was emitted'; + return; +end +[vnode, ~] = termParts(getIn(obs, 'statement', 'variable')); +if ~sameCurie(vnode, 'NCIT:C13717') + spec.unplaced{end+1} = sprintf('the observation''s variable is "%s", not Anatomic Site', vnode); +end +base = rebuildBase(obs); +sid = base.session_id; +tr = edgeIds(obs, 'time_reference_id'); +if numel(tr) ~= 1 + spec.unplaced{end+1} = sprintf('the observation names %d time references (the session anchor is one)', ... + numel(tr)); +else + hit = 0; + for k = 1:numel(bodies) + if ~used(k) && strcmp(char(getIn(bodies{k}, 'base', 'id')), tr{1}) + hit = k; + break; + end + end + if hit == 0 + spec.unplaced{end+1} = 'the session anchor was not emitted'; + else + used(hit) = true; + a = bodies{hit}; + [rnode, rname] = termParts(getIn(a, 'relative_time_reference', 'value', 'relation')); + during = endsWith(rnode, 'intervalDuring') || strcmp(rname, 'intervalDuring'); + if ~strcmp(classNameOf(a), 'relative_time_reference') ... + || ~isequal(edgeIds(a, 'referent_id'), {sid}) || ~during ... + || ~allEmpty(getIn(a, 'relative_time_reference', 'value', 'start')) + spec.unplaced{end+1} = 'the time reference is not the session anchor (intervalDuring the session)'; + end + end +end +for k = find(~used) + spec.unplaced{end+1} = sprintf('emitted document %d (%s) has no role in a probe location', ... + k, classNameOf(bodies{k})); +end +[node, name] = termParts(getIn(obs, 'term', 'value')); +probe = edgeIds(obs, 'entity_id'); +if isempty(probe); probe = {''}; end +v1.document_class = struct('class_name', 'probe_location'); +v1.depends_on = struct('name', 'probe_id', 'value', probe{1}); +v1.base = struct('id', base.id, 'session_id', sid, 'name', '', ... + 'datestamp', base.datestamp); +v1.probe_location = struct('ontology_name', node, 'name', name); +spec.same(end+1) = struct('path', 'probe_location.ontology_name', 'fn', @sameCurie, ... + 'why', ['a CURIE''s prefix case is notation ([spelling is notation], Jess ' ... + 'Haley, 2026-10-26); did2.convert.registeredTerm writes the registered spelling']); +end diff --git a/src/did/+did2/+convert/+roundtrip/syncgraph.m b/src/did/+did2/+convert/+roundtrip/syncgraph.m new file mode 100644 index 00000000..f1aceb0a --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/syncgraph.m @@ -0,0 +1,45 @@ +function [v1, spec] = syncgraph(bodies) +%SYNCGRAPH Rebuild a v1 `syncgraph` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.syncgraph(BODIES). V1 is the sync graph +% in NDI's v1 shape (syncgraph.json + base.json at the locked NDI-matlab +% `main`, 3cb19a8, as +ndi/+time/syncgraph.m newdocument writes it). BODIES +% holds the `clock_alignment_policy` and its `software` entity: +% +% base.id, session_id, datestamp the policy's +% base.name '' (the writer sets none) +% syncgraph.ndi_syncgraph_class the software entity's name +% depends_on syncrule_id_1.._N clock_alignment_configuration_id, in +% order (add_dependency_value_n's names) +% +% Or the pass-1 passthrough (a graph with no session), its outbound renames +% undone. +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.syncgraph. + +arguments + bodies cell +end + +CLASS = 'syncgraph'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +[doc, ~, swName, spec] = daqParts(bodies, 'clock_alignment_policy', spec); +if isempty(doc) + return; +end +spec.unplaced = [spec.unplaced, others(getIn(doc, 'clock_alignment_policy'), {}, ... + 'clock_alignment_policy')]; +base = rebuildBase(doc); +rules = edgeIds(doc, 'clock_alignment_configuration_id'); +names = arrayfun(@(k) sprintf('syncrule_id_%d', k), 1:numel(rules), 'UniformOutput', false); +v1.document_class = struct('class_name', CLASS); +v1.depends_on = struct('name', names, 'value', rules); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +v1.syncgraph = struct('ndi_syncgraph_class', swName); +end diff --git a/src/did/+did2/+convert/+roundtrip/syncrule.m b/src/did/+did2/+convert/+roundtrip/syncrule.m new file mode 100644 index 00000000..068c212d --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/syncrule.m @@ -0,0 +1,193 @@ +function [v1, spec] = syncrule(bodies) +%SYNCRULE Rebuild a v1 `syncrule` from what the migration made of it. +% +% [V1, SPEC] = did2.convert.roundtrip.syncrule(BODIES). V1 is the rule in +% NDI's v1 shape (syncrule.json + base.json at the locked NDI-matlab `main`, +% 3cb19a8, as +ndi/+time/syncrule.m newdocument writes it for filematch.m, +% filefind.m, commonTriggersOverlappingEpochs.m and randomPulses.m). BODIES +% is one of: +% +% the pass-1 passthrough (a channel-based rule, or a filefind rule before its +% systems are resolved): its outbound renames undone; +% +% the `clock_alignment_configuration` and its `software` entity (a filematch +% rule in pass 1), plus, for the filefind fold did2.convert. +% resolveClockAlignment makes, its two `acquisition_channels` and the two +% `acquisition_system`s they name: +% base.id, session_id, datestamp the configuration's +% base.name '' (the writer sets none) +% syncrule.ndi_syncrule_class the software entity's name +% syncrule.parameters the method parameters, by name: +% number_fullpath_matches 'minimum matching file paths' +% syncfilename 'sync file name' +% minEmbeddedFileOverlap 'minimum embedded file overlap' +% any other its own name ('_' written as a space) +% epochclocktype the configuration's clock +% daqsystem1, daqsystem2 the names of the acquisition systems +% the two acquisition_channels name, in +% the order of the configuration's +% acquisition_channels_id edges +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.syncrule, +% did2.convert.resolveClockAlignment. + +arguments + bodies cell +end + +CLASS = 'syncrule'; +spec = emptySpec(); +v1 = struct(); +if isscalar(bodies) && strcmp(classNameOf(bodies{1}), CLASS) + v1 = undoOutbound(bodies{1}); + return; +end +% the channels and the systems they name are claimed first; daqParts places +% the configuration and its software, and finds no role for anything else +ids = cellfun(@(b) char(getIn(b, 'base', 'id')), bodies, 'UniformOutput', false); +cfg = []; +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'clock_alignment_configuration') + cfg = bodies{k}; + break; + end +end +claimed = false(1, numel(bodies)); +systemNames = {}; +if ~isempty(cfg) + chIds = edgeIds(cfg, 'acquisition_channels_id'); + for j = 1:numel(chIds) + c = find(strcmp(ids, chIds{j}), 1); + if isempty(c) || ~strcmp(classNameOf(bodies{c}), 'acquisition_channels') + spec.unplaced{end+1} = sprintf('the acquisition_channels %s was not emitted', chIds{j}); + continue; + end + claimed(c) = true; + if ~allEmpty(getIn(bodies{c}, 'acquisition_channels', 'channels')) + spec.unplaced{end+1} = 'an acquisition_channels states channels (a filefind rule names none)'; + end + sysIds = edgeIds(bodies{c}, 'acquisition_system_id'); + s = []; + if ~isempty(sysIds) + s = find(strcmp(ids, sysIds{1}), 1); + end + if isempty(s) || ~strcmp(classNameOf(bodies{s}), 'acquisition_system') + spec.unplaced{end+1} = 'an acquisition_channels names no acquisition_system among the documents'; + continue; + end + claimed(s) = true; + systemNames{end+1} = fieldText(getIn(bodies{s}, 'acquisition_system'), 'name'); %#ok + end +end +[doc, ~, swName, spec] = daqParts(bodies(~claimed), 'clock_alignment_configuration', spec); +if isempty(doc) + return; +end +blk = getIn(doc, 'clock_alignment_configuration'); +spec.unplaced = [spec.unplaced, others(blk, {'clock', 'method'}, ... + 'clock_alignment_configuration')]; +[params, bad] = ruleParameters(getIn(blk, 'method', 'parameters')); +spec.unplaced = [spec.unplaced, bad]; +if ~allEmpty(getIn(blk, 'method', 'term')) + spec.unplaced{end+1} = 'the configuration''s method states a term (pass 1 writes none)'; +end +[~, clockName] = termParts(getIn(blk, 'clock')); +if ~isempty(clockName) + params.epochclocktype = clockName; +end +if numel(systemNames) == 2 + params.daqsystem1 = systemNames{1}; + params.daqsystem2 = systemNames{2}; +elseif ~isempty(systemNames) + spec.unplaced{end+1} = sprintf('%d acquisition systems (a rule names 0 or 2)', numel(systemNames)); +end +base = rebuildBase(doc); +v1.document_class = struct('class_name', CLASS); +v1.base = struct('id', base.id, 'session_id', base.session_id, 'name', '', ... + 'datestamp', base.datestamp); +v1.syncrule = struct('ndi_syncrule_class', swName, 'parameters', params); +end + +% ===================== helpers ========================================= + +function [s, bad] = ruleParameters(params) +%RULEPARAMETERS The rule's v1 parameters from the configuration's method +% parameters: the three the migrator names back to their writer spelling, +% every other one by its own name (a space read back as '_', a '.' as a +% nested field: private/jParameterList's naming). +s = struct(); +bad = {}; +if isempty(params) + return; +end +if isstruct(params) + params = num2cell(reshape(params, 1, [])); +end +named = {'minimum matching file paths', 'number_fullpath_matches'; ... + 'sync file name', 'syncfilename'; ... + 'minimum embedded file overlap', 'minEmbeddedFileOverlap'}; +for k = 1:numel(params) + e = params{k}; + [~, name] = termParts(getIn(e, 'variable')); + if isempty(name) + bad{end+1} = sprintf('method parameter %d has no name', k); %#ok + continue; + end + [v, ok] = entryValue(e); + if ~ok + bad{end+1} = sprintf('method parameter "%s" states no value', name); %#ok + continue; + end + hit = strcmp(named(:, 1), name); + if any(hit) + s.(named{hit, 2}) = v; + continue; + end + steps = strsplit(strrep(name, ' ', '_'), '.'); + s = setPath(s, steps, v); +end +end + +function [v, ok] = entryValue(e) +v = []; +ok = true; +c = getIn(e, 'count'); +if ~isempty(c) + v = c; + return; +end +q = getIn(e, 'quantity', 'value'); +if ~isempty(q) + v = q; + return; +end +t = getIn(e, 'text'); +if ~isempty(t) + v = char(t); + if any(v(1) == '[{') + try + v = jsondecode(v); + catch + end + end + return; +end +l = getIn(e, 'logical'); +if ~isempty(l) + v = l; + return; +end +ok = false; +end + +function s = setPath(s, steps, v) +if isscalar(steps) + s.(steps{1}) = v; + return; +end +inner = struct(); +if isfield(s, steps{1}) && isstruct(s.(steps{1})) && isscalar(s.(steps{1})) + inner = s.(steps{1}); +end +s.(steps{1}) = setPath(inner, steps(2:end), v); +end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index e5a07882..b547d408 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -113,6 +113,18 @@ % renamed. Written by +setup/+conv/+haley/doImport.m % and +babu/import.m. Round trips: % testRawV1RoundTripImage. +% daqsystem the acquisition-system family: superclass `base` +% filenavigator (+ `daqreader` for daqreader_ndr), no `app` block, +% daqreader no superclass migrator (none exists for `base` or +% daqreader_ndr `daqreader`; +migrators_j/daqreader.m is the +% daqmetadatareader concrete migrator daqreader_ndr hands on to). The +% syncrule v1 names are the migrator names. What a migrator +% syncgraph does not read carries the document +% probe_location (private/jRawAccount). Written by +daq/system.m, +% +file/navigator.m, +daq/reader.m, +daq/+reader/ +% +mfdaq/ndr.m, +daq/metadatareader.m, +time/ +% syncrule.m, +time/syncgraph.m and the probe-location +% writers. Round trips: testRawV1RoundTripDaq. % NOT LISTED, and why: % image no NDI writer at the locked main constructs it and no % corpus holds one; its subject-less passthrough has no @@ -141,6 +153,14 @@ 'syncrule_mapping', ... 'daqmetadatareader_epochdata_ingested', ... 'imageStack', ... + 'daqsystem', ... + 'filenavigator', ... + 'daqreader', ... + 'daqreader_ndr', ... + 'daqmetadatareader', ... + 'syncrule', ... + 'syncgraph', ... + 'probe_location', ... }; % v1 name migrator (+migrators_j); TEMPORARY, see above diff --git a/tests/+did2/+unittest/testRawV1RoundTripDaq.m b/tests/+did2/+unittest/testRawV1RoundTripDaq.m new file mode 100644 index 00000000..2e0ac366 --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripDaq.m @@ -0,0 +1,643 @@ +function tests = testRawV1RoundTripDaq +%TESTRAWV1ROUNDTRIPDAQ The acquisition-system family read as raw v1, and its +% round trip: daqsystem, filenavigator, daqreader, daqreader_ndr, +% daqmetadatareader, syncrule, syncgraph and probe_location. +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes), [migration reliability +% practices] (a) (a round trip per class, did2.convert.roundtrip.check), and +% [renames carry is temporary] (what universalRenames would discard is still +% carried, carry-049). The test of the round trip is [lossless means round +% trip]. +% +% THE v1 DOCUMENTS are built from NDI's templates at the locked NDI-matlab +% `main` (3cb19a8; tests/+did2/fixtures/ndi_templates, copied verbatim: +% daqsystem.json, filenavigator.json, daqreader.json, daqreader_ndr.json, +% daqmetadatareader.json, syncrule.json, syncgraph.json, probe_location.json, +% base.json) in the shapes their WRITERS give them (the writer wins over the +% template), and pass through jsonencode/jsondecode as a corpus delivers +% them: +% daqsystem +daq/system.m newdocument: base.name the system's +% name; filenavigator_id, daqreader_id, the template's +% own empty daqmetadatareader_id, then +% add_dependency_value_n's daqmetadatareader_id_1..N +% filenavigator +file/navigator.m newdocument: the class, the two +% cell2str pattern lists, the probe-map class +% daqreader +daq/reader.m newdocument: the class; the session is +% ndi.session.empty_id() (the corpora hold a real one) +% daqreader_ndr +daq/+reader/+mfdaq/ndr.m newdocument: the daqreader +% class, the NDR reader string, the NDR class (equal) +% daqmetadatareader +daq/metadatareader.m newdocument: the class and the +% tab-separated file parameter +% syncrule +time/syncrule.m newdocument, for filematch.m, +% filefind.m and commonTriggersOverlappingEpochs.m +% syncgraph +time/syncgraph.m newdocument: the class, and +% add_dependency_value_n's syncrule_id_1..N +% probe_location +setup/+conv/+dabrowska/doImport.m and +% +fun/+doc/+probe/probeLocations4probes.m: the term, +% probe_id, the session's newdocument (base.name '') +% These are the shapes of all 139 / 139 / 138 / 1 / 46 / 92 / 46 / 528 +% documents of the four corpus zips (20211116, Dab, JH, Soph; survey of the +% zips, 2026-10-27), with their values. +% +% WHAT V2 DOES NOT KEEP is listed per fixture as KNOWN FINDINGS (knownFindings +% below): every writer-shaped fixture round trips with none; the findings +% are shapes no NDI writer at the locked `main` makes, kept here so that the +% round trip is seen to report them. +tests = functiontests(localfunctions); +end + +function setupOnce(testCase) +prev = did2.schema.cache.strictMode('TermRegistry', false); +testCase.addTeardown(@() did2.schema.cache.strictMode('TermRegistry', prev)); +end + +% ===================== the switch ====================================== + +function testAllEightClassesAreSwitched(testCase) +names = did2.convert.rawV1Classes(); +for c = familyClasses() + verifyTrue(testCase, any(strcmp(names, c{1})), c{1}); + verifyEqual(testCase, did2.convert.rawV1Classes(c{1}), c{1}, ... + [c{1} ': the migrator is the v1 name']); +end +f = writerFixtures(); +r = runRaw(f(:, 2)'); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_read_raw_v1, size(f, 1)); +verifyEqual(testCase, r.summary.legacy_ndi_document.bodies_reaching_universal_renames, 0); +end + +% ===================== every writer shape round trips ===================== + +function testWriterShapesRoundTrip(testCase) +f = writerFixtures(); +for k = 1:size(f, 1) + [label, v1, outcome] = f{k, :}; + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + switch outcome + case 'converted' + verifyEmpty(testCase, out.passthrough, [label ': converted, not passed through']); + verifyGreaterThan(testCase, numel(out.migrated), 1, [label ': the document and its parts']); + case 'passthrough' + verifyEqual(testCase, numel(out.passthrough), 1, [label ': a pass-1 passthrough']); + verifyEqual(testCase, numel(out.migrated), 1, label); + verifyEqual(testCase, char(out.migrated{1}.get('document_class.schema_version')), ... + 'did_v2', [label ': a passthrough is not a carry']); + end + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyFalse(testCase, r.carried, label); + verifyRoundTrip(testCase, r, label, findingsFor(label)); +end +end + +function testEveryTemplateFieldIsAccountedFor(testCase) +% by name, on the converted writer shapes: each field NDI's template declares +cases = {'daqsystem, one metadata reader', {'base.id', 'base.session_id', 'base.name', ... + 'base.datestamp', 'document_class.class_name', 'daqsystem.ndi_daqsystem_class', ... + 'depends_on(1).name', 'depends_on(1).value', 'depends_on(2).value', ... + 'depends_on(3).name', 'depends_on(4).name', 'depends_on(4).value'}; ... + 'filenavigator, epochdir', {'filenavigator.ndi_filenavigator_class', ... + 'filenavigator.fileparameters', 'filenavigator.epochprobemap_class', ... + 'filenavigator.epochprobemap_fileparameters', 'base.name'}; ... + 'daqreader, empty session', {'daqreader.ndi_daqreader_class', 'base.session_id'}; ... + 'daqreader_ndr', {'daqreader.ndi_daqreader_class', 'daqreader_ndr.ndr_reader_string', ... + 'daqreader_ndr.ndi_daqreader_ndr_class'}; ... + 'daqmetadatareader', {'daqmetadatareader.ndi_daqmetadatareader_class', ... + 'daqmetadatareader.tab_separated_file_parameter'}; ... + 'syncrule, filematch', {'syncrule.ndi_syncrule_class', ... + 'syncrule.parameters.number_fullpath_matches'}; ... + 'syncgraph, two rules', {'syncgraph.ndi_syncgraph_class', 'depends_on(1).name', ... + 'depends_on(1).value', 'depends_on(2).name', 'depends_on(2).value'}; ... + 'probe_location, Dabrowska', {'probe_location.ontology_name', 'probe_location.name', ... + 'depends_on(1).name', 'depends_on(1).value', 'base.session_id'}}; +f = writerFixtures(); +for k = 1:size(cases, 1) + v1 = f{strcmp(f(:, 1), cases{k, 1}), 2}; + r = did2.convert.roundtrip.check(v1, runRaw(v1).migrated); + accounted = [r.matched, r.not_set, r.restated, r.equivalent]; + for p = cases{k, 2} + verifyTrue(testCase, any(strcmp(p{1}, accounted)), ... + sprintf('%s: %s is not accounted for', cases{k, 1}, p{1})); + end +end +end + +function testTheFilefindFoldRoundTrips(testCase) +% pass 1 passes a filefind rule through; did2.convert.resolveClockAlignment +% resolves its two system NAMES to the migrated acquisition systems and re-runs +% the migrator: a configuration, two acquisition_channels and its software. +% The rule is rebuilt from those and the two systems they name. +for path = {'raw', 'renamed'} + [batch, rule] = filefindBatch(); + if strcmp(path{1}, 'raw'); out = runRaw(batch); else; out = runRenamed(batch); end + out = did2.convert.resolveClockAlignment(out, 'Validate', false, 'TargetVersion', 'V_eta'); + verifyEqual(testCase, out.clock_alignment_fold.syncrule_configurations_folded, 1, path{1}); + docs = foldDocs(out, rule.base.id); + verifyNotEmpty(testCase, docs, path{1}); + r = did2.convert.roundtrip.check(rule, docs); + verifyFalse(testCase, r.carried, path{1}); + verifyRoundTrip(testCase, r, ['the filefind fold, ' path{1}], {}); + for p = {'syncrule.parameters.daqsystem1', 'syncrule.parameters.daqsystem2', ... + 'syncrule.parameters.syncfilename', 'syncrule.parameters.number_fullpath_matches'} + verifyTrue(testCase, any(strcmp(p{1}, r.matched)), sprintf('%s: %s not matched', path{1}, p{1})); + end +end +end + +% ===================== the switch changes no outcome ====================== + +function testTheSwitchChangesNoOutcome(testCase) +% a converted document is the one the renamed path converted; a passthrough is +% the same document but for v1's `value` edge key; a carry is carried on both +f = writerFixtures(); +for k = 1:size(f, 1) + [label, v1] = f{k, 1:2}; + raw = runRaw(v1); + old = runRenamed(v1); + verifyEmpty(testCase, raw.quarantine, label); + verifyEqual(testCase, numel(raw.quarantine), numel(old.quarantine), label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), label); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + a = raw.migrated{j}.toStruct(); + b = old.migrated{j}.toStruct(); + if ~isempty(raw.passthrough) + verifyEqual(testCase, edgeMap(a), edgeMap(b), label); + a = rmfieldIf(a, 'depends_on'); + b = rmfieldIf(b, 'depends_on'); + end + verifyTrue(testCase, isequaln(a, b), sprintf('%s, document %d: raw %s; renamed %s', ... + label, j, jsonencode(a), jsonencode(b))); + end +end +end + +% ===================== what the migrator does not read is carried ========= + +function testAnUnreadFieldIsCarried(testCase) +% before the switch a field or edge the migrator does not read was dropped +% without a word on the renamed path; now the document is carried whole, as +% the untouched v1 source, with an `unplaced:` note naming it (no register row +% yet: a question for the team) +breaks = { ... + 'daqsystem, one metadata reader', 'daqsystem.ndi_daqsystem_version', ... + @(v) setIn(v, {'daqsystem', 'ndi_daqsystem_version'}, '2'); ... + 'daqsystem, one metadata reader', 'depends_on(device_id)', ... + @(v) addEdge(v, 'device_id', 'dev_1'); ... + 'filenavigator, epochdir', 'filenavigator.directory', ... + @(v) setIn(v, {'filenavigator', 'directory'}, '/data'); ... + 'daqreader, empty session', 'daqreader_ndr', ... + @(v) setIn(v, {'daqreader_ndr', 'ndr_reader_string'}, 'intan'); ... + 'daqreader_ndr', 'base.type', ... + @(v) setIn(v, {'base', 'type'}, 'daqreader'); ... + 'daqmetadatareader', 'daqmetadatareader.metadata_names', ... + @(v) setIn(v, {'daqmetadatareader', 'metadata_names'}, 'stims'); ... + 'syncrule, filematch', 'files', ... + @(v) setIn(v, {'files'}, struct('file_list', {{'rule.bin'}})); ... + 'syncgraph, two rules', 'depends_on(session_reference_id)', ... + @(v) addEdge(v, 'session_reference_id', 'sref_1'); ... + 'probe_location, Dabrowska', 'probe_location.hemisphere', ... + @(v) setIn(v, {'probe_location', 'hemisphere'}, 'left')}; +f = writerFixtures(); +for k = 1:size(breaks, 1) + [label, path, fn] = breaks{k, :}; + v1 = jsondecode(jsonencode(fn(f{strcmp(f(:, 1), label), 2}))); + raw = runRaw(v1); + verifyEmpty(testCase, raw.quarantine, [label ' + ' path]); + verifyEqual(testCase, numel(raw.passthrough), 1, [label ' + ' path ': carried']); + emitted = raw.migrated{1}.toStruct(); + verifyEqual(testCase, emitted.document_class.schema_version, 'did_v1', [label ' + ' path]); + emitted.document_class = rmfield(emitted.document_class, 'schema_version'); + verifyTrue(testCase, isequaln(emitted, v1), [label ' + ' path ': the carry is not the v1 source']); + d = raw.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, startsWith(d, 'unplaced: ') && contains(d, path), d); + verifyTrue(testCase, did2.convert.roundtrip.check(v1, raw.migrated).ok, [label ' + ' path]); +end +end + +function testAnEmptyUnreadFieldIsNotACarry(testCase) +% an empty value states nothing: the document converts as before +v1 = writerDaqmetadatareader(); +v1.daqmetadatareader.metadata_names = ''; +v1 = jsondecode(jsonencode(v1)); +out = runRaw(v1); +verifyEmpty(testCase, out.passthrough); +verifyGreaterThan(testCase, numel(out.migrated), 1); +end + +function testWhatTheRenamedPathDiscardedIsCarriedOnBothPaths(testCase) +% carry-049 ([renames carry is temporary]): a depends_on `version`, an +% `ndi_document` beside `base`, a camelCase twin with a different value +breaks = { ... + 'daqsystem, one metadata reader', @(v) setDep(v, 1, 'version', 2); ... + 'syncgraph, two rules', @(v) setIn(v, {'ndi_document'}, struct('id', 'old_1', 'type', 'syncgraph')); ... + 'filenavigator, epochdir', @(v) setIn(v, {'filenavigator', 'epochprobemapClass'}, 'other.class')}; +f = writerFixtures(); +for k = 1:size(breaks, 1) + label = breaks{k, 1}; + v1 = jsondecode(jsonencode(breaks{k, 2}(f{strcmp(f(:, 1), label), 2}))); + raw = runRaw(v1); + old = runRenamed(v1); + verifyEqual(testCase, numel(raw.passthrough), 1, [label ': raw carries']); + verifyEqual(testCase, numel(old.passthrough), 1, [label ': renamed carries']); + verifyEqual(testCase, char(raw.migrated{1}.get('document_class.schema_version')), 'did_v1', label); + verifyEqual(testCase, char(old.migrated{1}.get('document_class.schema_version')), 'did_v1', label); + d = raw.summary.migration_notes.carried_as_v1.distinct_details{1}; + verifyTrue(testCase, startsWith(d, '[carry-049] '), d); +end +end + +function testTheExistingCarriesStayCarried(testCase) +% carry-017 / carry-039 (daqreader_ndr) and the passthroughs keep their notes +v1 = writerDaqreaderNdr(); +v1.daqreader_ndr.file_extension = '.rhd'; +v1 = jsondecode(jsonencode(v1)); +out = runRaw(v1); +verifyEqual(testCase, numel(out.passthrough), 1); +d = out.summary.migration_notes.carried_as_v1.distinct_details{1}; +verifyTrue(testCase, contains(d, '[carry-039]'), d); +emitted = out.migrated{1}.toStruct(); +emitted.document_class = rmfield(emitted.document_class, 'schema_version'); +verifyTrue(testCase, isequaln(emitted, v1), 'the carry is not the v1 source'); +end + +% ===================== the round trip can fail =========================== + +function testAChangedValueIsReportedLost(testCase) +cases = {'daqsystem, one metadata reader', {'daqsystem', 'ndi_daqsystem_class'}, ... + 'ndi.daq.system.other', 'daqsystem.ndi_daqsystem_class'; ... + 'filenavigator, epochdir', {'filenavigator', 'fileparameters'}, ... + '{ ''other.txt'' }', 'filenavigator.fileparameters'; ... + 'syncgraph, two rules', {'base', 'session_id'}, 'sess_other', 'base.session_id'; ... + 'probe_location, Dabrowska', {'probe_location', 'name'}, 'amygdala', 'probe_location.name'}; +f = writerFixtures(); +for k = 1:size(cases, 1) + v1 = f{strcmp(f(:, 1), cases{k, 1}), 2}; + out = runRaw(v1); + changed = setIn(v1, cases{k, 2}, cases{k, 3}); + r = did2.convert.roundtrip.check(changed, out.migrated); + verifyFalse(testCase, r.ok, cases{k, 1}); + verifyEqual(testCase, {r.lost.path}, cases(k, 4), cases{k, 1}); +end +end + +function testADroppedEdgeIsReportedLost(testCase) +% a v1 metadata reader the acquisition_system no longer names +v1 = writerDaqsystem('vhvis_spike2', {'mdr_1', 'mdr_2'}); +out = runRaw(v1); +docs = cellfun(@(d) d.toStruct(), out.migrated, 'UniformOutput', false); +for k = 1:numel(docs) + if strcmp(docs{k}.document_class.class_name, 'acquisition_system') + keep = ~strcmp({docs{k}.depends_on.document_id}, 'mdr_2'); + docs{k}.depends_on = docs{k}.depends_on(keep); + end +end +r = did2.convert.roundtrip.check(v1, docs); +verifyFalse(testCase, r.ok); +verifyTrue(testCase, any(startsWith({r.lost.path}, 'depends_on(5)')), describeLost(r)); +end + +function testAMissingOrExtraDocumentIsUnplaced(testCase) +f = writerFixtures(); +for label = {'daqsystem, one metadata reader', 'syncgraph, two rules', 'probe_location, Dabrowska'} + v1 = f{strcmp(f(:, 1), label{1}), 2}; + docs = runRaw(v1).migrated; + % one document short (the software entity, or the session anchor) + r = did2.convert.roundtrip.check(v1, docs(1)); + verifyFalse(testCase, r.ok, label{1}); + verifyNotEmpty(testCase, r.unplaced, label{1}); + % a stray document + stray = runRaw(writerDaqmetadatareader()).migrated; + r = did2.convert.roundtrip.check(v1, [docs, stray(1)]); + verifyFalse(testCase, r.ok, label{1}); + verifyNotEmpty(testCase, r.unplaced, label{1}); +end +end + +% ===================== known findings =================================== + +function f = knownFindings() +% {fixture, path, why}. No writer-shaped fixture has one; these are shapes no +% NDI writer at the locked `main` makes, and today's behaviour is kept for them +% (a question for the team each): +f = { ... + 'daqreader with a base.name', 'base.name', ... + 'V2 writes no base.name (#73 item 54); the writer leaves it '''' (as subject 4a)'; ... + 'filenavigator, unbraced pattern', 'filenavigator.fileparameters', ... + 'a pattern not written by cell2str is read as one pattern and written back braced'; ... + 'probe_location, a label not the registry''s', 'probe_location.name', ... + 'a registered node takes the registry''s label (as treatment 11e)'}; +end + +function testKnownFindingsAreReported(testCase) +cases = {'daqreader with a base.name', setIn(writerDaqreader('ndi.daq.reader.mfdaq.intan', emptySessionId()), ... + {'base', 'name'}, 'intan reader'); ... + 'filenavigator, unbraced pattern', setIn(writerFilenavigator('ndi.file.navigator', ... + '#\.mat\>', 'ndi.epoch.epochprobemap_daqsystem', ''), {'base', 'name'}, ''); ... + 'probe_location, a label not the registry''s', writerProbeLocation('pl_9', 'UBERON:0002436', 'V1')}; +for k = 1:size(cases, 1) + [label, v1] = cases{k, :}; + v1 = jsondecode(jsonencode(v1)); + out = runRaw(v1); + verifyEmpty(testCase, out.quarantine, label); + verifyEmpty(testCase, out.passthrough, [label ': converted, as today']); + r = did2.convert.roundtrip.check(v1, out.migrated); + verifyRoundTrip(testCase, r, label, findingsFor(label)); +end +end + +function paths = findingsFor(fixture) +f = knownFindings(); +paths = reshape(sort(f(strcmp(f(:, 1), fixture), 2)), 1, []); +end + +% ===================== helpers ========================================= + +function c = familyClasses() +c = {'daqsystem', 'filenavigator', 'daqreader', 'daqreader_ndr', ... + 'daqmetadatareader', 'syncrule', 'syncgraph', 'probe_location'}; +end + +function out = runRaw(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function out = runRenamed(v1) +out = did2.convert.v1_to_v2(v1, 'Validate', false, 'TargetVersion', 'V_eta', ... + 'RawV1Classes', {}); +end + +function verifyRoundTrip(testCase, r, label, expectedLost) +verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); +lost = reshape(sort({r.lost.path}), 1, []); +verifyEqual(testCase, lost, reshape(sort(expectedLost), 1, []), ... + sprintf('%s: lost paths are not the listed findings; lost: %s', label, describeLost(r))); +verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); +verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end + +function s = describeLost(r) +parts = cell(1, numel(r.lost)); +for k = 1:numel(r.lost) + parts{k} = sprintf('%s (v1 %s, rebuilt %s)', r.lost(k).path, ... + show(r.lost(k).v1), show(r.lost(k).rebuilt)); +end +s = strjoin(parts, '; '); +if isempty(s); s = '(none)'; end +end + +function s = show(v) +try + s = jsonencode(v); +catch + s = class(v); +end +end + +function m = edgeMap(b) +% name -> id, whichever key holds it +m = struct(); +if ~isfield(b, 'depends_on'); return; end +d = b.depends_on; +if isstruct(d); d = num2cell(d); end +for k = 1:numel(d) + e = d{k}; + v = ''; + for key = {'document_id', 'value', 'id'} + if isfield(e, key{1}) && ~isempty(e.(key{1})) + v = char(e.(key{1})); + break; + end + end + m.(matlab.lang.makeValidName(char(e.name))) = v; +end +end + +function s = rmfieldIf(s, f) +if isfield(s, f); s = rmfield(s, f); end +end + +function s = setIn(s, path, value) +s = setfield(s, path{:}, value); %#ok +end + +function v1 = addEdge(v1, name, id) +d = v1.depends_on; +if isempty(d) + d = struct('name', {}, 'value', {}); +end +d = reshape(d, 1, []); +d(end+1) = struct('name', name, 'value', id); +v1.depends_on = d; +end + +function v1 = setDep(v1, k, field, value) +d = num2cell(reshape(v1.depends_on, 1, [])); +d{k}.(field) = value; +v1.depends_on = d; +end + +function doc = docWithId(out, id) +doc = []; +for k = 1:numel(out.migrated) + if strcmp(char(out.migrated{k}.get('base.id')), id) + doc = out.migrated{k}; + return; + end +end +end + +function ids = edgesOf(doc, name) +ids = {}; +deps = doc.get('depends_on'); +if isstruct(deps); deps = num2cell(deps); end +for k = 1:numel(deps) + e = deps{k}; + if ~strcmp(char(e.name), name); continue; end + for key = {'document_id', 'value', 'id'} + if isfield(e, key{1}) && ~isempty(e.(key{1})) + ids{end+1} = char(e.(key{1})); %#ok + break; + end + end +end +end + +function docs = foldDocs(out, ruleId) +%FOLDDOCS The configuration the rule folded into, its software, its two +% acquisition_channels and the acquisition systems they name. +docs = {}; +cfg = docWithId(out, ruleId); +if isempty(cfg) || ~strcmp(char(did2.unittest.helpers.classKey(cfg)), ... + 'clock_alignment_configuration') + return; +end +docs = {cfg}; +for sw = edgesOf(cfg, 'software_id') + docs{end+1} = docWithId(out, sw{1}); %#ok +end +for ch = edgesOf(cfg, 'acquisition_channels_id') + c = docWithId(out, ch{1}); + docs{end+1} = c; %#ok + for s = edgesOf(c, 'acquisition_system_id') + docs{end+1} = docWithId(out, s{1}); %#ok + end +end +end + +% ===================== fixtures, from the WRITERS ========================= + +function tpl = loadTemplate(name) +thisDir = fileparts(mfilename('fullpath')); +f = fullfile(fileparts(thisDir), 'fixtures', 'ndi_templates', [name '.json']); +tpl = jsondecode(fileread(f)); +end + +function id = emptySessionId() +% ndi.session.empty_id(): every character of a fresh id '0' but the '_' +id = '0000000000000000_0000000000000000'; +end + +function v1 = withBase(tplName, id, sessionId, name) +tpl = loadTemplate(tplName); +baseTpl = loadTemplate('base'); +v1 = struct(); +v1.document_class = tpl.document_class; +if isfield(tpl, 'depends_on') + v1.depends_on = tpl.depends_on; +end +v1.base = baseTpl.base; +v1.base.id = id; +v1.base.session_id = sessionId; +v1.base.name = name; +v1.base.datestamp = '2025-05-27T15:47:23.738Z'; +end + +function f = writerFixtures() +% {label, v1, 'converted' | 'passthrough'} +f = { ... + 'daqsystem, one metadata reader', writerDaqsystem('vhvis_spike2', {'mdr_1'}), 'converted'; ... + 'daqsystem, no metadata reader', writerDaqsystem('vhintan', {}), 'converted'; ... + 'filenavigator, epochdir', writerFilenavigator('ndi.file.navigator.epochdir', ... + '{ ''reference.txt'', ''.*\.rhd\>'', ''vhintan_channelgrouping.txt'', ''vhintan_intan2spike2time.txt'' }', ... + 'ndi.setup.epoch.epochprobemap_daqsystem_vhlab', '{ ''vhintan_channelgrouping.txt'' }'), 'converted'; ... + 'filenavigator, navigator', writerFilenavigator('ndi.file.navigator', ... + '{ ''#\.mat\>'', ''#\.epochprobemap.txt\>'' }', 'ndi.epoch.epochprobemap_daqsystem', ... + '{ ''(.*)epochprobemap.txt'' }'), 'converted'; ... + 'filenavigator, no parameters', writerFilenavigator('ndi.file.navigator', '', ... + 'ndi.epoch.epochprobemap_daqsystem', ''), 'converted'; ... + 'daqreader, empty session', writerDaqreader('ndi.daq.reader.mfdaq.intan', emptySessionId()), 'converted'; ... + 'daqreader, corpus session', writerDaqreader('ndi.daq.reader.mfdaq.cedspike2', 'sess_0001'), 'converted'; ... + 'daqreader_ndr', writerDaqreaderNdr(), 'converted'; ... + 'daqmetadatareader', writerDaqmetadatareader(), 'converted'; ... + 'syncrule, filematch', writerSyncrule('rule_fm', 'ndi.time.syncrule.filematch', ... + struct('number_fullpath_matches', 2)), 'converted'; ... + 'syncrule, filefind', writerSyncrule('rule_ff', 'ndi.time.syncrule.filefind', ... + filefindParameters()), 'passthrough'; ... + 'syncrule, commonTriggersOverlappingEpochs', writerSyncrule('rule_ct', ... + 'ndi.time.syncrule.commonTriggersOverlappingEpochs', struct( ... + 'daqsystem1_name', 'vhtaste_sync', 'daqsystem2_name', 'vhtaste_bpod', ... + 'daqsystem_ch1', 'dep1', 'daqsystem_ch2', 'mk1', 'epochclocktype', 'dev_local_time', ... + 'minEmbeddedFileOverlap', 1, 'errorOnFailure', true)), 'passthrough'; ... + 'syncgraph, two rules', writerSyncgraph({'rule_ff', 'rule_fm'}), 'converted'; ... + 'probe_location, Dabrowska', writerProbeLocation('pl_1', 'UBERON:0001880', ... + 'bed nucleus of stria terminalis (BNST)'), 'converted'; ... + 'probe_location, probeLocations4probes', writerProbeLocation('pl_2', 'UBERON:0002436', ... + 'primary visual cortex'), 'converted'}; +end + +function v1 = writerDaqsystem(name, metadataIds) +% +daq/system.m newdocument: base.name the system's name, the real session; +% set_dependency_value fills the template's filenavigator_id and daqreader_id; +% add_dependency_value_n appends daqmetadatareader_id_1..N beside the +% template's own empty daqmetadatareader_id +v1 = withBase('daqsystem', ['daq_' name], 'sess_0001', name); +v1.depends_on(1).value = ['nav_' name]; +v1.depends_on(2).value = ['rdr_' name]; +for k = 1:numel(metadataIds) + v1.depends_on(end+1) = struct('name', sprintf('daqmetadatareader_id_%d', k), ... + 'value', metadataIds{k}); +end +tpl = loadTemplate('daqsystem'); +v1.daqsystem = tpl.daqsystem; +v1.daqsystem.ndi_daqsystem_class = 'ndi.daq.system.mfdaq'; +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerFilenavigator(cls, fileParams, mapClass, mapParams) +% +file/navigator.m newdocument: the four fields, cell2str'd lists ('' for +% none); the session is the navigator's; base.name the template's '' +v1 = withBase('filenavigator', 'nav_1', 'sess_0001', ''); +v1.filenavigator = struct('ndi_filenavigator_class', cls, 'fileparameters', fileParams, ... + 'epochprobemap_class', mapClass, 'epochprobemap_fileparameters', mapParams); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerDaqreader(cls, sessionId) +% +daq/reader.m newdocument: the class; base.session_id ndi.session.empty_id() +% (a corpus document holds the session it was added to) +v1 = withBase('daqreader', 'rdr_1', sessionId, ''); +v1.daqreader = struct('ndi_daqreader_class', cls); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerDaqreaderNdr() +% +daq/+reader/+mfdaq/ndr.m newdocument: the daqreader class, the reader +% string, the NDR class (the same class); superclasses base, daqreader +v1 = withBase('daqreader_ndr', 'rdr_ndr', emptySessionId(), ''); +v1.daqreader = struct('ndi_daqreader_class', 'ndi.daq.reader.mfdaq.ndr'); +v1.daqreader_ndr = struct('ndr_reader_string', 'dabrowska', ... + 'ndi_daqreader_ndr_class', 'ndi.daq.reader.mfdaq.ndr'); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerDaqmetadatareader() +% +daq/metadatareader.m newdocument +v1 = withBase('daqmetadatareader', 'mdr_1', emptySessionId(), ''); +v1.daqmetadatareader = struct('ndi_daqmetadatareader_class', ... + 'ndi.daq.metadatareader.NewStimStims', 'tab_separated_file_parameter', 'stims.mat'); +v1 = jsondecode(jsonencode(v1)); +end + +function p = filefindParameters() +p = struct('number_fullpath_matches', 1, 'syncfilename', 'vhintan_intan2spike2time.txt', ... + 'daqsystem1', 'vhintan', 'daqsystem2', 'vhvis_spike2'); +end + +function v1 = writerSyncrule(id, cls, params) +% +time/syncrule.m newdocument: the class and the rule's parameters; the +% corpora hold the session the rule was added to +v1 = withBase('syncrule', id, 'sess_0001', ''); +v1.syncrule = struct('ndi_syncrule_class', cls, 'parameters', params); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerSyncgraph(ruleIds) +% +time/syncgraph.m newdocument: the class, the real session, and +% add_dependency_value_n('syncrule_id', ...) per rule (the template declares +% no edge) +v1 = withBase('syncgraph', 'graph_1', 'sess_0001', ''); +v1.depends_on = struct('name', arrayfun(@(k) sprintf('syncrule_id_%d', k), ... + 1:numel(ruleIds), 'UniformOutput', false), 'value', ruleIds); +v1.syncgraph = struct('ndi_syncgraph_class', 'ndi.time.syncgraph'); +v1 = jsondecode(jsonencode(v1)); +end + +function v1 = writerProbeLocation(id, node, name) +% +setup/+conv/+dabrowska/doImport.m: ndi.document('probe_location', +% 'probe_location', struct(ontology_name, name)) + session.newdocument(), then +% set_dependency_value('probe_id', ...) +v1 = withBase('probe_location', id, 'sess_0001', ''); +v1.depends_on.value = 'probe_1'; +v1.probe_location = struct('ontology_name', node, 'name', name); +v1 = jsondecode(jsonencode(v1)); +end + +function [batch, rule] = filefindBatch() +%FILEFINDBATCH The two acquisition systems a filefind rule names (each with +% its navigator and reader), and the rule, in one session. +rule = writerSyncrule('rule_ff', 'ndi.time.syncrule.filefind', filefindParameters()); +batch = {writerDaqsystem('vhintan', {}), writerDaqsystem('vhvis_spike2', {'mdr_1'}), rule}; +end diff --git a/tests/+did2/fixtures/ndi_templates/daqmetadatareader.json b/tests/+did2/fixtures/ndi_templates/daqmetadatareader.json new file mode 100644 index 00000000..46b1e6a0 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqmetadatareader.json @@ -0,0 +1,18 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/daqmetadatareader.json", + "validation": "$NDISCHEMAPATH\/daq\/daqmetadatareader_schema.json", + "class_name": "daqmetadatareader", + "property_list_name": "daqmetadatareader", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "daqmetadatareader": { + "ndi_daqmetadatareader_class": "ndi.daq.metadatareader", + "tab_separated_file_parameter": "" + } +} + + diff --git a/tests/+did2/fixtures/ndi_templates/daqreader.json b/tests/+did2/fixtures/ndi_templates/daqreader.json new file mode 100644 index 00000000..446888ca --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqreader.json @@ -0,0 +1,15 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/daqreader.json", + "validation": "$NDISCHEMAPATH\/daq\/daqreader_schema.json", + "class_name": "daqreader", + "property_list_name": "daqreader", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "daqreader": { + "ndi_daqreader_class": "ndi_daqreader" + } +} diff --git a/tests/+did2/fixtures/ndi_templates/daqreader_ndr.json b/tests/+did2/fixtures/ndi_templates/daqreader_ndr.json new file mode 100644 index 00000000..262abb0c --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqreader_ndr.json @@ -0,0 +1,18 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/daqreader_ndr.json", + "validation": "$NDISCHEMAPATH\/daq\/daqreader_ndr_schema.json", + "class_name": "daqreader_ndr", + "property_list_name": "daqreader_ndr", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/daq\/daqreader.json" } + ] + }, + "daqreader_ndr": { + "ndr_reader_string": "RHD", + "ndi_daqreader_ndr_class": "ndi.daq.reader.mfdaq.ndr" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/daqsystem.json b/tests/+did2/fixtures/ndi_templates/daqsystem.json new file mode 100644 index 00000000..030bbfb5 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/daqsystem.json @@ -0,0 +1,27 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/daqsystem.json", + "validation": "$NDISCHEMAPATH\/daq\/daqsystem_schema.json", + "class_name": "daqsystem", + "property_list_name": "daqsystem", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + { "name": "filenavigator_id", + "value": "" + }, + { "name": "daqreader_id", + "value": "" + }, + { "name": "daqmetadatareader_id", + "value": "" + } + ], + "daqsystem": { + "ndi_daqsystem_class": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/filenavigator.json b/tests/+did2/fixtures/ndi_templates/filenavigator.json new file mode 100644 index 00000000..6e6663f7 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/filenavigator.json @@ -0,0 +1,19 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/filenavigator.json", + "validation": "$NDISCHEMAPATH\/daq\/filenavigator_schema.json", + "class_name": "filenavigator", + "property_list_name": "filenavigator", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "filenavigator": { + "ndi_filenavigator_class": "ndi_filenavigator", + "fileparameters": "", + "epochprobemap_class": "", + "epochprobemap_fileparameters": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/probe_location.json b/tests/+did2/fixtures/ndi_templates/probe_location.json new file mode 100644 index 00000000..75717062 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/probe_location.json @@ -0,0 +1,22 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/probe\/probe_location.json", + "validation": "$NDISCHEMAPATH\/probe\/probe_location_schema.json", + "class_name": "probe_location", + "property_list_name": "probe_location", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { "name": "probe_id", + "value": "" + } + ], + "probe_location": { + "ontology_name": [], + "name": [] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/syncgraph.json b/tests/+did2/fixtures/ndi_templates/syncgraph.json new file mode 100644 index 00000000..6747e14c --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/syncgraph.json @@ -0,0 +1,18 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/syncgraph.json", + "validation": "$NDISCHEMAPATH\/daq\/syncgraph_schema.json", + "class_name": "syncgraph", + "property_list_name": "syncgraph", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "depends_on": [ + ], + "syncgraph": { + "ndi_syncgraph_class": "ndi_syncgraph" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/syncrule.json b/tests/+did2/fixtures/ndi_templates/syncrule.json new file mode 100644 index 00000000..cb9a60cb --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/syncrule.json @@ -0,0 +1,17 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/daq\/syncrule.json", + "validation": "$NDISCHEMAPATH\/daq\/syncrule_schema.json", + "class_name": "syncrule", + "property_list_name": "syncrule", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "syncrule": { + "ndi_syncrule_class": "ndi.time.syncrule", + "parameters": [] + } +} + From ee1b509af9223da00dc70edc590824d705590bd2 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 05:16:57 +0000 Subject: [PATCH 17/45] Spike-sorting / calculation family reads raw v1; round trips on the writers' output Phase 2 of the generic migration, the spike-sorting / calculation family (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [renames carry is temporary], [early migration pieces fixed] (1), [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - did2.convert.rawV1Classes: + neuron_extracellular, jrclust_clusters, hartley_calc, speedtuning_calc (one line each); the table maps speedtuning_calc (NDIcalc-vis's spelling) -> speed_tuning_calc. universalRenames never made that mapping, so before the switch a writer's speed document passed through unconverted. simple_calc is not listed (its raw passthrough would meet the V_eta simple_calc class's app_name and quarantine; reason in rawV1Classes). - The four migrators read the raw document (jRawBody; v1read.readApp / readDependsOn). What universalRenames would have discarded carries the document as before (carry-049; Q5's ndi_document.name 'jrclust.prm'). Every other v1 field is accounted for: hartley_calc's four blocks (unreadFields + jCalculation 'AccountForEveryField', new 'OtherBlocks' option; carry-056), ngrid.data_size only when it restates the data type; jrclust_clusters and neuron_extracellular (unreadFields; no register row yet, marker `none`), including a waveform without times or times without a waveform, a fractional cluster index and a quality label with spaces, which were dropped or rewritten before. - hartley_calc calls +migrators_j/+super/ngrid.m (a guard) on the raw block; it stays for ontology_image. - speed_tuning_calc: a document whose fit blocks would become model_fit entries all named 'Priebe fit' (the writer's fit, fit_no_speed, fit_fullspeed) is carried (carry-056): which fit is which would be kept by order only. - Deleted (never reached): +migrators/hartley_calc.m, speed_tuning_calc.m, simple_calc.m, jrclust_clusters.m and their helper calcCommon (and its tests in testMigrators). - +roundtrip: inverses for the four classes (private/speedBlock). - Fixtures: NDI templates verbatim (NDI-matlab 3cb19a8: jrclust_clusters, ngrid; NDIcalc-vis-matlab 00e3e0f: hartley_calc, hartley_reverse_correlation, reverse_correlation, speedtuning_calc, speed_tuning) and the calculators' stored self-test outputs (hartley_calc.mock.1.json, speedtuning_calc.mock.1.json). - testRawV1RoundTripSpike: writer-shaped documents round trip; the lost paths are exactly the known findings (jrclust base.name; neuron base.id and waveform_sample_times, rebuilt from origin + spacing to 1.1e-19); nothing invented or unplaced; raw and renamed paths agree or both carry; unread fields carry; broken inputs fail; the converted documents validate. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/+migrators/Contents.m | 23 +- .../+did2/+convert/+migrators/hartley_calc.m | 16 - .../+convert/+migrators/jrclust_clusters.m | 25 - .../+did2/+convert/+migrators/simple_calc.m | 16 - .../+convert/+migrators/speed_tuning_calc.m | 16 - .../+convert/+migrators_j/hartley_calc.m | 117 +- .../+convert/+migrators_j/jrclust_clusters.m | 110 +- .../+migrators_j/neuron_extracellular.m | 125 +- .../+migrators_j/private/jCalculation.m | 19 +- .../+convert/+migrators_j/speed_tuning_calc.m | 89 +- .../+did2/+convert/+roundtrip/hartley_calc.m | 273 ++ .../+convert/+roundtrip/jrclust_clusters.m | 79 + .../+roundtrip/neuron_extracellular.m | 202 ++ .../+convert/+roundtrip/private/speedBlock.m | 171 ++ .../+convert/+roundtrip/speedtuning_calc.m | 61 + src/did/+did2/+convert/Contents.m | 2 +- src/did/+did2/+convert/calcCommon.m | 168 -- src/did/+did2/+convert/rawV1Classes.m | 36 + tests/+did2/+unittest/testMigrators.m | 112 +- .../+did2/+unittest/testRawV1RoundTripSpike.m | 514 ++++ .../fixtures/ndi_templates/hartley_calc.json | 35 + .../hartley_reverse_correlation.json | 34 + .../ndi_templates/jrclust_clusters.json | 23 + tests/+did2/fixtures/ndi_templates/ngrid.json | 19 + .../ndi_templates/reverse_correlation.json | 27 + .../fixtures/ndi_templates/speed_tuning.json | 81 + .../ndi_templates/speedtuning_calc.json | 24 + .../hartley_calc.mock.1.json | 1 + .../speedtuning_calc.mock.1.json | 2425 +++++++++++++++++ 29 files changed, 4467 insertions(+), 376 deletions(-) delete mode 100644 src/did/+did2/+convert/+migrators/hartley_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/jrclust_clusters.m delete mode 100644 src/did/+did2/+convert/+migrators/simple_calc.m delete mode 100644 src/did/+did2/+convert/+migrators/speed_tuning_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/hartley_calc.m create mode 100644 src/did/+did2/+convert/+roundtrip/jrclust_clusters.m create mode 100644 src/did/+did2/+convert/+roundtrip/neuron_extracellular.m create mode 100644 src/did/+did2/+convert/+roundtrip/private/speedBlock.m create mode 100644 src/did/+did2/+convert/+roundtrip/speedtuning_calc.m delete mode 100644 src/did/+did2/+convert/calcCommon.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripSpike.m create mode 100644 tests/+did2/fixtures/ndi_templates/hartley_calc.json create mode 100644 tests/+did2/fixtures/ndi_templates/hartley_reverse_correlation.json create mode 100644 tests/+did2/fixtures/ndi_templates/jrclust_clusters.json create mode 100644 tests/+did2/fixtures/ndi_templates/ngrid.json create mode 100644 tests/+did2/fixtures/ndi_templates/reverse_correlation.json create mode 100644 tests/+did2/fixtures/ndi_templates/speed_tuning.json create mode 100644 tests/+did2/fixtures/ndi_templates/speedtuning_calc.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/hartley_calc.mock.1.json create mode 100644 tests/+did2/fixtures/ndi_writer_outputs/speedtuning_calc.mock.1.json diff --git a/src/did/+did2/+convert/+migrators/Contents.m b/src/did/+did2/+convert/+migrators/Contents.m index a5ca42c3..de1757b1 100644 --- a/src/did/+did2/+convert/+migrators/Contents.m +++ b/src/did/+did2/+convert/+migrators/Contents.m @@ -63,22 +63,15 @@ % grams_per_liter, mass_fraction, % volume_fraction) populated when computable. % -% Calculator-base wrappers (20211116-driven): -% each calls did2.convert.calcCommon to move v1's -% `.input_parameters` into a new inherited `calculator` block. -% The calculator-identity string lives in `app.app_name` (carried in -% v1 as `app.name`) and is handled by the universal app-block field -% rename in did2.convert.universalRenames; the per-class wrapper does -% not have to know its own calculator-name string. -% -% hartley_calc, speed_tuning_calc, simple_calc -% -% The tuning family's wrappers (tuningcurve_calc, oridirtuning_calc, +% The calculator-base wrappers are all deleted, with their shared helper +% calcCommon: the tuning family's (tuningcurve_calc, oridirtuning_calc, % contrast_sensitivity_calc, contrast_tuning_calc, -% spatial_frequency_tuning_calc, temporal_frequency_tuning_calc) are -% deleted: each class has a +migrators_j migrator, so the wrapper was never -% reached, and the class now reads raw v1 (did2.convert.rawV1Classes; -% [early migration pieces fixed] (1), Jess Haley, 2026-10-26). +% spatial_frequency_tuning_calc, temporal_frequency_tuning_calc) and then +% hartley_calc, speed_tuning_calc and simple_calc, with jrclust_clusters' +% rename. Each class has a +migrators_j migrator, so the wrapper was never +% reached; the classes read raw v1 (did2.convert.rawV1Classes; simple_calc +% is not switched, see there; [early migration pieces fixed] (1), Jess +% Haley, 2026-10-26). % % See did-schema's % did-schema's per-class conversion notes (deleted with did-schema #88) for the diff --git a/src/did/+did2/+convert/+migrators/hartley_calc.m b/src/did/+did2/+convert/+migrators/hartley_calc.m deleted file mode 100644 index 7a344edc..00000000 --- a/src/did/+did2/+convert/+migrators/hartley_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = hartley_calc(preBody) -%HARTLEY_CALC Base migrator: did_v1 hartley_calc body -> the class-preserving V2 shape. -% -% a Hartley reverse-correlation analysis. The v1 form -% carries `input_parameters` directly on the hartley_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'hartley_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/jrclust_clusters.m b/src/did/+did2/+convert/+migrators/jrclust_clusters.m deleted file mode 100644 index 87272edd..00000000 --- a/src/did/+did2/+convert/+migrators/jrclust_clusters.m +++ /dev/null @@ -1,25 +0,0 @@ -function v2Body = jrclust_clusters(preBody) -%JRCLUST_CLUSTERS Base migrator: did_v1 jrclust_clusters body -> the class-preserving V2 shape. -% -% Lowercases the v1 `res_mat_MD5_checksum` field name to -% `res_mat_md5_checksum`. universalRenames's snake_case pass treats -% the trailing-camel `Checksum` as a word boundary but leaves the -% embedded `MD5` ALLCAPS run alone, so this class-specific rename -% handles it explicitly. The companion legacy `ndi_document` block -% that v1 sometimes ships on these documents is reconciled in -% universalRenames (the universal `ndi_document -> base` rule). - -arguments - preBody (1,1) struct -end - -v2Body = preBody; -if isfield(v2Body, 'jrclust_clusters') && isstruct(v2Body.jrclust_clusters) - block = v2Body.jrclust_clusters; - if isfield(block, 'res_mat_MD5_checksum') && ~isfield(block, 'res_mat_md5_checksum') - block.res_mat_md5_checksum = block.res_mat_MD5_checksum; - block = rmfield(block, 'res_mat_MD5_checksum'); - end - v2Body.jrclust_clusters = block; -end -end diff --git a/src/did/+did2/+convert/+migrators/simple_calc.m b/src/did/+did2/+convert/+migrators/simple_calc.m deleted file mode 100644 index ad61d906..00000000 --- a/src/did/+did2/+convert/+migrators/simple_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = simple_calc(preBody) -%SIMPLE_CALC Base migrator: did_v1 simple_calc body -> the class-preserving V2 shape. -% -% a simple example calculator. The v1 form -% carries `input_parameters` directly on the simple_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'simple_calc'); -end diff --git a/src/did/+did2/+convert/+migrators/speed_tuning_calc.m b/src/did/+did2/+convert/+migrators/speed_tuning_calc.m deleted file mode 100644 index bcb190e4..00000000 --- a/src/did/+did2/+convert/+migrators/speed_tuning_calc.m +++ /dev/null @@ -1,16 +0,0 @@ -function v2Body = speed_tuning_calc(preBody) -%SPEED_TUNING_CALC Base migrator: did_v1 speed_tuning_calc body -> the class-preserving V2 shape. -% -% a speed tuning fit. The v1 form -% carries `input_parameters` directly on the speed_tuning_calc block; -% V2 moves it to the inherited `calculator` block. The -% calculator-identity string lives in `app.app_name` and is -% handled by the universal `app`-block field rename in -% did2.convert.universalRenames -- not here. - -arguments - preBody (1,1) struct -end - -v2Body = did2.convert.calcCommon(preBody, 'speed_tuning_calc'); -end diff --git a/src/did/+did2/+convert/+migrators_j/hartley_calc.m b/src/did/+did2/+convert/+migrators_j/hartley_calc.m index ab1151e6..2e2479b9 100644 --- a/src/did/+did2/+convert/+migrators_j/hartley_calc.m +++ b/src/did/+did2/+convert/+migrators_j/hartley_calc.m @@ -250,6 +250,43 @@ preBody (1,1) struct end +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): v1_to_v2 hands this migrator the document exactly +% as v1 wrote it, with no universalRenames and no superclass migrator. The one +% superclass migrator the renamed path ran for it, +migrators_j/+super/ngrid.m +% (a guard against a reshaped `ngrid` block; it changes nothing), is called +% here on the raw block ([early migration pieces fixed] (1)); it stays for +% ontology_image, which is not switched. Identity through jRawBody; the `app` +% block in either spelling (did2.convert.v1read.readApp); `frameTimes` as v1 +% writes it (or `frame_times`, the renamed spelling). Every v1 field is +% accounted for: a field this fold reads nowhere carries the document whole as +% v1 (unreadFields below and jCalculation 'AccountForEveryField', carry-056). +% A carry is the untouched v1 source. did2.convert.roundtrip.hartley_calc +% rebuilds the v1 document; testRawV1RoundTripSpike compares the two on the +% writer's own output (NDIcalc-vis-matlab mock/hartley/mock.1.json). +body = jRawBody(preBody, 'hartley_calc'); +collision = jResponseRenameCollisions(preBody, cell(0, 3)); +if ~isempty(collision) + % what universalRenames would have discarded (a depends_on version or + % second id, an ndi_document beside base, two differing app spellings): + % the renamed path carried such a document before any migrator ran, and so + % does this one ([renames carry is temporary]) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'hartley_calc', char(body.base.id), ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); + bodies = {preBody}; + return; +end +body = did2.convert.migrators_j.super.ngrid(body); +bodies = fold(body); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry (or a passthrough) is the untouched v1 source +end +end + +function bodies = fold(preBody) +%FOLD The fold itself, on the identity-normalised raw body (jRawBody). + % `receptive_field.value` declares no sub-fields (the volume is on the plane % bodies, #73 audit 2 D11). Until 2026-10-21 it was also REQUIRED, so no % document could satisfy it and this fold passed through (corpus run @@ -353,11 +390,17 @@ && ~strcmpi(strtrim(char(string(rc.method))), 'Hartley') dropped{end+1} = 'reverse_correlation.method'; end +% every other field of the four hartley blocks is accounted for (unreadFields): +% one this fold reads nowhere is unplaced, and jCalculation carries the +% document whole as v1 (carry-056), as it does for an unread calculator field +dropped = [dropped, unreadFields(preBody)]; bodies = jCalculation(preBody, 'receptive_field_calculation', 'rf', ... 'hartley_calc', 'receptive field', 'ndi.calc.vis.hartley', ... 'ExtraParameters', extra, 'ExtraInputs', inputs, 'DataBody', true, ... 'DatumType', datumType, 'SourceDatumType', sourceDatumType, ... - 'Dropped', dropped); + 'Dropped', dropped, 'AccountForEveryField', true, ... + 'OtherBlocks', {'files', 'hartley_reverse_correlation', 'ngrid', ... + 'reverse_correlation'}); leaf = bodies{1}; if isscalar(bodies) && strcmp(leaf.document_class.class_name, 'hartley_calc') return; % passed through (no subject): no bodies @@ -667,6 +710,78 @@ end end +% ===================== every field accounted for =========================== + +function c = unreadFields(preBody) +%UNREADFIELDS The fields of the hartley blocks this fold reads nowhere and +% that hold a value, as paths (jCalculation prefixes '[carry-056] '). +% +% READ (and where it lands): hartley_reverse_correlation.stimulus_properties +% (compared, above), .reconstruction_properties.{T,X,Y}_coords (the axes), +% .spiketimes (the input body), .frameTimes / .frame_times and +% .hartley_numbers (the stimulus sequence parameters); ngrid.data_dim, +% .coordinates, .data_type (the bodies) and .data_size, left unwritten only +% when it restates the data type's byte size ([restated values checked], +% Jess Haley, 2026-10-26); reverse_correlation.method (implied, above) and +% .dimension_labels (empty, above). A `frameTimes` beside a differing +% `frame_times` states two things, and only one is read. +c = {}; +hrc = blockOf(preBody, 'hartley_reverse_correlation'); +c = [c, rest(hrc, 'hartley_reverse_correlation', {'stimulus_properties', ... + 'reconstruction_properties', 'spiketimes', 'frameTimes', 'frame_times', ... + 'hartley_numbers'})]; +if isfield(hrc, 'frameTimes') && isfield(hrc, 'frame_times') ... + && ~isequaln(hrc.frameTimes, hrc.frame_times) + c{end+1} = 'hartley_reverse_correlation.frame_times (differs from frameTimes)'; +end +if isfield(hrc, 'reconstruction_properties') + c = [c, rest(hrc.reconstruction_properties, ... + 'hartley_reverse_correlation.reconstruction_properties', ... + {'T_coords', 'X_coords', 'Y_coords'})]; +end +ng = blockOf(preBody, 'ngrid'); +c = [c, rest(ng, 'ngrid', {'data_size', 'data_type', 'data_dim', 'coordinates'})]; +if isfield(ng, 'data_size') && ~isEmptyValue(ng.data_size) + want = bytesOf(fieldOr(ng, 'data_type', '')); + if isempty(want) || ~isnumeric(ng.data_size) || ~isscalar(ng.data_size) ... + || double(ng.data_size) ~= want + c{end+1} = 'ngrid.data_size (does not restate the data type''s byte size)'; + end +end +c = [c, rest(blockOf(preBody, 'reverse_correlation'), 'reverse_correlation', ... + {'method', 'dimension_labels'})]; +end + +function c = rest(blk, path, read) +%REST The fields of BLK outside READ that hold a value, as 'PATH.field'. +c = {}; +if ~isstruct(blk) || ~isscalar(blk) + return; +end +fns = fieldnames(blk); +for k = 1:numel(fns) + if ~any(strcmp(fns{k}, read)) && ~isEmptyValue(blk.(fns{k})) + c{end+1} = [path '.' fns{k}]; %#ok + end +end +end + +function n = bytesOf(dataType) +%BYTESOF The byte size NDI's mat2ngrid stores as `data_size` for DATATYPE +% ([] for a type it does not name). +n = []; +switch lower(strtrim(char(string(dataType)))) + case {'double', 'int64', 'uint64'} + n = 8; + case {'single', 'int32', 'uint32'} + n = 4; + case {'int16', 'uint16'} + n = 2; + case {'int8', 'uint8', 'char', 'logical'} + n = 1; +end +end + % ===================== small readers ======================================= function b = blockOf(preBody, name) diff --git a/src/did/+did2/+convert/+migrators_j/jrclust_clusters.m b/src/did/+did2/+convert/+migrators_j/jrclust_clusters.m index bb82ba12..1d166d33 100644 --- a/src/did/+did2/+convert/+migrators_j/jrclust_clusters.m +++ b/src/did/+did2/+convert/+migrators_j/jrclust_clusters.m @@ -62,7 +62,43 @@ preBody (1,1) struct end -TV = 'V_eta'; +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): the document exactly as NDI's writer +% (+ndi/+fun/+probe/+import/+jrclust/probe.m) wrote it, with no +% universalRenames and no superclass migrator (none exists for `base` or +% `app`; the old +migrators/jrclust_clusters.m, a rename of +% res_mat_MD5_checksum, was never reached and is deleted). The checksum is read +% in either spelling; identity through jRawBody; the `app` block in either +% spelling (jSoftwareFromApp, checked by did2.convert.v1read.readApp). What +% universalRenames would have discarded (an `ndi_document` beside `base`, e.g. +% the Soph vintage's ndi_document.name 'jrclust.prm'; a depends_on version) +% carries the document as the renamed path did (carry-049; [one-reading quick +% answers] Q5, Jess Haley, 2026-10-26). Every other v1 field is accounted for +% (unreadFields): one this fold reads nowhere carries the document whole as +% v1. base.name, which the writer sets to the parameter file's name, is not +% written (#73 item 54), as before the switch: the round trip lists it +% (testRawV1RoundTripSpike, a known finding; open). A carry is the untouched +% v1 source. Inverse: did2.convert.roundtrip.jrclust_clusters. +raw = preBody; +preBody = jRawBody(raw, 'jrclust_clusters'); +collision = jResponseRenameCollisions(raw, cell(0, 3)); +if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'jrclust_clusters', char(preBody.base.id), ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); + bodies = {raw}; + return; +end +unplaced = unreadFields(preBody); +if ~isempty(unplaced) + % carry-register: none (a jrclust_clusters field this fold reads nowhere; + % no row yet) + did2.convert.reportNote('carried_as_v1', 'jrclust_clusters', char(preBody.base.id), ... + ['unplaced: ' strjoin(unplaced, ', ')]); + bodies = {raw}; + return; +end + blk = getBlock(preBody, 'jrclust_clusters'); subjectId = firstNonEmpty(dependencyValue(preBody, 'element_id'), ... @@ -114,6 +150,78 @@ bodies = [{obs, body, anchor}, software, runDocs]; end +% ===================== every field accounted for =========================== + +function c = unreadFields(preBody) +%UNREADFIELDS The v1 fields this fold reads nowhere that hold a value: a +% top-level block other than the five jrclust/probe.m writes (plus a `files` +% / `file` block, which rides on the body); a jrclust_clusters field other +% than the checksum, or the checksum in both spellings with different +% values; an `app` field outside NDI's app.json; a depends_on edge other than +% element_id (or subject_id, read when there is no element_id). +c = {}; +known = {'document_class', 'depends_on', 'base', 'app', 'jrclust_clusters', ... + 'files', 'file'}; +top = fieldnames(preBody); +for k = 1:numel(top) + if ~any(strcmp(top{k}, known)) && ~isEmptyValue(preBody.(top{k})) + c{end+1} = top{k}; %#ok + end +end +blk = getBlock(preBody, 'jrclust_clusters'); +fns = fieldnames(blk); +for k = 1:numel(fns) + if ~any(strcmp(fns{k}, {'res_mat_MD5_checksum', 'res_mat_md5_checksum'})) ... + && ~isEmptyValue(blk.(fns{k})) + c{end+1} = ['jrclust_clusters.' fns{k}]; %#ok + end +end +if isfield(blk, 'res_mat_MD5_checksum') && isfield(blk, 'res_mat_md5_checksum') ... + && ~isequaln(blk.res_mat_MD5_checksum, blk.res_mat_md5_checksum) + c{end+1} = 'jrclust_clusters.res_mat_md5_checksum (differs from res_mat_MD5_checksum)'; +end +c = [c, appRest(preBody)]; +deps = did2.convert.v1read.readDependsOn(preBody); +for k = 1:numel(deps) + nm = deps(k).name; + if isempty(deps(k).document_id) || strcmp(nm, 'element_id') ... + || (strcmp(nm, 'subject_id') && isempty(dependencyValue(preBody, 'element_id'))) + continue; + end + c{end+1} = ['depends_on ' nm]; %#ok +end +end + +function c = appRest(preBody) +c = {}; +a = did2.convert.v1read.readApp(preBody); +ex = fieldnames(a.extra); +for k = 1:numel(ex) + if ~isEmptyValue(a.extra.(ex{k})) + c{end+1} = ['app.' ex{k}]; %#ok + end +end +end + +function tf = isEmptyValue(v) +if isstruct(v) + tf = true; + for k = 1:numel(v) + fns = fieldnames(v(k)); + for j = 1:numel(fns) + if ~isEmptyValue(v(k).(fns{j})) + tf = false; + return; + end + end + end +elseif isstring(v) + tf = isempty(v) || all(strlength(v) == 0); +else + tf = isempty(v); +end +end + % ===================== small helpers ======================================= function t = otTerm(name) diff --git a/src/did/+did2/+convert/+migrators_j/neuron_extracellular.m b/src/did/+did2/+convert/+migrators_j/neuron_extracellular.m index f13191ea..4f3ed7d7 100644 --- a/src/did/+did2/+convert/+migrators_j/neuron_extracellular.m +++ b/src/did/+did2/+convert/+migrators_j/neuron_extracellular.m @@ -309,6 +309,37 @@ preBody (1,1) struct end +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]): the document exactly as NDI's writers wrote it +% (+ndi/+fun/+probe/+import/+jrclust/probe.m, +kilosort/probe.m, +% +kiasort/probe.m, +ndi/+app/spikesorter.m), with no universalRenames and no +% superclass migrator (none exists for `base` or `app`). Identity through +% jRawBody; the `app` block in either spelling (jSoftwareFromApp, checked by +% did2.convert.v1read.readApp). What universalRenames would have discarded +% carries the document as the renamed path did (carry-049). Every other v1 +% field is accounted for (unreadFields): one this fold reads nowhere carries +% the document whole as v1. A carry is the untouched v1 source. Inverse: +% did2.convert.roundtrip.neuron_extracellular; testRawV1RoundTripSpike. +raw = preBody; +preBody = jRawBody(raw, 'neuron_extracellular'); +collision = jResponseRenameCollisions(raw, cell(0, 3)); +if ~isempty(collision) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', 'neuron_extracellular', char(preBody.base.id), ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); + bodies = {raw}; + return; +end +unread = unreadFields(preBody); +if ~isempty(unread) + % carry-register: none (a neuron_extracellular field this fold reads + % nowhere; no row yet) + did2.convert.reportNote('carried_as_v1', 'neuron_extracellular', char(preBody.base.id), ... + ['unplaced: ' strjoin(unread, ', ')]); + bodies = {raw}; + return; +end + blk = getBlock(preBody, 'neuron_extracellular'); % ---- the two count fields are droppable only if they AGREE ------------------ @@ -344,7 +375,7 @@ % default) did2.convert.reportNote('carried_as_v1', 'neuron_extracellular', ... char(baseField(preBody, 'id', '')), [carryTag 'unplaced: ' strjoin(unplaced, ', ')]); - bodies = {preBody}; + bodies = {raw}; return; end @@ -596,6 +627,98 @@ isRegular = max(abs(model - t)) <= tolerance; end +% ===================== every field accounted for =========================== + +function c = unreadFields(preBody) +%UNREADFIELDS The v1 fields this fold reads nowhere that hold a value: a +% top-level block other than the five NDI's template declares; a +% neuron_extracellular field other than its seven; an `app` field outside +% NDI's app.json; a depends_on edge other than element_id (or subject_id, +% read when there is no element_id) and spike_clusters_id. A cluster index +% that is not a whole number is unplaced too: the unit's name and its label +% calculation state it rounded. +c = {}; +known = {'document_class', 'depends_on', 'base', 'app', 'neuron_extracellular'}; +top = fieldnames(preBody); +for k = 1:numel(top) + if ~any(strcmp(top{k}, known)) && ~isEmptyValue(preBody.(top{k})) + c{end+1} = top{k}; %#ok + end +end +blk = getBlock(preBody, 'neuron_extracellular'); +read = {'number_of_samples_per_channel', 'number_of_channels', 'mean_waveform', ... + 'waveform_sample_times', 'cluster_index', 'quality_number', 'quality_label'}; +fns = fieldnames(blk); +for k = 1:numel(fns) + if ~any(strcmp(fns{k}, read)) && ~isEmptyValue(blk.(fns{k})) + c{end+1} = ['neuron_extracellular.' fns{k}]; %#ok + end +end +w = getField(blk, 'mean_waveform'); +t = getField(blk, 'waveform_sample_times'); +hasW = isnumeric(w) && ~isempty(w); +hasT = isnumeric(t) && ~isempty(t); +if ~isempty(w) && ~(isnumeric(w) && ismatrix(w)) + c{end+1} = 'neuron_extracellular.mean_waveform (not a numeric matrix)'; +elseif hasW && ~hasT + c{end+1} = 'neuron_extracellular.mean_waveform (no waveform_sample_times to place it on)'; +end +if ~isempty(t) && ~isnumeric(t) + c{end+1} = 'neuron_extracellular.waveform_sample_times (not numeric)'; +elseif hasT && ~hasW + c{end+1} = 'neuron_extracellular.waveform_sample_times (no mean_waveform to place them on)'; +end +ci = getField(blk, 'cluster_index'); +if ~isempty(ci) && (~isnumeric(ci) || ~isscalar(ci) || ~isfinite(ci) || ci ~= round(ci)) + c{end+1} = 'neuron_extracellular.cluster_index (not one whole number)'; +end +qn = getField(blk, 'quality_number'); +if ~isempty(qn) && ~(isnumeric(qn) && isscalar(qn)) + c{end+1} = 'neuron_extracellular.quality_number (not one number)'; +end +ql = getField(blk, 'quality_label'); +if ~isempty(ql) && ~(ischar(ql) || (isstring(ql) && isscalar(ql))) + c{end+1} = 'neuron_extracellular.quality_label (not text)'; +elseif ~isempty(ql) && ~strcmp(strtrim(char(ql)), char(ql)) + c{end+1} = 'neuron_extracellular.quality_label (surrounding spaces)'; +end +a = did2.convert.v1read.readApp(preBody); +ex = fieldnames(a.extra); +for k = 1:numel(ex) + if ~isEmptyValue(a.extra.(ex{k})) + c{end+1} = ['app.' ex{k}]; %#ok + end +end +deps = did2.convert.v1read.readDependsOn(preBody); +for k = 1:numel(deps) + nm = deps(k).name; + if isempty(deps(k).document_id) || any(strcmp(nm, {'element_id', 'spike_clusters_id'})) ... + || (strcmp(nm, 'subject_id') && isempty(dependencyValue(preBody, 'element_id'))) + continue; + end + c{end+1} = ['depends_on ' nm]; %#ok +end +end + +function tf = isEmptyValue(v) +if isstruct(v) + tf = true; + for k = 1:numel(v) + fns = fieldnames(v(k)); + for j = 1:numel(fns) + if ~isEmptyValue(v(k).(fns{j})) + tf = false; + return; + end + end + end +elseif isstring(v) + tf = isempty(v) || all(strlength(v) == 0); +else + tf = isempty(v); +end +end + % ===================== small helpers ======================================= function t = otTerm(node, name) diff --git a/src/did/+did2/+convert/+migrators_j/private/jCalculation.m b/src/did/+did2/+convert/+migrators_j/private/jCalculation.m index edc315e4..3e0515d2 100644 --- a/src/did/+did2/+convert/+migrators_j/private/jCalculation.m +++ b/src/did/+did2/+convert/+migrators_j/private/jCalculation.m @@ -75,7 +75,9 @@ % of these, when it holds a value, is unplaced (carry-056) and carries the % document whole as v1: % - a top-level block other than document_class, depends_on, base, app, -% calculator, the calculator's own block and SOURCEBLOCK; +% calculator, the calculator's own block, SOURCEBLOCK and OPTS.OtherBlocks +% (blocks whose fields the caller accounts for itself: hartley_calc's +% files, hartley_reverse_correlation, ngrid, reverse_correlation); % - a field of the calculator's own block other than input_parameters and % depends_on (tuningcurve_calc's `log` and `stim_property_list`); for % 'csf' (the block IS the result), a field jContrastSensitivityValue @@ -104,6 +106,7 @@ opts.SourceDatumType = '' opts.Dropped = {} % more dropped v1 field paths, reported verbatim opts.AccountForEveryField (1,1) logical = false % see ACCOUNTED FOR below + opts.OtherBlocks = {} % more top-level blocks the CALLER accounts for end srcBlk = struct(); @@ -162,7 +165,7 @@ cellfun(@(d) ['[carry-056] ' char(d)], reshape(opts.Dropped, 1, []), ... 'UniformOutput', false)]; if opts.AccountForEveryField - unplaced = [unplaced, unaccounted(preBody, sourceBlock, family)]; + unplaced = [unplaced, unaccounted(preBody, sourceBlock, family, opts.OtherBlocks)]; end % The calculator block's inner `depends_on` copy (e.g. % `oridirtuning_calc.depends_on`) is left unwritten only when it restates the @@ -237,12 +240,13 @@ end end -function c = unaccounted(preBody, sourceBlock, family) +function c = unaccounted(preBody, sourceBlock, family, otherBlocks) %UNACCOUNTED The fields of PREBODY the fold does not read and that hold a % value, each as '[carry-056] ' (see ACCOUNTED FOR in the header). c = {}; leaf = classNameOf(preBody); -known = {'document_class', 'depends_on', 'base', 'app', 'calculator', leaf, sourceBlock}; +known = [{'document_class', 'depends_on', 'base', 'app', 'calculator', leaf, sourceBlock}, ... + reshape(cellstr(otherBlocks), 1, [])]; top = fieldnames(preBody); for k = 1:numel(top) if ~any(strcmp(top{k}, known)) && ~isEmptyValue(preBody.(top{k})) @@ -259,7 +263,9 @@ end end c = [c, blockRest(preBody, leaf, read, true)]; -elseif ~strcmp(leaf, sourceBlock) +elseif ~strcmp(leaf, sourceBlock) || strcmp(family, 'rf') + % (receptive field: the calculator's own block is also its source block, + % and holds only input_parameters and depends_on) c = [c, blockRest(preBody, leaf, {'input_parameters', 'depends_on'}, false)]; end c = [c, blockRest(preBody, 'calculator', {}, false)]; @@ -275,7 +281,8 @@ end inputs = {'element_id', 'stimulus_tuningcurve_id', 'stimulus_response_scalar_id', ... 'stimulus_response_id'}; -if strcmp(family, 'csf') +if any(strcmp(family, {'csf', 'rf'})) + % (the receptive field writes it through OPTS.ExtraInputs: hartley_calc) inputs{end+1} = 'stimulus_presentation_id'; end % the contrast tuning inputs inputIds reads: contrasttuning_id_1, _2, ... up diff --git a/src/did/+did2/+convert/+migrators_j/speed_tuning_calc.m b/src/did/+did2/+convert/+migrators_j/speed_tuning_calc.m index 40fbd2f8..29dbba89 100644 --- a/src/did/+did2/+convert/+migrators_j/speed_tuning_calc.m +++ b/src/did/+did2/+convert/+migrators_j/speed_tuning_calc.m @@ -11,9 +11,94 @@ % % Fold is 1 -> 1 with base.id + depends_on preserved. See % did2.convert.migrators_j.private.jCalculation. +% +% READS RAW v1 (did2.convert.rawV1Classes; Decided by Jess Haley, 2026-10-26 +% [migrators read raw v1]). NDIcalc-vis-matlab's ndi.calc.vis.speed_tuning +% writes the class as `speedtuning_calc` (its template calc/speedtuning_calc.json +% and its stored self-test output mock/speed_tuning/mock.N.json); +% rawV1Classes' one table maps that spelling to this migrator. The renamed +% path never did (universalRenames maps only the contrast spellings), so +% before the switch a writer's document passed through unconverted. The +% document is read exactly as v1 wrote it: identity through jRawBody, the +% `app` block in either spelling (did2.convert.v1read.readApp), and every +% other field accounted for (jCalculation 'AccountForEveryField': a field the +% fold reads nowhere carries the document whole as v1, carry-056). A carry is +% the untouched v1 source. did2.convert.roundtrip.speedtuning_calc rebuilds +% the v1 document; testRawV1RoundTripSpike compares the two on the writer's +% output. arguments preBody (1,1) struct end -bodies = jCalculation(preBody, 'speed_tuning_calculation', 'speed', ... - 'speed_tuning', 'speed tuning', 'ndi.calc.vis.speed'); +body = jRawBody(preBody, 'speed_tuning_calc'); +collision = jResponseRenameCollisions(preBody, cell(0, 3)); +if ~isempty(collision) + % what universalRenames would have discarded: the renamed path carried such + % a document before any migrator ran ([renames carry is temporary]) + % carry-register: carry-049 (the renamed path carried this collision) + did2.convert.reportNote('carried_as_v1', classNameOf(preBody), char(body.base.id), ... + ['[carry-049] universalRenames would discard: ' strjoin(collision, ', ')]); + bodies = {preBody}; + return; +end +bodies = jCalculation(body, 'speed_tuning_calculation', 'speed', ... + 'speed_tuning', 'speed tuning', 'ndi.calc.vis.speed', ... + 'AccountForEveryField', true); +if isscalar(bodies) && isequaln(bodies{1}, body) + bodies = {preBody}; % a carry is the untouched v1 source + return; +end +% THE FIT BLOCKS MUST STAY TELLABLE APART. jTuningCurve names each model_fit +% entry by its field prefix, so the writer's three blocks `fit`, +% `fit_no_speed` and `fit_fullspeed` (all `Priebe_fit_*`) become three entries +% named 'Priebe fit', and which one is the free fit, which has the speed index +% fixed at 0 and which at 1 is kept only by their order. A V2 reader cannot +% tell them apart, and the v1 block names are not recoverable ([lossless means +% round trip]): the document is carried whole as v1 instead (carry-056: the +% block names have no home), until the team decides how the fits are told +% apart (e.g. by the fit's constraints, as [Naka-Rushton is one function] does +% for the contrast fits). +dup = duplicateFitModels(bodies{1}); +if ~isempty(dup) + % carry-register: carry-056 (the fit block names have no home) + did2.convert.reportNote('carried_as_v1', classNameOf(preBody), char(body.base.id), ... + sprintf('unplaced: [carry-056] %s (%d fit blocks become model_fit entries all named ''%s'')', ... + strjoin(fitBlocksOf(body), ', '), dup{2}, dup{1})); + bodies = {preBody}; +end +end + +function dup = duplicateFitModels(leaf) +%DUPLICATEFITMODELS {name, count} of a model name two or more model_fit +% entries share, or {} when every entry's model is its own. +dup = {}; +mf = {}; +if isfield(leaf, 'tuning_curve') && isfield(leaf.tuning_curve, 'value') ... + && isfield(leaf.tuning_curve.value, 'model_fit') + mf = leaf.tuning_curve.value.model_fit; +end +if isstruct(mf); mf = num2cell(mf); end +names = {}; +for k = 1:numel(mf) + m = mf{k}.model; + if iscell(m); m = m{1}; end + names{end+1} = char(m.name); %#ok +end +[u, ~, j] = unique(names); +c = accumarray(j(:), 1); +if any(c > 1) + i = find(c > 1, 1); + dup = {u{i}, c(i)}; +end +end + +function c = fitBlocksOf(body) +c = {}; +if ~isfield(body, 'speed_tuning') || ~isstruct(body.speed_tuning); return; end +fns = fieldnames(body.speed_tuning); +c = cellfun(@(f) ['speed_tuning.' f], fns(strcmp(fns, 'fit') | startsWith(fns, 'fit_')), ... + 'UniformOutput', false)'; +end + +function cn = classNameOf(b) +cn = char(did2.convert.v1read.readStamp(b).class_name); end diff --git a/src/did/+did2/+convert/+roundtrip/hartley_calc.m b/src/did/+did2/+convert/+roundtrip/hartley_calc.m new file mode 100644 index 00000000..e8cf3ae2 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/hartley_calc.m @@ -0,0 +1,273 @@ +function [v1, spec] = hartley_calc(bodies) +%HARTLEY_CALC Rebuild a v1 `hartley_calc` from what +% did2.convert.migrators_j.hartley_calc emitted when it CONVERTED it: the +% `receptive_field_calculation` (the source id), its two plane bodies and +% its spike-time body (`sampled_body`), the session anchor and the software +% entities (with their version assertions). +% +% [V1, SPEC] = did2.convert.roundtrip.hartley_calc(BODIES). V1 is the +% document in the shape NDIcalc-vis-matlab ndi.calc.vis.hartley writes it +% (its stored self-test output, mock/hartley/mock.1.json, and the corpus +% vintage: hartley_calc + hartley_reverse_correlation + reverse_correlation +% + ngrid + app + base): +% +% identity, `app` calcParts (method term ndi.calc.vis.hartley) +% depends_on element_id (entity_id), +% stimulus_presentation_id (input_id) +% hartley_calc.input_parameters the method parameters other than the +% stimulus sequence +% hartley_calc.depends_on restates the top-level element_id +% (SPEC.equivalents, [restated values checked]) +% hartley_reverse_correlation +% .reconstruction_properties T_coords: the plane bodies' `lag` +% covariate; X_coords, Y_coords: the two +% other dimensions' covariates, or the index +% 1..n when they have none (jNgridBody writes +% none for the default index vector) +% .spiketimes the spike-time body's `time` covariate +% .frameTimes, .hartley_numbers the `stimulus sequence` parameters +% .stimulus_properties left unwritten only when equal to the +% referenced presentation's generator +% settings ([hartley leftovers checked]): +% rebuilt from them +% (did2.convert.stimulusPresentationSpecs, the +% batch v1_to_v2 indexed), compared +% orientation-insensitively (SPEC.same) +% ngrid.data_dim the plane's extents, then the plane count +% ngrid.coordinates [T; X; Y], the writer's order +% ngrid.data_type the calculation's source_data_type +% ngrid.data_size restates the data type's byte size +% (SPEC.equivalents) +% reverse_correlation.method 'Hartley', implied by the method term +% ([hartley method implied]); '' restated +% files the first plane body's, as v1 wrote them +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.hartley_calc. + +arguments + bodies cell +end + +n = numel(bodies); +isBody = cellfun(@(b) strcmp(classNameOf(b), 'sampled_body'), bodies); +[v1, leaf, inputs, spec] = calcParts(bodies(~isBody), 'receptive_field_calculation', ... + 'hartley_calc', 'ndi.calc.vis.hartley'); +if isempty(leaf) + return; +end +leafId = char(getIn(leaf, 'base', 'id')); + +% ---- the bodies ------------------------------------------------------------- +planes = {}; +planeNames = {}; +spike = []; +for k = find(isBody) + b = bodies{k}; + if ~isequal(edgeIds(b, 'owner_id'), {leafId}) + spec.unplaced{end+1} = sprintf('sampled_body %d is not owned by the calculation', k); + continue; + end + [~, plane] = termParts(getIn(b, 'data_body', 'conditions', 'term')); + if ~isempty(plane) + planes{end+1} = b; %#ok + planeNames{end+1} = plane; %#ok + elseif isempty(spike) + spike = b; + else + spec.unplaced{end+1} = sprintf('sampled_body %d has no role in a hartley_calc', k); + end +end +if ~isequal(planeNames, {'response estimate', 'significance'}) + spec.unplaced{end+1} = sprintf('the plane bodies are {%s}, not the response estimate and the significance', ... + strjoin(planeNames, ', ')); +end + +% ---- identity, edges ---------------------------------------------------------- +entity = edgeIds(leaf, 'entity_id'); +names = {'element_id'}; +values = {''}; +if isscalar(entity) + values = entity; +else + spec.unplaced{end+1} = sprintf('%d entity_id edges', numel(entity)); +end +presentationId = ''; +if ~isempty(inputs) + presentationId = inputs{1}; + names{end+1} = 'stimulus_presentation_id'; + values{end+1} = presentationId; +end +for k = 2:numel(inputs) + spec.unplaced{end+1} = sprintf('input_id %s has no v1 edge name', inputs{k}); +end +v1.depends_on = struct('name', names, 'value', values); + +% ---- hartley_calc: input parameters, the inner depends_on copy ----------------- +hc = v1.hartley_calc; +seq = struct(); +if isfield(hc, 'input_parameters') && isfield(hc.input_parameters, 'stimulus_sequence') + seq = hc.input_parameters.stimulus_sequence; + hc.input_parameters = rmfield(hc.input_parameters, 'stimulus_sequence'); +end +v1.hartley_calc = hc; +why = ['the calculator block''s inner depends_on copy restates a top-level ' ... + 'edge ([restated values checked], Jess Haley, 2026-10-26)']; +for k = 1:numel(names) + spec.equivalents(end+1) = struct('path', sprintf('hartley_calc.depends_on(%d).name', k), ... + 'values', {names}, 'why', why); + spec.equivalents(end+1) = struct('path', sprintf('hartley_calc.depends_on(%d).value', k), ... + 'values', {values}, 'why', why); +end + +% ---- the response volume: ngrid + reconstruction_properties -------------------- +hrc = struct(); +ng = struct(); +if ~isempty(planes) + [ext, coords, bad] = planeAxes(planes{1}); + spec.unplaced = [spec.unplaced, bad]; + for k = 2:numel(planes) + [e2, c2] = planeAxes(planes{k}); + if ~isequal(e2, ext) || ~isequal(c2, coords) + spec.unplaced{end+1} = sprintf('plane %d describes another volume', k); %#ok + end + end + if numel(coords) == 3 + T = coords{1}; + X = coords{2}; + Y = coords{3}; + hrc.reconstruction_properties = struct('T_coords', T, 'X_coords', X, 'Y_coords', Y); + ng.coordinates = [T; X; Y]; + end + ng.data_dim = [ext(:); numel(planes)]; + for f = {'files', 'file'} + if isfield(planes{1}, f{1}) + v1.(f{1}) = planes{1}.(f{1}); + end + end +end +dataType = char(getIn(leaf, 'value', 'source_data_type')); +if ~isempty(dataType) + ng.data_type = dataType; + bytes = bytesOf(dataType); + if ~isempty(bytes) + spec.equivalents(end+1) = struct('path', 'ngrid.data_size', 'values', {{bytes}}, ... + 'why', 'the byte size the data type states ([restated values checked])'); + end +end + +% ---- the spike times, the stimulus sequence ------------------------------------- +if ~isempty(spike) + c = asCell(getIn(spike, 'data', 'covariates')); + if isscalar(c) + hrc.spiketimes = column(getIn(c{1}, 'quantity', 'value')); + else + spec.unplaced{end+1} = 'the spike-time body has no single time covariate'; + end +end +if isstruct(seq) && isfield(seq, 'frame_times') + hrc.frameTimes = column(seq.frame_times); +end +if isstruct(seq) && isfield(seq, 'hartley_numbers') + hn = seq.hartley_numbers; + fns = fieldnames(hn); + for k = 1:numel(fns) + hn.(fns{k}) = column(hn.(fns{k})); + end + hrc.hartley_numbers = hn; +end + +% ---- stimulus_properties: the presentation's settings --------------------------- +KEYS = {'M', 'M'; 'L_max', 'L_absmax'; 'K_max', 'K_absmax'; 'sf_max', 'sfmax'; ... + 'fps', 'fps'; 'color_high', 'chromhigh'; 'color_low', 'chromlow'; 'rect', 'rect'}; +[pspec, found] = did2.convert.stimulusPresentationSpecs('get', presentationId); +if found && isstruct(pspec) + sp = struct(); + for k = 1:size(KEYS, 1) + if isfield(pspec, KEYS{k, 2}) + sp.(KEYS{k, 1}) = pspec.(KEYS{k, 2}); + spec.same(end+1) = struct('path', ['hartley_reverse_correlation.stimulus_properties.' KEYS{k, 1}], ... + 'fn', @sameNumbers, 'why', ['equal to the presentation''s generator setting ' ... + KEYS{k, 2} ' ([hartley leftovers checked]; compared as hartley_calc.m does)']); + end + end + hrc.stimulus_properties = sp; +end +v1.hartley_reverse_correlation = hrc; +v1.ngrid = ng; + +% ---- reverse_correlation --------------------------------------------------------- +[~, method] = termParts(getIn(leaf, 'interaction', 'method', 'term')); +if strcmpi(method, 'ndi.calc.vis.hartley') + v1.reverse_correlation = struct('method', 'Hartley'); + spec.equivalents(end+1) = struct('path', 'reverse_correlation.method', ... + 'values', {{'Hartley', ''}}, 'why', ['implied by the method term ' ... + 'ndi.calc.vis.hartley ([hartley method implied]); an empty one too']); +else + spec.unplaced{end+1} = sprintf('the method term is "%s", not ndi.calc.vis.hartley', method); +end +if n == 0 + spec.unplaced{end+1} = 'nothing was emitted'; +end +end + +% ============================================================================= + +function [ext, coords, bad] = planeAxes(b) +% the plane's extents in dimension order, and the coordinate vectors in the +% writer's [T; X; Y] order: the `lag` dimension, then the other two in order +bad = {}; +coords = {}; +dims = asCell(getIn(b, 'data', 'dimensions')); +ext = zeros(1, numel(dims)); +labels = cell(1, numel(dims)); +for k = 1:numel(dims) + ext(k) = numberOf(getIn(dims{k}, 'n')); + [~, labels{k}] = termParts(getIn(dims{k}, 'term')); +end +vals = cell(1, numel(dims)); +covs = asCell(getIn(b, 'data', 'covariates')); +for k = 1:numel(covs) + a = numberOf(getIn(covs{k}, 'along')); + if isempty(a) || a < 0 || a >= numel(dims) + bad{end+1} = sprintf('covariate %d is along no dimension', k); %#ok + continue; + end + vals{a + 1} = column(getIn(covs{k}, 'quantity', 'value')); +end +for k = 1:numel(dims) + if isempty(vals{k}) + vals{k} = (1:ext(k))'; % jNgridBody writes no covariate for 1..n + end +end +lag = find(strcmp(labels, 'lag')); +if ~isscalar(lag) || numel(dims) ~= 3 + bad{end+1} = 'the plane is not (axis, axis, lag)'; + return; +end +others = setdiff(1:numel(dims), lag); +coords = [vals(lag), vals(others)]; +end + +function n = bytesOf(dataType) +% the byte size mat2ngrid stores for DATATYPE (hartley_calc.m's bytesOf) +n = []; +switch lower(strtrim(dataType)) + case {'double', 'int64', 'uint64'} + n = 8; + case {'single', 'int32', 'uint32'} + n = 4; + case {'int16', 'uint16'} + n = 2; + case {'int8', 'uint8', 'char', 'logical'} + n = 1; +end +end + +function tf = sameNumbers(a, b) +% numeric vectors by value, whatever their orientation; anything else exactly +if isnumeric(a) && isnumeric(b) + tf = isequaln(double(a(:)), double(b(:))); +else + tf = isequaln(a, b); +end +end diff --git a/src/did/+did2/+convert/+roundtrip/jrclust_clusters.m b/src/did/+did2/+convert/+roundtrip/jrclust_clusters.m new file mode 100644 index 00000000..94e84fb6 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/jrclust_clusters.m @@ -0,0 +1,79 @@ +function [v1, spec] = jrclust_clusters(bodies) +%JRCLUST_CLUSTERS Rebuild a v1 `jrclust_clusters` from what +% did2.convert.migrators_j.jrclust_clusters emitted when it CONVERTED it: the +% label `calculation` (the source id), its `opaque_body`, the session anchor +% and the software entities (with their version assertions). +% +% [V1, SPEC] = did2.convert.roundtrip.jrclust_clusters(BODIES). V1 is the +% document in the shape NDI-matlab +ndi/+fun/+probe/+import/+jrclust/probe.m +% writes it (jrclust_clusters.json + app.json + base.json at the locked +% `main` 3cb19a8): +% +% identity, `app` calcParts (the calculation; a software +% entity named 'jrclust' with no version +% and no url is the one the migrator +% mints when v1 has no `app`, and writes +% no app block) +% depends_on element_id the calculation's entity_id +% jrclust_clusters.res_mat_MD5_checksum the opaque body's description, +% 'JRCLUST results (res_mat_MD5_checksum: X)' +% files / file the opaque body's, as v1 wrote them +% +% base.name is not rebuilt: V2 does not write it (#73 item 54), and the +% writer sets it to the parameter file's name ('jrclust.prm'), so the round +% trip reports it lost (a known finding, testRawV1RoundTripSpike; open). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.jrclust_clusters. + +arguments + bodies cell +end + +used = false(1, numel(bodies)); +ob = []; +for k = 1:numel(bodies) + if strcmp(classNameOf(bodies{k}), 'opaque_body') && isempty(ob) + ob = bodies{k}; + used(k) = true; + end +end +[v1, leaf, ~, spec] = calcParts(bodies(~used), 'calculation', 'jrclust_clusters', 'jrclust'); +if isempty(leaf) + return; +end +v1 = rmfield(v1, 'jrclust_clusters'); % (calcParts' input_parameters block: none here) +blk = struct(); +if isempty(ob) + spec.unplaced{end+1} = 'no opaque_body was emitted'; +else + owner = edgeIds(ob, 'owner_id'); + if ~isequal(owner, {char(getIn(leaf, 'base', 'id'))}) + spec.unplaced{end+1} = 'the opaque_body is not owned by the calculation'; + end + d = char(getIn(ob, 'data_body', 'description')); + tok = regexp(d, '^JRCLUST results \(res_mat_MD5_checksum: (.*)\)$', 'tokens', 'once'); + if ~isempty(tok) + blk.res_mat_MD5_checksum = tok{1}; + end + % the v1 attachment rides on the body as v1 wrote it; a body with none + % carries only the builder's own declaration, {file_list: body_data_0} + for f = {'files', 'file'} + if isfield(ob, f{1}) && ~isBuilderDefault(ob.(f{1})) + v1.(f{1}) = ob.(f{1}); + end + end +end +v1.jrclust_clusters = blk; +entity = edgeIds(leaf, 'entity_id'); +if isscalar(entity) + v1.depends_on = struct('name', 'element_id', 'value', entity{1}); +else + spec.unplaced{end+1} = sprintf('%d entity_id edges', numel(entity)); +end +end + +function tf = isBuilderDefault(f) +%ISBUILDERDEFAULT The file declaration did2.build gives a body with no v1 file. +tf = isstruct(f) && isscalar(f) && isequal(fieldnames(f), {'file_list'}) ... + && isequal(cellstr(f.file_list), {'body_data_0'}); +end diff --git a/src/did/+did2/+convert/+roundtrip/neuron_extracellular.m b/src/did/+did2/+convert/+roundtrip/neuron_extracellular.m new file mode 100644 index 00000000..8ad51aa8 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/neuron_extracellular.m @@ -0,0 +1,202 @@ +function [v1, spec] = neuron_extracellular(bodies) +%NEURON_EXTRACELLULAR Rebuild a v1 `neuron_extracellular` from what +% did2.convert.migrators_j.neuron_extracellular emitted when it CONVERTED it: +% the sorted unit (an `entity` of type cell), its derived_from relation to +% the recording element, the session anchor, the calculations about the unit +% (cluster index and quality label: `label`; mean waveform: `voltage`; +% quality number: `score`) and the software entities (with their version +% assertions). +% +% [V1, SPEC] = did2.convert.roundtrip.neuron_extracellular(BODIES). V1 is the +% document in the shape NDI-matlab's writers give it +% (neuron_extracellular.json + app.json + base.json at the locked `main` +% 3cb19a8; +ndi/+fun/+probe/+import/+jrclust/probe.m, +kilosort/probe.m, +% +kiasort/probe.m, +ndi/+app/spikesorter.m): +% +% base.id, session_id, datestamp the calculations' run (calcParts; the +% unit's id is minted, the source id is +% not kept: no inbound edge names a +% neuron_extracellular) +% app the calculations' software entities +% depends_on element_id the relation's parent_id +% depends_on spike_clusters_id the calculations' input_id ('' when none) +% cluster_index the 'spike sorter cluster index' label +% quality_label the 'spike sort quality' label +% quality_number the 'spike sort quality' score +% mean_waveform the 'mean spike waveform' voltage values, +% column-major over (time, channel) +% waveform_sample_times the time covariate: its values, or +% origin + spacing * (0:n-1) +% number_of_samples_per_channel, restated by the waveform's two extents +% number_of_channels ([restated values checked]); with no +% waveform the writers' 1 or 0 +% (SPEC.equivalents) +% +% base.id: the migrator does not keep the source id on any emitted document +% (testMigratorsJNeuronExtracellular testTheSourceIdIsNotReusedByAnyEmittedBody), +% so it is REPORTED LOST by the round trip (a known finding, +% testRawV1RoundTripSpike; open). +% +% See also did2.convert.roundtrip.check, did2.convert.migrators_j.neuron_extracellular. + +arguments + bodies cell +end + +spec = emptySpec(); +v1 = struct(); +n = numel(bodies); +used = false(1, n); +unitIdx = []; +for k = 1:n + if isEntityOfType(bodies{k}, 'cell') && isempty(unitIdx) + unitIdx = k; + end +end +if isempty(unitIdx) + spec.unplaced{end+1} = 'no unit entity (type cell) was emitted'; + return; +end +unit = bodies{unitIdx}; +used(unitIdx) = true; +unitId = char(getIn(unit, 'base', 'id')); + +% the calculations about the unit, by variable and value kind +calcs = struct('kind', {}, 'variable', {}, 'body', {}); +for k = 1:n + b = bodies{k}; + if ~strcmp(classNameOf(b), 'calculation') || ~isequal(edgeIds(b, 'entity_id'), {unitId}) + continue; + end + [~, var] = termParts(getIn(b, 'statement', 'variable')); + kind = ''; + for kk = {'label', 'score', 'voltage'} + if isfield(b, kk{1}); kind = kk{1}; end + end + calcs(end+1) = struct('kind', kind, 'variable', var, 'body', b); %#ok + used(k) = true; +end +if isempty(calcs) + spec.unplaced{end+1} = 'no calculation about the unit was emitted'; + return; +end +relParent = ''; +for k = 1:n + b = bodies{k}; + if used(k) || ~strcmp(classNameOf(b), 'directed_relation'); continue; end + if isequal(edgeIds(b, 'child_id'), {unitId}) + p = edgeIds(b, 'parent_id'); + if isscalar(p); relParent = p{1}; end + used(k) = true; + end +end +% identity, app: from the first calculation and the run entities it names +rest = bodies(~used); +[v1, leaf, inputs, s] = calcParts([{calcs(1).body}, rest], 'calculation', ... + 'neuron_extracellular', ''); +leafUnplaced = s.unplaced; +v1 = rmfield(v1, 'neuron_extracellular'); + +% what calcParts placed (the anchor, the software): every body it did not call +% unplaced is used +% (calcParts was handed every body not placed here, and names each it could +% not place) +spec.unplaced = [spec.unplaced, leafUnplaced]; +% every calculation names the same run: the others must agree with the first +for c = 2:numel(calcs) + for e = {'software_id', 'operating_system_id', 'interpreter_id', 'time_reference_id', 'input_id'} + if ~isequal(edgeIds(calcs(c).body, e{1}), edgeIds(leaf, e{1})) + spec.unplaced{end+1} = sprintf('calculation %d names another %s', c, e{1}); %#ok + end + end +end + +sc = ''; +if ~isempty(inputs); sc = inputs{1}; end +v1.depends_on = struct('name', {'element_id', 'spike_clusters_id'}, 'value', {relParent, sc}); + +ne = struct(); +local = fieldText(getIn(unit, 'entity'), 'local_identifier'); +for c = 1:numel(calcs) + b = calcs(c).body; + switch [calcs(c).kind '|' calcs(c).variable] + case 'label|spike sorter cluster index' + ne.cluster_index = str2double(char(getIn(b, 'label', 'value', 'name'))); + case 'label|spike sort quality' + ne.quality_label = char(getIn(b, 'label', 'value', 'name')); + case 'score|spike sort quality' + ne.quality_number = numberOf(getIn(b, 'score', 'value', 'score')); + case 'voltage|mean spike waveform' + [w, t, bad] = waveform(b); + spec.unplaced = [spec.unplaced, bad]; + ne.number_of_samples_per_channel = size(w, 1); + ne.number_of_channels = size(w, 2); + ne.mean_waveform = w; + ne.waveform_sample_times = t; + otherwise + spec.unplaced{end+1} = sprintf('calculation "%s" (%s) has no v1 field', ... + calcs(c).variable, calcs(c).kind); %#ok + end +end +% the unit's name restates its cluster index +want = 'unit'; +if isfield(ne, 'cluster_index'); want = sprintf('unit_%d', ne.cluster_index); end +if ~strcmp(local, want) + spec.unplaced{end+1} = sprintf('the unit is named "%s", not "%s"', local, want); +end +if ~isfield(ne, 'mean_waveform') + % no waveform: the counts were the writers' value for an empty one + % ([writer default is not set]: 1 from the import writers, 0 from + % spikesorter.m, absent or [] from the template) + why = 'no waveform: a writer''s count for an empty one ([writer default is not set], carry-041)'; + for f = {'number_of_samples_per_channel', 'number_of_channels'} + spec.equivalents(end+1) = struct('path', ['neuron_extracellular.' f{1}], ... + 'values', {{1, 0}}, 'why', why); + end +end +v1.neuron_extracellular = ne; +end + +function [w, t, bad] = waveform(b) +% the (time x channel) matrix and the sample times from the voltage calculation +bad = {}; +w = []; +t = []; +dims = asCell(getIn(b, 'data', 'dimensions')); +if numel(dims) ~= 2 + bad{end+1} = sprintf('the waveform has %d dimensions, not (time, channel)', numel(dims)); + return; +end +nT = numberOf(getIn(dims{1}, 'n')); +nC = numberOf(getIn(dims{2}, 'n')); +vals = asCell(getIn(b, 'voltage', 'value')); +x = zeros(numel(vals), 1); +for k = 1:numel(vals) + v = numberOf(getIn(vals{k}, 'source_value')); + if isempty(v); v = NaN; end + x(k) = v; +end +if numel(x) ~= nT * nC + bad{end+1} = sprintf('%d waveform values for %d x %d', numel(x), nT, nC); + return; +end +w = reshape(x, nT, nC); +covs = asCell(getIn(b, 'data', 'covariates')); +for k = 1:numel(covs) + c = covs{k}; + if numberOf(getIn(c, 'along')) ~= 0; continue; end + [q, hasQ] = getIn(c, 'quantity', 'value'); + if hasQ && ~isempty(q) + t = column(q); + else + o = numberOf(getIn(c, 'origin', 'source_value')); + s = numberOf(getIn(c, 'spacing', 'source_value')); + if ~isempty(o) && ~isempty(s) + t = o + s * (0:(nT - 1))'; + end + end +end +if isempty(t) + bad{end+1} = 'the waveform has no sample times'; +end +end diff --git a/src/did/+did2/+convert/+roundtrip/private/speedBlock.m b/src/did/+did2/+convert/+roundtrip/private/speedBlock.m new file mode 100644 index 00000000..cd6135fb --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/private/speedBlock.m @@ -0,0 +1,171 @@ +function [blk, bad] = speedBlock(leaf) +%SPEEDBLOCK The v1 `speed_tuning` block rebuilt from a converted +% speed_tuning_calculation (the inverse of +migrators_j/private/jTuningCurve +% for the two-variable speed curve). +% +% [BLK, BAD] = speedBlock(LEAF). Field names are the WRITER's spellings +% (NDIcalc-vis-matlab ndi.calc.vis.speed_tuning, mock/speed_tuning/mock.N.json): +% +% properties.response_units, response_type value.response_unit / response_type +% tuning_curve.spatial_frequency, +% temporal_frequency one condition per grid cell, in the WRITER's +% order: spatial frequency outer, temporal +% frequency inner (speed_tuning.m loops sf, then +% tf). jTuningCurve's grid ([tuning grid]) keeps +% each condition's values, not the order the +% conditions were listed in, so a document listed +% in another order is reported lost. +% tuning_curve.mean, stddev, stderr the grid arrays in that order +% tuning_curve.individual trials x conditions, in that order +% tuning_curve.control_* value.control.* +% significance.* value.significance +% fit.Priebe_fit_*, sse, r_squared, partial_r2 the one model_fit entry +% (model 'Priebe fit') +% +% BAD lists what is emitted but has no place in the block. + +bad = {}; +blk = struct(); +value = getIn(leaf, 'tuning_curve', 'value'); +if ~isstruct(value) + bad{end+1} = 'the calculation has no tuning_curve.value'; + return; +end +props = struct(); +if isfield(value, 'response_unit') + [~, props.response_units] = termParts(value.response_unit); +end +if isfield(value, 'response_type') + [~, props.response_type] = termParts(value.response_type); +end +if ~isempty(fieldnames(props)) + blk.properties = props; +end + +% ---- the grid ------------------------------------------------------------------ +dims = asCell(getIn(leaf, 'data', 'dimensions')); +covs = asCell(getIn(leaf, 'data', 'covariates')); +labels = cell(1, numel(dims)); +levels = cell(1, numel(dims)); +for k = 1:numel(dims) + [~, labels{k}] = termParts(getIn(dims{k}, 'term')); +end +for k = 1:numel(covs) + a = numberOf(getIn(covs{k}, 'along')); + if ~isempty(a) && a >= 0 && a < numel(dims) + levels{a + 1} = column(getIn(covs{k}, 'quantity', 'value')); + end +end +if ~isequal(lower(labels), {'spatial frequency', 'temporal frequency'}) ... + || any(cellfun(@isempty, levels)) + bad{end+1} = sprintf('the dimensions are {%s}, not spatial x temporal frequency', ... + strjoin(labels, ', ')); + return; +end +n1 = numel(levels{1}); +n2 = numel(levels{2}); +% writer order: sf outer, tf inner -> condition (i, j) is at (i - 1) * n2 + j +[J, I] = meshgrid(1:n2, 1:n1); % I(i,j) = i, J(i,j) = j +order = sub2ind([n1, n2], reshape(I.', [], 1), reshape(J.', [], 1)); +tc = struct(); +tc.spatial_frequency = levels{1}(reshape(I.', [], 1)); +tc.temporal_frequency = levels{2}(reshape(J.', [], 1)); +for f = {'mean', 'stddev', 'stderr'} + if isfield(value, f{1}) + tc.(f{1}) = flat(value.(f{1}), order, n1 * n2); + end +end +if isfield(value, 'individual') + x = value.individual; + nT = numel(x) / (n1 * n2); + x = reshape(x, n1 * n2, nT); % grid cells (column-major) x trials + tc.individual = x(order, :).'; % v1: trials x conditions +end +if isfield(value, 'raw_individual') + bad{end+1} = 'value.raw_individual has no place in the speed writer''s block'; +end +if isfield(value, 'control') && isstruct(value.control) + ctl = value.control; + map = {'mean', 'control_mean'; 'stddev', 'control_stddev'; 'stderr', 'control_stderr'}; + for k = 1:size(map, 1) + if isfield(ctl, map{k, 1}) + tc.(map{k, 2}) = flat(ctl.(map{k, 1}), order, n1 * n2); + end + end + bad = [bad, others(ctl, map(:, 1)', 'value.control')]; +end +blk.tuning_curve = tc; +if isfield(value, 'significance') && isstruct(value.significance) + blk.significance = value.significance; +end + +% ---- the fit ------------------------------------------------------------------- +if isfield(value, 'model_fit') + mf = asCell(value.model_fit); + for k = 1:numel(mf) + [b, why] = oneFit(mf{k}); + bad = [bad, why]; %#ok + if k == 1 + blk.fit = b; + else + bad{end+1} = sprintf('model_fit %d: a speed tuning has one fit block per name', k); %#ok + end + end +end +bad = [bad, others(value, {'response_unit', 'response_type', 'mean', 'stddev', ... + 'stderr', 'individual', 'raw_individual', 'control', 'significance', 'model_fit'}, ... + 'tuning_curve.value')]; +end + +function y = flat(x, order, n) +% a grid array (or a pooled scalar) in the writer's condition order +if isnumeric(x) && numel(x) == n + y = x(:); + y = y(order); +else + y = x; +end +end + +function [b, bad] = oneFit(e) +bad = {}; +b = struct(); +[~, model] = termParts(getIn(e, 'model')); +if ~strcmp(model, 'Priebe fit') + bad{end+1} = sprintf('model_fit "%s" is not the Priebe fit', model); + return; +end +P = 'Priebe_fit_'; +if isfield(e, 'coefficients') && ~isempty(e.coefficients) + c = asCell(e.coefficients); + b.([P 'parameters']) = cellfun(@(x) numberOf(x.value), c(:)); +end +if isfield(e, 'sampled_fit') && isstruct(e.sampled_fit) + x = e.sampled_fit.independent_values; + if size(x, 2) == 2 + b.([P 'spatial_frequencies']) = column(x(:, 1)); + b.([P 'temporal_frequencies']) = column(x(:, 2)); + else + bad{end+1} = 'the Priebe fit is not sampled over (spatial, temporal) frequency'; + end + b.([P 'values']) = column(e.sampled_fit.response); +end +mmap = {'speed_tuning_index', [P 'speed_tuning_index']; ... + 'spatial_frequency_preference', [P 'spatial_frequency_preference']; ... + 'temporal_frequency_preference', [P 'temporal_frequency_preference']; ... + 'partial_r2', 'partial_r2'; 'nested_f_test_p', [P 'nested_F_test_p_value']}; +if isfield(e, 'metrics') && isstruct(e.metrics) + for k = 1:size(mmap, 1) + if isfield(e.metrics, mmap{k, 1}) + b.(mmap{k, 2}) = e.metrics.(mmap{k, 1}); + end + end + bad = [bad, others(e.metrics, mmap(:, 1)', 'model_fit.metrics')]; +end +if isfield(e, 'goodness') && isstruct(e.goodness) + if isfield(e.goodness, 'sse'); b.sse = e.goodness.sse; end + if isfield(e.goodness, 'r2'); b.r_squared = e.goodness.r2; end + bad = [bad, others(e.goodness, {'sse', 'r2'}, 'model_fit.goodness')]; +end +bad = [bad, others(e, {'model', 'coefficients', 'sampled_fit', 'metrics', 'goodness'}, 'model_fit')]; +end diff --git a/src/did/+did2/+convert/+roundtrip/speedtuning_calc.m b/src/did/+did2/+convert/+roundtrip/speedtuning_calc.m new file mode 100644 index 00000000..08014664 --- /dev/null +++ b/src/did/+did2/+convert/+roundtrip/speedtuning_calc.m @@ -0,0 +1,61 @@ +function [v1, spec] = speedtuning_calc(bodies) +%SPEEDTUNING_CALC Rebuild a v1 `speedtuning_calc` from what +% did2.convert.migrators_j.speed_tuning_calc emitted when it CONVERTED it: the +% `speed_tuning_calculation`, its session anchor, and the software entities +% (calculator, operating system, interpreter) with their version assertions. +% +% [V1, SPEC] = did2.convert.roundtrip.speedtuning_calc(BODIES). V1 is the +% document in the shape NDIcalc-vis-matlab ndi.calc.vis.speed_tuning writes +% it (its stored self-test output, mock/speed_tuning/mock.N.json: +% calc/speedtuning_calc.json over vision/speed_tuning.json, calculator.json, +% app.json, base.json): +% +% identity, `app`, input_parameters calcParts +% depends_on element_id (entity_id), +% stimulus_tuningcurve_id (input_id) +% speedtuning_calc.depends_on restates the top-level +% stimulus_tuningcurve_id +% speed_tuning speedBlock +% +% The class is spelled as NDIcalc-vis writes it (`speedtuning_calc`); the +% migrator is +migrators_j/speed_tuning_calc.m (did2.convert.rawV1Classes' +% table). A document with more than one fit block is carried (its fits would +% all be named 'Priebe fit'), so a converted one has one: `fit`. +% +% See also did2.convert.roundtrip.check, speedBlock. + +[v1, leaf, ins, spec] = calcParts(bodies, 'speed_tuning_calculation', 'speedtuning_calc', ... + 'ndi.calc.vis.speed'); +if isempty(leaf) + return; +end +[blk, bad] = speedBlock(leaf); +spec.unplaced = [spec.unplaced, bad]; +v1.speed_tuning = blk; +entity = edgeIds(leaf, 'entity_id'); +names = {'element_id'}; +values = {''}; +if isscalar(entity) + values = entity; +else + spec.unplaced{end+1} = sprintf('%d entity_id edges', numel(entity)); +end +if ~isempty(ins) + names{end+1} = 'stimulus_tuningcurve_id'; + values{end+1} = ins{1}; +end +for k = 2:numel(ins) + spec.unplaced{end+1} = sprintf('input_id %s has no v1 edge name', ins{k}); +end +v1.depends_on = struct('name', names, 'value', values); +% the calculator block's inner copy names the input only (the writer's +% speedtuning_calc.depends_on: stimulus_tuningcurve_id) +why = ['the calculator block''s inner depends_on copy restates a top-level ' ... + 'edge ([restated values checked], Jess Haley, 2026-10-26)']; +for k = 1:numel(names) + spec.equivalents(end+1) = struct('path', sprintf('speedtuning_calc.depends_on(%d).name', k), ... + 'values', {names}, 'why', why); + spec.equivalents(end+1) = struct('path', sprintf('speedtuning_calc.depends_on(%d).value', k), ... + 'values', {values}, 'why', why); +end +end diff --git a/src/did/+did2/+convert/Contents.m b/src/did/+did2/+convert/Contents.m index 8461cad6..26324022 100644 --- a/src/did/+did2/+convert/Contents.m +++ b/src/did/+did2/+convert/Contents.m @@ -56,7 +56,7 @@ % .quarantine.json. % % Shared helpers used by migrators -% axisKey, axisTerm, calcCommon, channelType, epochIndex, +% axisKey, axisTerm, channelType, epochIndex, % ethicsJurisdiction, registeredTerm, reportNote, mintSessionDuring, % stimulusPresentationSpecs (the batch's presentation settings, loaded % by v1_to_v2) diff --git a/src/did/+did2/+convert/calcCommon.m b/src/did/+did2/+convert/calcCommon.m deleted file mode 100644 index be970696..00000000 --- a/src/did/+did2/+convert/calcCommon.m +++ /dev/null @@ -1,168 +0,0 @@ -function v2Body = calcCommon(preBody, v1ClassName) -%CALCCOMMON Shared migrator body for V2 `*_calc` classes. -% -% v2Body = did2.convert.calcCommon(PREBODY, V1CLASSNAME) reshapes a -% did_v1 calculator document body to match the V2 -% `calculator`-base inheritance contract. The abstract -% `calculator` parent declares `input_parameters` with -% `placement: "concrete_class"` (DID-schema V2 calculator.json), -% which means the field is hosted on the concrete subclass's block -% (`.input_parameters`) on V2 instance bodies and -% the abstract `calculator` class contributes no body block. See -% V_gamma_SPEC.md "Field placement" under "Field Definition Object". -% -% v1 already stores `input_parameters` on the concrete class block -% (`.input_parameters`) — the same location V2 wants — -% so no structural move is needed. This migrator therefore only: -% -% 1. Coerces `.input_parameters` to a struct (v1 sometimes -% shipped an empty `[]`; V2 wants `struct()`). Idempotent -% for v1 bodies that already shipped a struct. -% 2. Drops a redundant inner `depends_on` if v1 stored one on the -% calc block (e.g., `oridirtuning_calc.depends_on`); V2 -% only honors top-level `depends_on`. Only when every inner entry -% restates the top-level edge of the same name ([restated values -% checked], Jess Haley, 2026-10-26): otherwise the body is returned -% unchanged, carried whole as v1, with a `carried_as_v1` note. -% -% The calculator-identity string lives in `app.app_name`, not in a -% `calculator.calculator_name` field; that rename is handled -% universally by did2.convert.universalRenames against the v1 -% top-level `app` block, which calc documents already carry. So -% this helper does not have to (and must not) populate calculator -% identity per concrete class. -% -% Each per-class calc migrator under +did2/+convert/+migrators/ -% is a 3-line wrapper that calls this helper, e.g.: -% -% function v2Body = oridirtuning_calc(preBody) -% v2Body = did2.convert.calcCommon(preBody, 'oridirtuning_calc'); -% end -% -% The dispatcher's downstream ensureClassBlocks pass adds empty -% `{}` property blocks for the rest of the V2 inheritance -% chain (e.g., `tuning_fit`, the measurement parent), so this -% helper does not need to manufacture them. ensureClassBlocks is -% placement-aware and will not manufacture a `calculator` block -% since calculator contributes nothing of its own to instance -% bodies under the placement contract. -% -% See did-schema's conversion notes (deleted with did-schema #88) -% oridirtuning_calc.md for the full conversion spec. - -arguments - preBody (1,1) struct - v1ClassName (1,:) char -end - -v2Body = preBody; -if ~isfield(v2Body, v1ClassName) || ~isstruct(v2Body.(v1ClassName)) - error('did2:convert:missingBlock', ... - '%s body is missing the %s property block.', ... - v1ClassName, v1ClassName); -end - -block = v2Body.(v1ClassName); - -if isfield(block, 'input_parameters') - block.input_parameters = coerceToStruct(block.input_parameters); -else - block.input_parameters = struct(); -end - -% v1 sometimes stored an internal `depends_on` struct on the calc -% block (e.g., oridirtuning_calc.depends_on); V2 only honors -% top-level `depends_on`, so drop the redundant inner copy -- only when it -% IS redundant ([restated values checked], Jess Haley, 2026-10-26). A copy -% that differs from the top-level edges carries the body whole as v1 -% ([partly placed is carried as v1], Jess Haley, 2026-10-25). -if isfield(block, 'depends_on') - differing = innerDependsOnDiffers(preBody, block.depends_on); - if ~isempty(differing) - % carry-register: carry-016 - did2.convert.reportNote('carried_as_v1', v1ClassName, baseId(preBody), ... - sprintf('[carry-016] unplaced: %s.depends_on (%s differs from the top-level edge)', ... - v1ClassName, strjoin(differing, ', '))); - v2Body = preBody; - return; - end - block = rmfield(block, 'depends_on'); -end - -v2Body.(v1ClassName) = block; -end - -function out = coerceToStruct(value) -% Normalize a v1 `input_parameters` value to a struct so the -% V2 `structure`-type validator accepts it. v1 frequently -% stores an empty array (`[]`) where V2 wants `struct()`. -if isstruct(value) - out = value; -elseif isnumeric(value) && isempty(value) - out = struct(); -elseif iscell(value) && isempty(value) - out = struct(); -else - out = value; % leave non-empty non-struct as-is; validator will - % surface the type mismatch with a clear error. -end -end - -function differing = innerDependsOnDiffers(preBody, inner) -%INNERDEPENDSONDIFFERS The names of the inner entries whose id is not the -% top-level edge's of the same name. Both spellings of an id are read -% ({name, value} and {name, document_id}). -differing = {}; -if isempty(inner) - return; -end -if isstruct(inner) - inner = num2cell(inner); -elseif ~iscell(inner) - differing = {'(not a list of edges)'}; - return; -end -for k = 1:numel(inner) - d = inner{k}; - if ~isstruct(d) || ~isscalar(d) || ~isfield(d, 'name') - differing{end+1} = sprintf('entry %d', k); %#ok - continue; - end - if ~strcmp(edgeId(d), topLevelEdge(preBody, char(d.name))) - differing{end+1} = char(d.name); %#ok - end -end -end - -function v = topLevelEdge(preBody, name) -v = ''; -if ~isfield(preBody, 'depends_on') || isempty(preBody.depends_on) - return; -end -deps = preBody.depends_on; -if isstruct(deps); deps = num2cell(deps); end -for k = 1:numel(deps) - d = deps{k}; - if isstruct(d) && isfield(d, 'name') && strcmp(char(d.name), name) - v = edgeId(d); - return; - end -end -end - -function v = edgeId(d) -v = ''; -for key = {'document_id', 'value', 'id'} - if isfield(d, key{1}) && ~isempty(d.(key{1})) - v = char(d.(key{1})); - return; - end -end -end - -function id = baseId(preBody) -id = ''; -if isfield(preBody, 'base') && isstruct(preBody.base) && isfield(preBody.base, 'id') - id = char(preBody.base.id); -end -end diff --git a/src/did/+did2/+convert/rawV1Classes.m b/src/did/+did2/+convert/rawV1Classes.m index e5a07882..f295a816 100644 --- a/src/did/+did2/+convert/rawV1Classes.m +++ b/src/did/+did2/+convert/rawV1Classes.m @@ -113,7 +113,38 @@ % renamed. Written by +setup/+conv/+haley/doImport.m % and +babu/import.m. Round trips: % testRawV1RoundTripImage. +% neuron_extracellular the spike-sorting / calculation family: +% jrclust_clusters superclasses `base` + `app` (neuron, +% hartley_calc jrclust), `calculator` + hartley_reverse_correlation +% speedtuning_calc + reverse_correlation + ngrid (hartley_calc), and +% `calculator` + speed_tuning (speedtuning_calc). The +% only superclass migrator any of them met is +% +migrators_j/+super/ngrid.m (a guard, no reshape), +% which hartley_calc now calls on the raw block; it +% stays for ontology_image (not switched). The old +% +migrators wrappers (hartley_calc, speed_tuning_calc, +% simple_calc: calcCommon; jrclust_clusters) were never +% reached and are deleted with calcCommon. NDIcalc-vis +% writes `speedtuning_calc`, which universalRenames +% never mapped to the speed_tuning_calc migrator (the +% renamed path passes it through unconverted); the +% table below joins the two. Written by +% +ndi/+fun/+probe/+import/+jrclust/probe.m, +% +kilosort/probe.m, +kiasort/probe.m, +% +ndi/+app/spikesorter.m (neuron), jrclust/probe.m +% (jrclust_clusters), ndi.calc.vis.hartley and +% ndi.calc.vis.speed_tuning (NDIcalc-vis-matlab). Round +% trips: testRawV1RoundTripSpike. % NOT LISTED, and why: +% simple_calc a pass-1 passthrough for which no corpus holds a +% document; its raw passthrough (`app.name`, a +% `calculator` block) would meet the V_eta +% `simple_calc` class (`app_name`) under its own name +% and quarantine, where the renamed path's body +% validates. It stays on the renamed path until the +% open question on it (model it or retire it, +% V_eta_ground_truth_plan.md) is answered; its old +% +migrators wrapper is deleted (never reached). % image no NDI writer at the locked main constructs it and no % corpus holds one; its subject-less passthrough has no % register row, and as raw v1 it would meet the @@ -141,6 +172,10 @@ 'syncrule_mapping', ... 'daqmetadatareader_epochdata_ingested', ... 'imageStack', ... + 'neuron_extracellular', ... + 'jrclust_clusters', ... + 'hartley_calc', ... + 'speedtuning_calc', ... }; % v1 name migrator (+migrators_j); TEMPORARY, see above @@ -148,6 +183,7 @@ 'contrasttuning_calc', 'contrast_tuning_calc'; ... 'contrastsensitivity_calc', 'contrast_sensitivity_calc'; ... 'imageStack', 'image_stack'; ... + 'speedtuning_calc', 'speed_tuning_calc'; ... 'ontologyLabel', 'ontology_label'}; if nargin >= 1 diff --git a/tests/+did2/+unittest/testMigrators.m b/tests/+did2/+unittest/testMigrators.m index 175999a8..dfbdaa21 100644 --- a/tests/+did2/+unittest/testMigrators.m +++ b/tests/+did2/+unittest/testMigrators.m @@ -100,89 +100,10 @@ function testEpochclocktimesSplitsTimeRange(testCase) end % --- calc-base migrators (20211116 corpus) --- - -function testCalcCommonKeepsInputParametersOnSubclassBlock(testCase) -% V2 `calculator.input_parameters` declares `placement: -% "concrete_class"` (DID-schema V2 calculator.json), so the -% field lives on the concrete subclass's block on instance bodies, -% not in a `calculator` block. v1 already stores it there, so no -% structural move is required. -v1 = wrap('oridirtuning_calc', 'oridirtuning_calc', struct( ... - 'input_parameters', struct('algorithm', 'best'))); -out = did2.convert.calcCommon( ... - did2.convert.universalRenames(v1), 'oridirtuning_calc'); -verifyEqual(testCase, out.oridirtuning_calc.input_parameters.algorithm, 'best'); -verifyFalse(testCase, isfield(out, 'calculator')); -end - -function testCalcCommonCoercesEmptyArrayInputParametersToStruct(testCase) -% v1 frequently ships `input_parameters: []`. V2 `structure` -% type requires a struct value, so the helper coerces in place on -% the subclass block. -v1 = wrap('oridirtuning_calc', 'oridirtuning_calc', struct( ... - 'input_parameters', [])); -out = did2.convert.calcCommon( ... - did2.convert.universalRenames(v1), 'oridirtuning_calc'); -verifyTrue(testCase, isstruct(out.oridirtuning_calc.input_parameters)); -verifyTrue(testCase, isempty(fieldnames(out.oridirtuning_calc.input_parameters))); -verifyFalse(testCase, isfield(out, 'calculator')); -end - -function testCalcCommonDropsInnerDependsOn(testCase) -% The inner copy restates the top-level edge, so it is dropped ([restated -% values checked], Jess Haley, 2026-10-26). 2026-10-26: the top-level edge is -% now in the fixture; without it the copy restates nothing (next test). -v1 = wrap('oridirtuning_calc', 'oridirtuning_calc', struct( ... - 'input_parameters', [], ... - 'depends_on', struct('name', 'stimulus_tuningcurve_id', ... - 'value', 'abc'))); -v1.depends_on = struct('name', 'stimulus_tuningcurve_id', 'document_id', 'abc'); -out = did2.convert.calcCommon( ... - did2.convert.universalRenames(v1), 'oridirtuning_calc'); -verifyFalse(testCase, isfield(out.oridirtuning_calc, 'depends_on')); -end - -function testCalcCommonCarriesAnInnerDependsOnThatDiffers(testCase) -% [restated values checked] (Jess Haley, 2026-10-26): an inner copy that does -% not restate the top-level edge is not dropped; the body is carried whole as -% v1, unchanged, with a `carried_as_v1` note. -v1 = wrap('oridirtuning_calc', 'oridirtuning_calc', struct( ... - 'input_parameters', [], ... - 'depends_on', struct('name', 'stimulus_tuningcurve_id', ... - 'document_id', 'abc'))); -v1.depends_on = struct('name', 'stimulus_tuningcurve_id', 'document_id', 'xyz'); -pre = did2.convert.universalRenames(v1); -did2.convert.reportNote('reset'); -out = did2.convert.calcCommon(pre, 'oridirtuning_calc'); -notes = did2.convert.reportNote('collect'); -did2.convert.reportNote('reset'); -verifyTrue(testCase, isequaln(out, pre), 'returned unchanged'); -assertTrue(testCase, isfield(notes, 'carried_as_v1')); -verifyTrue(testCase, contains(notes.carried_as_v1.distinct_details{1}, ... - 'stimulus_tuningcurve_id')); -end - -function testCalcCommonMissingBlockErrors(testCase) -v1 = struct( ... - 'document_class', struct('class_name', 'oridirtuning_calc'), ... - 'base', struct()); -verifyError(testCase, ... - @() did2.convert.calcCommon(v1, 'oridirtuning_calc'), ... - 'did2:convert:missingBlock'); -end - -function testCalcWrapperPipesThroughHelper(testCase) -% Each per-class wrapper is a thin call to calcCommon; verify the -% wrapper produces the same shape (input_parameters preserved on -% the subclass block, no calculator block) as a direct calcCommon -% call. -v1 = wrap('speed_tuning_calc', 'speed_tuning_calc', struct( ... - 'input_parameters', [])); -out = did2.convert.migrators.speed_tuning_calc( ... - did2.convert.universalRenames(v1)); -verifyTrue(testCase, isstruct(out.speed_tuning_calc.input_parameters)); -verifyFalse(testCase, isfield(out, 'calculator')); -end +% (calcCommon and the hartley_calc / speed_tuning_calc / simple_calc wrappers +% are deleted, never reached: testRawV1RoundTripSpike +% testTheOldSpikeWrappersAreGone; jCalculation's inner depends_on check is +% tested in testRawV1RoundTripTuning) function testTheOldTuningWrappersAreGone(testCase) % [early migration pieces fixed] (1) (Jess Haley, 2026-10-26): one migrator @@ -200,31 +121,6 @@ function testTheOldTuningWrappersAreGone(testCase) end end -function testCalcMigratorWrappersAllResolve(testCase) -% Smoke: every concrete *_calc wrapper exists and runs cleanly on a -% minimal v1 body. The wrapper does not vary by class today (the -% calculator-identity lookup is handled by app-block rename upstream), -% but exercising each entry catches accidental deletions and ensures -% the dispatcher can still resolve the migrator by class name. -% (the tuning family's wrappers are deleted: those classes read raw v1 with -% their +migrators_j migrator; testTheOldTuningWrappersAreGone) -classes = { - 'hartley_calc'; - 'speed_tuning_calc'; - 'simple_calc'; -}; -for k = 1:numel(classes) - cls = classes{k}; - v1 = wrap(cls, cls, struct('input_parameters', [])); - migratorFcn = str2func(['did2.convert.migrators.' cls]); - out = migratorFcn(did2.convert.universalRenames(v1)); - verifyTrue(testCase, isstruct(out.(cls).input_parameters), ... - sprintf('Wrapper %s did not produce input_parameters on the subclass block', cls)); - verifyFalse(testCase, isfield(out, 'calculator'), ... - sprintf('Wrapper %s synthesized a phantom calculator block', cls)); -end -end - function testUniversalRenamesAppBlockNameAndVersion(testCase) % v1 carries app.name / app.version; V2 uses app.app_name / % app.app_version. The rename is in universalRenames so it applies diff --git a/tests/+did2/+unittest/testRawV1RoundTripSpike.m b/tests/+did2/+unittest/testRawV1RoundTripSpike.m new file mode 100644 index 00000000..27a8ccc9 --- /dev/null +++ b/tests/+did2/+unittest/testRawV1RoundTripSpike.m @@ -0,0 +1,514 @@ +function tests = testRawV1RoundTripSpike +%TESTRAWV1ROUNDTRIPSPIKE The spike-sorting / calculation family read as raw +% v1, and its round trip: neuron_extracellular, jrclust_clusters, +% hartley_calc, speedtuning_calc (migrator speed_tuning_calc). +% +% Decided by Jess Haley, 2026-10-26 (did-schema +% V_eta_go_forward_class_audit.md): [migrators read raw v1] (switched one +% family at a time, did2.convert.rawV1Classes), [early migration pieces +% fixed] (1) (one migrator per class: the old +migrators wrappers for +% hartley_calc, speed_tuning_calc, simple_calc and jrclust_clusters, and +% their helper calcCommon, are deleted) and [migration reliability practices] +% (a) (a round trip per class, did2.convert.roundtrip.check). +% +% THE v1 DOCUMENTS ARE THE WRITERS'. +% hartley_calc.mock.1.json NDIcalc-vis-matlab 00e3e0f, +% speedtuning_calc.mock.1.json +ndi/+calc/+vis/mock/: each +% calculator's stored self-test output, copied +% verbatim to tests/+did2/fixtures/ndi_writer_outputs +% jrclust_clusters built here as NDI-matlab (locked `main` +% neuron_extracellular 3cb19a8) +ndi/+fun/+probe/+import/+jrclust/ +% probe.m writes them (no stored output +% exists), and passed through +% jsonencode/jsondecode, the shape a corpus +% delivers; the kilosort no-template shape +% (+kilosort/probe.m: meanWf = [], wst = [], +% counts max(size,1) = 1) too +% The templates they are written over are copied verbatim to +% tests/+did2/fixtures/ndi_templates (NDI-matlab 3cb19a8: jrclust_clusters, +% ngrid, neuron_extracellular, app, calculator, base; NDIcalc-vis-matlab +% 00e3e0f: hartley_calc, hartley_reverse_correlation, reverse_correlation, +% speedtuning_calc, speed_tuning). The writer wins over the template: the +% Hartley writer stores frameTimes, hartley_numbers and spiketimes inline +% where its current template lists .bin files. +% +% WHAT THE WRITERS' DOCUMENTS DO TODAY. +% hartley_calc converts (with its presentation in the batch); alone it is +% carried (carry-040: the stimulus properties could not be +% compared). Nothing lost. +% speedtuning_calc carried (carry-056): its three fit blocks `fit`, +% `fit_no_speed`, `fit_fullspeed` would become three +% model_fit entries all named 'Priebe fit'. The same document +% with one fit block (the "converted shape") converts and +% loses nothing. On the renamed path it passed through +% unconverted: universalRenames never mapped the writer's +% spelling to the migrator. +% jrclust_clusters converts. KNOWN FINDING: base.name (the writer sets it +% to the parameter file's name, 'jrclust.prm') is not +% written (#73 item 54); the Soph vintage whose name is in +% ndi_document.name is carried (carry-049, [one-reading +% quick answers] Q5). +% neuron_extracellular converts. KNOWN FINDINGS: base.id (the migrator +% mints the unit's id and keeps the source id on no +% document), and waveform_sample_times (the regular time +% axis is stored as origin + spacing, which rebuilds the +% writer's (a:b)'/rate to within 1.1e-19, not exactly). +% Every lost path is listed here exactly; nothing is invented or unplaced. +tests = functiontests(localfunctions); +end + +function setup(testCase) +did2.convert.stimulusPresentationSpecs('reset'); +testCase.addTeardown(@() did2.convert.stimulusPresentationSpecs('reset')); +end + +% ===================== the writers' documents round trip ================= + +function testWriterOutputsRoundTrip(testCase) +% {label, batch (first: the document), carried?, known lost paths} +cases = { ... + 'hartley writer output', {hartley(), presentationOf(hartley())}, false, {}; ... + 'hartley corpus vintage', {hartleyVintage(), presentationOf(hartleyVintage())}, false, {}; ... + 'hartley without its presentation', {hartley()}, true, {}; ... + 'speed writer output', {speed()}, true, {}; ... + 'speed, converted shape', {speedOneFit()}, false, {}; ... + 'jrclust writer output', {jrclust()}, false, {'base.name'}; ... + 'jrclust Soph vintage (ndi_document.name)', {jrclustNdiDocument()}, true, {}; ... + 'neuron writer output', {neuron()}, false, ... + {'base.id', 'neuron_extracellular.waveform_sample_times'}; ... + 'neuron corpus vintage (no sorting output)', {neuronCorpusVintage()}, false, ... + {'base.id', 'neuron_extracellular.waveform_sample_times'}; ... + 'neuron with no waveform (kilosort)', {neuronNoWaveform()}, false, {'base.id'}; ... + 'neuron with times but no waveform (jrclust)', {neuronTimesOnly()}, true, {}}; +for k = 1:size(cases, 1) + [label, batch, carried, known] = cases{k, :}; + out = runRaw(batch); + verifyEmpty(testCase, out.quarantine, [label ': quarantined']); + mine = own(out.migrated); + r = did2.convert.roundtrip.check(batch{1}, mine); + verifyGreaterThan(testCase, r.fields_inspected, 0, [label ': inspected nothing']); + verifyEqual(testCase, r.carried, carried, [label ': carried?']); + verifyEqual(testCase, sort(lostPaths(r)), sort(known), ... + sprintf('%s: lost %s', label, describeLost(r))); + verifyEmpty(testCase, r.invented, sprintf('%s: invented: %s', label, strjoin(r.invented, ', '))); + verifyEmpty(testCase, r.unplaced, sprintf('%s: unplaced: %s', label, strjoin(r.unplaced, '; '))); +end +end + +function testEveryWriterFieldOfAConvertedHartleyIsAccountedFor(testCase) +% the denominator is the writer's document: each leaf matched, restated, +% equivalent, not set or exempt, and the ones the fold turns on by name +v1 = hartley(); +r = did2.convert.roundtrip.check(v1, own(runRaw({v1, presentationOf(v1)}).migrated)); +accounted = [r.matched, r.restated, r.equivalent, r.not_set, r.exempt]; +verifyEqual(testCase, numel(accounted), r.fields_inspected); +for p = {'ngrid.coordinates', 'ngrid.data_dim', 'ngrid.data_type', 'ngrid.data_size', ... + 'hartley_reverse_correlation.frameTimes', 'hartley_reverse_correlation.spiketimes', ... + 'hartley_reverse_correlation.hartley_numbers.KXV', ... + 'hartley_reverse_correlation.reconstruction_properties.T_coords', ... + 'hartley_reverse_correlation.stimulus_properties.rect', ... + 'hartley_calc.input_parameters.T', 'hartley_calc.depends_on(1).value', ... + 'reverse_correlation.method', 'files.file_info.locations.location', ... + 'app.version', 'depends_on(2).value', 'document_class.class_name'} + verifyTrue(testCase, any(strcmp(p{1}, [r.matched, r.restated, r.equivalent])), ... + sprintf('%s is not accounted for', p{1})); +end +end + +function testCarriesCiteTheirRows(testCase) +verifyCarriedFor(testCase, {hartley()}, '[carry-040]'); +verifyCarriedFor(testCase, {speed()}, '[carry-056] speed_tuning.fit, speed_tuning.fit_no_speed'); +verifyCarriedFor(testCase, {jrclustNdiDocument()}, '[carry-049] universalRenames would discard: ndi_document'); +verifyCarriedFor(testCase, {neuronTimesOnly()}, ... + 'neuron_extracellular.waveform_sample_times (no mean_waveform'); +end + +% ===================== the switch ====================================== + +function testTheSwitchListsTheFamily(testCase) +names = did2.convert.rawV1Classes(); +for cls = {'neuron_extracellular', 'jrclust_clusters', 'hartley_calc', 'speedtuning_calc'} + verifyTrue(testCase, any(strcmp(names, cls{1})), cls{1}); +end +verifyEqual(testCase, did2.convert.rawV1Classes('speedtuning_calc'), 'speed_tuning_calc'); +verifyFalse(testCase, any(strcmp(names, 'speed_tuning_calc')), ... + 'the migrator''s spelling is not the v1 name'); +verifyFalse(testCase, any(strcmp(names, 'simple_calc')), ... + 'simple_calc stays on the renamed path (rawV1Classes, NOT LISTED)'); +end + +function testTheSwitchChangesNoConvertedDocument(testCase) +% "keep behaviour identical": every document the raw path CONVERTS is the one +% the universalRenames path converted; a carry is carried on both paths, the +% raw one the untouched v1 source +batches = {{hartley(), presentationOf(hartley())}, {hartleyVintage(), presentationOf(hartleyVintage())}, ... + {hartley()}, {jrclust()}, {jrclustNdiDocument()}, {neuron()}, {neuronCorpusVintage()}, ... + {neuronNoWaveform()}}; +for k = 1:numel(batches) + b = batches{k}; + raw = runRaw(b); + old = did2.convert.v1_to_v2(b, 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', {}); + label = sprintf('batch %d (%s)', k, b{1}.document_class.class_name); + verifyEqual(testCase, raw.summary.legacy_ndi_document.bodies_read_raw_v1, 1, label); + verifyEmpty(testCase, raw.quarantine, label); + verifyEqual(testCase, numel(raw.quarantine), numel(old.quarantine), label); + verifyEqual(testCase, numel(raw.passthrough), numel(old.passthrough), ... + [label ': carried on one path only']); + verifyEqual(testCase, numel(raw.migrated), numel(old.migrated), label); + if isCarried(raw, b{1}) + verifyTrue(testCase, isCarried(old, []), [label ': carried on the raw path only']); + continue; + end + for j = 1:min(numel(raw.migrated), numel(old.migrated)) + verifyTrue(testCase, isequaln(raw.migrated{j}.toStruct(), old.migrated{j}.toStruct()), ... + sprintf('%s, document %d differs between the raw and the renamed path', label, j)); + end +end +end + +function testTheSpeedWriterSpellingNeverReachedItsMigratorBeforeTheSwitch(testCase) +% the renamed path keeps `speedtuning_calc` (universalRenames maps only the +% contrast spellings) and finds no migrator by that name: the document passed +% through unconverted. The raw path reaches speed_tuning_calc through +% rawV1Classes' table; the converted shape converts the same way on the +% migrator's own spelling. +v1 = speedOneFit(); +old = did2.convert.v1_to_v2({v1}, 'Validate', false, 'TargetVersion', 'V_eta', 'RawV1Classes', {}); +verifyEqual(testCase, numel(old.migrated), 1); +verifyEqual(testCase, char(old.migrated{1}.get('document_class.class_name')), 'speedtuning_calc'); +raw = runRaw({v1}); +names = cellfun(@(d) char(d.get('document_class.class_name')), raw.migrated, 'UniformOutput', false); +verifyTrue(testCase, any(strcmp(names, 'speed_tuning_calculation')), strjoin(names, ', ')); +snake = respelled(v1, 'speed_tuning_calc'); +b = runRaw({snake}); +verifyEqual(testCase, b.summary.legacy_ndi_document.bodies_read_raw_v1, 0); +verifyEqual(testCase, numel(b.migrated), numel(raw.migrated)); +for j = 1:min(numel(b.migrated), numel(raw.migrated)) + verifyTrue(testCase, isequaln(b.migrated{j}.toStruct(), raw.migrated{j}.toStruct()), ... + sprintf('document %d differs between the two spellings', j)); +end +end + +function testTheOldSpikeWrappersAreGone(testCase) +% [early migration pieces fixed] (1): one migrator per class. The +migrators +% wrappers were never reached (each class has a +migrators_j migrator, and no +% v1 class names them as a superclass); calcCommon served only them. +for cls = {'hartley_calc', 'speed_tuning_calc', 'simple_calc', 'jrclust_clusters'} + verifyEmpty(testCase, which(['did2.convert.migrators.' cls{1}]), ... + sprintf('+migrators/%s.m is back', cls{1})); + verifyNotEmpty(testCase, which(['did2.convert.migrators_j.' cls{1}]), ... + sprintf('+migrators_j/%s.m is missing', cls{1})); +end +verifyEmpty(testCase, which('did2.convert.calcCommon'), 'calcCommon is back'); +% the one superclass migrator hartley_calc met stays, for ontology_image +verifyNotEmpty(testCase, which('did2.convert.migrators_j.super.ngrid')); +end + +function testTheConvertedDocumentsValidate(testCase) +% the converted documents pass the V2 schema (the corpus run validates too) +batches = {{hartley(), presentationOf(hartley())}, {speedOneFit()}, {jrclust()}, {neuron()}, ... + {neuronNoWaveform()}}; +for k = 1:numel(batches) + out = did2.convert.v1_to_v2(batches{k}, 'Validate', true, 'TargetVersion', 'V_eta'); + label = batches{k}{1}.document_class.class_name; + verifyEmpty(testCase, out.quarantine, sprintf('%s: %s', label, quarantineText(out))); + verifyGreaterThan(testCase, numel(out.migrated), 2, label); +end +end + +% ===================== every field accounted for ========================= + +function testAFieldTheFoldDoesNotReadCarriesTheDocument(testCase) +v1 = neuron(); +v1.neuron_extracellular.isolation_distance = 12.5; +verifyCarriedFor(testCase, {v1}, 'neuron_extracellular.isolation_distance'); +v1 = neuron(); +v1.app.license = 'MIT'; +verifyCarriedFor(testCase, {v1}, 'app.license'); +v1 = neuron(); +v1.neuron_extracellular.cluster_index = 7.5; +verifyCarriedFor(testCase, {v1}, 'cluster_index (not one whole number)'); +v1 = neuron(); +v1.neuron_extracellular.quality_label = ' single'; +verifyCarriedFor(testCase, {v1}, 'quality_label (surrounding spaces)'); +v1 = jrclust(); +v1.jrclust_clusters.num_clusters = 12; +verifyCarriedFor(testCase, {v1}, 'jrclust_clusters.num_clusters'); +v1 = jrclust(); +v1.depends_on(end + 1) = struct('name', 'sorting_parameters_id', 'value', 'sp_1'); +verifyCarriedFor(testCase, {v1}, 'depends_on sorting_parameters_id'); +v1 = hartley(); +v1.hartley_reverse_correlation.window = [0 1]; +verifyCarriedFor(testCase, {v1, presentationOf(v1)}, '[carry-056] hartley_reverse_correlation.window'); +v1 = hartley(); +v1.ngrid.data_size = 4; +verifyCarriedFor(testCase, {v1, presentationOf(v1)}, '[carry-056] ngrid.data_size'); +v1 = hartley(); +v1.hartley_calc.log = 'a log'; +verifyCarriedFor(testCase, {v1, presentationOf(v1)}, '[carry-056] hartley_calc.log'); +v1 = speedOneFit(); +v1.speed_tuning.fit.Priebe_fit_note = 'x'; +verifyCarriedFor(testCase, {v1}, '[carry-056]'); +end + +% ===================== a check that cannot fail proves nothing =========== + +function testABrokenEmissionIsReportedLost(testCase) +% jrclust: the checksum in the body's description changed +v1 = jrclust(); +docs = structs(runRaw({v1}).migrated); +for k = 1:numel(docs) + if strcmp(docs{k}.document_class.class_name, 'opaque_body') + docs{k}.data_body.description = 'JRCLUST results (res_mat_MD5_checksum: 0)'; + end +end +r = did2.convert.roundtrip.check(v1, docs); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, sort(lostPaths(r)), sort({'base.name', 'jrclust_clusters.res_mat_MD5_checksum'})); + +% neuron: one waveform sample changed +v1 = neuron(); +docs = structs(runRaw({v1}).migrated); +for k = 1:numel(docs) + if isfield(docs{k}, 'voltage') + v = docs{k}.voltage.value; + if iscell(v) + v{3}.source_value = v{3}.source_value + 1; + else + v(3).source_value = v(3).source_value + 1; + end + docs{k}.voltage.value = v; + end +end +r = did2.convert.roundtrip.check(v1, docs); +verifyTrue(testCase, any(strcmp(lostPaths(r), 'neuron_extracellular.mean_waveform'))); + +% hartley: the spike-time body dropped +v1 = hartley(); +docs = structs(own(runRaw({v1, presentationOf(v1)}).migrated)); +keep = true(1, numel(docs)); +for k = 1:numel(docs) + if strcmp(docs{k}.document_class.class_name, 'sampled_body') ... + && ~isfield(docs{k}.data_body, 'conditions') + keep(k) = false; + end +end +r = did2.convert.roundtrip.check(v1, docs(keep)); +verifyEqual(testCase, lostPaths(r), {'hartley_reverse_correlation.spiketimes'}); +end + +function testADifferentSourceIsReportedLost(testCase) +v1 = hartley(); +out = runRaw({v1, presentationOf(v1)}); +v1.ngrid.coordinates(1) = 99; +v1.hartley_reverse_correlation.stimulus_properties.fps = 60; +r = did2.convert.roundtrip.check(v1, own(out.migrated)); +verifyFalse(testCase, r.ok); +verifyEqual(testCase, sort(lostPaths(r)), ... + {'hartley_reverse_correlation.stimulus_properties.fps', 'ngrid.coordinates'}); +end + +function testAnUnplacedDocumentFailsTheRoundTrip(testCase) +v1 = neuron(); +out = runRaw({v1}); +extra = runRaw({jrclust()}).migrated; +r = did2.convert.roundtrip.check(v1, [out.migrated, extra(2)]); +verifyFalse(testCase, r.ok); +verifyNotEmpty(testCase, r.unplaced); +end + +% ===================== helpers ========================================= + +function out = runRaw(batch) +out = did2.convert.v1_to_v2(batch, 'Validate', false, 'TargetVersion', 'V_eta'); +end + +function docs = own(migrated) +% the documents emitted for the first source: every one but a passed-through +% stimulus_presentation (the batch's other member) +keep = cellfun(@(d) ~strcmp(char(d.get('document_class.class_name')), 'stimulus_presentation'), migrated); +docs = migrated(keep); +end + +function tf = isCarried(out, v1) +docs = own(out.migrated); +tf = isscalar(docs) && strcmp(char(docs{1}.get('document_class.schema_version')), 'did_v1'); +if tf && ~isempty(v1) + s = docs{1}.toStruct(); + s.document_class = rmfield(s.document_class, 'schema_version'); + tf = isequaln(s, v1); +end +end + +function verifyCarriedFor(testCase, batch, part) +out = runRaw(batch); +v1 = batch{1}; +label = sprintf('%s (%s)', v1.document_class.class_name, part); +verifyEmpty(testCase, out.quarantine, label); +verifyTrue(testCase, isCarried(out, v1), [label ': not carried as the untouched v1 source']); +notes = out.summary.migration_notes; +assertTrue(testCase, isfield(notes, 'carried_as_v1'), [label ': no carried_as_v1 note']); +d = strjoin(cellstr(notes.carried_as_v1.distinct_details), ' || '); +verifyTrue(testCase, contains(d, part), sprintf('%s: the note does not name it: %s', label, d)); +end + +function p = lostPaths(r) +p = {}; +if ~isempty(r.lost) + p = {r.lost.path}; +end +end + +function s = describeLost(r) +s = strjoin(lostPaths(r), '; '); +end + +function c = structs(docs) +c = cellfun(@(d) d.toStruct(), docs, 'UniformOutput', false); +end + +function s = quarantineText(out) +s = strjoin(arrayfun(@(q) sprintf('%s|%s|%s', q.class_name, q.identifier, q.message), ... + out.quarantine, 'UniformOutput', false), '; '); +end + +function d = writerOutput(file) +thisDir = fileparts(mfilename('fullpath')); +d = jsondecode(fileread(fullfile(fileparts(thisDir), 'fixtures', 'ndi_writer_outputs', file))); +end + +function v1 = hartley() +% ndi.calc.vis.hartley's own stored output, verbatim +v1 = writerOutput('hartley_calc.mock.1.json'); +end + +function v1 = hartleyVintage() +% the shape corpus 20211116 holds: class version 1, the app named +% 'ndi.calc.vis.hartley_calc' (an earlier writer) +v1 = hartley(); +v1.document_class.class_version = 1; +v1.app.name = 'ndi.calc.vis.hartley_calc'; +end + +function p = presentationOf(v1) +% the stimulus_presentation the calculation names, with the generator settings +% its stimulus_properties copy (the measured key pairs, hartley_calc.m), and +% settings the copy does not carry beside them +sp = v1.hartley_reverse_correlation.stimulus_properties; +p = struct(); +p.document_class = struct('class_name', 'stimulus_presentation', 'class_version', 1, ... + 'superclasses', struct('definition', {'$NDIDOCUMENTPATH/base.json'})); +p.depends_on = struct('name', 'stimulus_element_id', 'value', 'stim_1'); +p.base = struct('id', v1.depends_on(2).value, 'session_id', v1.base.session_id, ... + 'name', '', 'datestamp', v1.base.datestamp); +p.stimulus_presentation = struct('presentation_order', 1, 'stimuli', struct('parameters', struct( ... + 'rect', sp.rect, 'windowShape', 0, 'distance', 30, 'M', sp.M, 'K_absmax', sp.K_max, ... + 'L_absmax', sp.L_max, 'sfmax', sp.sf_max, 'contrast', 1, 'chromhigh', sp.color_high, ... + 'chromlow', sp.color_low, 'background', 0.5, 'fps', sp.fps))); +end + +function v1 = speed() +% ndi.calc.vis.speed_tuning's own stored output, verbatim +v1 = writerOutput('speedtuning_calc.mock.1.json'); +end + +function v1 = speedOneFit() +% the writer's document with one fit block (the "converted shape") +v1 = speed(); +v1.speed_tuning = rmfield(v1.speed_tuning, {'fit_no_speed', 'fit_fullspeed'}); +end + +function s = respelled(v1, name) +s = v1; +old = s.document_class.class_name; +s.document_class.class_name = name; +s.document_class.property_list_name = name; +s.(name) = s.(old); +s = rmfield(s, old); +end + +function app = jrclustApp() +% jrclust/probe.m appStruct +app = struct('name', 'JRCLUST to ndi.fun.probe.import.jrclust', 'version', '4.1.0', ... + 'url', 'https://github.com/VH-Lab/JRCLUST', 'os', 'GLNXA64', 'os_version', '', ... + 'interpreter', 'MATLAB', 'interpreter_version', '24.2'); +end + +function dc = stampOf(path, cls) +dc = struct('definition', ['$NDIDOCUMENTPATH/' path cls '.json'], ... + 'validation', ['$NDISCHEMAPATH/' path cls '_schema.json'], ... + 'class_name', cls, 'property_list_name', cls, 'class_version', 1, ... + 'superclasses', struct('definition', {'$NDIDOCUMENTPATH/base.json', '$NDIDOCUMENTPATH/app.json'})); +end + +function d = jrclust() +% jrclust/probe.m: ndi.document('jrclust_clusters', 'app', appStruct, +% 'base.session_id', S.id(), 'base.name', options.prmName, +% 'jrclust_clusters.res_mat_MD5_checksum', md5Value), then element_id +d = struct(); +d.document_class = stampOf('apps/jrclust/', 'jrclust_clusters'); +d.depends_on = struct('name', 'element_id', 'value', 'probe_1'); +d.base = struct('id', 'jc_1', 'session_id', 'sess_1', 'name', 'jrclust.prm', ... + 'datestamp', '2026-08-27T00:22:18.600Z'); +d.app = jrclustApp(); +d.jrclust_clusters = struct('res_mat_MD5_checksum', '0cc175b9c0f1b6a831c399e269772661'); +d = jsondecode(jsonencode(d)); +end + +function d = jrclustNdiDocument() +% the Soph vintage: an ndi_document block naming the parameter file beside +% `base`, whose name is empty, and an empty app block +d = jrclust(); +d.base.name = ''; +d.ndi_document = struct('name', 'jrclust.prm'); +f = fieldnames(d.app); +for k = 1:numel(f); d.app.(f{k}) = ''; end +end + +function d = neuron() +% jrclust/probe.m: the neuron_extracellular of one unit (addMultiple sets +% element_id; spike_clusters_id is the jrclust_clusters document) +d = struct(); +d.document_class = stampOf('neuron/', 'neuron_extracellular'); +d.depends_on = struct('name', {'element_id', 'spike_clusters_id'}, 'value', {'neuron_el_1', 'jc_1'}); +d.base = struct('id', 'ne_1', 'session_id', 'sess_1', 'name', '', ... + 'datestamp', '2026-08-27T00:22:18.600Z'); +d.app = jrclustApp(); +meanWf = reshape(sin(1:(21 * 4)) * 100, 21, 4); +ne = struct(); +ne.number_of_samples_per_channel = max(size(meanWf, 1), 1); +ne.number_of_channels = max(size(meanWf, 2), 1); +ne.mean_waveform = meanWf; +ne.waveform_sample_times = (-5:15)' / 20000; % (evtWindowSamp(1):evtWindowSamp(2))'/sampleRate +ne.cluster_index = 7; +ne.quality_number = 1; +ne.quality_label = 'single'; +d.neuron_extracellular = ne; +d = jsondecode(jsonencode(d)); +end + +function d = neuronCorpusVintage() +% the 20211116 / Soph vintage: spike_clusters_id declared and empty, a +% multi-unit, quality 4 +d = neuron(); +d.depends_on(2).value = ''; +d.neuron_extracellular.quality_number = 4; +d.neuron_extracellular.quality_label = 'multi'; +end + +function d = neuronNoWaveform() +% +kilosort/probe.m when waveform_source is not 'templates': meanWf = [], +% wst = [], counts max(size([],k),1) = 1 +d = neuron(); +d.neuron_extracellular.mean_waveform = []; +d.neuron_extracellular.waveform_sample_times = []; +d.neuron_extracellular.number_of_samples_per_channel = 1; +d.neuron_extracellular.number_of_channels = 1; +end + +function d = neuronTimesOnly() +% jrclust/probe.m when the results hold no mean waveform: meanWf = [] but the +% times are the parameter file's window +d = neuronNoWaveform(); +d.neuron_extracellular.waveform_sample_times = (-5:15)' / 20000; +end diff --git a/tests/+did2/fixtures/ndi_templates/hartley_calc.json b/tests/+did2/fixtures/ndi_templates/hartley_calc.json new file mode 100644 index 00000000..9398e1fe --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/hartley_calc.json @@ -0,0 +1,35 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/hartley_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/hartley_calc_v2_schema.json", + "class_name": "hartley_calc", + "property_list_name": "hartley_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDICALCDOCUMENTPATH\/neuro\/hartley_reverse_correlation.json" } + ] + }, + "files": { + "file_list": [ "hartley_results.ngrid", "hartley_frametimes.bin", "hartley_numbers.bin", "hartley_spiketimes.bin" ] + }, + "hartley_calc": { + "input_parameters": { + "T": [0, 0.05, 0.10, 0.15, 0.20, 0.25 ], + "X_sample": 1, + "Y_sample": 1 + }, + "depends_on": [ + { + "name": "element_id", + "value": [] + }, + { + "name": "stimulus_presentation_id", + "value": "" + } + ] + } +} + + diff --git a/tests/+did2/fixtures/ndi_templates/hartley_reverse_correlation.json b/tests/+did2/fixtures/ndi_templates/hartley_reverse_correlation.json new file mode 100644 index 00000000..09b81400 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/hartley_reverse_correlation.json @@ -0,0 +1,34 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/neuro\/hartley_reverse_correlation.json", + "validation": "$NDICALCSCHEMAPATH\/neuro\/hartley_reverse_correlation.json", + "class_name": "hartley_reverse_correlation", + "property_list_name": "hartley_reverse_correlation", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"}, + { "definition": "$NDICALCDOCUMENTPATH\/neuro\/reverse_correlation.json"} + ] + }, + "hartley_reverse_correlation": { + "stimulus_properties": { + "M": 0, + "L_max": 20, + "K_max": 20, + "sf_max": 2, + "fps": 10, + "color_high": [255, 255, 255], + "color_low": [0, 0, 0], + "rect": [0, 0, 800, 600] + }, + "reconstruction_properties": { + "T_coords": [0, 0.1, 0.2], + "X_coords": [0, 0.1, 0.2], + "Y_coords": [0, 0.1, 0.2] + }, + "spiketimes": [], + "frameTimes": [], + "hartley_numbers": [] + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/jrclust_clusters.json b/tests/+did2/fixtures/ndi_templates/jrclust_clusters.json new file mode 100644 index 00000000..7a710b48 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/jrclust_clusters.json @@ -0,0 +1,23 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/apps\/jrclust\/jrclust_clusters.json", + "validation": "$NDISCHEMAPATH\/apps\/jrclust\/jrclust_clusters_schema.json", + "class_name": "jrclust_clusters", + "property_list_name": "jrclust_clusters", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" }, + { "definition": "$NDIDOCUMENTPATH\/app.json" } + ] + }, + "depends_on": [ + { + "name": "element_id", + "value": "" + } + ], + "jrclust_clusters": { + "res_mat_MD5_checksum": 0 + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/ngrid.json b/tests/+did2/fixtures/ndi_templates/ngrid.json new file mode 100644 index 00000000..1d239dbb --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/ngrid.json @@ -0,0 +1,19 @@ +{ + "document_class": { + "definition": "$NDIDOCUMENTPATH\/data\/ngrid.json", + "validation": "$NDISCHEMAPATH\/data\/ngrid_schema.json", + "class_name": "ngrid", + "property_list_name": "ngrid", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json" } + ] + }, + "ngrid" : { + "data_size": "", + "data_type": "", + "data_dim": "", + "coordinates": "" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/reverse_correlation.json b/tests/+did2/fixtures/ndi_templates/reverse_correlation.json new file mode 100644 index 00000000..4677b2ee --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/reverse_correlation.json @@ -0,0 +1,27 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/neuro\/reverse_correlation.json", + "validation": "$NDICALCSCHEMAPATH\/neuro\/reverse_correlation.json", + "class_name": "reverse_correlation", + "property_list_name": "reverse_correlation", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"}, + { "definition": "$NDIDOCUMENTPATH\/data\/ngrid.json"} + ] + }, + "depends_on": [ + { + "name": "element_id", + "value": "" + }, + { "name": "stimulus_presentation_id", + "value": "" + } + ], + "reverse_correlation": { + "method": "", + "dimension_labels": "Time, X, Y" + } +} + diff --git a/tests/+did2/fixtures/ndi_templates/speed_tuning.json b/tests/+did2/fixtures/ndi_templates/speed_tuning.json new file mode 100644 index 00000000..82f4033a --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/speed_tuning.json @@ -0,0 +1,81 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/vision\/speed_tuning.json", + "validation": "$NDICALCSCHEMAPATH\/vision\/speed_tuning_schema.json", + "class_name": "speed_tuning", + "property_list_name": "speed_tuning", + "class_version": 1, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/base.json"} + ] + }, + "depends_on": [ + { + "name": "element_id", + "value": "" + }, + { "name": "stimulus_tuningcurve_id", + "value": "" + } + ], + "speed_tuning": { + "properties": { + "response_units": 0, + "response_type": "mean" + }, + "tuning_curve": { + "spatial_frequency": 0, + "temporal_frequency": 0, + "mean": 0, + "stddev": 0, + "stderr": 0, + "individual": { + }, + "raw_individual": { + }, + "control_individual": { + } + }, + "significance": { + "visual_response_anova_p": 1, + "across_stimuli_anova_p": 1 + }, + "fit": { + "Priebe_fit_parameters": [0], + "Priebe_fit_spatial_frequencies": [0], + "Priebe_fit_temporal_frequencies": [0], + "Priebe_fit_values": [0], + "Priebe_fit_speed_tuning_index": [0], + "Priebe_fit_spatial_frequency_preference": 0, + "Priebe_fit_temporal_frequency_preference": 0, + "sse": 0, + "r_squared": 0 + }, + "fit_no_speed": { + "Priebe_fit_parameters": [0], + "Priebe_fit_spatial_frequencies": [0], + "Priebe_fit_temporal_frequencies": [0], + "Priebe_fit_values": [0], + "Priebe_fit_speed_tuning_index": [0], + "Priebe_fit_spatial_frequency_preference": 0, + "Priebe_fit_temporal_frequency_preference": 0, + "sse": 0, + "r_squared": 0, + "partial_r2": 0, + "Priebe_fit_nested_F_test_p_value": 0 + }, + "fit_fullspeed": { + "Priebe_fit_parameters": [0], + "Priebe_fit_spatial_frequencies": [0], + "Priebe_fit_temporal_frequencies": [0], + "Priebe_fit_values": [0], + "Priebe_fit_speed_tuning_index": [0], + "Priebe_fit_spatial_frequency_preference": 0, + "Priebe_fit_temporal_frequency_preference": 0, + "sse": 0, + "r_squared": 0, + "partial_r2": 0, + "Priebe_fit_nested_F_test_p_value": 0 + } + } +} diff --git a/tests/+did2/fixtures/ndi_templates/speedtuning_calc.json b/tests/+did2/fixtures/ndi_templates/speedtuning_calc.json new file mode 100644 index 00000000..4827df55 --- /dev/null +++ b/tests/+did2/fixtures/ndi_templates/speedtuning_calc.json @@ -0,0 +1,24 @@ +{ + "document_class": { + "definition": "$NDICALCDOCUMENTPATH\/calc\/speedtuning_calc.json", + "validation": "$NDICALCSCHEMAPATH\/calc\/speedtuning_calc_v2_schema.json", + "class_name": "speedtuning_calc", + "property_list_name": "speedtuning_calc", + "class_version": 2, + "superclasses": [ + { "definition": "$NDIDOCUMENTPATH\/calculator.json" }, + { "definition": "$NDICALCDOCUMENTPATH\/vision\/speed_tuning.json"} + ] + }, + "speedtuning_calc": { + "input_parameters": { + }, + "depends_on": [ + { + "name": "stimulus_tuningcurve_id", + "value": [] + } + ] + } +} + diff --git a/tests/+did2/fixtures/ndi_writer_outputs/hartley_calc.mock.1.json b/tests/+did2/fixtures/ndi_writer_outputs/hartley_calc.mock.1.json new file mode 100644 index 00000000..ea8550c0 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/hartley_calc.mock.1.json @@ -0,0 +1 @@ +{"app":{"name":"ndi.calc.vis.hartley","version":"6b1ac939f905baf95d213fc4b3d60a60c094f288","url":"https://github.com/VH-Lab/NDIcalc-vis-matlab","os":"MACA64","os_version":"26.6.2","interpreter":"MATLAB","interpreter_version":"24.2"},"base":{"id":"412696f9b2995f93_c0dc68fd7e0e476b","session_id":"412696f9abd9edc3_40dbbdf6582271b2","name":"","datestamp":"2026-08-27T00:22:18.600Z"},"calculator":{},"depends_on":[{"name":"element_id","value":"412696f9b191523a_40d2a39965656671"},{"name":"stimulus_presentation_id","value":"412696f9b28f6c8f_40d55d6fe5e08b0f"}],"document_class":{"definition":"$NDICALCDOCUMENTPATH/calc/hartley_calc.json","validation":"$NDICALCSCHEMAPATH/calc/hartley_calc_v2_schema.json","class_name":"hartley_calc","property_list_name":"hartley_calc","class_version":2,"superclasses":[{"definition":"$NDICALCDOCUMENTPATH/neuro/hartley_reverse_correlation.json"},{"definition":"$NDICALCDOCUMENTPATH/neuro/reverse_correlation.json"},{"definition":"$NDIDOCUMENTPATH/app.json"},{"definition":"$NDIDOCUMENTPATH/base.json"},{"definition":"$NDIDOCUMENTPATH/calculator.json"},{"definition":"$NDIDOCUMENTPATH/data/ngrid.json"},{"definition":"$NDIDOCUMENTPATH/base.json"}]},"files":{"file_list":["hartley_results.ngrid"],"file_info":{"name":"hartley_results.ngrid","locations":{"delete_original":1,"uid":"412696f9b2996702_c0b2caf1eb17b275","location":"/private/var/folders/0v/n81njqh159dcxzgwcl32xy_40000gn/T/tpc0e24729_33b4_4d86_95ec_f9e51fae888f_regen_hartley/hartley/412696f9b2995f93_c0dc68fd7e0e476b.ngrid","parameters":"","location_type":"file","ingest":1}}},"hartley_calc":{"input_parameters":{"T":[-0.1,-0.090000000000000011,-0.08,-0.07,-0.060000000000000005,-0.05,-0.040000000000000008,-0.03,-0.020000000000000004,-0.010000000000000009,0,0.009999999999999995,0.01999999999999999,0.03,0.040000000000000008,0.049999999999999989,0.06,0.07,0.079999999999999988,0.09,0.1,0.10999999999999999,0.12,0.13,0.14,0.15,0.16,0.16999999999999998,0.18,0.19,0.2,0.21,0.22,0.23,0.24,0.25],"X_sample":1,"Y_sample":1},"depends_on":{"name":"element_id","value":"412696f9b191523a_40d2a39965656671"}},"hartley_reverse_correlation":{"stimulus_properties":{"M":200,"L_max":20,"K_max":20,"sf_max":3,"fps":10,"color_high":[255,255,255],"color_low":[0,0,0],"rect":[0,-100,800,700]},"reconstruction_properties":{"T_coords":[-0.1,-0.090000000000000011,-0.08,-0.07,-0.060000000000000005,-0.05,-0.040000000000000008,-0.03,-0.020000000000000004,-0.010000000000000009,0,0.009999999999999995,0.01999999999999999,0.03,0.040000000000000008,0.049999999999999989,0.06,0.07,0.079999999999999988,0.09,0.1,0.10999999999999999,0.12,0.13,0.14,0.15,0.16,0.16999999999999998,0.18,0.19,0.2,0.21,0.22,0.23,0.24,0.25],"X_coords":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200],"Y_coords":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200]},"hartley_numbers":{"S":[-1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,1,1,1,1,-1,1,-1,1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,-1,1,1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,-1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,1,-1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,-1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,1,-1,1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,1,1,1,1,1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,1,1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,1,1,1,1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,1,1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,-1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,-1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,-1,-1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,1,-1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,1,1,1,-1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,1,-1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,1],"KXV":[4,3,-9,-3,-14,-4,-20,16,9,17,-1,18,-12,1,-18,-4,-4,7,-11,-15,18,0,2,11,-4,-3,-14,-18,-2,1,9,16,11,2,-19,-20,17,13,-20,-14,-15,17,-5,-18,-7,-6,-10,-17,-5,-8,-4,-7,-1,-4,2,17,16,-3,6,-5,-8,-10,-12,-11,11,-8,-17,-20,-3,-17,5,12,-4,-17,7,-6,-8,7,-19,1,19,-20,-8,12,-17,-9,-19,-20,20,16,13,2,19,-10,2,8,-5,4,20,19,-6,3,-18,-2,18,16,11,-6,12,-17,1,-1,-12,5,-16,-6,1,-1,-12,-18,6,1,-5,-3,17,-19,-18,-7,-18,-17,0,-13,-7,15,-15,5,7,20,-16,13,3,11,-3,0,8,8,12,1,-17,3,17,18,-6,14,13,-13,20,12,-9,7,5,11,7,11,-5,-5,13,-10,-15,6,-13,-9,1,-16,-18,5,16,-3,12,16,-4,0,-12,15,-8,7,-14,1,17,18,-4,-2,-8,-19,-17,-19,-16,9,-20,4,10,12,-13,-18,9,4,-12,-15,14,-1,2,2,-19,1,1,-9,-19,10,10,-18,-16,6,-18,13,-3,3,5,-9,7,6,9,20,19,16,-5,-5,-19,-12,5,6,-17,3,0,11,-2,10,-1,-11,-5,6,3,18,3,-8,10,20,-8,-11,12,-4,-8,-13,-9,-7,-8,-8,-8,10,14,1,9,18,19,-16,11,-17,-20,-11,12,-9,-7,20,-1,18,-4,5,11,19,-13,-16,-10,-4,4,3,11,-13,3,6,17,-10,18,-13,-12,10,-19,7,-2,3,12,-13,19,-12,-20,-19,4,4,-17,2,13,19,14,-18,4,9,20,4,4,16,4,-8,6,6,-4,9,10,16,-1,14,-20,11,-10,12,5,-9,20,2,-9,-10,11,14,13,5,-9,-4,7,12,-2,5,-6,-3,10,14,-17,-12,2,16,-6,13,-3,-1,-11,-20,-7,1,-12,12,15,-13,12,15,20,9,-5,18,-9,6,17,-1,-15,-16,-4,7,-3,-16,-9,-7,20,2,-5,-4,11,5,18,0,-4,8,8,-12,20,-16,-15,10,8,-18,-3,-2,-8,19,-9,0,4,8,-9,0,16,20,8,2,2,10,12,-17,6,20,6,5,16,-9,-5,2,3,-12,2,2,16,9,16,-6,13,0,-10,-18,16,-15,-6,-20,18,11,19,14,-13,-4,-4,8,-15,-2,-3,18,5,-17,20,9,0,0,-20,-9,4,6,-7,8,20,19,-3,-19,-11,19,-11,4,19,8,-6,8,13,-6,-1,19,-4,-18,-19,17,20,17,12,12,4,0,-5,7,-16,-10,-16,15,1,-15,1,-20,-11,-14,-7,2,4,-4,15,11,5,18,-5,2,7,18,20,-15,3,14,-12,1,-20,17,18,1,3,1,7,19,0,5,19,18,1,20,20,14,0,16,-15,0,-12,-10,-17,9,-4,-1,12,-4,-2,-8,8,-16,13,20,15,-2,6,-11,-8,-10,15,-18,19,10,0,-16,10,6,1,-12,-11,-5,-12,-20,-18,17,17,14,8,9,-6,12,-5,-1,16,-10,-6,-16,-6,19,1,5,-20,2,-8,7,-15,5,13,-10,0,-14,2,10,2,6,-11,-6,16,-19,-17,12,-16,-8,-15,-14,-5,-6,-6,11,10,-16,-1,-4,-7,-19,-14,-3,12,3,11,-16,-8,1,20,-15,-4,4,-20,-14,-20,-1,-18,18,14,-9,6,-12,5,14,-19,-20,-2,-20,-5,19,10,12,8,2,6,11,20,8,-15,15,-8,-14,1,17,1,-17,-20,18,3,11,14,20,18,-18,19,-9,-6,20,-15,5,-17,0,-4,-17,-9,19,15,-9,8,-17,-7,-4,-17,-8,16,-8,-16,1,-20,16,0,2,9,-2,-18,9,11,14,0,16,-19,18,3,-10,-14,2,15,-16,9,-7,7,-2,-1,-18,-7,4,-12,-7,7,5,-9,7,-10,1,-7,0,-5,-16,5,-20,-2,20,14,2,-11,-16,-1,-3,15,-16,16,18,11,2,2,-9,-14,15,-16,-10,13,17,1,3,-15,-13,12,-5,12,-11,0,-16,-11,8,10,-16,13,-2,2,-6,-15,10,10,18,-1,-8,0,12,15,-3,14,14,-11,8,13,13,0,-3,-11,20,14,17,6,-6,-17,-12,-9,0,5,-13,14,-18,5,-16,4,7,18,-13,-7,15,-5,-3,-16,-18,12,2,-4,9,13,1,-14,-14,0,13,18,11,6,10,8,-16,16,18,12,-13,-10,-5,-13,2,-8,3,8,11,-9,1,-15,16,19,-2,16,-19,2,-17,8,-11,6,0,9,0,19,16,-3,6,-12,-18,-2,-7,-20,-2,12,-12,-16,-16,8,13,-5,3,14,-5,19,-7,14,-14,13,-1,14,4,17,10,17,16,-6,4,-2,-10,-6,-3,-6,-7,6,-18,-6,7,13,8,-3,-11,-1,-9,3,-7,-19,-18,2,9,-14,-8,-16,1,-9,11,9,-19,-8,-17,-1,7,19,-5,11,-13,17,9,12,-19,-19,16,-17,-13,3,-20,14,13,18,10,8,-15,20,4,16,6,-18,15,-2,-1,10,-8,-10,18,9,12,-15,6,17,2,-10,-19,-1,-3,4,16,4,-19,20,-18,-9,-4,10,-11,9,10,3,-7,-9,0,-8,-8,-11,15,-11,-4,17,-16,2,17,-19,-2,-12,13,0,2,10,-4,-8,7,0,-4,-9,7,-6,15,-17,13,6,1,-2,5,-10,-7,-16,-11,-13,0,8,-14,18,20,11,2,20,10,-11,-3,15,-19,17,15,-9,-17,12,-5,-17,16,-4,13,-17,-9,5,-18,-16,19,15,-7,5,-18,8,-12,12,18,16,1,19,15,5,-5,-2,12,16,16,10,-19,-4,-1,13,2,-18,0,-18,-12,11,-6,-14,-6,3,-13,12,6,2,-13,-15,15,2,18,13,12,-4,-16,13,-7,10,-19,-1,-7,11,-11,-19,5,19,17,7,-1,-1,-3,20,-15,4,-4,15,20,-2,-9,-15,-12,14,20,4,-14,-20,6,13,-1,15,1,-11,-20,-5,-16,-9,4,16,-10,-12,1,3,-6,14,-13,-10,-18,0,14,9,13,10,5,15,17,-16,-13,19,-18,19,11,-10,20,-15,-16,8,-14,-17,-5,7,7,-5,8,3,12,2,-19,-17,9,6,8,-14,-9,7,-6,5,0,7,-4,-20,9,6,-9,-9,11,5,-2,-12,5,-14,10,-7,-12,7,7,3,20,-3,-19,-9,-13,9,19,-19,-19,-7,1,-5,-18,5,7,13,-3,20,20,1,7,20,-2,13,12,-17,-4,12,11,-13,-17,10,-2,17,20,6,17,-7,12,20,16,17,-6,2,4,10,-14,-1,19,1,-16,1,-12,-10,18,-11,-4,4,2,18,-15,14,2,2,0,-3,-14,1,7,-1,-15,18,-6,-3,16,6,16,-4,-14,18,-14,-5,-16,-14,10,8,-19,13,-16,7,17,-11,8,-18,6,4,16,-16,-1,12,4,17,7,6,-13,-9,-3,-20,-17,0,-4,-4,18,-17,12,-12,-11,20,4,-20,-4,10,19,19,-11,13,-17,-15,-14,-16,7,-14,5,-16,-1,16,-18,-7,-2,10,2,4,-12,-20,-6,9,13,17,-20,-7,-14,-2,-3,7,-14,-17,7,9,-6,-13,-15,10,12,14,-18,-11,-18,-7,9,10,-18,-12,16,-14,19,-2,1,-8,3,20,15,-19,-17,8,18,17,7,13,18,-15,20,3,-15,16,-13,-7,-15,-18,-15,5,11,9,-18,-12,19,6,16,-10,-7,17,-20,-6,17,-3,15,-17,-10,-6,-1,-16,-17,15,11,19,7,-5,-16,17,2,20,-3,-9,6,17,-11,-10,-14,18,-11,14,-20,-19,-20,-10,-4,17,18,-12,13,0,15,17,-2,4,-10,14,4,-15,-16,-10,-3,-17,-11,16,17,1,5,5,14,7,-16,-3,12,-9,19,4,-20,-20,10,-2,-15,5,4,9,8,12,9,-3,-7,-15,-8,20,-1,6,11,-15,-10,-5,-7,-18,1,14,-4,-8,2,11,-10,2,13,-11,20,6,10,12,-8,-11,-13,11,-20,-7,9,15,0,-1,-11,3,-15,19,19,15,14,10,-8,-10,-18,13,-16,4,1,8,-2,-6,-4,17,15,4,0,-10,12,20,-19,-12,-9,8,13,-7,-3,10,8,-12,-16,-1,17,8,2,-4,-3,7,20,14,-5,-10,-17,-5,20,11,8,5,-2,-13,1,19,19,-1,9,-12,13,-20,-17,5,17,8,3,-15,3,5,13,7,16,-6,-12,14,13,-5,11,-14,-11,1,-15,-11,-5,-15,11,-4,9,-9,-10,4,16,20,5,2,5,-5,-19,-14,-18,-14,14,-10,-13,-12,-17,-8,0,18,-3,5,7,-5,-6,-6,-13,-3,-19,-7,-11,6,-2,-2,20,-4,2,6,-16,6,-11,16,12,5,15,5,-8,14,-7,14,5,5,7,-15,-3,-9,19,-4,-17,2,-14,18,12,-12,-15,-7,-13,-19,-6,-13,8,-4,-1,13,8,7,3,-3,-18,10,15,-5,7,7,-3,-7,16,15,-13,0,11,-8,17,19,17,9,4,8,3,-6,15,20,6,8,18,-10,2,-6,-10,-9,-12,-18,-18,5,9,2,-2,-4,-16,17,-20,-4,-1,-13,19,-6,6,11,20,9,-14,19,-18,-9,17,-1,14,-6,20,4,-6,18,-19,-2,-13,8,-9,0,-5,-12,9,15,11,12,-8,-20,-4,-20,14,-11,-19,-3,-20,-2,4,13,9,-13,19,5,19,-9,-7,6,9,6,19,3,6,-19,10,-13,-14,-20,0,-3,11,-4,-16,17,17,-15,3,-5,-13,-10,3,-16,19,10,3,11,2,9,-1,-15,-14,-10,15,-7,6,-15,-15,8,9,-18,-8,6,-16,-4,-3,13,-3,-9,6,7,-12,-1,-19,1,14,9,-2,-11,-6,5,-14,-18,12,15,-9,16,-13,-5,-18,-19,-10,-14,-1,-5,-13,13,0,-17,12,16,-19,-1,-1,18,5,14,7,4,-2,-18,-15,19,12,19,1,11,-7,17,11,-18,-6,-7,14,5,6,0,13,8,-16,9,20,8,-11,15,10,-3,-2,-17,19,7,9,-12,-15,15,-18,18,8,-19,2,-5,-1,-14,-6,-12,17,-10,-10,-12,-8,-12,-13,10,-2,19,6,-9,16,18,5,11,-11,12,1,14,-13,-8,-13,-20,-8,14,-18,7,-3,-20,14,5,-8,-3,14,6,-20,-17,17,-5,-11,-17,-6,12,-1,5,13,-12,11,-11,12,5,-17,13,15,9,1,-6,19,-4,14,2,-2,-3,-20,-1,15,-10,12,-4,10,-4,-11,-18,-12,-3,17,0,-3,-11,17,4,-3,-20,16,-11,4,-14,-11,-8,-19,-6,14,15,-5,11,18,2,18,-12,-8,0,9,14,16,-2,14,-5,7,16,-14,-19,14,15,-12,-1,-6,15,19,-13,-14,-1,-17,8,-18,-2,6,4,-17,3,7,2,7,-16,-13,-14,14,19,19,3,18,-13,15,-15,-16,-11,-8,-8,15,8,18,-2,-8,15,13,20,18,6,3,0,-7,3,19,-5,19,-11,-11,-5,-18,11,16,-16,18,-4,3,6,9,10,4,17,14,15,16,-17,19,-20,11,-19,8,4,5,-15,-12,10,5,9,-18,12,-11,7,11,9,6,3,9,-15,4,1,0,12,-7,0,17,14,19,-3,-2,9,-14,13,-14,4,2,4,6,8,19,-6,3,-2,13,9,-14,-5,-8,-8,15,-1,20,10,-19,-6,-2,13,3,-18,1,-3,-4,-12,-7,-11,-13,-15,-16,11,6,-5,-8,-2,15,0,-3,-14,-3,3,9,-1,-5,-11,-7,-12,-20,7,10,1,3,-20,-2,-9,-8,-6,18,3,15,-13,16,-1,-16,-17,17,-12,-18,-2,9,13,-8,14,18,16,-8,0,3,1,-12,-2,-18,12,18,10,4,-19,-5,9,20,-19,-5,17,-17,15,12,-17,1,18,8,-3,10,-10,11,2,13,-8,-7,3,10,18,-15,17,-16,-16,11,-19,11,15,-15,-10,8,-10,18,10,11,-16,-1,-2,-15,8,17,3,-3,-19,20,11,7,-5,-19,-19,-4,-19,-20,10,2,12,-14,-16,17,8,-14,-13,-13,-1,6,17,-12,-2,-9,-13,-5,4,-19,-7,-13,-10,10,18,1,-14,7,10,-17,9,4,-9,-8,-10,6,-1,-19,-8,-5,2,0,-20,11,12,-10,3,-3,13,-8,-12,14,3,-11,0,-13,-6,-16,8,12,-14,15,10,-10,-16,-10,-4,-11,4,-12,11,11,18,0,-18,9,10,5,3,-7,-11,1,9,-19,-6,-11,6,-10,-14,8,-2,3,1,-6,3,20,-17,13,1,-19,4,-16,14,-6,13,5,7,4,1,9,-14,-11,-5,3,8,15,-13,-1,-7,-20,11,-14,5,-8,-5,-4,-14,-14,-15,5,7,5,-2,4,0,-18,-2,11,13,14,-20,-2,-14,-8,-15,15,18,-13,18,2,-1,12,20,4,-9,4,16,0,7,11,-17,-20,-9,7,1,-8,8,-13,15,13,0,-2,-8,-14,19,9,-7,-6,-12,-13,2,13,-9,8,17,-11,3,7,-14,-16,12,8,16,-3,-10,-11,-1,-10,-18,-10,4,15,11,3,5,-11,-3,14,-20,13,20,17,-7,-4,6,-5,-11,-9,19,11,7,9,-7,-8,14,12,-2,-2,-1,-17,12,0,3,15,-11,-17,19,-9,-6,-2,-4,-1,-7,9,4,-5,-14,-3,8,-12,8,17,19,18,-9,-7,1,-14,12,-8,19,0,11,14,-5,18,3,-7,-8,-6,-12,-2,-5,20,15,-2,12,17,3,-12,3,-9,15,-15,9,-11,-18,0,20,-10,6,8,18,9,6,19,11,-8,4,-3,2,-2,1,15,-17,5,-15,8,16,4,-4,12,-14,-12,-5,-15,-20,-2,-1,7,2,-14,-5,-18,-19,-17,7,-11,-10,9,9,18,5,6,-8,5,-8,-6,7,11,10,3,-14,17,18,3,-15,-2,-13,-3,-13,-4,-10,-20,-16,5,-13,0,-14,-13,19,-2,-6,10,17,19,-5,9,-17,14,-4,-12,-7,-2,1,-9,-20,-5,7,-1,9,20,1,-12,15,-5,9,-18,-9,20,0,-15,-10,-15,18,-8,-4,4,2,15,12,3,-17,-19,-20,-15,-11,18,12,14,-8,6,-19,3,-4,16,5,-20,-11,-16,-19,-19,-8,-3,19,14,17,-13,-7,-20,-9,1,6,17,11,12,-15,-16,12,16,-15,16,-7,16,17,-10,18,10,-12,-17,-3,-8,-3,-19,-1,-13,-11,4,15,-5,-12,13,3,-5,-12,-4,-20,7,-7,-5,6,2,-20,-4,-17,-14,-20,-20,-19,0,-7,-12,-17,19,8,-14,5,0,-15,5,5,8,-16,2,11,-14,16,14,20,-11,15,-3,-20,14,12,-9,-13,4,3,9,0,1,-7,-20,-9,-9,18,-2,-10,-5,14,-19,-17,4,-7,-15,-1,10,17,17,13,13,5,-13,-10,3,-19,-15,-12,8,-13,-7,6,13,-18,4,8,-5,-9,-1,-16,10,-16,9,-5,-2,13,16,12,3,-9,16,19,-7,-6,4,-8,7,6,11,2,-15,-11,-18,-6,-15,-11,4,18,14,2,19,-11,20,-14,-15,7,-13,1,20,-18,14,-13,-4,18,15,-18,-8,-8,15,14,1,8,19,6,2,13,-18,1,-4,-5,10,8,8,20,14,-7,17,5,4,12,-1,7,-13,4,-17,8,3,9,5,0,-17,-9,-6,-5,2,-20,-15,-6,14,12,-3,-6,-20,13,-3,10,-19,-16,11,-20,-18,10,16,-9,-10,-4,-6,-7,2,1,-4,17,12,14,-7,20,-6,0,0,-12,4,2,-11,17,-1,-2,5,-1,8,16,-19,7,-15,13,-11,9,-10,-19,-4,-10,13,-13,-14,-14,13,-3,-9,13,-7,-3,7,-7,-16,1,-2,-12,1,-20,-1,-12,-2,0,15,11,-6,20,-7,-7,17,6,18,-6,2,15,-13,-20,2,7,-7,17,20,15,17,-14,19,20,-4,-20,10,-1,-3,-19,10,-16,-20,-1,19,15,3,6,-19,18,13,-16,6,-8,-1,2,3,-17,19,5,13,0,-6,-7,-14,-20,1,-9,-10,-2,-9,6,-17,-10,-6,-15,17,10,-8,-9,16,-20,-18,15,8,16,-17,3,3,-1,6,11,17,4,-18,-9,1,14,-4,-11,-6,-2,14,-13,-19,1,13,15,10,0,6,-10,-8,18,-10,9,-13,8,0,6,-13,-1,-7,-2,-10,16,-9,15,20,-10,-20,2,1,-19,4,-14,8,-11,12,-17,-12,-1,9,9,-2,-12,10,0,14,3,4,-11,-12,1,-11,-17,-3,-19,7,12,-6,20,-18,-8,4,1,-19,19,-17,1,-10,-14,-13,-1,-13,-12,7,-7,-13,-17,16,7,4,3,1,17,7,-10,16,-1,-3,-7,-15,20,11,20,0,-20,7,16,1,-10,-15,4,-6,5,3,-12,3,10,-17,1,-18,16,13,18,-19,-14,10,8,-1,15,9,-1,4,-10,-3,18,11,3,16,20,-5,13,-12,5,-6,8,14,16,9,-15,-3,-13,-18,16,20,-5,15,-9,10,15,18,6,-14,-1,-14,-9,-15,16,0,-3,-5,18,11,-8,5,-10,-13,-17,-7,7,-4,0,6,-3,-4,0,-18,10,14,11,-1,11,19,-17,-2,14,-10,2,13,-15,10,-9,-6,-19,-18,13,11,-2,-16,15,12,9,10,6,18,8,14,19,-3,20,-12,10,-6,0,10,-9,-10,2,-13,-9,-16,-7,-18,-17,2,7,-2,-19,-16,19,-12,-15,2,-17,-10,3,6,-15,19,-9,5,3,-2,-3,11,-4,-19,-10,15,4,5,-1,-20,20,7,8,-10,-18,-11,-17,9,5,-4,12,-11,-7,-18,3,3,-5,1,18,12,16,11,9,4,8,-11,-13,-6,-4,0,0,-19,16,5,14,-20,-16,-14,3,-4,-5,15,-19,14,4,-19,-9,-16,10,-12,11,-9,-12,16,-11,-10,-4,1,3,18,10,-15,-12,-8,-3,-6,0,-18,9,18,4,20,1,15,17,-19,-10,17,13,-11,1,13,11,-1,-18,-13,-7,-6,-15,-1,15,-11,-16,-12,-18,-20,-12,-17,3,-4,-8,14,-4,4,-5,-13,-12,10,-16,-17,12,0,-18,-15,-8,-1,-13,-9,6,4,-4,-17,1,-11,11,-11,19,-2,12,-2,0,8,-8,-11,12,-5,-12,-19,17,0,15,20,-10,-13,-2,13,8,-9,0,-16,-5,18,4,9,3,15,-4,-11,-5,11,1,-20,15,-9,9,-6,-14,12,18,17,-14,2,3,-2,0,6,2,4,14,-10,14,-5,-1,4,-7,-5,-14,13,0,0,11,-5,8,-13,8,-2,-17,0,-8,17,-5,2,-4,-6,-6,1,-6,1,9,12,10,-16,8,-4,17,-12,-10,12,-16,12,-3,9,1,-11,-1,14,9,-4,11,-20,2,-11,-5,-8,17,4,-2,-11,14,15,11,-2,19,-19,18,-8,12,-9,-11,-19,0,-18,10,-14,-18,6,6,-19,5,-7,18,7,9,-18,14,0,15,13,-16,-11,14,-9,-18,0,-18,-10,-12,-11,5,17,-5,16,-17,2,-17,-3,11,-9,-7,-17,19,-3,-19,-15,-13,-2,6,19,11,-4,5,7,-1,-13,2,-12,0,19,13,5,10,-10,-18,11,20,-14,2,9,6,-4,-2,-10,-1,-7,-15,12,2,-4,3,16,5,3,0,-17,2,14,11,17,-7,-17,11,-4,4,-13,1,-13,3,-11,3,4,6,10,7,-16,20,17,-8,10,-6,-9,16,19,-11,-4,-10,6,-17,19,16,-16,-13,-13,14,-17,3,-13,20,0,10,-12,14,4,-9,-5,2,-14,10,20,9,17,-11,-8,-4,3,0,-17,17,3,8,-10,-13,11,-8,-1,10,7,20,5,5,-11,14,-15,14,-3,-18,8,-1,-8,9,15,-17,-14,16,5,13,8,14,15,-16,8,-19,16,-1,-9,14,-6,14,-16,6,-19,-2,-17,-2,-14,-17,8,18,-1,17,-14,-15,6,-1,-19,-11,-20,-16,-11,18,12,-2,9,17,4,-18,-18,10,-4,18,4,16,13,0,0,20,13,16,4,-17,14,10,-1,3,-17,16,-15,13,-20,20,7,19,-4,-20,19,-13,-5,-3,-6,-19,17,13,-18,-11,-9,-8,-13,6,13,-12,13,1,16,5,2,11,5,12,12,10,-3,10,-11,14,9,-17,-19,-14,10,8,1,19,3,15,0,17,-13,-2,17,17,20,-9,13,-12,14,6,-14,-11,6,12,-12,13,-17,6,5,-8,-3,-6,-13,-18,17,5,3,-10,7,12,-16,-1,14,-5,15,16,6,3,6,-2,3,-5,6,-5,2,-12,12,-17,7,2,18,7,19,-14,5,8,18,2,9,16,5,12,16,-3,0,-3,12,20,4,-14,18,-14,16,12,-12,15,-7,19,11,10,20,-20,-18,-19,-5,5,-15,-19,7,6,-20,-13,-6,-18,0,-17,-7,-14,-6,2,-6,-20,-17,-9,11,4,17,-16,1,-10,-20,9,9,12,17,5,16,9,-10,-14,3,-16,-1,-17,16,9,-16,2,18,-9,-4,-7,-7,-3,-15,-2,-11,-16,20,11,11,-15,4,4,3,20,-14,-14,-5,-15,12,-6,9,10,-14,-7,8,10,-1,3,10,17,-12,-20,-15,-7,15,12,-13,-6,18,0,8,3,1,-13,-14,-5,-3,7,-15,12,0,14,19,-16,-5,20,-9,20,19,-6,9,17,4,4,-5,-9,-5,7,15,-11,-9,2,0,6,12,7,-18,10,12,-14,15,-16,-14,-8,1,-18,2,-16,18,-13,-20,-17,-4,-17,19,-11,0,-15,-9,-8,13,-9,-20,-7,13,-19,5,-11,-8,11,10,-14,-14,-6,-10,3,-2,4,19,-20,-6,19,-12,18,8,13,16,10,11,17,4,20,-18,-4,-15,3,-5,3,-11,-20,-20,-3,-8,4,-8,6,18,-7,3,16,12,-9,-16,-9,-4,11,2,-20,1,-12,-15,-6,12,16,15,-13,-10,-18,2,-7,-17,-4,3,-7,8,-9,-17,12,-11,-13,19,7,-8,-6,8,-9,-5,5,20,19,13,8,0,-19,14,16,-4,-17,12,-6,14,5,-12,-7,20,7,-4,1,-3,-9,15,3,-10,0,-2,15,4,-2,2,-11,-16,5,5,-6,18,-13,-2,-1,-4,12,-18,8,10,3,-7,-9,-2,12,14,-15,-18,19,-3,14,-17,-7,-9,19,17,4,1,-16,18,-13,-17,5,-20,5,10,11,2,-10,-13,-17,0,8,-4,-14,2,1,7,-1,15,7,-10,-18,10,-9,-15,-9,-17,-15,19,-7,11,2,10,8,17,-18,-7,-2,-5,-4,-7,4,2,-6,8,-5,-5,15,-18,-10,15,7,-19,-12,-15,17,-12,-17,-3,-16,10,-8,-13,13,5,-12,7,0,-10,-8,-13,13,8,14,14,-12,4,-14,-3,9,18,-7,-7,7,-10,-11,-1,-5,-8,-19,6,-17,7,-5,-20,-13,-12,6,-15,12,-18,-3,13,-11,-19,0,-5,-9,-1,-10,13,2,12,-15,12,7,-7,12,-15,-2,9,-6,-17,-16,-15,15,18,11,0,-14,-12,20,10,17,9,15,18,20,12,16,-6,-18,-13,7,4,9,0,9,16,-16,-6,-10,-5,6,-9,-19,2,-13,-6,20,19,16,-15,19,-14,12,4,8,12,7,-8,-13,1,16,-7,4,19,7,-13,-8,-6,-9,10,-8,9,-8,-14,-5,-7,-18,-8,-18,-16,8,1,-20,6,8,18,-2,18,-3,17,9,11,-5,8,-13,6,6,18,1,10,1,6,-1,8,11,19,-6,-8,5,15,-5,-20,9,-13,12,1,15,-12,15,11,-13,-17,-15,2,-20,-10,-3,2,18,16,-20,6,14,-16,16,2,-17,-18,-20,11,-1,-19,-11,5,-19,-13,6,5,-6,-11,14,-2,7,6,9,-15,-3,12,5,-3,-7,14,9,-18,9,-20,0,-3,2,14,11,-18,-10,-4,13,11,-9,9,-18,2,-9,-19,-7,17,3,1,18,11,-13,-2,-16,-2,-13,-4,-18,4,-2,-19,-14,-19,19,8,6,15,17,-10,20,-1,-5,0,12,-15,-10,3,6,-4,-8,15,-7,15,17,2,-17,17,3,-12,-8,-5,3,-7,-5,-15,6,20,14,-15,17,-16,-2,10,1,-20,-8,10,-8,1,6,-18,9,-1,16,-19,-20,9,-7,-11,10,-19,-16,-10,-15,-18,-20,5,14,-15,-15,-5,-12,-1,12,-18,-19,1,18,-14,5,-18,-9,6,-1,-16,-7,-1,-19,19,14,1,12,4,2,-10,19,12,18,8,9,7,-5,14,-6,-12,-19,-7,-16,-14,10,10,19,-17,20,0,-6,-20,15,-1,14,-16,1,-9,4,-10,-15,-13,16,-1,3,9,16,9,-3,-2,-19,-19,-18,-4,-1,18,-9,8,11,-16,6,-11,-19,-12,-15,-12,10,18,8,-1,15,-6,-16,1,3,6,11,2,-6,14,18,-16,5,20,5,-5,-17,-17,9,19,15,-7,20,-15,20,4,-2,16,-16,9,1,-7,9,-5,-3,10,-4,15,-10,1,20,-15,-16,-10,3,-9,-16,15,-3,4,-18,18,-5,15,6,-4,-20,-12,1,14,19,-13,2,-20,11,-19,16,16,-13,5,5,1,-1,-13,-2,0,-5,-15,9,18,-12,7,-17,9,-10,-4,2,-19,-1,2,-12,11,20,4,-16,-13,4,8,-20,-8,-1,8,12,11,-16,-17,10,-9,8,4,-8,-8,18,8,16,7,11,14,3,-18,19,-19,-13,-17,-9,19,7,-16,-17,-5,-15,17,9,8,19,12,-14,17,-17,-6,6,8,-11,10,-15,8,-11,3,-19,-10,-5,4,-8,18,2,7,16,-6,-15,-19,-12,19,1,10,-9,17,1,-10,6,19,13,-6,6,-4,-8,13,-5,18,-7,-12,-4,20,4,7,-3,-15,10,-10,10,-15,12,8,-19,5,-18,4,-16,13,-16,-9,13,12,6,-8,8,-5,-14,17,-20,13,-12,2,4,20,15,4,-18,-5,-14,-20,7,-18,16,2,16,4,13,-9,2,-14,-3,-20,0,-9,6,17,0,11,18,-2,1,14,-17,2,10,13,-1,4,-16,10,3,7,13,8,13,2,-11,-9,16,14,-13,-20,-18,-12,-5,-10,18,-7,-2,-11,-2,20,11,5,13,15,17,-6,-13,9,0,-2,-18,13,-17,13,-3,11,-12,20,-12,-11,-2,-20,18,3,4,7,7,13,3,14,5,13,-6,-3,4,-14,18,-15,8,-8,7,0,-12,-2,13,8,-20,15,-8,-7,-19,-8,-12,3,8,20,15,7,-2,0,9,-20,-12,2,14,-15,-11,11,4,8,6,19,-19,-17,1,-8,-19,-10,-11,8,-4,10,19,-6,20,0,14,-14,7,-19,-8,10,16,7,17,2,4,4,-20,0,-7,3,17,-5,-12,-7,5,14,-20,-4,1,3,-4,15,20,-11,3,5,-11,-14,-11,2,-5,-5,18,-2,-12,13,9,18,20,-8,-7,-16,0,-4,-19,2,-12,-19,9,-3,-8,-9,-18,-7,13,0,-4,11,16,-9,-5,2,-9,-10,20,-13,10,-11,-3,-15,-10,-12,-14,-17,-16,-9,-8,-1,-19,-20,-11,-1,-18,1,-8,-12,14,-3,-4,11,9,-18,-7,8,-4,7,4,0,-4,8,6,-8,11,11,1,11,20,12,4,12,15,3,5,13,-8,-8,15,-13,1,0,-7,-6,10,2,-20,-7,17,1,-18,15,6,-16,0,-9,-4,-14,9,-16,17,8,14,10,1,9,19,-10,-5,0,0,-10,-1,5,-13,1,-11,12,14,-4,20,17,13,-9,-8,16,-8,16,8,13,16,-15,20,18,-7,17,-11,-2,11,17,9,-9,17,17,19,-13,18,-18,7,-2,12,7,7,10,19,-8,14,-11,4,-11,8,13,6,-3,6,12,9,20,20,17,-3,-16,14,7,19,-7,-1,-2,-1,-3,-9,-16,9,-4,-3,-18,4,-9,20,20,-3,6,14,13,-13,-13,-12,-19,-11,-16,-17,-9,-13,-10,-4,12,4,-6,-10,20,-11,12,-20,2,-10,-8,3,2,-6,-19,16,5,17,10,-9,-14,-3,6,-14,-1,-1,-1,-17,-10,2,-6,-16,19,-13,8,-19,20,7,-20,6,-14,1,11,20,20,4,-11,20,19,11,-6,-11,-2,7,-9,-19,-10,-20,-8,-1,-12,-4,-10,6,2,9,-17,-1,15,-13,-4,-14,-14,-17,7,-14,2,-17,-5,-8,-6,0,2,3,16,-19,-7,16,20,0,-20,17,2,-13,-14,-16,9,-15,-18,-14,6,-3,16,-4,14,-7,-14,-5,-3,-2,15,-18,7,-3,-3,-13,15,13,-6,-1,8,15,-5,-15,-7,-5,-1,-13,-6,0,0,18,11,-5,7,15,-18,-1,18,19,17,-20,-20,-15,4,-4,-17,8,19,12,1,7,-20,13,-19,-4,-3,16,3,-19,19,4,2,19,9,17,5,9,19,7,-3,-19,-7,5,-1,-15,-3,16,4,5,13,-3,19,-9,-8,-3,7,4,-14,7,-13,-20,-6,3,-18,10,-18,16,16,-3,3,-15,-3,18,2,8,-19,17,11,6,-1,8,-3,18,10,14,-6,15,7,-9,-5,-4,7,-4,0,-14,-20,18,-5,-7,19,1,-11,18,-6,16,-19,-3,2,11,16,-11,-6,-4,9,20,-11,-2,-16,-15,14,-5,-1,7,-15,13,-20,-13,18,18,5,14,12,-20,-4,-3,-12,-13,-10,13,-2,-6,20,2,12,13,-1,14,-12,10,-2,0,-9,-14,19,18,18,11,-17,-17,-9,-12,-1,-14,-10,7,17,16,9,-20,-20,5,3,-7,-13,17,12,-9,-15,-10,14,-5,-20,16,20,13,-13,-15,13,-18,15,15,-1,20,-13,11,-4,4,-15,14,14,-13,0,-12,-4,0,3,7,20,-3,15,-10,-13,-13,8,1,19,15,20,15,-20,-12,0,10,-12,-6,-7,-11,-19,10,-12,-14,-3,2,13,2,2,18,0,-9,-6,12,0,5,18,-12,5,12,8,10,-17,-2,-2,-5,14,-7,18,2,18,-16,8,15,9,-10,15,17,7,18,-1,-13,-4,0,-9,9,-7,-15,-16,-10,16,6,-7,-20,16,20,12,12,-16,4,2,-3,14,-7,-4,-2,-2,-13,-6,9,12,1,-7,17,4,16,20,16,9,11,-8,10,3,-15,5,-19,10,13,17,11,10,-14,13,-18,13,16,-19,11,5,-16,12,-12,-9,-6,5,10,-10,-4,-17,9,17,0,19,14,-7,15,-11,16,-12,4,-16,-11,6,12,3,17,9,3,-13,5,9,-3,9,1,-8,-14,-4,10,0,11,0,-1,10,-2,10,-5,2,10,0,-7,-12,-6,12,-6,-19,14,-17,-8,0,11,-19,-4,12,1,-15,-10,14,3,-6,-7,11,4,-1,-1,15,-7,8,-8,-14,-12,16,15,-14,11,-6,-11,-15,18,7,-20,6,17,18,-2,-3,-6,0,-14,-5,3,-18,18,-15,-16,6,-1,-19,-14,7,-11,9,-15,9,-13,-11,-15,6,19,-2,-11,16,5,-4,8,5,-14,-18,16,-1,13,-20,-14,19,17,1,15,1,-11,-6,6,15,19,18,3,14,16,1,4,2,20,-14,1,-2,-18,7,7,-18,-4,-10,12,-11,3,3,17,-10,-15,18,14,14,-1,-10,-15,-1,-14,-15,0,-1,16,2,13,16,15,-2,-1,-3,-14,13,8,18,-18,-1,1,-10,17,-10,11,19,8,13,13,-14,17,5,1,17,7,-19,6,2,1,-7,-2,-16,8,18,11,3,-10,6,1,8,-20,12,-17,-10,-12,-4,-14,-13,11,-3,-16,-16,-20,17,-12,-3,12,-16,7,-6,11,16,12,-16,-7,17,-12,-7,20,-14,19,-20,3,16,16,16,-3,19,-3,-7,-16,6,16,-9,12,10,0,-19,18,-5,-6,9,4,-16,20,-14,-8,12,15,-17,9,-15,20,4,-3,11,8,3,17,-3,-4,10,19,3,16,0,-15,-6,-7,19,-3,5,1,1,-7,13,9,15,6,-11,-9,-5,19,10,-16,-11,-7,15,-16,20,19,8,-18,-14,-19,16,-19,-3,7,-17,-2,-4,6,-3,-4,-17,8,-9,-16,9,-2,19,7,18,7,13,-9,9,-9,-6,6,-5,-2,-6,11,-9,17,12,5,-19,13,-18,-7,-1,17,10,-18,20,-13,11,-2,16,7,-6,-14,20,2,10,2,15,-7,1,10,3,-3,-8,-14,3,5,14,-2,-17,-2,-9,-18,-7,11,1,17,19,5,13,13,-4,19,-2,-17,17,-1,13,-18,-8,-20,8,-8,0,14,-1,2,11,-10,-7,3,20,-8,-2,-12,14,8,0,-1,-2,-5,-5,15,20,4,9,-12,-19,-1,14,8,18,13,5,-20,-17,-20,-20,3,9,-10,6,-6,-8,3,-7,-3,14,-13,9,2,11,-8,12,10,15,7,-19,-7,2,14,-12,5,-6,19,14,-2,-2,4,8,6,-16,13,-20,14,4,5,4,20,11,-10,11,5,-15,-5,-13,17,16,1,-18,8,-7,-17,-6,18,3,-3,8,-1,14,-2,-13,-10,-16,5,-10,-2,0,-2,1,18,-17,20,-13,-15,3,-2,-3,-6,2,2,-8,-8,-6,-6,-17,-7,1,-10,-15,3,3,-6,3,-15,-7,18,5,-11,6,-4,-10,6,-1,8,-19,19,-3,1,1,-1,5,-3,18,-4,-14,-4,-4,-2,7,4,19,20,-11,-2,-10,-12,15,-19,-3,17,-10,-1,-9,18,7,5,6,0,-8,6,8,-2,-2,7,7,-13,-20,-14,-18,4,2,-1,14,-9,-16,13,19,-10,1,-16,4,5,8,10,16,-14,6,-19,13,-1,1,12,-6,12,-5,-11,18,19,-20,4,20,17,-17,5,16,-10,-10,-14,-12,19,-14,-12,1,13,-17,7,13,-4,9,-3,-19,12,-18,19,7,11,-20,-20,-9,1,4,-1,11,-12,14,10,20,-20,14,-14,19,-11,20,10,-5,-12,-18,6,-9,-1,17,-8,-20,-9,-6,1,-3,-12,6,-6,16,-16,-12,15,5,-15,9,-1,4,18,6,10,3,18,-15,10,11,20,15,5,20,-16,-17,-12,6,-18,1,6,-8,-11,18,-4,6,-5,14,-11,12,8,19,20,-15,-12,-5,-10,7,-18,-2,-9,17,-17,-20,5,-8,-6,-9,-15,-13,-2,-9,-5,15,13,1,13,13,-3,-20,15,13,15,10,-2,20,-5,0,3,-2,-11,15,-8,0,-8,1,10,-1,0,-16,11,2,18,1,16,15,13,-12,20,15,12,5,-9,11,4,-19,-11,5,2,9,-5,3,1,-17,20,-18,19,-18,-8,17,-10,-17,10,7,-14,-12,-19,11,-10,-11,-6,-17,-20,6,10,-15,9,-16,-3,13,-19,-8,15,1,7,-8,-20,-13,-8,6,-17,18,-11,-4,-12,1,-8,11,-20,15,-5,7,13,17,-4,-14,-5,4,-18,-3,-1,3,-10,-3,-19,-19,15,19,8,5,5,-8,19,-15,14,5,1,-18,1,-12,11,18,-19,11,-4,-13,15,9,12,-11,-7,-8,-19,19,-15,6,18,8,3,-11,-5,1,-11,-15,-11,4,-7,0,2,-20,-3,-4,6,15,4,19,7,6,-2,10,17,-15,6,15,9,-19,13,-11,-3,11,3,-13,4,-2,-1,19,12,5,18,20,0,-16,-13,-8,5,-8,4,16,-20,-6,-11,7,-18,0,13,5,9,-4,-2,-15,-19,-16,-18,-1,-5,-4,-18,-11,8,-13,1,-12,16,1,-19,-1,-6,20,-20,-3,8,-2,9,-4,-5,-11,-5,18,2,-16,-12,-8,3,0,-6,-3,11,-3,14,19,6,4,6,10,-9,-9,-3,11,20,-7,-8,6,-4,17,-5,19,3,6,20,0,6,2,18,-9,-8,-9,-19,20,-20,-11,-9,-9,-2,-9,-2,11,-20,20,13,2,-3,14,-12,6,-14,-12,-5,2,-8,-12,3,19,-12,10,4,18,-6,-4,-20,-16,11,-13,16,-7,20,-16,-10,-2,-4,19,14,-4,16,-18,18,-4,8,14,-2,4,-12,-11,0,11,-14,5,-12,14,4,-9,-17,17,-15,-17,4,-3,11,-20,5,10,10,0,16,-7,-2,-4,9,-6,-7,3,-1,3,-9,-2,8,-6,-11,-10,-12,9,5,-3,-3,12,1,4,-11,8,-5,-6,12,7,9,-10,1,-8,-13,15,-2,-13,7,12,11,9,-8,13,-14,8,-13,8,-18,-15,0,-12,0,-1,-13,-2,-17,-6,15,19,-10,18,-12,-6,19,20,20,-2,-9,-1,-14,-2,-8,17,-11,9,-19,-11,-2,3,-15,-4,-1,0,10,-14,14,20,8,15,-18,-16,-16,-10,7,-15,9,-19,13,-19,-15,13,-6,-10,9,-10,3,-19,-5,-1,-19,-10,-4,2,-16,3,6,15,-12,-19,-4,-10,6,20,2,11,-17,-15,4,-3,15,-8,17,-19,-17,-7,4,-1,10,-3,-14,-3,2,-14,13,12,4,13,18,17,16,16,-7,0,-17,-5,-19,-14,14,11,14,11,-8,8,-5,-19,-9,-13,4,15,1,-13,15,-16,-10,11,-13,15,-7,-17,12,2,17,12,17,8,12,5,7,-14,-8,2,-1,9,11,-6,18,16,-9,-18,-19,5,9,9,-20,-12,19,-4,2,-13,7,20,0,-17,13,-15,12,8,-14,3,15,-4,-3,13,12,-13,-6,6,-16,6,-11,-6,-18,18,-1,7,20,-5,-11,15,3,-18,5,-13,13,-10,5,-7,-20,-4,4,12,-4,8,17,-18,1,10,-18,17,-10,-18,3,-13,-8,-1,-5,-14,5,3,6,10,-12,20,-8,6,-12,-8,14,-10,-14,-8,-20,13,5,15,7,-15,-2,17,-20,0,-9,-11,18,7,-14,-20,13,6,0,20,11,19,12,3,-11,15,7,5,-3,-11,-18,11,-14,8,10,15,-10,7,-6,-19,-12,16,-3,-19,-7,8,14,-15,-10,11,16,16,-19,19,-8,7,-11,-6,20,18,-2,-3,20,-9,-11,-12,15,12,-14,9,-10,-12,13,-10,-5,9,-2,10,16,-7,20,15,15,6,-18,-18,4,-19,-6,-8,17,-11,-19,16,-16,-14,8,19,18,5,-5,11,1,-14,-16,12,19,-10,6,-9,0,4,9,-15,15,16,-7,-7,-1,-18,-7,2,14,12,17,13,14,15,5,8,0,-16,-19,2,14,10,4,6,11,-15,-2,17,9,16,11,4,1,-6,-7,-4,5,3,-11,0,-17,-19,-13,11,-8,10,-11,19,17,-17,13,14,3,-15,18,-14,1,-10,14,-20,9,3,19,17,-10,6,18,7,-15,-6,9,19,0,11,-1,-15,13,19,-6,-12,20,-6,14,-12,2,-5,19,5,-13,-1,8,-7,-7,-4,18,19,0,-17,-18,-10,15,-8,-19,-8,-7,4,6,7,9,5,-14,-15,8,-6,1,20,15,-4,-10,-10,18,-20,2,16,0,-1,18,18,8,14,0,-1,-13,14,6,2,5,-11,19,-7,-2,-12,-5,-6,-19,-7,-13,-17,0,3,5,15,19,-11,-8,-6,12,-9,8,6,-6,-16,4,-13,-20,19,-13,11,-20,19,0,15,8,-9,-19,-10,-20,3,-14,19,4,18,12,1,-3,-13,6,-19,-19,-11,13,-3,17,4,15,-11,-5,18,1,-14,11,-4,8,2,-18,14,-20,-11,-11,5,7,18,17,-1,-18,18,-15,-5,-7,-20,16,-11,12,19,15,2,-19,-1,-5,8,6,-13,-20,-17,7,-9,7,0,-3,-20,19,-8,18,2,-9,16,16,16,17,-13,20,-2,-16,20,-5,-8,4,20,16,-6,-20,13,12,18,19,14,19,7,-1,-17,19,-6,-10,-19,14,-16,7,-10,8,-11,-4,-4,-18,10,1,18,-18,19,6,13,-9,16,4,-7,6,10,-14,19,-6,20,-20,-2,14,12,-13,17,13,3,15,-8,-18,17,-2,-8,2,1,14,20,13,-2,-15,-10,-4,1,7,-5,-11,-8,-1,10,-17,4,-16,-15,-13,-8,20,-16,20,-1,-2,4,12,9,18,14,12,15,-15,6,-20,-1,-5,2,-18,10,7,14,9,12,0,6,10,15,-18,5,-18,-10,-1,-7,19,18,4,-8,20,6,-16,9,19,-7,-6,-14,-16,-15,-16,3,15,-13,19,-2,15,-10,-8,3,17,-19,9,-8,20,7,13,-15,0,-10,-6,-7,11,-17,-7,-4,2,15,-14,0,-14,3,-2,19,-9,-8,-12,-18,-6,-15,0,-14,0,-1,20,-20,-9,16,3,-11,17,8,2,-15,7,-4,8,-4,5,-12,12,9,-10,8,-6,-4,9,-13,19,-20,14,-3,-8,-4,16,-2,-14,-3,9,-17,-20,9,8,11,-3,-11,-11,6,-1,0,-18,3,-18,10,-20,-18,6,14,1,15,14,11,18,-9,-7,-20,4,-11,4,-19,-2,12,-2,13,-19,1,14,7,-13,10,-19,13,-18,-6,-2,8,-3,-11,-2,9,-20,-11,-15,6,17,-14,0,-16,4,15,4,18,-11,-7,-13,-11,2,-1,3,-15,13,18,-6,-5,-3,7,16,1,-8,-8,-14,20,1,-12,8,-16,9,20,-15,20,8,15,-11,-4,-13,-18,-3,19,17,-15,-3,12,16,5,7,-5,1,-5,-3,16,4,12,3,-6,-17,-12,-6,-7,-13,-18,-17,8,3,-4,-1,14,-14,-12,-15,8,8,-9,-17,10,-12,-16,0,10,13,-10,10,15,7,-17,-5,-19,-11,20,10,-6,17,10,17,-16,-20,18,3,-6,-19,-9,-4,-2,20,13,20,10,5,-19,-9,-1,2,-18,-9,-1,-8,-2,-10,1,-12,-1,-15,-17,3,3,0,18,15,20,5,2,-10,15,8,15,-12,9,20,-18,8,-5,15,-6,-20,-18,-1,15,-13,-17,-17,-15,-16,5,-18,4,2,-3,-11,-6,17,-15,-18,19,-4,-13,9,2,19,16,9,15,6,3,0,-15,-11,-1,8,-9,-9,1,-12,-17,-17,19,6,0,18,19,-10,-2,-1,13,-7,-1,-20,-12,6,14,-5,1,18,2,-2,8,8,1,-2,20,-11,5,-1,-1,-2,7,-2,-13,15,-2,16,-8,3,-6,-9,17,-12,-17,-15,-20,-20,-12,6,15,-3,20,-19,12,13,-15,13,2,-4,16,2,2,-14,12,7,-6,0,-2,-17,-19,7,4,18,-20,3,-11,16,11,-3,-16,-2,0,10,4,9,14,-10,7,18,-15,20,7,2,-5,18,10,16,-10,-14,-13,18,-12,1,-14,2,11,-16,-5,20,10,16,2,-17,10,18,-19,-17,18,10,8,-7,5,-16,20,13,4,14,19,-16,18,10,5,0,20,9,-9,-9,10,7,-9,-1,-3,-9,-14,14,7,-19,-18,-12,16,1,3,-13,-15,16,13,13,-1,9,2,-11,10,8,-4,14,-16,-18,-12,-10,-13,-16,1,-7,10,18,5,-12,15,6,-3,-10,-12,4,-4,-2,14,0,-4,-2,-12,9,19,-8,4,0,14,3,0,-9,-20,4,18,-3,-14,-12,7,5,0,-10,13,17,-16,-6,6,-14,18,-19,-7,1,-13,0,-17,1,19,-1,-11,9,-2,19,14,19,-16,-8,12,7,1,1,7,-12,-11,1,18,7,5,-14,-2,0,-20,-3,-3,2,5,8,0,-15,11,11,19,-16,-6,9,0,-10,0,10,16,18,13,-15,15,13,18,-1,-1,14,-14,-15,0,13,-2,12,6,1,3,-3,8,-7,15,2,-4,10,8,-16,7,-3,-16,-3,7,14,-9,20,-7,6,16,-20,7,-8,-3,16,0,-1,-18,10,2,10,20,18,6,-9,15,-2,10,-13,-11,5,-16,-5,9,3,16,17,12,-6,-20,-15,-20,15,-20,18,3,-8,3,-13,19,17,-5,10,-12,-1,15,-1,-5,0,-9,14,6,1,-17,-13,1,13,5,-10,-11,14,20,1,8,-4,17,20,2,-9,5,-19,7,-1,13,14,4,-7,17,-12,15,-10,-1,4,-7,20,5,-20,-1,17,-12,12,-16,16,-8,-20,-14,19,-5,-9,5,-13,9,-1,-8,18,7,-4,-15,9,-17,19,18,16,3,-10,7,-16,1,-2,-1,9,-8,6,-17,-18,1,-15,1,2,-2,-18,8,9,-13,19,6,-3,8,-19,-2,10,3,7,16,-8,-11,2,18,6,-6,0,11,-20,9,-18,-18,7,-1,-18,-20,20,3,11,-12,3,-7,4,-19,10,-7,2,11,-6,8,7,-18,-11,-7,12,-10,-10,4,12,-5,-2,11,17,5,-3,-16,-20,-19,3,4,-15,12,5,13,11,13,13,17,-10,-9,14,9,1,-10,-16,-18,11,8,18,-12,-7,1,2,10,-4,7,2,-7,-17,15,-17,4,-20,0,3,-20,5,-8,-1,19,17,9,-6,-6,-20,12,-17,12,-7,-16,6,15,6,19,-11,17,-10,8,6,20,-17,-5,-12,4,17,-7,13,-5,14,13,1,-13,-14,4,11,-9,-20,-3,7,13,13,16,18,-2,-9,19,15,17,13,-20,2,-15,3,-20,5,0,-11,-11,-18,-16,17,-4,4,-4,16,14,-4,7,19,-20,-6,11,-15,15,-11,-10,-3,4,-15,-2,4,-12,-17,-19,-1,19,-2,11,-5,-6,-19,-14,8,-14,16,-16,14,6,12,-11,-16,2,-11,13,-19,-2,14,18,19,15,13,5,-8,-6,-17,-11,0,-4,-13,-1,19,14,15,5,-20,-13,12,18,12,-2,-10,6,-14,9,-14,10,2,-6,8,-13,1,17,-3,10,2,3,-17,16,15,-5,12,-17,16,10,17,-5,11,-16,-16,13,-1,-5,-9,3,-2,15,-6,7,8,-5,-20,20,15,-19,5,-13,-4,11,-4,17,5,-4,16,0,-10,3,20,16,4,3,8,17,-16,-15,19,-12,-8,14,4,-5,-20,-6,-7,9,-17,-18,4,8,4,2,14,10,10,-3,-18,14,-7,4,20,-15,13,17,4,5,13,15,9,19,-10,-19,3,4,4,-10,6,7,7,6,-12,9,-17,-6,7,-8,13,-5,-15,18,-8,3,-6,13,13,18,20,-3,-4,-4,-19,-7,-18,-3,17,-18,-8,-3,17,5,1,12,-10,-2,3,-14,-18,-2,9,-3,6,-17,14,13,-2,16,-17,-9,-2,-7,10,-1,10,-19,11,7,5,-16,-1,-7,-18,-11,-9,0,1,-7,-3,-14,-13,20,7,-19,-7,-9,-19,0,19,11,14,8,20,-13,-5,5,-4,2,8,7,-15,1,-14,11,14,-8,9,6,1,-10,-19,20,0,1,4,-8,-4,-17,7,11,1,11,2,-1,-13,-7,14,5,-10,-9,19,-4,-16,-6,2,6,-8,-17,-1,-1,3,9,19,20,0,-6,-15,-14,-1,-6,3,-11,-5,8,16,8,-16,-3,11,-14,3,8,-15,-8,-10,-1,-18,-3,-20,-6,14,-12,-15,-4,-19,-14,-7,8,-10,-6,-7,-5,-16,18,-5,-9,12,-13,-10,-10,-4,-10,-15,2,-12,-19,10,-16,-3,-3,9,7,-1,-6,-17,3,-5,-1,-4,-10,-17,6,-10,20,-9,-11,15,5,8,-2,-16,1,-17,10,18,-9,1,-14,-14,-19,6,-17,-3,10,17,15,12,-6,-3,17,-13,-10,16,13,-5,-5,6,12,-5,0,-9,2,-5,-8,14,4,18,20,16,14,16,16,-15,-19,17,-9,-9,-12,-1,-14,11,-12,-13,1,-19,18,10,-9,-14,4,11,-5,12,2,-17,1,10,-5,-20,4,-15,-7,17,-2,9,-3,-17,3,-12,-20,9,-4,-14,-4,18,-4,19,17,-14,-1,8,-18,-4,-14,6,-16,11,12,-16,-11,9,7,11,7,-20,-17,-9,-7,-3,6,-18,-16,16,9,4,0,-9,9,9,-14,-8,-19,-10,-4,-4,13,-13,0,11,3,-4,9,5,-16,0,-5,-20,12,17,7,1,20,12,-2,-15,11,1,-8,5,-14,12,-2,2,15,19,3,-13,-15,12,-8,-20,-18,15,-6,20,-16,-1,-11,1,2,-18,-4,5,12,13,-17,10,16,11,-11,6,9,18,14,-8,5,7,-15,-13,-12,-4,5,8,19,-14,12,12,-6,-7,-8,1,-2,-2,-17,2,16,-17,-18,12,-7,6,3,-16,-9,18,-18,-20,-2,12,-14,-14,-14,17,7,5,17,0,-20,-1,14,-18,-15,10,-18,3,11,-18,-9,-11,20,-9,-14,19,0,13,-18,-17,19,11,16,1,-11,-10,18,1,5,-2,7,-9,-12,-15,20,-20,-19,1,5,-17,-12,16,9,-16,9,-16,-15,4,2,-12,-14,9,-19,19,-19,-19,14,-19,-14,-6,-8,-5,14,16,20,11,-4,10,9,-2,-1,5,1,-7,-1,1,12,-18,-8,0,5,20,-11,10,-10,0,-4,-13,10,7,13,-12,-9,11,11,-5,0,-19,-20,-4,6,7,6,-14,-10,-10,8,4,2,-4,1,-3,-14,-6,1,13,6,-19,-13,-2,-20,-18,-9,-19,-15,0,15,-9,-17,-7,3,-14,3,7,15,17,11,-8,-2,-5,3,10,13,13,8,-9,-11,-17,0,2,8,20,-13,17,-8,-1,-5,13,-1,14,12,-6,-17,-9,-15,-17,19,16,-5,-20,3,-11,-16,12,-6,-10,12,12,-11,10,-6,-17,-11,17,0,13,3,-12,2,12,-9,-7,18,4,15,-15,12,11,-17,17,-9,10,-15,-13,-17,5,11,-17,-11,-9,-6,8,0,19,-1,15,12,-7,-12,18,-2,-6,-12,-1,9,4,12,-5,1,20,13,-1,-9,16,9,-18,1,-13,6,-2,10,-9,-4,-5,10,16,-19,-19,-13,-20,4,-4,-10,12,-3,-4,-19,-3,-12,16,-17,19,17,-7,15,17,16,-5,-15,5,-3,-10,11,-13,2,-8,10,-13,11,-4,16,-17,-3,18,-6,13,18,14,14,12,1,-3,8,-5,-12,-15,-14,-15,-9,3,-18,19,14,-17,0,-5,20,-6,13,-5,4,18,3,17,-4,-5,6,4,20,-8,-19,12,1,16,5,12,2,-9,18,-18,1,-14,-14,-8,17,11,9,-3,8,8,-1,7,-13,-13,-8,-8,-17,16,-1,0,2,5,11,-7,8,-5,-12,9,10,-12,17,15,7,8,-9,-15,7,-5,14,-7,8,-9,-3,3,-6,-3,14,-12,17,13,13,-17,-18,6,-15,-12,17,-16,18,-7,20,8,20,16,17,4,-4,-8,3,-16,-4,-20,9,7,3,5,-12,-14,3,20,14,-11,-16,2,7,-10,-13,-5,-6,-7,19,-3,-16,-19,-6,12,-13,-20,-6,-13,9,-16,20,12,18,-11,-8,-16,3,2,-7,-5,-5,17,19,15,17,-13,12,17,-16,6,20,-12,-17,-7,12,-3,10,-14,7,13,10,6,-16,-5,19,6,5,5,-13,-17,14,16,-6,0,20,8,-16,-13,6,1,-11,12,-10,-14,5,10,10,18,18,19,-11,13,1,-5,-18,-8,-16,0,-18,-17,17,4,-6,12,13,15,1,-18,12,-7,-18,-20,2,-18,11,11,0,4,0,10,11,-10,-19,17,-10,2,19,-13,8,-15,16,5,-4,14,-12,-7,10,5,4,-17,6,16,19,-18,16,18,-14,3,-19,20,-18,11,7,11,13,10,15,12,-12,11,-11,-15,-8,-7,-7,13,18,15,2,1,-3,-8,8,2,-18,4,-7,-3,20,11,-15,-10,11,-5,-5,-20,-7,14,6,7,-19,16,-14,10,9,-19,-3,2,-20,-2,-2,-1,7,-4,-12,17,-15,5,-5,-2,14,-14,-13,-20,14,2,-5,17,-15,10,-16,12,-18,-5,4,-10,-3,-4,-12,16,-13,10,-16,-15,17,-13,13,-7,3,8,6,-9,-12,11,16,-10,-13,1,15,6,14,13,-8,-4,5,-3,7,-17,-3,-20,-2,13,-17,-16,11,-16,9,2,-9,18,-8,4,16,5,-3,-7,-16,-9,0,-8,-20,16,-3,2,11,-16,14,20,-9,2,-19,13,18,5,-16,11,1,6,15,-4,-13,-15,-1,15,-14,-12,-20,12,-7,-19,-17,5,16,5,8,-1,-12,-20,4,5,-3,19,-6,-3,15,-11,2,-12,14,-20,17,9,6,7,-9,10,4,-12,9,-19,7,-2,-2,15,-14,2,9,-10,-13,-7,11,2,1,3,12,17,-3,19,-7,2,15,3,-8,14,1,10,16,1,4,-7,-10,9,14,17,-1,-18,10,-16,11,-8,3,5,1,-11,0,6,-17,-9,20,-5,-5,17,13,3,9,10,-12,-8,5,-9,6,17,16,9,7,-20,-14,-14,14,14,-1,20,4,8,-6,-17,2,-2,-3,0,16,-2,12,-7,-16,12,-14,0,-7,-13,-18,1,20,5,-17,-17,-18,-5,-14,-17,13,15,2,-3,5,19,1,10,-3,2,-17,-13,17,-9,-14,-10,-2,1,-14,0,-13,14,9,-14,10,-19,14,-10,-10,-16,-13,16,-13,-17,17,15,11,1,7,-19,13,-14,3,-1,-14,-14,-1,19,-8,18,15,2,-16,-15,-12,-8,5,-11,-15,-15,17,-1,19,19,-15,-2,-16,-19,15,6,-12,17,0,-1,8,6,-15,-12,-5,-8,18,13,19,-5,0,-20,-10,-11,-18,-16,-11,3,-14,1,2,12,-3,-6,11,9,-1,-1,15,-17,0,-9,-3,16,12,19,7,20,-13,-17,-1,17,-18,-12,20,-13,12,2,2,18,-12,-1,2,4,15,10,-6,9,6,15,18,-4,-11,10,-7,-3,-10,8,17,13,11,-15,-14,4,9,-18,12,3,-6,-8,-11,-12,18,16,-14,2,-7,-6,-18,-12,5,-14,10,-8,-18,-14,8,9,8,-5,-15,19,0,-16,19,-2,-14,-20,0,-2,4,-7,20,-13,-7,-12,-4,-17,8,17,11,-5,19,2,-8,0,-17,12,18,-15,1,13,-13,-6,16,5,-8,11,-9,-8,-11,13,1,-4,8,-10,19,-8,12,15,-17,7,-4,-8,11,9,14,5,18,4,16,2,-5,-2,-17,-19,13,18,5,18,-12,-16,8,-10,6,-3,-17,-14,-20,-13,-2,14,9,-9,2,14,15,6,15,20,-6,-13,-3,0,-1,9,-19,-11,-14,0,-9,-8,-3,20,11,7,-17,3,-10,5,-5,-19,-20,4,9,17,15,3,-10,-13,-12,1,-13,14,11,0,2,-16,20,-9,13,11,-4,13,-13,-8,11,-1,-14,17,-19,-11,-7,16,-19,16,16,4,-7,20,17,-3,14,-9,11,3,-6,14,-17,-20,-17,0,20,11,14,13,11,-3,15,-10,-19,-16,-13,6,-16,-18,6,-11,7,3,14,9,-9,-5,4,2,11,-19,9,8,6,-2,-14,-7,-15,12,8,20,12,-14,18,8,-5,-8,-10,-15,-12,-19,8,-18,-7,2,12,16,20,8,-11,6,5,2,-18,-9,7,14,-4,13,11,-8,15,-19,-19,4,-17,-20,14,6,-13,12,10,-4,-12,7,-18,-1,4,-3,-20,1,1,16,-2,-2,-10,-2,10,12,2,-19,15,-18,-18,-13,10,4,-7,-12,9,3,2,0,0,-15,17,-1,15,10,-10,16,0,-7,-19,-4,-9,10,-20,12,-7,11,-18,15,19,-18,11,19,9,5,-18,-18,9,-7,13,8,-19,3,20,-18,8,-15,-11,19,14,-5,-15,7,-5,-19,4,-2,-11,-7,-4,-10,-20,-2,3,-16,-16,-1,6,-6,-8,10,-8,18,16,-10,9,13,-7,1,13,-9,-5,6,-2,-4,-4,5,-18,-10,-16,-4,7,11,-1,-20,19,13,20,7,5,3,18,13,-3,18,-3,17,-14,-18,9,19,1,4,9,17,-12,14,11,-3,-18,6,-7,-11,-13,3,-12,-2,13,-6,12,-10,-19,-2,8,-10,0,-4,16,-9,-1,-1,-17,-1,-2,19,-7,5,7,3,16,-11,13,-11,-4,-12,-11,-11,16,13,7,4,-10,-5,-15,-5,17,0,-16,-7,-12,18,0,8,-18,8,-16,5,-4,8,2,-3,-3,11,5,-1,17,-19,-15,-14,6,1,20,-13,-10,-18,-2,-7,-16,20,-1,-13,-6,-8,-10,-5,14,14,-5,16,-5,-10,3,11,6,10,-16,4,20,-12,-17,-4,7,15,16,14,20,15,0,-20,4,2,14,-13,-6,-1,4,-5,-15,-1,5,7,1,3,-16,-6,-15,3,15,12,-15,18,9,-9,-5,9,8,15,16,15,5,9,-13,-10,7,11,-18,8,-18,17,-10,-11,0,19,-15,3,-8,14,13,-8,11,2,-14,-12,-12,-11,-2,7,-19,-1,-14,-14,11,3,19,20,-15,-15,0,8,13,-20,5,13,16,13,18,-4,-2,-14,-11,18,4,3,6,-7,13,-3,12,5,-5,11,16,7,0,7,1,12,4,-14,-18,11,-16,-14,18,-3,7,0,-1,10,-20,0,9,5,-4,-14,-10,-3,-6,-6,-15,-2,-9,15,-8,-4,-5,5,17,-18,-4,7,16,18,16,-10,-7,-11,15,3,17,0,-14,6,6,11,-11,-4,14,-13,10,0,15,-13,14,-14,-7,-12,17,15,-17,-10,15,-11,-7,-6,-20,17,7,7,20,1,-2,1,-9,-6,-5,-20,-3,18,-14,-12,9,9,4,0,-4,9,17,3,-16,3,10,9,19,5,-19,17,-15,18,18,20,17,-6,-15,15,0,-15,-15,14,12,16,3,10,-12,6,18,11,-8,-10,5,16,8,5,16,5,-4,1,6,-12,-16,20,7,-14,-11,-7,18,-3,1,6,20,0,6,18,16,4,-8,2,16,-8,1,-17,-9,1,5,19,1,-8,14,-19,-6,-8,-16,-16,20,-19,18,15,16,1,-17,4,5,13,-17,9,-15,4,17,-8,17,19,-14,-7,5,6,-9,4,-11,19,-13,-2,-20,-3,-7,9,17,1,-9,-5,-17,-6,9,-3,-14,18,9,9,-4,1,-4,12,2,-19,9,10,19,-3,-9,6,-18,-3,-13,-17,10,4,-1,-16,-13,5,-17,-7,-11,13,-5,-2,12,-7,-16,3,9,19,11,-11,-9,4,16,12,13,-10,14,-9,-3,15,-1,18,-13,-3,-1,-4,10,18,-16,-7,-6,-4,-7,18,5,8,-5,5,4,8,13,-3,9,-13,2,11,-13,-2,19,-11,20,-5,19,3,10,-2,-2,-12,-16,19,-19,-12,7,-19,-12,-16,-10,6,0,10,-2,-5,1,-19,8,-15,-17,7,1,13,0,19,3,-7,-2,10,12,11,-17,-20,8,-9,18,-1,15,3,1,-18,-16,3,-4,-20,15,-18,-12,12,13,-12,10,10,-7,19,2,-4,-5,-9,-4,12,-19,7,1,-11,10,1,-3,-8,-10,5,20,-17,-2,-2,14,6,-11,20,-12,19,-12,14,-1,1,-1,-6,5,-9,17,13,-13,-4,-10,12,2,8,4,6,-20,-16,17,5,-3,-15,-3,-19,4,-18,11,6,6,-3,-13,0,-18,14,18,9,-17,-17,19,-5,9,-16,-19,-10,19,4,16,10,13,11,11,-11,8,-2,-16,-7,-18,-9,2,-12,-10,-7,20,-16,4,6,-15,11,-7,-8,12,-1,-5,8,20,19,-7,-2,-18,5,-6,-8,7,15,16,14,18,-8,-6,-9,-8,15,6,-3,18,3,-6,19,8,18,-20,-2,7,1,19,-9,-20,15,7,-8,1,14,-20,-7,13,9,-11,-4,19,-2,-10,19,-4,-10,-1,8,4,17,16,4,15,-11,16,5,7,-16,1,7,13,13,-15,-17,-10,19,-12,-7,6,1,-12,-11,10,-4,4,0,-1,-19,-15,5,-9,-11,-19,-18,6,-1,-15,-10,8,5,16,13,-18,-10,-8,-18,16,-11,-18,18,-17,-3,10,-20,20,-13,7,16,-20,-10,16,-7,4,-8,-11,-1,3,-1,-2,-13,12,12,-6,2,-11,-6,19,14,1,5,-20,-2,1,1,-6,10,12,2,-3,-3,1,1,16,7,-3,-13,7,-17,-13,9,-15,-2,8,7,1,15,16,3,0,-13,15,-10,10,-1,18,12,0,0,7,9,13,-8,4,3,3,12,19,-11,5,-18,16,-19,-14,11,1,11,-15,5,8,2,13,10,8,-5,-4,9,6,13,17,-17,-11,-14,-6,-6,-8,19,-16,16,12,-19,-20,4,-20,3,17,18,-9,20,-4,-4,-13,12,-10,-12,-20,-7,8,-9,15,-2,8,-15,7,8,4,14,-16,-8,-10,9,-20,14,-12,1,8,5,-17,19,15,-6,-9,20,9,-7,-13,3,11,15,9,-13,10,6,-10,-5,-13,0,-10,-11,-3,-8,-20,-19,-3,-16,-2,-1,-14,18,11,-9,0,3,9,13,-19,-18,-18,10,-18,4,15,-4,9,-6,19,4,-13,-12,-12,-5,-15,-1,0,5,-3,19,-12,-14,19,-9,-19,-6,-17,-14,-13,-8,-16,12,7,3,-17,3,-10,6,19,3,-20,-5,-11,5,9,-6,-20,18,12,6,1,-12,6,15,9,-4,-15,20,17,-4,-13,4,10,-7,13,4,15,20,-20,-13,-8,7,-16,-15,-11,19,-9,-17,-14,-19,4,-19,-18,16,20,-11,16,-5,-16,5,10,-5,1,-4,3,15,7,14,-6,9,4,-20,-1,4,-14,-2,14,10,-17,10,11,-6,-9,-8,15,-11,-15,-10,-14,4,-1,-6,14,8,2,3,-8,18,-3,7,-9,20,-4,6,-13,-2,-6,-16,12,-14,9,-3,-9,13,-19,-3,11,9,-10,1,-17,-12,-2,-1,0,-5,-20,4,-7,9,13,17,3,-19,-17,-5,15,16,14,17,-20,17,-19,10,18,7,-1,-8,-14,1,-14,-8,11,-16,15,18,-12,0,-1,14,-20,19,17,7,19,-1,20,-7,15,2,4,1,6,-1,-19,-11,-1,10,-14,14,-19,5,17,7,-11,3,16,11,12,-13,-1,-10,-16,-10,-1,-11,11,14,-2,20,-1,-16,10,-12,-19,6,-18,-14,2,16,-20,13,-15,-13,8,5,-6,14,-9,5,18,-8,13,7,12,20,-9,-2,19,12,-14,17,-6,5,18,3,-4,2,-19,-18,-16,-9,-12,-19,-20,18,-5,0,-6,11,-2,15,1,1,19,-12,17,-18,19,15,-16,-11,20,4,-15,-5,4,-18,15,16,4,-8,14,11,1,-10,-1,7,4,-16,16,-17,-6,-13,-17,13,-14,-3,-11,-12,-15,-9,-15,-14,3,-9,4,20,8,-5,9,10,20,10,-2,-17,10,0,-4,-1,0,17,17,-8,-16,6,6,7,9,-5,17,2,4,1,-14,-6,-19,7,-4,2,-7,9,-19,6,2,19,-6,-3,2,12,-15,-18,-17,-20,1,-2,-7,8,7,16,-3,14,-17,-1,-20,16,17,20,3,-3,16,-10,-13,-7,11,-5,-12,-4,1,3,4,-10,16,-12,-14,-9,-16,7,-13,-17,14,-2,-5,-8,-17,13,-10,-7,3,-19,-11,-6,8,-2,-12,-14,-17,-8,-9,-5,-20,1,8,6,-5,2,7,6,1,16,-12,17,1,12,-16,-1,6,-20,-19,-18,14,-8,-6,18,0,-11,-5,15,-10,-19,20,-3,11,-8,3,5,6,-5,-20,-17,-17,-9,-10,20,-3,3,2,16,-7,-20,1,-1,-20,5,7,7,-17,-4,12,-2,-19,18,-14,-13,11,-17,6,-2,8,11,16,-13,-11,-6,-2,-11,-1,-14,12,0,-14,4,6,0,-20,-5,-3,15,-20,14,-18,-15,14,12,-5,4,-8,18,-2,-5,-6,-11,-9,5,-1,-5,10,16,-11,-6,9,13,-1,-7,4,-12,3,-1,-10,0,19,-12,8,3,-12,-19,19,3,11,17,-20,-3,-20,-17,-3,10,13,-16,-7,-13,3,-6,13,15,-5,9,-11,-9,10,17,-15,19,-17,-6,6,19,9,17,3,-3,-10,-9,2,-19,7,10,-10,16,-13,-16,3,4,15,9,-15,-3,-13,-2,-15,1,-10,-3,7,-17,13,18,17,8,-2,3,8,13,7,-10,17,10,-7,17,-18,-10,-12,10,-8,11,5,0,0,12,-2,-9,-12,-16,17,-4,1,-7,16,13,-6,11,15,14,13,20,15,8,-12,5,-6,16,-20,18,6,20,7,-16,-3,-19,-18,2,-7,16,12,-19,-14,3,14,-11,18,13,-16,-17,2,13,-20,-2,-9,1,2,16,18,14,0,-6,-20,19,-9,-4,11,-18,-20,18,5,2,13,8,-10,-2,8,12,-15,13,8,-15,2,3,-3,-8,-1,1,17,-18,-8,-6,-9,5,12,9,-5,13,-17,-18,-14,-19,-17,18,-6,18,20,-6,0,-9,6,-4,-12,17,-11,8,19,13,12,14,19,-9,-8,20,20,-6,-9,-20,-2,8,4,-8,0,12,-4,6,2,8,19,11,-19,8,2,3,4,10,19,0,3,2,-11,2,14,-20,-3,15,18,-19,10,14,4,2,17,-4,-18,-3,6,11,7,-9,-15,-18,-13,-20,2,10,-3,-6,-6,5,12,-17,1,14,-17,17,7,-9,-17,-13,20,2,-4,-20,18,8,-1,11,16,6,-7,-4,-7,2,-1,4,-18,-5,14,-3,-1,15,4,-4,19,6,-1,-2,-9,-2,-20,-11,-19,-1,6,5,10,18,7,-14,-16,-10,16,-19,16,12,15,12,-10,-6,7,-14,-12,-17,15,15,20,9,13,-12,20,-7,-2,8,5,19,-2,-12,5,-18,17,-7,-9,14,20,8,-3,-17,17,-13,-11,19,-10,-15,15,-15,20,7,12,-13,14,8,-15,19,13,20,17,18,10,-2,-6,8,-18,-6,13,-15,-10,-6,-11,-12,-14,-3,9,-17,10,4,-7,7,10,-6,-17,12,13,-10,12,-17,-9,-4,-9,14,-7,-18,-5,-15,-9,4,-12,-10,1,-11,17,-12,-4,0,9,17,-3,-20,-16,-16,1,13,18,-18,-6,-14,11,12,-17,12,12,17,15,8,20,16,13,-11,3,-16,12,17,-1,-19,-6,-17,11,8,-20,-7,-16,-2,-17,-3,-8,20,-17,-4,-1,-1,7,8,-8,18,2,-6,-4,-16,6,-16,-15,-5,17,1,-3,-20,14,17,4,0,11,-1,-4,20,7,13,4,7,2,9,16,5,2,-20,-9,18,19,-11,-18,12,-14,-2,-4,-2,-6,-14,8,-9,20,8,20,-19,-5,-4,-5,-18,-9,-1,0,-13,-2,11,-7,-19,-18,10,-7,16,-4,-20,-5,-18,-4,2,-19,16,-18,-7,19,6,-15,14,-19,1,17,-2,-4,0,-8,15,9,14,1,17,1,-9,17,-20,-4,2,-12,18,-11,5,-12,11,3,-20,-1,6,16,3,-20,6,-18,12,-5,-8,-10,-13,0,-4,1,-15,11,-1,-15,1,-16,-12,13,8,-8,4,9,-14,-16,-6,-13,18,-5,2,-4,7,3,7,16,-18,15,14,14,3,3,-4,13,-15,-18,15,5,3,-12,10,7,10,18,-2,0,-6,17,1,20,-6,5,-2,-5,-2,-16,-18,13,20,-13,-11,16,1,3,8,-8,2,-18,-16,17,-12,17,10,2,19,11,0,4,-7,12,5,-5,14,9,11,-8,-8,11,-13,-6,-4,-15,-6,13,4,15,12,6,-18,-7,10,10,14,-15,-10,-10,9,15,-17,19,17,2,-3,-14,-3,-19,0,-1,-15,1,3,-19,18,-4,1,10,-7,5,2,-19,16,-15,-14,12,-14,-9,17,6,-14,1,-2,-6,-12,-12,-17,-3,-13,12,-16,18,-19,4,8,4,20,18,4,8,-17,18,20,3,-9,8,-18,-13,5,6,15,6,17,-12,18,11,14,-13,-5,-5,0,-13,9,-4,4,11,7,2,10,13,6,7,16,8,20,-13,-16,-10,18,10,7,-13,-19,19,-2,7,14,7,-20,4,-20,-4,-4,-19,-16,13,-7,20,-18,6,17,-16,-6,-3,3,-7,20,-5,-15,-5,-8,8,19,-8,12,-12,6,11,16,-7,-9,9,-4,-1,6,-12,-20,-15,13,-20,0,-9,-8,-5,15,8,15,5,9,1,-17,2,17,6,-11,14,18,-11,-3,6,-14,6,-14,-16,-9,-12,-16,9,11,0,-2,11,5,12,0,-14,-7,4,2,6,-5,-8,1,-13,17,-11,-15,9,-11,-18,10,-1,20,19,2,16,13,-1,-20,10,10,19,17,-1,15,9,-4,-8,12,-5,-13,18,19,-18,18,-13,8,-15,1,7,-13,6,-8,0,9,-5,2,18,5,-4,10,20,20,12,14,-13,15,-18,13,-15,18,13,14,6,-15,10,-5,3,2,10,15,-19,16,-19,9,-1,-3,-7,1,-10,5,-10,-6,20,-1,10,11,-1,-12,3,-3,-17,-6,0,12,10,2,-17,-19,19,12,-15,-2,11,11,-7,14,4,-13,15,5,6,19,20,10,-14,10,-12,14,13,-10,7,0,11,-3,3,-19,10,-3,-5,5,6,-6,2,-12,-14,20,-20,19,-14,-20,5,-14,15,-8,-11,-13,2,14,-7,9,0,19,-8,1,-15,-12,-2,-3,20,8,6,-11,-10,10,-3,13,0,20,7,-20,-19,-15,16,-3,14,-9,-10,16,-10,-16,10,14,1,-15,-19,17,-5,-9,3,-20,-8,2,7,20,-17,12,-17,20,-8,-14,14,-2,2,6,9,8,-5,-9,13,-3,-13,-3,-16,-7,19,-15,-17,-11,8,-5,12,3,-15,-17,-20,6,2,14,9,9,-18,4,-9,13,18,-8,-13,7,13,-15,10,3,11,17,-1,-1,-18,5,18,7,-7,4,-14,5,-16,-4,4,15,-2,-7,-3,5,-9,-7,-20,-11,-7,-2,-11,12,-19,-6,0,2,3,-17,-2,11,20,-16,4,-8,20,8,5,-20,-9,-4,-8,10,16,-5,-19,5,0,-10,-11,-16,-4,19,-15,15,-7,19,0,14,2,-5,0,-9,-14,18,7,12,-12,0,-11,-6,-6,-8,-10,5,-11,-9,12,-16,14,0,12,-9,17,-18,-15,9,-10,-8,2,-16,20,5,-3,14,-1,11,-5,-6,12,-14,-11,2,15,15,14,14,-14,17,-20,18,17,-9,-15,4,18,-8,-16,-9,12,-5,-12,-8,11,-20,-13,0,9,9,-14,0,-12,-18,-5,-19,-12,16,2,20,6,14,-4,12,-13,3,20,15,5,-11,-16,8,3,8,3,2,2,-7,10,-20,7,16,-16,10,11,11,-4,9,11,-13,-2,7,20,-9,-17,-3,20,5,10,5,9,19,-2,3,3,-7,-18,14,20,18,-13,20,13,-3,-9,18,-11,12,-2,10,15,1,-5,15,-11,-6,-8,18,-15,-10,-4,-6,-11,-4,20,13,-11,-20,1,18,-2,0,-13,14,-8,20,19,2,15,6,-11,-8,16,-4,18,3,-11,-10,-13,-5,8,-14,11,12,-13,9,-18,9,-5,-3,8,-11,16,4,4,-9,5,6,9,6,11,8,7,-5,1,-1,15,11,7,11,-10,-18,-9,10,-20,11,18,-4,6,-3,-2,-17,7,12,13,-1,-15,-12,6,18,5,-16,-1,-16,-12,3,-12,12,-2,-14,18,-15,-18,17,3,10,-16,2,-12,3,11,-9,20,8,19,-17,2,-6,13,18,18,-20,8,-16,13,16,-12,2,-6,-13,-9,12,-2,-16,-10,8,-8,15,-7,-10,-3,-1,18,-7,-7,-4,10,-14,5,3,-13,-14,-3,-15,8,14,-6,-16,16,2,-12,16,-4,19,-6,13,-3,15,5,8,15,13,-8,-1,-15,-18,8,-11,-2,-19,-16,-8,1,-2,6,14,-12,-18,14,17,0,8,3,1,-9,6,0,17,8,-9,-17,20,-19,13,0,-1,3,5,12,7,-2,17,0,-11,-9,14,-10,-10,0,11,-17,13,17,-9,-2,0,13,-16,-18,17,-12,-15,1,-14,-14,5,7,6,-16,6,-19,19,17,-3,0,11,-3,9,-3,-8,1,20,20,-9,10,8,-11,-5,-14,-4,-10,14,8,19,-11,3,11,-9,-14,8,15,5,0,14,14,2,-4,10,-10,5,11,0,-4,7,10,-4,0,-7,-15,12,17,-13,-11,-15,8,3,-7,-2,16,-7,6,-14,9,-13,15,-9,15,-11,-10,11,7,7,13,18,-13,-13,-7,-19,5,-14,2,-20,-10,-6,-14,-13,-12,-19,-18,-8,4,20,-17,12,-16,-7,9,-17,9,-5,-8,-9,0,15,-14,5,-5,12,13,-5,-15,16,-7,16,-11,4,-9,-9,-9,13,20,-1,3,-5,-8,20,12,17,16,-8,18,10,-4,-13,-11,-20,-11,-13,-6,-11,5,-19,5,5,-9,-19,7,16,3,-16,18,-1,5,3,-18,-2,-14,-10,-17,-12,-12,6,-20,19,17,-19,9,-19,2,17,7,7,3,5,-1,-5,19,-14,-2,-12,-10,12,-10,-6,0,5,-2,-1,-10,15,-15,18,-12,6,-5,-13,19,9,15,20,-6,-19,18,-19,1,-10,-8,15,10,17,-12,-19,-4,9,16,15,-6,1,-2,3,7,2,-1,-7,13,-9,15,9,10,6,13,-1,-5,-17,-5,2,-20,-5,5,3,5,-9,20,-16,-12,-3,-6,-7,-16,-10,17,-15,-11,-6,-18,-7,16,16,5,-4,8,-18,-6,-17,20,4,20,8,9,20,2,16,19,0,8,-14,-4,18,-12,-18,-18,18,16,2,16,8,19,-13,-19,-19,18,-19,1,3,8,-16,-14,-13,20,-15,6,-6,18,-17,-18,-9,6,-10,-17,-2,15,19,6,6,14,1,-2,18,-2,-11,13,-15,17,20,-1,-15,-6,7,-18,-17,3,-9,-17,6,-1,-6,14,1,-13,-1,13,1,6,11,2,-12,-4,14,3,-12,-13,-13,3,-16,-5,-14,-10,19,-7,12,-13,-17,-4,20,2,4,14,-4,-5,-8,4,16,-19,16,16,-13,-2,4,13,12,-20,-5,2,2,-14,-7,-3,-6,13,-20,17,5,15,8,-17,-9,14,-16,2,-18,-12,7,17,-9,19,9,5,19,-18,14,-19,-15,-16,17,-10,-3,17,-17,20,14,-14,14,-11,1,-6,12,7,-8,12,13,-13,-4,12,5,-3,12,11,-19,13,4,-19,16,11,-3,9,3,16,-5,3,-6,0,-18,-15,-2,10,-18,-9,-15,-10,-17,-3,18,-17,12,0,13,8,-6,11,1,-18,-18,15,1,16,12,-9,11,4,-3,9,-3,-11,-3,-16,-1,-14,-5,0,13,19,8,-20,-19,14,17,-18,-11,6,4,-12,0,-9,6,15,19,6,18,-20,5,-13,17,-9,14,15,-8,16,11,-6,-16,-12,14,-3,15,0,10,-16,-17,7,-2,11,15,15,2,1,9,-4,15,-13,-15,5,12,16,17,11,-8,7,-18,17,9,-4,3,6,2,0,-14,5,-15,-14,3,4,4,4,-11,-18,-17,4,-19,17,-17,15,16,-11,0,7,-6,-13,12,-3,-9,-6,-1,-12,6,12,-1,-2,-4,12,-19,18,-16,-3,0,20,2,12,13,-10,-4,-19,-6,20,-20,6,8,-18,-11,-1,-14,-11,-7,3,-5,-10,0,1,-20,-3,-3,18,7,4,1,9,-16,-16,9,2,-20,-13,14,-4,10,0,5,-12,15,-19,10,-10,10,-8,-20,3,-1,16,-4,-13,-12,-5,-17,-10,-11,19,-3,10,-13,6,-16,-10,-12,9,16,-19,5,19,2,20,19,16,17,7,0,2,2,1,-14,17,-4,-17,-5,-6,18,18,11,9,-16,-16,-5,5,-18,-2,3,-4,16,17,19,-17,20,17,6,-11,-5,-2,-5,20,-4,15,-8,-19,-8,-1,-6,8,-9,4,20,3,15,-6,-14,18,11,4,-14,-10,11,-1,18,7,-9,5,-17,-14,14,-4,-15,-18,1,-3,20,1,11,-8,-2,6,10,-7,-6,3,-12,10,-9,-9,16,-20,13,-19,-13,8,-15,-1,8,9,19,2,18,-3,-14,16,-2,8,-7,4,11,15,-3,6,-8,-20,-6,18,1,-2,-3,14,11,-20,-10,-10,9,7,10,-8,19,1,-4,-8,-6,-13,2,20,0,-12,9,-14,18,-3,-9,-1,1,-5,11,16,2,0,7,5,17,-20,17,-9,9,-3,5,16,-8,3,-9,13,17,-11,-13,-15,-3,16,7,-19,0,-19,0,-18,13,-7,17,8,7,-19,-14,-10,-4,10,16,-7,16,-18,6,10,-16,17,2,-15,-14,3,-6,8,15,-17,17,-16,-19,0,-15,12,9,10,15,-1,-16,-16,19,5,15,-18,1,-3,3,-19,-10,1,12,18,-12,20,14,9,-7,-13,-1,-3,1,1,9,-12,11,-13,18,8,-7,8,4,2,-20,10,1,-13,-16,-1,-17,4,-8,-16,9,-3,4,-4,-5,5,-7,17,-13,3,1,0,10,4,-11,4,-14,-12,-4,-3,-8,-12,13,19,10,-20,-7,-6,-19,9,-11,-16,-17,-5,-15,18,20,-10,11,9,8,-14,4,4,1,11,10,12,-20,-17,-8,1,-4,11,-11,-2,6,15,11,-4,13,-17,-6,3,20,13,2,0,-7,16,16,14,17,0,-16,-16,12,2,-9,7,3,-20,-12,-15,-7,-6,-18,8,19,15,2,5,-13,-5,7,14,1,-10,19,5,-11,5,10,15,2,4,10,4,8,-1,-2,-12,12,10,-4,5,-3,-15,-18,-1,15,17,12,14,-10,0,-2,20,-3,4,1,15,-3,7,-7,7,9,-20,-3,1,8,-9,-7,11,2,-12,-15,-10,-12,-4,18,-5,-7,4,-18,13,-10,-3,13,-15,-3,8,13,-1,-10,-20,-10,-2,15,19,-4,19,-17,-8,4,-11,7,2,10,5,9,-12,1,-17,6,15,16,9,-13,14,12,18,2,13,-14,-14,-15,1,15,3,-9,9,15,-20,11,11,-12,-19,-3,-13,3,-7,18,-14,-19,5,16,-6,-20,13,-16,9,-9,-5,11,-5,-14,-15,11,2,2,-3,17,-3,13,1,-12,18,5,3,-9,19,0,7,-8,-11,13,11,-13,18,3,10,7,-11,-19,-3,14,4,11,18,5,-4,-8,-12,11,12,-18,-11,2,7,10,-11,-9,12,-9,9,6,-17,12,-17,3,-20,14,0,-7,-8,-16,8,-16,8,-5,15,-20,14,-1,7,-1,-7,-1,-7,-16,-6,-18,10,-18,-18,-16,20,-3,-20,4,-14,-1,-3,4,10,-2,-15,14,-13,10,-11,10,15,-4,-15,-17,-15,-20,-7,17,18,14,16,20,1,-15,14,9,2,16,-16,-8,-15,-12,-3,4,3,18,-15,3,-14,-20,14,-12,-6,8,-9,-1,-19,8,-8,-4,4,-7,10,19,-8,-5,10,13,19,3,-10,15,-20,20,-15,-4,19,12,11,1,3,-7,8,-8,14,-19,2,-17,16,-6,-8,-11,-17,15,-11,-10,11,14,8,0,-8,6,-8,-15,-5,0,-14,-16,7,15,-9,12,-15,5,10,-18,20,16,-16,-9,-9,-1,-6,11,9,12,-11,-2,19,-4,1,-10,-9,3,4,14,5,15,6,-5,4,-11,-2,-17,6,6,4,17,-14,9,4,-5,14,8,-19,-19,5,-7,-1,15,-4,14,-20,15,4,4,20,15,-1,18,9,0,11,19,6,11,7,-16,14,-18,1,-19,-15,10,-6,13,16,18,20,-6,17,-7,-20,-9,8,2,-15,18,20,17,10,9,-8,10,5,-13,-5,7,-14,-5,18,-11,-20,-14,-10,15,-13,-13,-2,-17,-16,-17,-18,-6,-5,-2,-8,0,3,2,4,-7,20,-17,13,17,-13,-15,8,-4,7,7,11,10,2,-2,-4,7,-19,-2,4,-16,-3,6,-18,10,9,5,-10,-14,-19,-13,-5,19,-13,2,-19,-1,5,16,-15,12,18,19,10,-17,-16,-16,4,-5,-11,9,-9,12,18,17,15,-17,19,2,-18,6,19,1,1,8,13,8,17,14,6,-10,-2,6,8,-18,2,-14,17,-13,9,2,-9,0,5,7,-4,8,18,-5,17,-19,-20,3,5,-10,-2,-8,-13,2,14,-10,-7,7,7,20,20,-17,-3,-6,2,13,7,19,-16,-6,13,-8,-16,8,-15,8,19,-5,-16,2,4,-6,0,17,7,3,-1,10,-11,12,15,-14,-2,10,-16,6,2,6,3,-14,15,-7,1,-7,-17,4,-5,-12,-5,12,19,13,-5,13,-9,0,-9,15,15,16,-19,-20,-7,12,-9,-19,11,-9,4,-10,-8,8,4,-18,-20,10,-14,16,15,-18,7,11,-20,-6,0,7,-3,-13,-19,-7,-7,-12,18,-5,16,6,20,15,-6,8,-2,-7,-18,0,-15,20,16,-19,3,14,-14,-15,-13,3,0,1,-15,10,5,-13,-3,-12,-14,13,19,17,-9,-15,-16,4,-10,3,-19,16,12,-1,20,20,-16,-11,17,11,-11,-15,-6,14,-8,-20,-15,20,-19,-17,-8,-20,-11,6,-3,16,-2,19,7,3,-7,-9,-11,5,12,-18,8,14,-20,4,4,-10,4,18,2,0,20,5,-1,-20,16,-9,-1,-17,7,-8,-4,-6,15,-7,14,11,14,0,-16,5,-11,-16,-7,17,9,-10,-12,-13,16,-4,6,-20,-7,17,19,0,15,0,0,-2,19,-3,-3,-20,-19,2,15,-10,-8,-3,-1,-12,-5,19,-16,-8,-3,10,-20,-11,13,-14,-4,11,-16,13,-10,4,19,9,19,-1,-5,-18,-1,0,4,-1,1,17,17,-2,16,-5,4,-8,18,-13,15,20,14,16,1,15,8,-4,-7,19,16,16,-6,7,14,-6,20,12,11,-2,7,-2,-12,0,-15,-14,20,-8,5,-17,-4,12,18,4,-14,13,11,-6,19,-3,5,-14,10,-2,18,8,-19,9,-8,17,9,-1,16,-5,-3,-18,6,-17,0,-6,-8,6,-2,-20,6,9,-15,7,-12,13,-8,15,15,3,3,9,12,-1,5,-6,-18,17,-18,-5,7,-4,-12,12,0,7,11,-10,-9,-15,4,10,-2,-1,4,14,-4,0,13,20,-2,3,9,13,-17,1,-2,19,-16,-11,12,-9,-1,8,2,5,2,3,-19,-12,18,1,10,1,2,6,19,-16,12,-8,-1,-3,14,-13,-5,-4,-16,5,-4,-15,6,12,-19,-7,14,-11,10,6,16,-5,5,-19,17,17,-12,-15,17,-11,8,-17,-1,19,10,-9,-16,19,0,14,-7,-5,-8,-1,-11,-12,8,20,-10,20,16,8,-20,-7,-12,20,-14,-15,-5,-20,12,10,-10,-17,-9,-4,-18,0,14,0,-17,-11,-13,19,-14,-18,-18,-11,-20,3,-19,-1,-6,13,0,-12,-19,5,-14,20,12,1,-1,12,-14,-18,6,-19,15,1,-12,18,-11,-7,-7,-10,-4,-19,3,1,18,-16,-9,14,-2,-20,-15,-14,6,-2,18,3,-17,20,-2,-20,-5,-8,-20,5,-2,4,12,1,13,-11,18,-16,-12,-19,-17,13,-1,-2,6,-4,4,16,5,0,-14,-7,13,-5,9,-11,-2,-15,0,18,-12,-15,7,-16,6,-13,-9,3,19,-6,-8,9,-6,-18,12,3,-19,10,12,7,-20,-1,-12,7,11,-16,1,11,-17,9,10,-19,-3,12,-9,3,-18,4,13,7,-6,-10,-5,-14,-10,-17,5,13,12,-1,9,-17,-16,-20,-19,-15,6,19,5,-12,12,3,9,-10,16,7,10,-2,-8,6,-20,-20,-3,-19,-7,11,4,9,-3,-17,-15,9,-6,-12,-5,-1,6,18,13,-3,9,19,14,-8,-3,-14,-15,-5,-4,11,20,-20,-7,11,-4,3,-11,20,6,5,5,3,-1,17,10,17,-13,-20,16,-20,-1,-10,-13,-11,-11,10,-3,-8,-12,-2,-8,-17,-13,-7,-18,9,17,0,14,-12,20,7,13,1,-11,17,-16,-18,2,-9,-11,19,-12,5,-2,-12,-3,-18,-20,-17,-15,-14,6,-18,-5,18,-12,11,9,9,-10,4,2,-17,-10,3,-20,-20,16,-7,-2,-11,-19,-8,-13,11,0,9,-9,14,11,18,-6,-7,-3,-16,-20,19,-19,-9,0,-18,19,-5,-7,-13,-6,7,-3,-10,-11,-2,0,-7,10,-19,13,-4,-8,-6,-16,2,13,17,5,1,-2,-17,-7,19,4,0,-10,17,4,-13,12,-2,-2,16,-9,4,19,5,-14,-20,10,-12,-20,9,5,-17,20,8,-13,-6,-16,-6,8,14,2,-11,1,-9,8,-20,-5,-16,12,-13,-18,14,20,16,11,-9,9,19,-1,17,-6,7,13,7,5,7,3,-7,2,16,-7,12,-5,16,10,3,-13,-12,-18,19,-15,6,15,8,-11,8,11,1,-14,1,-12,1,18,14,8,-3,15,-3,-15,14,-19,-11,-16,13,-6,-7,0,-4,-19,-18,1,20,-7,-8,10,3,-19,12,20,6,8,-5,15,12,8,-10,-11,-7,-4,-10,3,19,5,-17,-5,-15,-10,-5,-13,2,15,1,20,-18,-6,6,4,13,4,14,-14,-12,19,-2,16,14,-8,-5,-13,13,5,20,16,-11,-8,15,7,6,1,6,10,11,-15,18,-16,17,-10,7,-2,-13,-18,13,5,-10,-2,12,-4,2,-16,14,19,-7,-17,1,4,8,1,1,-3,2,-15,14,-11,4,14,16,-17,9,-17,19,2,-9,17,1,13,-2,-7,20,11,6,14,20,19,13,-18,-4,-1,-12,1,0,-14,17,-12,7,-7,-9,10,-6,-16,-18,-14,14,4,-12,-19,2,-19,20,-4,-16,-4,8,-20,20,-17,-3,-6,-7,-13,-20,-4,11,6,11,20,17,-14,15,-17,3,9,13,-6,7,-20,10,-15,-10,-7,-8,8,6,8,12,-15,-7,-18,8,-9,-4,-1,3,-18,10,-15,-1,-14,11,1,17,3,20,11,10,-16,-5,-20,0,8,18,1,15,-3,9,-8,-8,-6,18,10,-14,18,-1,12,13,0,19,16,15,-17,-2,2,-4,14,-20,11,19,-3,-3,10,-4,15,18,12,2,7,12,-10,-14,13,7,-9,-1,-1,6,-9,-15,3,-20,-8,-18,15,7,-1,18,-1,8,-18,17,7,-10,18,-11,-4,19,-2,-19,-4,-20,1,12,7,-18,-15,-8,-10,12,14,-9,-1,20,-7,6,3,-18,0,-13,4,-17,11,-5,-3,-12,9,-14,17,-16,14,-11,14,15,-15,-17,-6,-14,14,4,-13,-2,-3,11,2,5,18,4,16,-19,2,-10,12,-18,-7,-14,17,-13,18,19,4,-5,17,-17,1,-4,-5,-8,16,4,2,-10,-8,12,13,-13,20,2,-16,-17,2,7,4,2,-1,-5,18,-1,6,0,-4,-15,6,-10,10,10,-20,12,12,-13,11,9,17,13,13,7,20,-14,1,-10,11,11,-6,17,-13,-9,-1,9,-19,-11,3,-20,-17,11,8,7,-13,-10,6,-19,14,-11,16,9,9,10,13,-19,-7,6,1,14,9,16,11,20,6,-20,-10,-15,1,10,1,0,11,16,6,-2,1,-2,5,0,19,-8,-1,-15,10,-16,2,-13,-11,-8,2,6,5,16,19,-17,15,-8,-15,-12,0,18,-9,-14,-11,-4,10,-12,7,-6,-8,-5,7,7,-1,-14,-19,18,10,-11,2,-20,-1,6,-12,8,-1,-4,-19,18,-15,-14,10,2,18,-1,0,-12,10,-16,-12,13,19,14,-9,-5,-20,-11,5,-1,-5,14,8,16,5,17,-6,-18,-15,13,19,0,-3,-6,-8,-12,-6,-2,15,-3,2,-1,8,18,19,-4,13,17,20,-19,3,-5,8,17,12,8,-5,19,-14,-4,14,14,-9,17,-2,-10,11,-8,-8,-19,-17,20,-6,-14,4,12,-2,9,19,2,4,-4,-6,3,-2,17,-5,-18,-13,13,9,9,1,15,2,-4,-13,-2,-12,17,16,-3,9,-18,-18,-6,12,-10,-7,11,-13,7,15,6,1,-15,13,9,12,-17,14,6,-8,-13,16,3,-20,11,12,3,-18,7,18,20,13,-2,9,-10,4,-6,12,18,-9,0,-20,-7,-4,-12,-14,-7,5,20,-17,-5,-8,4,-18,0,-12,11,-17],"KYV":[19,17,-19,8,-1,-20,1,-13,15,-15,7,-4,-4,4,-10,-17,-3,17,-9,14,-5,-16,-20,-19,5,10,15,7,12,8,10,8,-8,19,-18,-17,-18,3,3,-15,-6,-13,14,-11,-20,20,-10,11,-3,13,12,-5,-4,-4,11,-3,-16,-5,12,18,17,6,0,19,-10,-12,-20,10,15,18,-3,10,3,19,8,-11,-8,-2,-11,10,2,-13,-8,14,10,-11,-20,4,15,-18,-17,-5,-17,1,-8,-11,-14,-16,-20,-13,-4,0,9,-8,7,13,-7,-2,-19,9,20,9,11,14,18,-17,18,-4,-18,3,-16,-5,-8,-9,14,-2,11,11,-19,15,13,-10,13,-8,-18,-19,-3,-9,-20,-14,-1,17,4,-17,19,-7,17,20,8,20,-5,0,1,-2,-7,-14,0,-8,8,-14,-10,4,-16,10,15,-5,-17,20,16,-8,-3,0,7,8,17,15,19,9,-17,0,-12,3,-19,-12,18,5,-15,2,-20,2,7,-3,-15,-9,17,-5,-19,17,0,11,-19,-17,-8,15,-19,-6,-3,14,9,-1,6,-10,18,-18,19,17,-4,-15,-11,17,16,13,-4,-10,0,-14,0,14,-12,-2,-15,13,-14,-6,20,-2,10,14,0,18,-9,12,11,0,9,4,18,-12,-11,8,-8,-1,-3,-9,-6,13,20,-4,5,9,-14,16,-2,-13,19,4,13,-14,-4,7,-8,8,-5,9,-14,2,-8,-5,-11,-9,14,5,-2,6,8,7,-15,0,6,-14,-15,16,12,-19,6,-13,10,-12,-10,-2,-20,0,-2,-19,-8,15,1,7,-12,-19,-2,15,14,6,-15,-9,14,-6,10,15,6,5,-20,-20,18,14,-1,6,-20,-13,-5,8,3,-9,-3,-15,18,1,5,20,11,18,-20,-4,17,12,13,-7,-6,7,2,18,8,-16,12,-3,5,13,17,7,-16,-17,-8,9,-18,-17,-7,17,-18,16,16,-15,-1,-17,-13,-2,18,-17,0,-11,16,10,-12,-12,4,-18,19,-17,-19,17,20,-17,7,-4,2,3,-19,10,-19,2,-13,11,10,12,6,-15,-8,8,15,3,9,-4,-2,-11,-9,3,-14,20,-15,10,20,15,0,3,-9,-7,7,-16,20,-14,3,1,20,19,-2,-1,-20,-1,-15,-14,-19,-10,-11,-9,-4,15,-1,12,-2,15,17,-12,-3,-5,4,4,14,-11,-9,-16,-14,11,19,18,17,6,1,3,-5,-2,-6,11,17,-10,-12,15,-10,16,8,-17,-17,-4,-1,-6,-18,12,-17,3,13,-10,-9,13,5,11,16,-19,-10,16,-7,10,4,-17,-20,12,-2,-17,10,-6,-10,15,15,-3,1,3,15,20,6,8,2,16,-3,-15,-6,13,19,-15,2,-4,1,-16,10,-13,15,-15,7,-6,-5,-10,6,-11,14,16,-7,18,-2,9,18,-14,9,17,-13,-1,20,9,2,13,18,-9,4,1,-7,-16,-6,0,18,7,18,14,-3,-1,2,2,17,-14,1,17,-9,-18,6,-10,-4,13,18,14,-6,-13,-1,20,13,-6,20,5,-3,19,5,18,-20,-9,-9,5,17,14,-14,6,-3,-12,6,16,17,-12,5,11,2,-11,15,-2,-7,18,8,-16,-1,9,-9,-15,12,-12,20,-15,11,6,4,-14,12,-8,0,-17,-9,-1,-7,10,-12,-11,-6,12,15,-13,-14,13,-3,-9,-9,-15,-13,0,6,-19,9,1,-9,-1,0,-1,-13,-7,9,-18,-19,18,-12,5,-11,12,3,-19,-17,-16,-9,6,20,1,19,-1,2,-9,16,11,-12,2,-11,-2,14,11,1,-2,15,8,-3,-11,-13,10,-13,3,-17,-1,-6,-5,9,-8,19,20,-16,-2,12,-17,-13,1,-2,-1,-7,5,-14,-5,1,-3,20,4,-17,-11,-15,15,18,11,0,-10,10,10,13,-13,15,-18,-15,-6,-18,10,-12,3,2,-11,-3,-19,13,-18,19,-8,15,-1,19,4,-18,-15,-12,-19,17,-19,-10,-2,18,6,-11,5,6,3,-7,-6,-16,18,-15,15,-2,-5,2,5,7,-12,-10,-14,-11,-2,-12,-20,9,16,11,7,11,-12,8,-9,11,-13,-10,20,-7,-7,2,17,-11,-4,-6,3,-12,-12,-7,-19,1,5,-20,5,-5,-3,-11,14,12,9,0,2,14,-9,-17,-11,-14,-20,2,-15,6,-10,3,3,9,10,7,6,0,-8,1,-14,8,7,17,-17,-4,-20,7,-20,-18,9,-10,15,-10,20,-14,-16,2,3,-1,-5,-18,-13,5,7,-2,-12,7,1,18,15,-14,1,6,10,-10,17,1,-6,11,20,-19,-4,13,17,-2,9,-15,7,-1,-16,-14,10,8,19,5,-6,0,0,9,18,-10,19,10,-5,19,-10,13,-19,9,-15,-14,-12,-17,17,7,13,-6,20,9,-19,-16,-1,13,-1,11,-6,17,-20,-13,-1,-19,11,-18,-18,-15,-2,4,-18,5,-16,-18,-11,-11,-4,11,13,-11,6,-19,18,17,10,-1,17,-18,18,-16,-12,-13,20,7,-14,1,-16,-6,15,-9,19,5,-2,4,15,-10,-4,16,-12,-8,-4,19,14,19,11,-9,-8,-10,-10,-3,-1,-18,15,1,-9,4,-10,2,-7,11,-13,1,19,13,-5,16,15,-2,-12,2,4,-16,7,16,8,9,-16,-7,13,-7,-5,18,-16,10,5,15,-5,-5,-15,-13,-20,14,-5,6,-8,-8,2,-4,-7,10,0,-15,17,16,-15,4,-8,18,-3,8,-20,19,16,17,11,-18,17,14,11,-10,-11,7,16,11,19,-6,-11,-18,-6,-1,12,-5,13,16,-18,-8,-9,9,5,14,0,-17,13,2,4,-2,-19,-1,-19,-6,-2,-13,4,-20,-6,-5,7,4,19,16,20,4,0,1,-3,6,16,18,8,1,3,18,20,-14,-20,9,7,-16,9,-5,-18,2,13,-19,17,14,16,10,7,10,9,-1,7,5,5,10,17,4,-19,4,2,9,12,-9,15,-9,8,-20,-14,1,12,-1,-11,-7,2,-6,10,8,-3,7,12,-10,1,6,-11,-12,4,14,19,-18,19,4,16,9,-7,-16,-8,-11,-11,6,-10,12,-15,0,8,19,-15,8,4,-20,-12,0,0,-5,-18,1,-9,-10,-12,12,7,-4,-3,-9,-16,12,13,5,-1,12,-6,10,-3,-1,-16,2,-10,-5,-14,6,-3,-1,-5,6,-20,1,-2,17,8,-16,-1,-4,17,-11,9,6,-5,-16,-5,-7,6,5,4,-18,-15,-11,-13,16,9,-7,-15,3,20,-8,-5,-2,2,-15,7,18,-15,12,-9,11,3,17,5,-7,-4,-20,11,-17,19,-15,0,-1,16,0,11,-8,2,-2,3,8,4,4,20,18,-20,-8,20,12,-9,9,11,10,-18,3,-12,20,7,18,6,-5,20,19,5,-9,15,6,-9,16,-11,-2,20,19,-20,-8,14,19,9,-11,-16,-9,12,-13,-11,8,14,-20,15,-3,-16,7,-20,10,-13,-19,-1,-3,15,12,0,-5,8,-2,-14,-13,4,-20,14,0,-7,-11,-19,-2,-3,11,1,-20,10,0,-8,12,1,4,-14,7,20,20,17,18,18,-16,18,-17,3,-2,2,-20,7,-13,-1,18,15,11,-14,-10,19,-12,-3,-4,17,1,-12,14,5,6,6,18,-1,13,10,-17,16,12,15,16,8,11,-5,-12,-7,-11,13,-2,0,-14,-18,2,-11,-15,-16,-18,-14,-3,7,-18,-4,1,3,-8,-2,2,-8,-13,19,-20,-5,-16,-1,6,3,13,-7,-8,-2,9,-14,16,16,-15,9,-10,11,16,-5,3,-20,-7,20,17,-12,-6,-1,5,8,-5,-3,8,17,-1,4,11,-15,17,-11,16,12,-3,11,-19,19,-14,-2,19,-8,5,0,-19,16,-9,0,11,-3,-12,11,7,-20,6,4,8,-9,2,11,-4,-13,-3,4,-10,8,13,10,-14,-15,7,10,-3,-6,-17,8,16,-2,-13,-17,-17,-19,2,-7,0,11,9,-4,1,-19,12,-15,5,7,9,13,9,-1,19,1,-6,8,6,0,4,3,4,-15,9,14,17,3,5,12,7,18,-16,-10,10,-11,-13,-6,6,15,-5,-5,10,-4,9,10,-20,-13,10,13,20,-20,16,4,-14,1,-12,-12,1,14,-9,13,1,1,5,-3,5,-6,-10,1,20,3,18,-7,6,-14,4,-9,-18,15,18,-6,7,-1,3,-15,-18,-3,-8,17,-13,9,1,-19,-17,6,10,16,-10,-1,4,6,-8,-8,14,0,-18,4,-3,-12,10,15,17,12,0,7,-8,3,6,-16,-16,-14,16,6,1,5,6,-20,4,11,-1,-1,14,-3,-16,-5,10,-8,-17,-14,-20,6,-15,-17,-14,-17,16,6,-13,-4,-20,-16,-5,13,1,-3,-19,-7,-1,-11,-14,-3,18,3,4,-11,12,-14,-10,-7,12,-14,5,19,17,-11,-14,-17,18,7,14,-6,-7,15,18,16,-5,0,-18,-12,2,10,12,8,-18,-14,-8,-13,-19,9,-15,0,0,-7,8,14,-15,-5,-18,-12,11,-5,16,12,-20,7,11,20,3,6,17,16,-1,12,-4,-17,15,20,-7,8,5,12,3,5,-20,-12,8,-7,17,1,1,-14,-8,17,18,-9,19,2,-5,9,-2,-8,19,6,-16,6,17,-4,2,-7,-15,19,-5,13,14,8,3,10,-14,-2,-3,-6,-4,-16,11,-12,-16,8,-4,-7,-1,20,5,-8,9,13,14,12,15,4,1,-9,-16,-4,-17,12,14,7,10,-3,-8,-6,15,-20,-6,-1,19,20,3,0,4,-8,-2,-9,20,-5,-3,17,12,11,-5,1,-10,9,-6,14,14,-14,18,9,5,-15,13,-14,15,3,4,19,14,-5,-20,-13,19,4,16,-4,-7,19,-2,-15,-18,14,-1,14,-13,-18,9,-6,16,13,-16,7,-11,1,-6,-13,7,13,12,-5,-4,6,1,-2,14,-15,6,13,-4,3,-16,12,15,5,14,16,19,-11,4,-12,13,6,16,-16,-7,-15,13,-3,-2,4,15,-5,7,-15,-12,-11,16,-20,-9,-18,10,2,-4,-18,-10,13,-16,-14,4,-14,7,-20,17,-13,12,-16,-2,15,3,5,12,19,10,12,-6,7,3,5,6,-4,14,-11,14,-4,9,15,-11,20,10,-16,-14,3,-12,9,2,-18,16,-16,-4,16,18,-6,7,-17,-11,3,-14,3,-7,-18,3,2,19,-2,17,-14,20,13,15,-3,13,2,-5,-4,17,16,20,8,13,-7,2,-10,-15,20,-6,15,12,-10,6,5,-12,-9,12,13,20,19,18,-14,-19,6,16,13,-20,1,16,14,8,-18,-14,18,-8,0,-6,18,-8,-11,20,7,19,-9,-17,1,-6,9,-1,-3,-12,-11,11,6,-13,-9,20,-18,1,7,18,-5,14,19,13,-6,16,4,1,0,3,19,-2,2,10,4,-12,-7,16,3,-17,4,-3,-8,-15,-13,-2,-7,4,9,-6,5,17,20,-13,10,-12,13,17,6,-14,-16,-4,-7,-4,-9,-12,-7,16,5,13,14,5,-12,-19,7,-9,-17,10,-17,2,1,4,17,2,10,6,-8,3,11,-12,3,-16,-19,2,-18,-16,10,-10,-15,-1,18,-1,1,-1,-19,-4,16,8,4,-20,-19,18,6,2,-9,11,6,2,3,2,-19,5,15,11,8,-5,2,18,10,-11,-9,6,15,-20,-13,-1,-14,-5,-2,5,4,0,10,-19,-20,3,4,-11,-15,6,3,-7,6,-20,-8,10,8,20,-16,-8,-6,8,-5,-16,-15,-10,-17,5,-6,3,-2,-5,-6,-5,14,1,14,-8,9,-9,-8,-4,-4,19,20,-15,-18,-10,16,8,-1,-11,14,2,-9,19,-13,-7,12,-9,-5,-12,11,11,-18,-13,18,2,12,1,-20,12,11,-20,13,-5,-7,-19,-17,9,3,-10,-14,16,13,-16,2,-3,-9,16,-19,-18,15,7,-2,-4,-11,10,16,8,-3,11,0,-5,-2,8,-11,-17,-5,-17,-1,19,6,-13,-3,-8,-17,-15,10,-7,17,-5,14,15,11,17,-16,14,19,4,-1,-7,6,-6,0,15,13,7,5,-8,2,11,19,-7,-1,12,20,-14,14,0,-13,11,-7,-8,14,-16,-19,11,-13,4,-18,-11,-10,7,-19,0,8,2,-10,-17,-11,-9,-15,12,12,1,19,-9,16,17,14,-11,-16,1,-2,-16,-19,-16,-6,-16,-11,1,-2,-2,-8,14,2,9,-4,-16,-6,10,-3,-5,19,-10,17,18,8,0,-7,-18,-19,1,5,14,13,4,-3,0,10,-19,-20,-13,16,6,11,-12,14,20,-17,-9,-13,3,9,-15,-7,17,15,8,-2,7,-13,-19,7,-7,8,11,-11,-20,-19,13,15,10,18,18,-17,-1,-17,-7,-4,-17,12,-1,4,16,-9,13,5,14,-13,-6,-8,16,-16,-7,16,17,19,13,15,1,2,9,-17,-6,19,-15,-10,11,5,15,-14,9,14,-7,11,-6,-6,-14,14,-9,1,4,4,-18,-6,-1,-13,-12,-10,7,-7,-11,-3,2,-1,-20,12,-11,-18,5,11,-5,11,12,-5,2,19,3,-8,0,-19,5,2,17,-10,-4,-20,-5,0,17,-15,-15,-6,20,4,4,8,2,-16,15,6,17,-4,8,-6,17,-16,-3,2,-17,-9,-3,-19,15,9,-18,-13,-16,-11,-11,5,14,-7,0,13,-9,20,-14,15,-8,6,3,3,14,9,11,-12,-20,-9,-8,16,-4,-18,9,18,1,0,-4,5,18,5,15,-2,20,-16,2,-3,13,-17,-5,13,-15,6,-4,5,4,16,14,7,10,-14,-12,-16,-18,12,-5,12,17,7,4,0,17,13,-13,8,9,8,-16,6,11,0,-15,-1,-19,-7,18,-10,9,-20,-9,-1,-8,0,-20,-12,19,14,19,9,1,14,3,18,16,-3,1,5,-5,-2,-4,8,0,12,5,17,-10,17,-17,-6,-9,-14,5,-7,-6,5,-11,-18,4,13,-20,-13,-6,20,-10,-19,-1,-6,-1,9,-15,-4,7,4,-1,12,0,20,14,-10,2,-17,18,-1,2,2,-16,-9,-18,9,8,8,4,-3,-7,8,8,-19,-4,-10,-18,-18,-19,-6,8,0,0,3,-7,-4,-13,2,-18,-20,-7,-13,-10,-3,9,-10,-17,-12,3,-19,1,8,-3,-12,0,15,-12,-12,-13,12,7,11,19,-6,-3,9,-17,-12,-5,18,8,20,-3,10,10,-10,-13,17,8,-3,14,10,-11,-17,20,-17,4,8,1,11,19,12,7,13,-12,15,-19,-3,-11,0,15,5,2,4,-15,9,11,20,11,-19,-3,20,-1,19,-13,5,-18,-15,10,-12,12,9,12,-3,8,-10,-8,-13,-18,-4,-10,17,16,10,-3,-12,18,-14,-7,6,15,12,15,-10,10,-8,8,-16,2,-10,18,-3,12,15,-14,6,15,-4,15,15,20,11,14,19,-3,-17,-4,20,-1,20,3,20,-8,19,2,14,-7,6,1,-13,19,10,2,-12,-1,-5,-20,19,18,-7,-4,-2,-17,-10,18,1,-6,6,-10,5,-7,-16,-17,-15,-3,-7,-2,-17,12,-6,2,-18,-1,-14,-7,-12,15,11,-11,3,20,8,12,14,7,-15,-14,-12,12,17,16,11,-8,-18,3,-2,-9,-19,-15,17,-18,14,-19,10,4,-14,9,-9,-4,-8,-10,19,-20,14,13,-13,-4,2,-18,-6,-8,-14,12,18,-2,14,3,-2,9,-20,-13,16,-19,-16,-7,20,7,5,-1,-5,-1,-10,1,-20,-19,-11,-12,6,6,6,-13,-6,-2,1,-18,18,12,-18,1,-19,-12,7,-14,-15,0,-10,8,-16,9,17,-14,0,10,13,12,2,-8,-13,-14,1,0,-18,2,-4,-5,-16,-2,7,7,20,18,-10,1,5,-14,11,2,5,-13,-6,-8,4,14,-19,7,5,9,18,-12,12,11,-13,16,-18,20,8,-3,9,13,-2,18,18,12,-7,-11,3,6,-10,-8,19,-5,3,12,1,10,-3,0,-16,-3,4,1,-20,-19,17,1,-7,17,3,-9,19,3,16,-4,-19,-6,12,-20,0,13,17,-16,13,14,16,-11,-4,16,3,-15,-1,-5,7,20,10,-4,-4,-2,-4,17,-7,3,5,-20,-6,-9,3,7,-6,-14,-20,16,-11,6,7,-8,-2,-1,-13,-17,-15,-20,-12,-20,3,8,16,-6,-17,12,7,0,-8,5,9,-2,-4,2,-14,5,10,14,-16,4,-20,4,-2,15,15,11,-15,-13,-7,20,18,-12,-18,-4,-5,-17,13,9,-10,-10,-12,-11,9,-10,-19,11,-14,20,19,19,-9,-10,-1,-17,-4,0,13,-15,-10,-8,20,10,15,-17,-9,-19,-8,3,0,-12,-19,-18,4,13,13,-4,-13,-8,4,-15,-13,19,-9,-13,-1,12,5,7,5,-19,14,18,7,-17,-5,4,-17,-11,-2,18,-18,-3,-2,7,-4,-20,11,-12,16,13,-8,1,2,11,-18,9,-4,0,-13,-10,-8,1,-20,-15,-2,-6,-19,-18,-13,-3,0,-11,15,-9,-17,-12,7,8,-18,-13,-11,-5,-2,7,0,8,20,-9,19,3,10,2,5,-8,5,-9,-7,-15,13,13,-6,-19,-11,-9,13,-8,-2,8,-3,-9,13,3,3,20,-7,-17,-4,8,-20,0,-6,1,8,-3,-17,9,-7,6,2,-18,15,16,20,5,-20,-16,-16,-6,19,20,10,16,11,-17,-12,-13,20,3,18,-19,-10,19,-17,-2,-18,-2,5,14,8,-1,7,15,6,-2,-6,-12,-6,8,-11,11,0,17,6,0,19,-6,15,6,-6,-5,-12,2,14,-16,7,7,20,-16,-13,-20,-12,-18,-15,1,7,8,-18,-5,0,9,1,-19,-20,1,4,0,9,-2,19,-3,1,19,-20,13,-3,-12,9,-11,14,17,2,8,19,20,-3,-14,-8,-19,2,1,-2,-12,3,-3,16,6,16,14,-20,12,17,-10,-9,-12,1,18,-6,17,1,-5,11,-10,20,-15,14,-5,19,18,16,4,1,-7,9,11,16,13,18,-15,19,5,-18,-14,1,-20,20,-15,-10,-13,19,-10,-19,-18,10,-5,-7,-4,-15,17,0,15,-4,7,-16,1,3,17,-3,1,9,8,6,-16,20,-10,-19,-12,15,14,11,5,-10,12,-8,7,15,6,-13,1,7,-20,12,-8,-10,-16,8,0,16,16,-15,-16,20,-16,-17,4,-17,-6,-5,-2,-12,19,-3,14,2,-11,-7,8,1,16,-11,16,12,15,-6,-11,15,-11,-18,13,1,16,6,-12,-18,-13,14,7,16,-19,-17,10,2,7,16,-19,-2,-12,-9,0,19,10,-13,-1,-7,14,-18,-1,16,-9,-4,-16,12,-10,4,-5,9,-6,-7,5,-16,-9,-12,-12,-9,-11,13,17,-13,8,7,3,10,7,-6,-16,0,2,-11,2,0,-3,-19,-17,-9,13,-18,20,13,-14,1,-7,-3,-1,14,4,16,-4,-5,2,-12,7,-5,-5,-16,-16,8,-3,-3,9,-6,-8,2,-13,16,-12,14,-9,14,13,5,2,7,15,3,-17,-13,14,10,7,12,-15,-17,-1,-16,-8,2,-10,-16,6,-3,-6,15,-8,-9,20,-9,-6,-14,0,-9,-3,-15,9,-16,-17,-2,-3,7,-13,-16,-3,17,-4,-2,3,9,-3,-8,-13,20,6,-7,1,-3,-7,-15,15,17,-20,18,3,-7,-8,3,-19,-19,-17,12,11,16,-1,12,-13,-3,12,20,0,20,17,5,18,10,-13,16,-11,19,8,16,16,16,-19,10,6,-5,5,6,-14,11,20,-11,-11,13,-9,20,7,-1,9,12,-20,17,-11,-4,17,-2,-7,6,-16,-18,-13,18,10,-18,8,-18,-12,-11,-11,-20,15,9,11,-8,2,-14,-1,-15,15,4,4,-10,-9,8,-17,-16,11,-9,18,0,-8,16,-6,13,20,12,19,-7,17,-17,-14,0,9,4,-13,16,20,8,-1,12,-8,9,-17,8,-10,4,13,-10,19,-19,14,5,0,5,13,20,8,-18,-7,-10,-19,14,-6,-4,-11,0,9,13,-12,-1,18,10,12,-5,16,13,8,-11,-9,4,6,4,-12,2,-10,-12,19,-20,-6,12,-2,-3,10,-10,-3,-14,13,16,12,9,-16,18,-12,0,-4,-13,0,3,-1,3,9,4,7,4,14,-14,9,-14,12,-19,5,-11,-4,-18,-1,3,18,-5,-19,-5,-1,16,-10,20,7,-14,-7,17,4,20,-17,-10,-19,-2,-2,-2,0,-16,17,0,20,19,0,5,-15,1,8,-3,18,14,-9,-4,6,11,-19,8,-5,7,7,-18,10,16,-9,-19,8,1,-4,-16,3,10,20,-4,9,-14,-1,4,3,-10,-18,12,-19,11,-14,12,20,-5,10,1,11,1,14,18,-2,14,11,1,16,2,14,4,-11,18,-4,-13,-5,19,10,-2,12,2,-13,15,-12,20,-1,7,-17,6,-15,-1,12,-5,18,17,19,2,-16,-10,2,2,-2,-8,5,-20,5,-8,11,19,4,1,17,-2,-3,-17,15,-20,1,14,14,17,20,19,9,2,5,7,-17,5,18,13,-5,-16,12,-5,-7,-4,3,4,-2,13,4,-3,-1,-8,16,13,-17,-17,6,-19,1,19,2,11,-9,6,8,12,4,11,-16,1,-12,-19,14,-10,15,-14,-17,-6,13,-15,-10,20,-19,-8,7,-4,-1,-16,-20,-6,16,17,-1,-8,-2,8,9,-15,-5,-2,10,-8,9,-3,11,-9,6,3,8,3,17,19,16,0,-13,5,-6,10,10,17,-10,-20,-11,4,5,19,-6,-1,4,18,-16,17,-8,7,16,6,-15,-1,0,19,-1,10,-14,-1,-11,-9,-9,-4,-1,17,-1,-12,16,7,-16,-13,9,-20,-16,9,-2,8,-5,-14,9,20,20,-16,10,-7,13,-9,-10,5,-11,-18,18,-19,-14,10,16,16,-3,8,13,9,-6,4,10,17,-6,12,-20,-12,8,-15,4,5,10,-13,-5,-3,9,-11,-5,-16,17,17,-14,-20,-12,-20,-16,1,-16,7,0,9,-9,17,-15,-6,4,-4,20,-20,12,16,11,-4,-13,-17,-17,18,-4,8,-14,0,5,-1,-17,-19,-2,14,-2,14,1,3,18,16,-15,-16,3,-15,-5,18,2,-12,-7,-10,-10,-8,10,-3,1,-8,15,-4,3,-5,-5,-18,-12,1,-9,2,1,8,3,-4,18,14,16,11,20,-17,13,-1,-3,-14,-6,-15,12,13,18,-12,0,-1,14,-18,-19,-17,-18,-12,13,-16,7,-18,-15,3,-18,-10,-7,16,-6,20,8,8,-1,-19,6,-8,-15,-18,-3,1,-8,13,3,12,-2,-8,-20,-8,7,-12,15,-2,-15,-13,8,-3,-6,-5,13,17,8,10,20,6,14,-7,-14,6,-5,9,3,-13,-3,-4,-16,17,3,6,18,-5,8,15,20,10,-19,-10,-8,11,20,2,-10,18,-14,1,-15,-8,4,-6,-18,-9,-6,-9,-16,-12,15,-18,5,-3,11,-14,-20,5,-17,-20,20,-1,-5,16,5,-14,12,10,17,-19,5,13,12,3,0,3,-4,-2,-15,-13,-17,-19,-3,17,20,-13,-9,19,-1,-2,4,1,-12,-17,2,18,4,14,16,11,-13,-10,-7,10,-18,10,-3,16,11,-18,-5,-10,-10,7,-5,-4,-11,5,-20,-5,-2,1,-7,-2,-12,17,17,9,-9,13,-6,-16,19,17,14,-17,-16,-16,-11,14,11,7,-7,-17,-14,-1,14,0,7,2,-4,-5,1,2,14,-2,11,-4,-15,15,1,7,16,-1,15,5,-8,-13,20,15,-14,6,6,3,5,-19,-11,12,4,-7,18,-10,19,-11,-7,-6,-14,9,-5,-18,17,-1,0,2,-4,-20,17,-3,-16,19,-1,17,15,1,18,2,5,-13,8,-1,-15,-12,19,10,16,-20,-4,7,3,6,11,3,-9,-12,18,-18,-7,-9,14,19,4,12,3,-4,-13,18,-4,20,-18,16,11,-1,-19,16,-6,17,-9,11,16,-2,10,-14,4,15,9,-15,2,-8,-16,13,-17,-2,-6,19,-20,13,-13,-9,-9,17,0,10,20,8,19,-12,11,10,-2,-7,17,-9,4,14,-12,13,-12,-20,-7,-5,-16,-13,7,-17,-3,-14,12,-10,-17,0,-20,9,7,-10,-2,-14,1,7,20,12,-1,9,12,-6,2,11,-14,19,-15,5,-15,16,4,-8,12,-5,-8,13,9,-15,-17,18,-15,-9,15,3,16,11,-11,-15,13,20,6,16,7,8,-3,19,11,-15,-2,2,9,16,-16,12,-14,6,6,6,-6,10,18,-10,-19,-14,10,8,14,14,-14,-14,-3,-4,2,8,-17,16,20,-19,-10,-15,-10,-9,13,15,-20,-7,17,-17,4,-7,-8,12,6,11,17,-8,12,-9,-11,-14,-11,-7,-16,15,12,10,-15,5,11,6,-19,-3,12,-6,-20,12,-19,6,-4,-18,11,12,-8,-6,-16,-6,-8,7,15,8,1,5,13,15,-7,-13,20,-5,-16,6,-19,19,4,0,13,12,16,-4,1,6,-1,-4,-9,8,16,-20,-6,2,18,-11,-2,-6,9,5,18,-17,-8,18,16,12,2,-19,-7,16,16,6,4,-13,5,7,2,-4,-4,6,-18,-14,15,7,19,-14,-5,16,9,-14,-14,-6,15,-7,-7,1,-3,0,-17,5,-6,5,-18,-5,-13,13,-8,7,20,-17,13,20,-13,10,2,-9,-5,6,-13,0,10,-13,-8,11,3,16,-15,-3,-6,-16,7,14,11,-18,-14,19,-13,-6,7,14,5,-5,8,17,-3,10,17,7,-13,-18,10,-17,-8,-9,14,18,5,-16,-15,18,-7,-17,-16,5,-18,-5,18,-18,-2,-4,10,-12,10,11,2,-2,15,-12,9,-19,-9,13,-19,5,-6,-19,14,-4,-6,0,-2,17,5,15,14,15,-19,-1,-19,-9,-19,8,11,-14,-9,-5,13,-8,4,-20,12,20,-9,0,-2,17,16,8,-9,-9,13,-7,18,5,16,13,5,4,-7,7,20,-17,15,13,-14,12,-13,-14,-15,4,-6,11,-2,19,-9,6,-17,-20,-12,-13,-5,-9,10,-14,-3,-6,-8,-2,-7,-20,-4,-18,19,-1,-2,-14,-7,-6,14,-8,10,-19,-15,-11,13,13,-10,20,-3,-19,-8,-13,-13,19,-10,1,-10,10,-4,12,-13,-14,-7,16,13,-19,-4,12,5,3,-20,5,-20,19,3,10,17,-6,-11,-12,6,20,-3,4,4,14,3,15,-7,19,-1,0,18,-9,2,8,12,15,3,-3,0,4,4,5,4,-9,7,12,-3,15,19,-10,-11,-15,18,14,-6,-8,17,6,-2,-5,7,-17,20,6,8,13,-5,2,6,11,0,-17,1,-8,15,-17,9,-2,-13,14,-20,-8,15,10,14,-12,-13,1,-8,10,-11,3,-11,-6,18,1,2,7,5,3,2,-3,-17,7,-14,2,-5,15,0,8,-7,16,12,2,14,-1,-19,11,11,-20,11,-2,15,-8,-2,-20,5,0,-8,-2,17,-10,-11,-15,-18,-6,-14,18,-5,-6,-7,4,7,2,-20,5,20,-19,12,-19,20,-10,6,8,6,-10,19,-19,20,12,17,17,-10,1,10,2,4,7,-11,-13,14,16,-17,2,5,-6,7,20,-14,19,-4,2,0,3,1,9,9,-11,9,2,5,-19,3,-4,6,-5,-3,15,-7,0,-11,4,-12,-3,-4,-10,-7,8,11,14,15,-15,3,13,-20,-17,12,-4,5,20,0,-3,18,-4,-17,-6,7,-14,-5,-18,-13,2,-19,4,-19,-15,-1,5,8,15,4,2,4,8,-15,-6,-15,4,4,-3,0,-7,-15,12,5,-17,-10,2,-14,18,-13,7,6,4,1,9,-16,0,20,-8,-17,2,-19,8,0,14,15,6,-20,-19,14,-15,3,-4,8,10,18,17,-17,3,-15,-7,-7,-16,-12,-12,-17,-14,-9,-14,-7,0,-12,0,-18,-20,-11,4,-16,6,-1,-8,-17,15,-2,18,-5,7,-20,-9,6,-3,-20,-7,1,-8,17,-2,-16,-4,-12,5,-6,11,-16,2,19,13,-11,-17,-10,-15,-8,-3,-1,-13,-3,3,11,0,-2,-5,-16,7,-4,-15,-6,-10,-3,-11,-1,-12,6,1,8,6,-16,-18,-5,13,-18,13,-11,19,17,-8,4,-11,-10,-5,-2,11,8,10,-9,-15,-19,-6,18,-20,8,-14,-17,5,1,16,11,0,-16,-7,18,1,-13,3,20,6,5,12,7,-5,17,1,9,-10,12,-8,-4,2,3,-16,0,-3,9,-16,9,-1,2,1,-4,10,11,-6,-11,-18,-13,-12,0,17,-2,-7,-5,-11,17,-13,-11,-15,-12,7,-5,2,-11,-13,16,-12,3,18,13,6,18,17,-18,19,11,3,-7,20,5,15,18,3,15,20,-9,9,-15,-9,10,14,15,-19,-11,-12,19,19,0,-13,5,9,10,-4,13,-3,0,1,17,11,13,16,-20,-4,8,8,12,-13,1,14,6,-13,-11,-5,-14,14,-18,14,11,5,8,-7,-19,5,0,12,-2,15,-4,2,-6,11,-15,-3,-15,15,19,-15,12,-5,-14,16,-16,-16,-13,4,-11,9,-13,-16,-7,18,0,9,-4,10,16,5,13,-6,-7,-12,5,10,-13,12,-17,-13,17,-1,-12,0,8,18,0,2,-1,-2,7,3,-8,19,9,19,-8,-2,-5,-10,-9,-15,-18,17,-8,20,-20,5,-19,17,-5,-3,-17,-3,14,-16,4,6,9,20,18,2,3,-12,14,-3,-7,-15,-7,-4,9,13,18,7,-1,-18,-4,-1,-3,-16,0,17,-19,15,9,6,-2,-20,6,-3,-3,-10,4,-3,18,0,-1,18,-10,-8,3,-12,-1,-7,12,16,-8,-7,7,11,-13,3,-18,-13,-1,-16,-20,19,-16,8,9,-2,-12,-3,9,18,-17,-1,-10,-8,18,-18,-2,18,10,14,-20,-4,20,11,18,5,13,-13,10,-1,-13,-19,12,-18,-19,-15,20,10,17,19,16,17,9,4,-18,-5,-16,-2,-19,6,-7,-17,-14,-6,-17,-5,20,4,-17,10,15,-20,2,12,0,-13,-19,7,-1,16,9,-16,-17,-18,13,18,1,2,-1,6,19,-9,18,8,-13,10,20,-13,9,-4,15,17,8,17,19,3,0,-17,4,-10,13,-10,1,-13,20,14,-2,18,-6,7,6,7,11,14,-10,-5,17,-4,1,-9,-6,-19,3,0,-19,-18,11,-17,3,-11,12,-11,4,-6,-2,-17,-9,14,-8,15,19,14,-14,11,7,13,-14,15,11,12,-18,12,-11,-20,-13,0,19,-11,-10,13,9,1,-18,19,-8,0,-7,-4,15,-14,18,13,-18,-14,-1,10,-7,19,-2,-20,-16,12,5,-8,6,-4,-15,15,-11,1,-5,17,5,-15,13,3,-9,7,-12,-4,-6,8,9,-11,-13,-5,8,2,-13,13,-2,-6,-4,9,-18,-16,14,16,9,8,-19,9,-2,-13,20,-12,1,-18,2,-18,-1,15,-15,-6,16,19,-8,3,-20,2,2,10,16,-15,19,-2,-6,-18,1,-20,-13,-7,-16,-7,20,1,-4,4,-8,-1,19,11,3,19,18,15,10,14,15,-18,-12,18,-17,-17,-2,13,19,3,14,-12,6,-2,-1,19,14,13,8,15,-1,10,0,7,-20,18,3,1,20,-15,-10,9,-12,-12,-6,19,-5,-11,-7,7,-10,-15,13,11,15,4,-14,7,-11,-3,3,-18,-10,13,19,-5,11,-4,-12,-12,11,7,-11,0,6,20,10,-4,-15,3,5,10,17,-12,-4,-16,7,-10,-20,-10,-4,3,-1,-4,-9,1,9,-6,3,-18,8,-8,-15,15,2,10,-9,4,2,9,-14,-16,15,15,-3,-11,6,-6,16,-20,-9,-18,-5,5,-19,6,-7,9,8,11,2,12,20,0,15,9,11,10,-14,2,15,14,17,1,-15,-12,8,-2,-10,7,6,-1,1,-1,-19,0,3,20,8,3,-3,-6,-20,0,-2,3,-1,4,8,11,-4,6,-3,11,10,0,-12,18,12,3,19,-12,17,9,-14,6,-14,14,-17,-4,10,16,-11,18,8,-1,18,-2,-3,5,-3,-16,-1,-14,9,-18,-5,-16,-8,-5,5,13,-20,-12,-4,6,-11,-1,-15,-18,20,-15,-9,2,-20,-16,-18,-9,12,1,-19,2,0,12,-7,5,-7,4,-5,6,-14,-9,-17,9,-12,-15,15,-11,-3,5,5,-12,4,9,17,8,-8,-8,-9,-11,-12,11,8,9,19,20,-20,-6,5,-4,-9,19,-19,13,8,5,-14,4,18,-6,-20,-13,19,-12,-9,-18,20,1,-20,6,15,14,5,-14,-18,-11,1,-11,-13,1,-11,16,-12,-2,-19,-13,-20,-5,-17,3,10,7,18,4,-20,-7,-1,9,-10,14,12,-2,18,18,-9,6,-7,6,-14,-4,-6,-9,-9,5,14,-9,-20,12,-7,-10,-5,-19,6,-12,-9,-8,1,13,11,17,15,-2,9,3,8,11,-14,11,18,3,3,17,4,10,-18,-12,-9,-15,-16,19,13,17,2,-4,11,-3,0,-11,-9,12,-20,-5,-19,-8,-11,19,15,-14,-4,14,-20,-2,15,20,7,-1,17,-14,-10,-8,-20,-3,-10,-17,-11,-1,-20,-3,-17,19,16,-7,-7,2,15,17,-10,1,1,8,-8,-8,-6,9,-18,-17,14,-10,-19,15,-11,2,-9,-11,-10,12,-8,6,-2,9,-15,-18,-11,1,-1,-7,14,6,18,-6,-20,-16,13,12,0,4,16,-6,12,-10,11,-5,2,15,11,-1,-11,13,3,0,-7,13,-3,-4,4,4,-10,-13,-7,-10,-19,16,-3,10,-17,3,-11,-9,18,19,-14,7,11,-3,7,10,1,-20,-1,-17,-1,-5,-15,-3,1,10,11,-13,2,19,-20,-18,-1,-1,7,3,-13,-14,9,-19,17,14,-15,-12,-15,-8,-11,13,5,16,5,10,-11,-12,-6,19,-4,-11,-18,18,5,3,12,19,8,0,8,12,15,20,-7,4,-10,15,-17,13,-8,1,-19,11,17,-20,0,-3,-2,15,6,-4,20,8,-12,-20,-7,-7,-12,11,3,12,20,-7,15,-16,8,-19,9,-18,-2,-16,7,3,-5,19,-6,-1,6,5,4,3,-17,12,-8,14,1,20,6,11,-12,-17,9,2,-9,-2,-15,-14,-13,-10,-18,14,-15,11,8,10,-20,9,10,-10,20,14,4,-19,-8,2,10,-5,18,7,-15,-13,4,-20,-9,-19,-9,19,2,-16,-8,-17,-19,4,12,20,-2,17,-18,-18,14,7,1,3,8,-4,7,-14,18,11,5,-20,3,14,16,11,2,-7,15,13,-14,-7,10,-19,-3,17,18,13,-15,-17,-16,-11,19,-20,1,-5,4,-1,-14,-18,-15,10,20,-17,16,13,-9,4,-6,-20,-9,-10,-2,13,0,-11,-10,-8,0,13,13,14,-17,4,19,-10,2,-18,-8,3,2,-4,6,-10,-14,10,-18,-11,20,7,0,6,2,-20,1,-15,9,-5,-8,6,18,6,-11,5,-10,-15,19,7,-17,-5,4,16,-8,20,-13,0,20,4,12,7,4,-16,17,6,-2,0,14,-6,6,-17,-3,17,14,5,-6,5,-9,-19,20,-6,5,-9,10,8,-17,12,20,9,-4,-16,-1,-18,-1,-18,-15,2,-1,5,4,3,-20,4,10,4,2,-17,-4,-17,-11,-19,-1,-17,1,5,4,17,18,-14,9,17,-9,-16,-10,16,17,20,-16,18,-4,14,6,17,13,2,-12,-20,-12,5,-10,-15,10,-6,2,5,10,-11,-15,-7,5,-17,-13,-15,17,8,17,20,-14,15,11,18,8,-20,12,10,-17,-9,-20,-3,9,6,-18,18,-20,18,18,14,20,-18,17,-13,-5,-18,-16,17,3,9,4,-16,-16,7,-11,16,12,16,-13,2,-4,-4,-11,7,1,-1,-9,7,-6,19,-17,-8,14,-15,-15,-12,18,-5,-3,15,-10,4,-5,2,19,9,-11,-11,13,2,12,10,1,-7,-19,-10,15,-3,-9,18,-19,-8,6,18,1,-4,20,0,2,-11,-5,7,11,11,-13,17,5,17,-14,-5,-10,-13,-2,18,-18,7,-9,16,8,-8,8,-18,13,-15,-16,5,19,-17,16,-8,14,-14,-6,-13,12,-4,20,-6,-14,20,-16,-3,-16,5,17,-19,9,-2,2,-11,5,-20,16,9,8,3,4,5,-5,-5,2,-16,9,1,17,20,3,-14,17,-20,12,10,-12,6,-18,-7,11,-8,-12,-17,18,8,-2,-2,-16,18,18,3,1,-12,6,16,7,2,10,11,1,13,3,-3,7,14,6,-12,-15,17,11,-20,-18,13,5,-15,9,8,11,18,-9,9,-7,7,3,-16,17,1,11,2,-7,17,10,20,-7,19,1,-2,3,12,19,3,-6,-13,16,-16,-12,-19,-12,7,-16,-11,-19,13,11,0,0,16,-6,20,0,-17,18,-6,18,-13,14,0,9,7,5,-4,-13,3,-6,8,-10,-11,16,-11,5,-17,11,-6,4,8,-3,-20,1,2,-5,15,1,-16,-2,10,11,6,-4,-8,-3,11,20,20,-11,-15,7,4,16,-4,19,16,1,-16,2,18,17,-17,-3,0,13,-10,-11,-18,-20,-4,-20,-4,-3,-7,-2,6,6,12,-5,7,10,-8,-11,20,-6,19,-11,-20,-18,19,9,8,-11,-1,7,1,1,13,14,-15,1,9,-1,-16,-14,14,-10,6,-17,4,11,13,-12,0,-18,7,-18,-4,-5,-2,-20,0,-5,13,-11,19,16,7,-20,-6,-10,20,-7,11,13,-12,-4,-16,2,-3,-17,11,-10,12,11,-10,7,8,-7,-5,17,-14,17,-2,18,-2,2,-9,-5,-16,-7,-16,-12,-4,-3,-1,10,11,17,-5,1,-10,-8,7,-6,19,-10,19,18,-19,-14,14,-12,1,-11,-12,18,-7,-8,3,16,9,11,16,19,-17,17,8,19,7,8,-18,0,15,20,-8,17,-18,9,12,18,17,7,6,1,-10,-20,-14,19,-17,20,13,-17,13,-10,5,19,8,-5,4,-10,-8,20,7,9,16,12,15,-19,5,13,-1,-11,-9,-1,5,-2,-20,5,10,-18,-15,18,-1,-3,10,1,-17,15,4,14,-19,-15,16,15,10,-8,-10,20,-20,12,6,19,0,-14,-7,-13,14,12,18,-1,-7,-10,-16,-14,5,3,-18,-4,0,-9,0,-12,9,-15,-17,-4,-6,-8,-2,-10,20,-9,16,15,-15,-11,1,19,-5,14,-16,-15,-20,-2,-7,4,4,13,-20,-10,17,9,2,4,-3,-7,2,12,-6,18,11,16,-15,12,-3,18,-15,-1,-9,18,-4,9,15,15,11,20,-20,10,16,-13,-14,10,-12,-16,2,18,-14,1,-4,-13,-3,19,10,-1,16,4,-1,-8,17,-7,-10,17,12,-8,20,10,-19,1,15,-4,2,-12,-18,-2,-19,-11,20,10,5,10,-16,0,-2,-5,5,-7,-9,0,19,-3,-20,-19,-9,18,3,-7,17,-10,-20,-17,-6,4,14,-13,-1,1,7,-7,-12,-14,-18,18,4,6,-19,16,3,8,11,-19,8,-17,12,-13,17,19,17,12,-5,-16,-12,-17,-3,-20,16,-4,19,-14,3,-4,1,11,-2,15,9,-7,-3,-3,16,-15,18,1,-5,-17,10,16,-2,-16,1,-18,19,-14,-5,6,7,6,-7,-15,8,-7,-13,-14,2,5,9,-15,-10,5,-15,-18,20,-5,1,-18,-6,-3,-1,-3,20,-5,0,15,-17,-4,-7,-10,20,18,19,-13,9,-12,3,7,9,-3,10,20,14,7,-6,1,-16,-14,1,6,-16,-15,14,-9,5,-13,19,-18,-5,-16,4,17,-8,5,-11,13,12,-19,-8,-8,12,-18,14,8,-2,13,10,6,-19,-11,12,-14,9,8,11,-16,-10,-13,-18,5,19,-13,5,-17,3,9,8,-10,-8,-17,5,8,6,-19,-19,-8,15,9,-7,8,6,-17,-12,13,-6,16,18,-18,-2,-18,-9,10,-13,4,-1,-19,-15,16,-6,-7,-18,15,12,-16,17,5,-11,-2,7,10,1,-13,-5,16,19,-13,-11,-18,20,-7,12,0,-7,-2,-2,-1,8,19,15,3,-9,-17,-9,-13,-4,-8,-1,4,16,-20,16,3,-6,-5,8,7,6,-9,-12,-5,-15,-4,11,-8,-1,-20,7,7,8,-2,5,-20,12,0,-3,6,-13,13,-8,-13,16,-17,17,-20,15,15,-12,-18,-20,-16,-1,-11,-12,3,13,20,-3,15,0,6,-1,9,3,-9,-4,-17,7,4,-18,19,3,9,-1,5,3,13,9,-19,-3,-18,19,-17,11,-1,16,1,8,-18,-18,11,-9,-20,-9,10,-3,0,-13,16,-13,-7,14,-13,11,19,7,7,1,7,19,5,-19,-7,-7,3,18,9,12,-12,-11,-18,-12,10,8,9,17,-2,10,18,-4,6,2,-15,-17,15,15,5,1,-7,14,-13,-5,1,-1,-8,-14,-3,-8,14,12,-9,6,-16,-17,9,7,-7,-14,18,-4,13,7,18,17,-12,7,8,17,-4,-9,16,-14,20,1,3,-18,7,11,11,-17,-10,0,0,18,6,-2,13,-9,-4,8,-3,16,4,-12,17,-14,-4,-10,0,-14,4,-13,-14,-1,2,-2,5,14,-5,13,-15,20,-18,10,17,-1,7,-12,15,6,-2,4,16,-19,-18,5,9,-17,9,10,1,13,15,-2,9,-6,8,11,1,-19,20,14,15,-4,-10,-5,-20,-7,14,19,11,2,10,-9,19,-12,-17,3,9,-13,-7,13,8,-13,10,-1,13,8,-18,20,15,9,-11,3,-5,13,2,-16,11,2,6,2,-20,-17,8,-19,9,3,-10,-19,-17,15,-11,18,-4,3,4,12,-14,-3,-9,9,1,-19,1,8,-13,-17,12,-16,-14,10,-8,20,13,11,2,-7,-16,9,-9,-20,-3,7,-2,20,2,18,-19,-8,-9,15,-18,19,19,19,-5,10,11,-1,0,-16,4,-14,2,-13,20,-15,4,-12,14,11,-16,7,11,-14,10,19,17,5,-3,-12,-1,-12,2,0,6,10,15,14,-10,0,20,1,4,-11,-7,10,4,-3,20,-2,-19,1,14,-19,-9,3,-10,5,0,-3,8,-8,-20,-16,-7,8,8,-5,14,11,-7,13,-8,-13,8,4,12,-20,-12,4,1,4,13,15,10,-1,-19,-10,-17,7,-3,-4,-3,-11,0,2,2,7,8,5,-20,-15,-11,-6,17,10,6,-14,8,20,4,-16,19,15,11,-19,-8,-16,13,17,16,-3,-8,-10,-16,-5,19,-13,-15,-17,4,-3,-14,-2,4,2,0,12,-17,-7,-2,-5,18,6,-12,18,2,13,-10,-18,3,-11,-20,-5,-18,-20,14,-1,-5,14,17,10,3,19,19,0,-16,14,12,1,-10,14,9,15,-16,2,5,6,15,-4,3,-14,18,8,-16,7,1,-15,15,0,-1,11,9,14,-1,-1,17,8,7,-11,-2,-7,4,-14,13,-10,-11,-4,17,0,-5,17,14,-10,20,17,19,16,16,5,7,-10,15,-20,14,-19,11,8,19,6,20,9,-4,-7,-17,6,16,15,6,0,-6,-16,11,-2,-7,12,16,-2,-8,15,13,-12,-19,2,-11,1,-7,-14,-15,-10,-4,9,12,19,6,-13,5,-1,-2,-11,-11,20,-18,-4,-13,6,10,0,8,2,-10,-9,-8,5,-11,-1,12,15,-3,8,18,8,11,19,-5,4,7,-16,-5,-17,12,13,-14,13,-8,4,12,4,-5,-19,-8,-16,12,-6,9,2,-3,-10,-19,-12,-5,-2,-19,-3,12,1,15,-2,2,-6,-9,-20,11,8,19,12,2,12,-1,-7,13,0,-15,-14,-10,12,13,2,17,-10,11,-19,16,-10,4,6,0,-20,-8,-12,-8,-15,17,-19,-7,13,3,4,16,-9,0,-15,-13,-10,16,-11,-16,-8,-14,1,20,13,14,-10,4,-12,2,0,0,-7,-9,5,3,-7,-19,17,9,-8,-3,9,-13,-9,3,17,-17,2,-18,13,1,-17,7,2,13,7,8,13,3,-9,15,-1,-13,-2,12,-17,3,16,-12,10,20,8,4,-18,-6,-2,-6,-10,-10,11,-16,9,-15,-15,-13,-3,15,-5,3,5,-16,-5,6,-19,-19,-8,20,13,-17,-8,4,-12,17,3,-9,0,-19,-10,2,12,9,20,-8,5,1,-4,15,-10,19,9,-3,1,2,6,-2,6,3,-12,-14,-18,10,-5,15,9,19,1,5,-17,-18,-13,-20,-12,7,-10,-20,0,4,-15,10,12,10,18,19,-19,-1,-19,12,-9,-15,-18,-12,-17,-17,18,-1,19,-13,-16,-18,-8,7,-20,-6,-13,7,11,2,6,-15,6,6,-4,9,-1,-5,7,-17,4,20,-14,-2,-19,-5,-15,16,17,19,-11,-1,-7,-3,1,6,1,-16,20,-11,10,-14,-18,-2,-1,-6,15,2,-12,-3,-20,6,0,3,13,13,-18,-1,-15,-2,8,-11,-9,6,5,-10,-4,-2,-11,3,20,-18,-5,18,18,-10,7,-16,-4,14,10,-13,-9,-17,0,-6,-5,8,-6,0,10,-7,-8,-14,2,9,-6,-8,-17,-13,-20,5,-16,18,4,0,-14,17,17,-17,-17,13,-12,11,4,-1,4,-2,-6,-5,11,15,-14,-5,-7,12,12,20,2,-4,13,11,-7,3,3,-10,-1,12,14,-14,10,5,-20,6,-5,-16,11,-6,-13,12,-9,14,-9,12,19,16,18,-7,5,2,3,16,-15,14,-9,15,-11,-20,-12,-11,4,11,6,-4,-9,-11,14,-15,-20,-13,12,0,-15,3,14,-7,0,-15,-4,-11,-12,4,-19,-15,-13,16,-20,-8,10,4,6,-17,-17,-9,-15,-5,15,-4,-2,10,13,-5,13,-2,3,-12,-10,-15,0,13,-13,18,-19,16,-16,-11,-3,14,8,-2,-7,-1,2,17,-15,6,-20,0,7,7,-1,14,18,11,-14,-20,8,-20,10,13,20,-8,-3,-18,-7,12,13,18,-3,11,-11,20,-7,-12,-4,-11,3,11,16,-7,1,-18,1,15,16,18,17,8,-3,3,14,15,16,6,-12,-7,-8,7,-12,7,18,-2,0,8,-3,-19,4,17,3,4,6,-15,-15,15,20,14,8,7,-10,8,-14,14,6,-9,-9,10,6,-18,-7,11,-3,11,-3,7,-14,-2,18,0,-16,-2,-11,-1,2,-14,1,8,18,19,0,-13,15,-8,-14,15,5,-11,0,-11,0,-9,-3,-13,-17,20,-7,-17,-17,-2,-3,6,17,0,10,3,16,10,-1,-5,8,-12,-12,-3,-6,-7,14,-7,-5,-6,-15,13,17,-11,13,-12,0,20,-10,4,12,9,-9,-16,-18,-8,13,9,20,-4,6,-2,7,-10,17,-12,13,16,-14,5,-6,-18,-3,2,12,5,19,-16,-7,-3,-5,19,0,-18,-6,13,19,0,-10,4,18,-1,6,-5,-1,12,12,15,-18,-14,10,-8,-17,-19,-1,16,-6,-12,13,12,-1,-3,-6,-18,1,13,-10,3,-2,16,-13,-9,19,2,-1,11,1,9,-18,17,6,-11,-14,4,16,5,13,8,8,1,6,-8,-1,-19,3,-6,-8,-11,14,12,-14,-20,-1,-6,4,-18,3,-11,-13,-10,-12,-19,-13,5,9,-17,-8,-9,15,-15,-4,0,5,18,6,1,12,-12,-6,-14,-11,15,-16,14,-17,20,0,-15,-17,-20,-19,-3,15,12,-14,10,15,-10,-11,20,1,-20,20,-14,7,-14,-9,-3,-4,16,2,-14,9,17,-11,-11,20,-18,13,19,-18,16,-11,-4,-15,-1,-20,-6,3,-9,-15,15,-12,-1,12,16,-18,6,6,-2,7,-20,14,-10,18,3,-10,14,-3,-19,-13,10,-14,4,-8,16,-13,-11,13,-9,1,-18,8,-14,3,5,12,-3,9,-2,-17,17,1,3,-14,13,-3,0,-12,0,20,14,14,12,-4,11,-20,1,14,7,-18,6,-2,-16,4,2,-6,-14,-10,2,18,-10,12,-2,-20,7,-8,1,-9,-3,15,16,-9,-8,-2,-19,-19,-19,-19,17,-4,-16,-20,-5,-4,17,-11,-2,-2,-16,19,15,-6,-8,-1,19,-7,14,12,19,-20,16,-12,0,1,-15,15,-7,5,17,2,15,-10,17,-1,-19,-2,-4,17,-12,20,13,6,-5,-14,-6,13,15,2,-20,-13,14,-14,-6,14,-8,9,8,-19,-2,10,-10,-5,9,15,7,11,3,-5,13,0,11,10,-7,8,-1,-1,20,-12,-11,-8,20,-3,-1,-14,3,7,11,-6,-17,-15,-4,-8,17,-7,-2,3,11,-7,-4,-11,-5,3,-4,-6,1,17,-18,19,15,-12,-5,-9,12,15,-13,-3,-16,9,-4,-4,-13,9,-10,-1,16,15,-13,19,-8,14,-8,3,-13,-13,-9,-2,-20,-13,-7,-13,4,-16,-6,16,12,5,2,-7,-4,20,-4,-16,16,-13,3,-14,19,0,4,-20,13,-2,-8,2,0,-6,-12,10,9,8,11,-7,-6,-14,11,-10,-2,-17,-9,-5,13,7,-12,-4,-3,8,-13,-16,-8,-12,-9,-10,3,19,17,-18,20,11,-5,18,-4,8,12,3,-6,-15,6,1,10,-4,-9,19,-6,5,4,-17,-10,-19,-11,-8,2,5,-1,-20,7,10,2,-8,-10,2,-14,-20,-17,-10,-2,-7,-1,-18,1,-3,-6,1,14,-8,12,14,14,-17,11,18,0,18,-3,14,-11,-19,-7,-4,12,-20,2,7,-1,15,-20,3,12,-18,-9,16,20,2,-19,14,-6,11,2,-6,-20,5,18,-9,-6,-19,-14,-5,-8,-13,3,-2,-2,-5,12,-2,8,5,2,-19,-19,-15,20,-15,9,-10,10,3,5,-6,-16,9,-12,-20,2,0,-7,-12,1,-9,-1,3,14,7,-20,8,-6,5,2,-14,15,-19,8,9,-9,7,-9,19,-2,-12,-6,-6,15,16,13,-9,-9,-4,-2,-15,-9,15,-6,-13,11,11,-3,-3,-15,18,-19,16,4,-19,-3,-5,-16,-15,1,3,8,-16,7,-19,5,-8,11,18,-8,6,-5,-3,7,-10,-18,0,10,1,19,4,19,8,-17,9,18,5,-5,-4,7,-17,13,4,18,19,8,6,12,14,9,14,14,-10,-7,15,-12,-3,11,-17,-10,17,-13,11,1,-20,4,2,-16,6,8,-14,-16,19,17,14,-4,13,15,-2,10,0,7,19,2,19,-9,-14,3,-13,2,17,-11,-19,-18,1,0,3,18,9,-1,18,-6,10,11,3,-10,-1,-11,-12,-2,1,14,15,5,1,12,12,16,4,-19,-15,10,8,-19,6,-15,16,2,-5,18,-9,-3,-3,-9,-15,19,-18,19,1,-12,-7,-20,4,7,-11,-1,-11,8,-9,10,-3,5,16,15,11,-11,6,-6,17,-6,-14,-2,3,5,10,14,-17,15,-1,-16,17,7,5,-3,14,1,-9,-13,7,-18,-4,20,4,-14,-8,4,11,-19,2,5,11,8,3,-6,14,-13,20,18,-5,3,-5,-12,6,4,-13,19,-9,17,13,-12,-20,1,-5,6,11,-8,-14,-19,-8,-1,-4,10,0,16,4,0,-13,-4,-17,-5,14,11,-15,-19,5,9,13,6,-9,-20,8,11,-19,3,5,-13,0,-8,19,14,10,9,8,-3,-8,-6,0,-5,-8,10,-6,-2,-15,18,-18,13,-1,-4,-15,12,-6,-15,-6,-13,4,17,10,-19,-13,16,-7,-14,-6,12,-16,-14,20,-4,3,-2,-20,3,5,-9,9,14,-4,11,16,-12,-18,6,4,-12,16,-5,13,20,5,-19,-7,-6,1,19,-12,-4,-7,-7,19,10,8,0,3,-11,-12,18,7,14,18,-3,12,-6,20,-3,-7,16,10,13,-20,20,10,-6,-11,-9,-20,14,2,9,9,-15,-12,16,15,6,8,13,0,-16,-20,13,-10,-20,10,0,4,-17,-1,-4,18,12,-4,-17,12,-18,12,-4,-7,2,10,9,11,-19,17,5,20,-16,-8,14,7,20,2,-19,-18,-11,20,18,6,6,-18,14,-14,9,-17,-16,18,5,-1,-9,15,15,20,9,-5,-16,-8,19,-9,0,9,-15,4,18,20,-16,-16,-11,16,-15,-4,10,-14,18,-8,-5,14,-15,-13,20,16,9,-4,14,-11,11,-6,-15,-14,6,-15,13,-1,-11,18,17,4,7,-18,17,15,-14,13,9,-2,10,-18,-15,15,-6,2,19,-20,-19,-1,-12,-11,-9,-15,15,-6,-17,-5,-13,-1,5,-2,-15,6,-10,-9,1,12,-1,-17,7,10,-12,5,10,1,1,3,-12,16,11,10,-20,0,-18,-9,19,-2,-11,9,14,4,18,7,-12,8,-8,-2,-6,6,2,13,-13,-1,12,-18,-9,-14,-11,20,-12,12,18,18,14,13,-5,-15,0,11,-3,18,9,-12,-16,16,13,-18,8,-4,9,7,-17,6,3,0,12,-9,-12,16,18,16,13,-6,8,2,-2,10,-3,10,18,-14,-13,16,-2,13,15,-17,-11,-3,-20,0,-13,19,-10,-10,-14,18,15,-18,-17,19,-15,3,18,-12,-18,19,-13,-12,-3,13,-4,-12,-6,-16,-1,2,10,-5,19,0,15,-15,-12,2,14,5,14,-9,11,-11,2,-9,-10,-8,1,-12,3,-4,1,-17,-4,-3,18,8,11,13,10,13,-5,6,-14,14,-6,4,-18,6,-18,-14,1,4,-8,4,7,-11,1,-11,-2,4,-12,2,15,-4,-13,18,-20,8,-11,16,-4,-10,1,7,17,15,7,3,13,14,1,16,-20,17,-4,-4,-17,-1,16,14,-8,-18,1,-14,19,9,-1,16,14,-7,-11,-20,-2,17,19,9,5,-3,11,-9,-1,13,-13,-5,-1,8,-17,-3,15,7,-15,-7,1,-18,6,5,16,-12,-5,19,-7,-15,12,-8,-9,-7,15,4,1,-3,7,10,4,19,-1,14,-9,-6,9,3,17,-8,-12,-19,-10,-3,1,3,2,13,4,7,-17,-11,20,7,-4,-9,-14,0,-17,-13,-15,-13,-19,10,-1,-4,-16,-7,-15,-11,0,-2,-17,15,18,-8,10,-7,9,-16,-2,17,2,-16,10,0,18,-5,9,13,-20,-7,8,-1,-18,-11,2,-3,-1,16,11,-12,17,-19,-16,14,0,-20,-20,-4,-11,3,13,13,10,-19,-10,16,3,18,14,1,-7,8,17,-2,3,14,-10,14,-19,0,-8,12,7,16,-12,17,0,17,4,7,6,-14,-16,-11,16,14,15,16,-2,17,16,-7,-8,-16,10,7,6,-2,8,5,17,-16,5,-7,-10,19,-9,-14,7,19,-10,17,2,12,-5,-17,-8,-18,-17,13,-2,-7,0,6,2,13,11,-3,-9,-4,15,-15,-8,-3,-15,16,-13,-10,1,20,7,-13,-14,1,8,-1,3,-5,1,11,0,17,17,13,15,-12,-10,3,-12,20,20,9,-19,-14,6,-2,-16,18,-17,-19,5,-15,1,-17,14,-15,0,-8,-16,11,-9,-18,-19,2,-6,15,12,7,1,3,1,-18,4,-1,15,-14,-9,15,5,12,-17,-20,-12,17,-10,-18,19,-19,-11,19,15,11,-8,4,-18,-8,-16,18,-19,6,13,7,19,7,-5,-11,-13,-20,2,11,-15,18,3,4,-19,3,18,15,10,0,-5,18,-9,16,-15,17,-13,-3,5,1,13,-17,4,-14,16,9,-11,9,-10,-5,4,7,20,18,11,8,-19,-17,9,11,-17,3,-10,0,-19,-5,7,-12,1,3,-18,4,8,14,-3,-1,2,-17,-16,-1,-6,12,-6,-20,-10,-18,-16,12,8,6,-7,8,-9,17,6,19,-6,-19,6,8,-12,-5,-18,-16,15,3,-10,20,-10,7,8,16,16,12,14,-20,3,-8,-11,-3,15,-20,-11,8,20,7,0,-5,5,-9,-5,-19,9,-10,18,20,-4,12,-19,-4,0,9,5,0,8,7,5,-7,17,-4,4,-16,-14,14,-20,8,-1,-14,-13,-4,4,-6,14,1,4,3,-7,10,5,20,-12,-14,-3,20,8,-3,-2,-19,1,16,-4,-10,-17,13,-7,-6,20,-5,11,3,11,-7,-4,15,17,8,20,-6,13,-16,-4,-3,-8,4,3,-6,19,7,10,-11,-14,-7,-19,-1,8,1,-8,18,7,1,-19,-16,10,-4,2,-19,1,0,-18,-5,7,20,-4,14,7,20,-13,-14,17,-15,1,7,-5,11,3,-6,9,-17,16,-15,-12,14,2,-3,-16,11,-8,-2,-20,15,-10,-11,4,9,6,-8,-5,-8,2,-8,6,-16,-5,-8,-10,-7,-13,-20,16,-9,0,-4,16,6,-14,-14,15,-5,-9,-19,16,18,2,6,12,-13,3,-1,14,17,9,-7,-13,1,-14,8,14,-6,-1,0,19,-9,9,13,1,1,3,-18,-16,-5,-16,3,16,19,13,-18,-2,6,19,3,9,8,9,-10,-6,10,-11,0,-15,2,-3,-5,-19,6,-15,2,-7,4,0,0,6,-14,-8,-7,-12,15,-18,11,-2,-19,-12,-10,-18,0,-19,-5,17,-2,10,-9,11,3,3,-13,18,8,-14,5,-2,19,18,-4,-19,-20,-8,1,15,-3,13,5,-9,14,-5,9,-15,17,-9,5,-9,-13,16,-1,-17,-11,-17,-6,19,-10,1,11,-15,16,9,-17,20,-7,-11,5,-14,12,-20,18,-6,0,9,15,-8,20,20,16,-19,10,-15,-19,1,-19,-6,-8,14,-14,-2,13,10,16,10,-20,15,6,4,11,-17,0,-7,-13,12,-18,-11,-1,-1,-19,6,-13,-8,-9,-12,15,-4,2,-17,-6,-17,-20,3,-18,-7,-8,12,-3,19,-4,19,4,-2,12,15,3,6,9,2,-14,-9,15,-19,-11,-18,1,-20,12,-20,-4,-17,19,-4,-7,-19,3,4,-8,0,2,-4,6,-10,-7,-13,19,-10,15,0,-5,9,-10,-11,-2,-20,20,17,-7,16,-16,-14,-16,-7,2,-16,-5,-3,15,-12,7,13,8,12,10,-15,20,-16,-16,20,20,10,-15,1,4,-4,14,7,3,11,4,-6,17,10,11,19,-13,-16,-16,8,-5,-1,-16,11,1,-19,0,19,1,20,-18,19,3,4,9,13,-10,-12,4,-4,3,-7,19,8,20,-6,-1,-1,-14,-15,0,-7,20,18,3,10,-14,17,-9,-6,16,9,18,-13,2,13,18,8,-15,-14,4,-12,13,10,13,8,17,18,-18,-6,8,-4,-17,-7,-19,-15,-11,17,11,-4,3,-14,-6,-18,3,15,-19,-20,14,18,16,-10,-14,-7,20,-8,19,20,-2,11,-8,-2,12,10,-7,19,-10,4,-19,-11,19,-20,-13,-15,2,-11,-5,16,0,3,16,-20,-18,20,-19,-14,9,-2,16,-9,-6,3,-4,13,0,-6,-16,2,-8,5,-17,-13,-14,-19,2,-11,7,5,-9,14,10,-7,-16,3,8,9,11,12,11,-11,20,11,10,17,-11,1,-20,-17,13,7,5,6,-20,-12,9,17,13,11,20,17,-9,5,5,-20,-2,18,5,14,0,-8,-16,-9,5,-3,6,1,13,10,15,8,5,-16,0,15,-4,9,6,-14,7,14,-1,-15,9,-9,-4,7,20,16,0,-13,16,2,-18,-15,-7,7,1,-18,-12,1,5,-17,7,13,14,-19,-17,8,10,-10,-2,-6,11,-15,12,1,15,9,-12,6,-20,11,19,-12,18,-8,1,-8,-1,11,-12,-11,-13,-3,8,-15,-2,-14,-12,5,8,-9,9,10,9,13,-16,15,7,10,4,19,-17,-4,-6,3,13,-19,11,13,18,-20,-14,-7,-9,4,-3,-17,18,9,-13,7,8,-13,3,6,13,6,-8,13,-14,-6,-5,13,3,8,4,6,-3,14,-3,-19,14,13,10,5,15,-14,-11,-13,16,0,-14,12,-11,9,-12,-5,-15,-16,-3,-15,-7,-5,-7,-18,-7,-10,-7,-3,-8,20,20,20,9,3,-13,3,-1,4,-7,-15,5,-13,6,10,1,-15,-18,-15,-17,8,-12,5,-6,2,4,-20,9,20,-11,8,-1,-19,-10,-7,16,3,-9,15,16,0,5,-15,-10,-5,0,20,18,15,-18,-7,-3,7,-2,5,-9,20,-9,15,-20,-12,4,10,15,20,-19,8,16,15,-5,2,7,10,-10,4,-17,11,-10,14,-18,-10,18,-15,16,14,12,-6,-11,6,-14,8,-3,16,-19,3,-1,-6,20,-12,-16,2,-8,16,-20,16,-18,6,-10,0,-15,-15,5,-6,11,-19,-6,-16,1,-5,-1,-10,15,7,-9,13,9,10,19,-9,14,-14,18,13,-17,-5,-4,-1,-8,-10,-6,-9,-2,-6,-20,11,18,13,2,13,12,9,-14,-18,-7,-18,3,11,-15,2,2,-3,-2,-5,-5,14,6,-2,18,19,2,-8,-7,5,16,-14,2,19,-10,11,3,-2,13,6,-19,6,-1,-20,-16,18,-6,12,-2,-15,0,18,6,11,-13,-19,-3,14,13,-16,4,-11,17,-11,15,17,6,7,20,-12,-17,-11,12,9,5,-10,6,8,-3,-4,18,-20,5,-6,-10,-1,-5,9,0,8,-7,-16,20,-15,16,7,-16,10,-3,9,12,11,-13,12,-18,1,-6,6,-16,-1,18,14,-17,12,-17,-7,6,-16,-15,-17,-5,1,9,-9,-13,5,-2,14,10,-13,-17,-14,-6,-20,19,7,18,9,-8,13,-2,19,-16,-11,-10,-14,-13,17,0,5,-8,-17,-13,17,5,-4,-9,13,1,11,11,11,4,-2,15,14,20,-9,8,14,-7,-19,12,-12,-5,-2,8,15,0,-11,-3,15,16,4,-17,9,3,13,-20,-11,6,-19,-7,-12,-3,6,-9,-5,-17,9,1,12,8,3,0,19,-18,-3,19,-5,-5,-3,16,13,-9,10,-1,-12,-15,-19,-9,-2,6,5,20,-18,6,-10,18,14,5,9,-8,-19,15,15,-13,19,6,-17,-16,-16,9,-14,9,-15,-15,15,9,18,0,-5,12,-18,-8,10,15,7,-8,-1,5,-15,-10,4,2,-20,13,-5,4,-7,19,11,15,0,18,-17,2,-6,16,11,1,-5,-8,8,12,7,-5,4,16,-3,0,-12,-5,13,12,-9,11,3,9,-20,15,1,-12,8,11,6,-5,1,-12,-12,11,7,7,20,5,2,10,9,6,-18,-14,13,-1,-20,13,3,18,-3,-1,-5,3,18,-17,13,-17,-20,-12,13,-17,-13,-9,-6,-20,7,-10,-16,-1,19,-15,-10,13,-14,-11,7,0,12,-12,-4,3,-6,-8,-8,-13,5,-5,4,1,-8,-5,18,-1,10,4,12,8,-2,8,-15,-18,-20,-10,-12,-4,2,-1,-17,14,13,-18,-6,8,-2,17,1,-19,0,-10,16,19,-15,18,-18,-20,16,-8,-14,-11,11,6,-19,19,-13,-5,20,3,-5,-2,3,-8,-6,-8,-13,17,10,10,10,6,1,-16,-4,-6,2,7,-3,-19,-10,16,-13,-17,9,-9,0,19,-20,-1,20,-6,-2,-1,12,10,8,-6,12,-16,-18,-19,16,-5,-19,-5,-11,14,5,4,8,-8,9,-9,18,4,13,-1,-15,-11,7,14,2,20,11,-11,-3,12,-2,-13,1,-3,-17,-1,19,-15,-7,-4,18,19,18,-19,20,-19,-11,3,10,4,-17,4,12,-15,-14,-3,6,-3,8,19,14,-4,-12,16,-2,-3,-13,-1,-7,-8,15,-16,-7,7,2,-10,-18,5,3,-6,-7,1,-10,-17,-19,15,-8,-16,-9,-11,-1,8,7,-19,-14,20,17,4,4,9,17,11,20,-2,-8,12,-4,18,11,19,9,-18,15,-4,-4,-14,-9,15,6,17,7,-4,-8,-17,-17,16,-3,19,-3,-17,15,12,4,-6,-9,14,-18,7,13,13,10,13,15,-2,14,-4,15,-8,-20,-1,-11,12,15,5,-12,-12,7,-17,-12,20,-5,-8,9,-20,3,12,19,13,8,-4,-12,-7,-6,-11,-1,2,1,2,-5,11,19,1,-9,2,2,0,-10,-4,17,6,8,18,-18,7,-4,-1,-9,4,-15,14,-5,20,-20,4,8,-2,-3,-7,-15,20,10,11,2,-7,-4,18,-1,4,0,4,1,1,1,-4,15,-6,12,-14,-7,5,2,2,11,-9,12,3,7,-10,-7,-15,10,-8,-15,-9,-4,0,12,-2,5,-7,-4,2,20,-3,0,-3,17,-5,14,0,-7,-19,-12,-10,18,7,10,-7,-20,-3,-13,2,-12,-1,8,14,-2,-9,20,4,9,17,-17,17,-18,7,-16,-6,-7,14,10,-12,-1,-9,-19,19,-8,14,-1,-14,20,5,-5,0,-12,13,-5,-6,9,18,6,10,-11,12,-18,3,16,8,7,-3,8,-20,14,14,-19,-17,-16,5,9,-4,-15,-5,19,-12,6,2,-1,-4,5,-2,12,-6,10,12,8,11,-15,-13,-8,-2,-4,-3,17,1,-12,1,-7,11,-5,-8,9,-11,1,16,17,-13,-17,4,12,-5,20,-20,-14,11,14,-10,-4,-2,7,6,-10,-11,-1,-20,6,13,9,8,-4,7,5,6,-7,-2,-3,17,17,-13,-6,12,16,-20,-15,19,-15,-17,-7,12,-12,-2,-9,17,13,16,15,10,-16,-2,-2,5,19,-1,-20,-9,10,18,-20,7,-4,-14,-18,10,3,-16,17,-8,-11,16,-2,-3,17,5,13,20,-16,-5,-14,-13,2,19,10,2,15,-8,20,-4,-10,-18,-12,-20,8,16,-11,6,-13,5,-14,20,18,8,-19,2,-6,-1,-15,-17,19,8,-10,3,20,-20,16,-15,4,-18,14,-8,-14,-3,-20,12,19,-12,16,1,-2,-4,7,-6,-1,3,-15,-2,-17,-11,14,12,17,-13,-8,-10,-14,-2,-19,11,15,-7,-13,-18,-1,-16,18,12,2,10,4,-11,-15,18,-18,-19,17,0,13,-20,2,-5,-5,-18,16,-11,-9,-19,0,7,10,12,14,8,-10,0,-6,-13,-16,-15,15,12,7,-13,-20,1,-10,-19,0,-14,-20,2,2,18,0,2,-3,20,-11,12,17,18,-3,-1,-13,12,14,-18,-8,-12,15,-4,-13,7,17,-5,-5,11,-20,-17,-16,-7,-19,19,-20,11,-4,8,12,7,19,-13,-2,-16,-10,-18,-12,-4,-14,5,-18,-2,-1,20,-1,-6,-19,-20,7,5,-12,-11,-17,6,-16,2,-5,13,13,-18,7,17,-1,-19,5,20,10,-12,8,19,19,-8,14,-11,-20,19,-16,-9,-2,16,-11,-6,-14,-13,-10,2,11,-7,-18,-10,6,19,12,-20,4,-6,-4,-14,-16,-9,-16,-4,6,10,-7,15,17,-3,15,0,-6,6,0,13,-3,-20,2,-1,-4,5,6,19,18,20,-18,2,11,19,-13,18,-8,-15,-14,-12,-13,20,-5,9,-11,16,-8,-8,-4,-14,-18,-6,18,-1,20,-4,-9,-3,-7,14,15,5,15,-2,2,-2,-13,10,-12,12,12,11,4,1,4,6,15,-9,-14,4,-12,-1,20,-4,-4,8,14,-3,5,-14,17,-7,10,9,1,16,11,-10,0,-1,-16,-16,-4,15,-3,-6,-17,14,-6,-16,-20,12,-9,-20,17,-9,-6,5,3,11,4,-16,17,-14,-15,17,-3,-14,15,8,11,-3,-17,5,0,-20,9,-6,-1,12,-14,12,-2,5,17,16,-1,-7,-11,-7,-11,-8,3,-17,18,20,-16,12,-6,-9,10,-16,9,6,17,-13,14,-15,4,-13,-6,-9,-19,-9,-11,-17,5,12,-14,18,20,16,6,-12,-2,-14,0,13,-20,-19,-15,-7,5,9,-6,8,-10,-11,14,3,-15,11,-10,12,-2,-3,19,0,3,12,1,18,2,12,-18,17,-5,-19,0,-14,11,-8,9,-18,20,14,19,0,6,-6,8,3,17,-10,1,10,-3,10,-20,14,20,-6,-12,-6,13,-18,-15,-1,18,-5,0,-18,17,-17,5,16,-8,0,6,-19,-13,-8,1,-16,12,19,-16,-18,5,-7,-12,1,-4,-8,12,4,-11,-1,13,0,2,2,-13,6,-18,-7,20,4,-10,-15,19,2,-6,9,-18,10,-16,-5,-4,-4,-9,0,20,11,12,-1,14,-1,14,17,9,-14,-2,4,5,3,0,-12,13,14,17,4,-16,-18,-2,7,19,-12,-11,-10,-14,-18,13,1,-5,7,-13,2,-5,6,-11,13,4,10,9,-2,-19,9,3,-6,-1,9,-17,7,2,-10,-2,11,19,4,19,19,-3,-4,8,14,-14,6,18,3,17,17,-16,-3,11,2,4,17,11,-20,6,-19,-17,10,-3,6,-20,-18,-8,8,5,-2,18,-9,-16,-7,-19,-19,19,6,14,9,-11,-15,5,-16,1,-20,-7,11,20,15,8,-14,9,0,7,-5,9,17,-13,-11,13,10,-13,-2,2,10,-8,-10,5,17,-3,18,-17,-10,6,6,-6,10,9,-1,13,-17,9,-13,3,-3,-19,-12,2,20,15,-13,-2,4,-7,12,-16,4,10,-10,-11,-11,-3,15,14,-2,-2,8,15,18,18,1,-14,7,-18,3,18,12,-10,19,4,-17,-3,-3,-1,11,-13,-1,15,5,4,-13,12,20,-12,-15,-17,17,14,11,14,17,-20,-15,2,-13,5,-19,20,5,-10,17,7,8,-4,16,-11,17,17,3,17,-1,20,-15,5,15,-4,-10,-16,-20,-10,19,-1,-13,11,5,14,-9,-16,1,16,4,6,4,-18,18,-3,8,14,0,3,-13,-18,-11,-1,-6,-15,7,-14,8,10,-9,15,10,2,1,-20,7,16,15,-9,11,16,11,-9,-17,-10,-3,-7,-2,-6,5,7,10,-15,19,3,-9,12,17,10,5,3,2,-12,9,-11,-15,-17,-8,-19,13,-13,2,-3,10,-20,19,20,-5,-12,-2,-14,-20,-6,-7,3,11,0,-3,-11,-17,12,4,-11,-12,17,14,4,5,-8,18,17,-6,1,-5,18,7,-16,-13,-11,16,5,9,-8,6,-9,-15,18,16,1,-4,-13,11,8,-2,-12,-18,16,20,-2,-9,-13,-19,4,-9,14,3,15,6,-5,2,0,16,20,2,-18,1,14,-9,-2,-4,-7,-5,-5,-3,16,14,14,10,-20,13,2,6,4,5,9,-13,12,-9,13,19,-10,-5,-14,20,6,-9,-19,8,0,-4,-1,-17,-17,-4,11,-1,-10,-10,14,13,17,-15,-6,3,-15,-12,2,0,20,13,-13,-12,-14,13,-16,-4,17,-16,8,-1,-5,-1,18,-12,-6,-17,13,14,-18,20,11,-7,-3,-4,-12,-20,-1,-17,7,18,-19,18,13,-16,11,-12,2,7,-17,4,-20,-15,16,-16,3,-15,-12,-20,11,17,4,17,-2,-2,15,-7,-14,-3,11,5,-2,10,-12,14,11,10,11,-15,8,-2,1,20,-16,-9,-6,17,-2,-16,11,2,2,-15,-16,-2,-17,16,7,0,15,14,7,11,-9,11,20,9,-2,-2,-20,12,-17,14,-14,-20,5,1,10,-6,3,-10,-8,14,7,-2,9,2,6,-4,-20,-7,-4,4,-9,11,-16,4,19,20,18,-10,-6,-4,4,-4,-9,0,6,-2,16,-20,13,-7,-11,-15,1,-13,7,-9,0,-1,-18,1,-10,-10,20,8,-6,8,-5,2,-14,7,10,-9,0,-13,8,-15,3,-8,19,18,-18,-15,-20,-1,-18,-11,-10,13,-5,14,-13,-4,9,-5,-17,-13,2,-5,-2,-14,9,4,-1,-9,16,15,-17,9,17,6,17,11,10,11,-6,-19,1,-8,-4,16,-3,-19,-10,-2,-12,3,-19,-13,8,-14,5,19,20,12,-18,17,-12,4,15,-6,-2,20,1,-5,-12,13,-20,-3,-9,-17,18,0,12,3,-8,-10,-16,-11,-4,-15,7,-10,0,-3,-9,-13,-7,-11,18,-10,5,7,8,6,12,10,-15,-20,10,-4,-13,15,0,-17,-10,17,-8,15,1,-19,17,0,18,17,7,17,8,-15,-9,13,10,-20,12,11,20,-9,-8,-4,18,19,-4,14,-19,18,-1,-10,-20,-6,18,-2,19,-4,-19,11,-18,0,18,-7,3,-9,7,-17,16,14,-7,-10,-8,-14,-9,-11,0,14,15,-6,5,-19,-9,-1,-8,13,-16,19,19,-7,-6,-6,15,-16,-8,-8,-9,-10,14,16,7,13,-3,13,9,-11,-13,-15,-11,-18,16,-10,-13,5,-2,4,-3,2,-6,-17,-5,16,20,-2,-4,5,-17,17,-16,6,-19,4,-1,-13,8,-17,2,4,-19,9,-10,1,7,-4,11,-10,-5,10,-19,-18,4,5,1,-5,-10,-3,20,-5,5,-3,4,11,-16,5,14,7,9,3,18,-13,20,-1,12,5,8,-18,17,15,2,-10,11,-1,4,-3,-18,-16,17,-6,11,-20,-7,-10,-7,-8,-13,4,7,19,-1,-19,17,18,-13,-16,5,13,16,-12,-13,19,1,10,-1,-20,8,-15,3,-1,18,-10,3,9,-19,-15,18,4,3,1,-9,0,11,-6,9,-11,9,-12,-4,9,-9,-15,-19,0,13,3,16,-8,2,-11,2,-10,-17,-6,0,-18,-2,-8,-14,-1,0,17,-7,1,-11,-14,-2,17,-1,-18,-1,-10,-20,-1,15,-18,16,7,-18,-13,9,12,-1,0,-17,-6,19,3,-10,18,12,15,12,16,-10,-3,-19,7,-11,13,-5,-16,11,16,-10,18,5,10,15,-2,-10,4,-6,-15,-7,7,-9,20,8,-10,-15,-3,-10,15,-13,-2,3,-8,10,-3,-15,-14,-9,-18,1,-7,-14,-10,2,1,17,7,18,-18,-20,8,17,-13,15,8,10,13,-11,3,-16,15,-5,17,-13,6,-16,8,-19,-17,-20,4,20,5,-14,1,-2,-13,-7,0,-13,10,-7,-15,12,14,19,15,-16,10,19,-4,-8,-8,-1,-17,-6,5,-13,3,13,-10,3,-18,-1,-3,-10,18,-5,-7,-12,17,1,19,-2,7,-20,-3,-12,13,-16,2,-3,-3,-14,7,7,-9,-14,-8,2,9,4,-19,-3,4,-4,-19,6,-19,16,-6,3,0,10,-18,6,13,10,-10,-1,10,-15,-6,-10,6,1,3,8,3,16,-13,13,12,-19,10,-15,-5,17,-16,-13,4,-8,-13,-4,5,-7,18,6,18,14,-18,-16,-1,14,13,7,-20,13,5,-18,13,-15,1,1,1,-10,12,10,4,-7,-18,19,12,-7,6,15,11,-9,-3,-1,-3,-5,-8,5,-2,-3,15,-2,-5,13,-4,3,15,14,-5,-15,19,-9,-6,-4,-17,19,19,-5,-12,-15,9,13,-15,19,-3,6,0,12,-12,-13,2,1,12,0,8,-19,8,1,-1,-6,2,-13,15,-13,5,-14,14,4,12,-5,-10,-15,19,2,-9,-14,3,9,12,19,-19,2,-18,18,15,-5,6,18,10,13,-18,-3,-12,-12,18,10,10,-3,19,18,-20,-20,-2,-5,3,0,-18,-6,-17,6,10,-19,2,4,-9,-18,-15,20,19,-11,-7,6,-15,14,3,8,15,4,-4,18,-1,-16,18,-7,0,-6,-3,6,-4,16,4,18,-14,-19,-15,-6,1,18,3,7,-17,-5,-3,19,18,-14,11,-13,9,-12,8,-11,-13,-1,-8,2,-16,-1,10,14,4,20,-17,-20,-4,11,-16,5,-10,7,12,-11,-7,7,-17,6,0,14,-18,-3,-16,-3,-11,-13,-10,-16,2,10,14,10,-2,8,-12,17,-8,-9,-15,-12,-20,15,9,-17,-18,-13,10,-17,18,-10,-17,15,4,-20,-1,-18,0,-1,-15,3,-2,19,-5,5,13,-6,13,-6,14,-4,2,0,-3,8,-1,-18,10,18,3,-20,-3,17,-6,-15,14,17,14,-12,19,19,-8,-18,4,19,-19,16,2,14,17,-12,-6,9,-10,-16,11,14,-12,17,4,-7,11,3,14,7,-5,1,1,-19,-11,-10,-9,-6,-12,-14,-18,7,-13,-13,8,-18,10,-8,-1,-8,-9,15,8,-9,12,12,9,1,-7,-4,-15,20,-18,-12,5,-14,20,8,-8,-11,-14,-7,4,-17,2,20,6,18,15,-17,-12,15,13,5,3,9,-13,10,7,9,-3,-19,11,18,-5,16,3,15,12,-12,9,9,-1,-15,1,-5,-9,-14,-6,6,-14,2,5,-11,-9,-14,-2,-6,-13,-13,-5,-3,-16,14,-19,-4,12,-3,10,3,-12,20,2,5,6,-10,15,-7,-11,-3,-6,-20,-4,12,-1,-6,6,17,-5,-10,4,14,2,11,1,2,20,19,-20,19,1,2,8,8,-3,-10,-18,6,15,-3,13,15,-12,3,-11,-14,13,-5,-4,-11,-5,0,-4,18,14,-19,-11,-14,8,12,-20,2,2,-11,-4,-6,12,10,-11,-10,11,19,-13,-7,2,6,14,-13,-20,-19,12,10,-18,-13,20,-16,2,9,9,7,19,-9,8,4,-10,20,-14,6,5,4,-11,-8,-10,14,14,12,0,15,1,2,14,-3,-19,-18,13,-20,0,-14,4,11,-11,-20,5,3,12,-13,5,14,12,20,5,-8,8,9,-18,3,-17,-16,-20,-16,-11,12,4,-7,12,6,-5,8,-13,-10,7,-16,17,15,17,-14,19,-14,-4,-13,19,-8,-12,-2,-19,-17,-4,17,4,-11,0,-18,-16,9,-18,-18,-8,-8,2,-13,3,8,-15,-8,6,12,-14,-18,-8,20,9,1,-19,-3,2,-20,-6,-5,0,-1,-15,-19,-5,19,1,-18,0,5,19,5,-12,-20,13,-19,-8,8,11,13,9,5,-9,-15,-7,0,-16,2,-16,19,17,-3,10,-17,-8,17,17,1,1,-8,-9,6,-13,6,-2,0,-10,-15,2,-2,-2,-12,15,-4,20,-5,-18,-7,1,11,19,-12,-2,-16,-16,0,-16,-10,3,6,-1,-10,4,-11,18,-5,-2,-20,-9,17,18,-2,18,-17,20,-16,14,-2,13,12,14,-4,-10,-7,-5,-17,-16,14,-18,12,-18,-17,-16,3,10,4,12,15,11,4,-18,2,0,-17,-12,11,-3,0,1,7,-6,-14,14,-9,8,-9,-7,-3,-1,16,0,17,17,2,17,7,-20,-5,-7,-4,-12,19,14,-6,11,-14,-14,0,1,2,13,2,8,11,-3,10,-15,-12,-15,6,18,2,20,-12,2,-18,-1,-17,5,-12,-20,-19,-19,-7,-3,10,7,-12,0,-10,1,-10,-13,18,-11,4,11,12,19,-9,15,15,15,-20,5,15,-5,16,-20,-8,15,16,-2,11,-5,0,-1,-20,-15,19,4,7,-13,16,6,-12,-9,19,-5,9,-3,-16,16,12,-11,5,12,2,9,-10,6,-9,17,-14,-11,-16,-17,-13,17,13,-18,7,-20,-5,-15,1,-7,-6,0,-2,-15,0,1,9,-8,16,7,18,-6,2,16,10,-12,12,2,-15,2,10,6,-17,7,9,20,12,-12,2,-6,4,15,-20,20,13,13,10,11,-17,-13,-2,6,14,-3,-10,-19,-20,16,-1,-12,-3,-8,17,2,8,-15,18,-7,-4,17,12,-18,15,4,-20,-9,-20,20,-19,-9,-12,17,-9,13,2,14,14,-4,1,-20,-3,-11,0,-4,-11,-9,-4,-7,-3,-8,4,20,-14,-8,19,0,-1,-8,0,-15,-14,-12,20,-13,7,5,-12,2,-1,4,-15,6,-20,16,-17,1,-11,-14,-9,1,-5,18,-11,6,4,-11,-12,11,11,9,20,12,16,-15,6,-16,7,9,-20,12,-7,-7,-4,-12,19,-9,11,8,9,-11,-17,11,12,-13,-16,16,5,1,-8,-14,5,-3,1,-7,-5,2,7,18,8,-13,-13,-5,-17,-9,9,4,9,-10,1,-11,-1,-11,2,4,1,9,-3,12,-19,-6,-1,-8,10,-14,-20,8,7,6,9,19,-18,-14,20,18,20,8,17,16,19,9,8,-10,8,-10,-17,-6,-8,-8,3,4,10,-2,-15,-6,-3,-12,-2,-20,12,-1,16,-20,18,13,-18,-1,1,16,13,20,2,-11,16,5,-18,2,-6,-2,-8,-7,-15,17,8,1,13,5,14,19,20,6,20,13,16,9,16,-17,-4,19,-5,11,10,-11,16,12,10,-13,-5,-6,-19,-11,5,9,16,11,10,-3,-11,-2,1,3,6,3,20,2,-17,-8,11,-4,-6,16,-10,-3,13,-6,13,-4,-10,1,-20,4,0,17,-19,6,-11,-10,-8,-16,-17,8,-8,-1,-19,3,-16,3,9,-11,-17,5,15,9,-1,17,6,2,6,-2,2,8,16,-9,-5,15,-11,-9,6,-6,13,-7,9,-13,16,-7,3,5,-15,9,-14,-12,15,-19,-4,-20,6,-20,-14,-17,12,-11,-12,13,0,-18,17,-8,19,10,-12,6,-5,0,-11,8,10,19,8,13,12,12,-15,-3,-6,17,10,13,18,-7,4,14,-5,5,-8,-18,-9,19,-15,18,-10,-7,10,-14,12,9,-8,-12,13,17,-20,5,16,-5,19,2,14,14,6,-1,-5,-19,7,7,4,-6,-14,9,-20,5,-17,-14,5,-17,-1,-17,18,1,8,2,-13,0,-18,10,-7,13,12,-18,9,-20,6,12,-4,16,-19,-2,10,-2,2,11,7,16,9,10,-19,-8,-13,9,14,10,14,-4,3,5,15,12,-9,-20,8,10,-20,9,20,-7,8,11,-13,-16,-4,1,6,-16,19,6,20,5,-10,11,5,-17,-9,-16,-11,-3,-20,16,7,-2,12,-5,-20,-11,-17,11,12,-2,-10,5,-5,5,-5,11,12,5,-11,-6,9,3,-2,-8,-16,11,3,13,-1,16,10,0,-11,4,5,-5,8,-4,19,10,-14,14,20,-8,-7,-5,0,-19,6,16,12,-8,20,-17,7,4,0,-14,-7,7,-2,-12,5,7,7,10,-14,-5,-3,17,-12,13,10,20,-18,8,-12,-9,17,-4,-1,-17,10,19,2,-7,-12,9,-11,-8,7,10,17,-14,19,-14,20,-4,8,-3,-4,-5,8,17,-16,20,13,15,-1,-4,3,-15,3,-18,-7,11,4,17,14,19,1,11,15,1,0,-19,4,5,18,14,-9,-2,18,0,2,-18,-20,-19,-4,17,-7,-8,2,7,-6,11,-2,3,5,20,-7,0,-3,-5,-13,-17,-7,-16,17,-17,-16,3,17,-9,-2,0,-2,-9,11,12,19,12,-7,-11,-15,0,-12,-13,-17,3,-12,3,17,12,-9,7,-2,-20,6,4,4,18,1,-11,15,8,13,3,10,-1,5,9,14,-3,-19,-11,11,-20,16,4,-2,19,17,14,11,-17,11,-3,5,20,13,-1,11,-15,-15,12,13,7,4,-6,-9,6,12,-7,-16,-3,14,0,-3,3,0,-3,12,10,19,8,-13,-4,14,-19,19,-20,16,7,-18,-10,12,-2,-4,-20,14,12,2,5,-19,-9,10,2,-8,-7,-7,7,3,-8,-5,13,-19,9,-5,20,-14,-14,0,-9,-8,6,0,10,-4,13,-10,9,14,18,11,-2,-5,-18,11,15,0,4,-20,-1,-4,-7,-10,-18,-17,13,17,-6,-7,17,1,20,1,15,-2,19,9,-9,9,16,0,-14,-20,-2,-16,15,-2,-19,-6,-3,-11,17,20,10,15,-13,13,-14,19,-14,7,8,8,9,13,15,-19,7,13,-19,10,-7,2,-1,8,10,-15,10,1,-10,10,14,-18,17,-11,-1,-8,3,2,-14,6,13,5,6,-14,17,-17,9,3,14,17,14,1,9,17,13,-16,17,16,-12,18,-1,-9,18,-13,-16,5,-7,-11,1,-19,-16,-17,18,-5,-6,-4,19,-11,20,-19,3,10,11,9,-3,1,-9,1,-15,-18,-20,2,5,17,4,-20,-2,-12,9,5,17,-9,-6,16,-11,19,-12,-5,-13,11,6,19,16,15,20,5,1,14,-10,-13,-8,11,3,15,2,-8,-4,18,2,-1,-15,-8,8,6,15,-5,3,-19,18,-5,-10,19,19,9,17,5,-19,13,-4,-6,7,7,20,8,-12,-12,-7,12,-14,-19,8,8,7,6,-7,-16,-17,-17,15,6,-3,11,16,9,-12,18,7,13,16,-12,-5,-4,-7,1,-20,13,7,18,-6,15,-8,-13,-1,2,-10,13,5,8,-16,-14,-19,6,-14,7,3,14,0,11,-18,-4,1,10,13,11,-7,-15,-3,-11,-12,-11,-8,6,12,-16,12,4,-18,-17,15,-7,0,11,-14,4,15,-11,15,17,5,-9,20,19,-3,-16,13,1,15,-15,1,-8,-15,10,-17,7,-3,18,7,6,-6,6,5,-16,15,6,3,2,16,-5,-15,19,-18,1,-15,-5,-6,-9,-18,9,-9,-2,-2,-11,16,-8,-5,10,16,-12,-2,-1,14,16,9,16,15,-6,9,1,3,-12,11,-16,8,-17,9,16,-10,-5,-18,-4,-19,-11,-18,-10,-17,-9,-19,1,-5,-3,-19,-14,20,10,18,-8,9,-2,-16,18,-8,3,3,-18,10,-13,8,13,-19,1,20,-19,20,-16,-13,-12,-8,-2,11,10,0,-20,-9,-18,-18,-18,-6,17,-19,-6,-16,18,-7,5,19,17,-4,1,4,-12,-8,-16,5,6,1,-4,-4,-1,20,-7,-14,-12,-1,19,-16,20,14,-12,16,-9,0,-13,18,13,12,6,-11,-4,6,3,1,-17,-4,-4,-7,-14,15,17,18,-20,12,-6,-13,20,20,-15,7,-5,0,-3,-11,9,2,-4,-2,16,20,-17,0,-7,15,-19,14,8,16,5,-20,14,-16,20,4,-8,14,20,-11,15,16,-19,15,12,18,-8,-2,12,-9,-14,6,-14,11,-4,11,15,8,-1,-4,8,4,-2,-12,14,-11,-12,16,3,3,14,-4,12,-18,-1,-6,-14,8,10,-11,4,14,-18,-7,-12,-2,-20,7,13,12,-18,-16,-10,6,20,-1,15,-8,4,20,-7,18,-1,-6,11,-15,-13,-17,-6,3,19,-15,20,-4,-9,-4,-10,3,4,4,-18,-9,-15,-9,14,8,19,-7,6,-1,-19,7,6,3,-20,-8,18,-8,5,-7,-3,9,-16,0,-9,-6,15,-10,14,-13,-3,-17,-15,18,-16,18,-20,4,19,15,1,-17,-16,9,0,-12,-19,-5,-6,6,-3,-3,-15,-6,-12,-1,4,8,-11,14,7,9,9,-2,-15,-11,-18,-10,14,8,-7,-8,3,3,7,-4,20,8,7,-11,-20,0,11,6,14,-1,-1,-19,20,2,-9,20,11,20,15,18,15,19,-7,-15,14,7,-19,-3,19,8,20,1,1,19,-7,11,7,18,-1,13,3,-10,16,-3,-11,7,16,-7,15,-17,20,-6,-1,-14,6,5,4,17,15,12,-6,4,-2,-6,-16,20,-1,-6,2,-14,19,8,3,18,-17,-6,16,-13,1,16,11,6,18,-14,-20,-9,-8,9,19,3,13,-1,-4,7,3,17,3,16,0,11,-14,-19,-14,19,-15,20,3,0,11,13,-14,-17,-13,-16,17,-12,7,-17,-13,-5,-2,17,-2,16,-2,-13,7,3,-9,-14,-16,11,12,5,8,-13,3,20,6,-13,-6,-6,-8,3,-15,8,-16,14,-17,17,-17,-18,4,0,5,-15,7,2,-17,-7,-9,-3,-5,8,15,-6,18,-5,-20,-17,4,-11,18,8,6,-1,15,4,9,-11,-3,14,-14,-13,7,-1,-19,15,16,1,-10,0,-4,2,-2,16,-1,7,-12,-7,0,5,6,15,-16,-2,-13,-1,16,-2,1,16,-14,5,-5,16,-15,0,10,13,5,-5,-9,10,19,12,-9,-13,8,18,-8,-15,-16,2,20,-14,4,16,-19,-11,18,-19,12,-20,20,5,5,-14,20,-19,-19,-2,12,-14,-11,6,11,-15,16,4,16,18,-6,-18,13,17,-15,14,-3,15,10,9,-11,1,-3,7,16,4,-15,18,0,-12,-2,-18,-14,12],"ORDER":[1023,980,2133,726,1946,657,1702,3163,1224,1522,807,3254,2025,2565,1773,2340,2354,1144,2061,240,1573,825,2582,1272,2362,728,1962,1790,771,889,1219,1504,2963,941,1724,1684,3199,1376,24,252,220,3204,2330,92,534,2295,2101,155,633,526,689,2229,796,2353,933,1534,3160,713,2778,2334,2210,437,2029,409,1281,501,124,31,733,162,2722,1342,680,163,2815,2264,505,2805,1731,891,3301,8,2185,3026,1834,2141,42,1705,3355,1478,1356,917,1602,2112,2594,2837,622,988,1640,3286,591,2643,1792,2431,3265,1509,1284,593,2993,153,901,2489,360,2739,1883,2258,899,2476,2011,1786,1070,876,628,2389,1551,1740,1794,2245,1764,159,2533,1978,567,1447,208,1026,1124,3331,1845,1359,2642,2988,2402,824,1187,1161,3029,2581,152,983,1532,1578,2276,1412,3046,1974,1660,1324,480,2793,2715,1295,1111,1301,2331,2311,3036,451,242,1078,305,472,2568,193,120,2740,3195,2407,2995,3176,665,843,330,1443,2211,2812,1932,883,1517,3260,2364,2436,2178,1733,1841,1737,166,2906,21,1015,1231,1315,300,118,2870,998,346,1920,3103,2479,928,2592,1760,2543,2580,489,1738,1235,2919,1800,1881,1099,99,1363,718,2629,1045,486,2795,1084,1194,1673,1605,1490,2336,2314,1752,2043,2725,1104,1815,975,851,2971,2448,2934,2498,2058,625,2774,2635,1577,2640,2184,2924,3353,533,386,1337,2366,2179,324,470,541,532,2197,2206,1236,1410,888,1201,1586,1614,194,2957,1826,1693,2065,3001,463,568,1665,2478,1584,685,2732,1276,3299,314,171,2096,2373,2696,944,2977,1975,2653,1074,3207,429,1558,1988,347,2911,1734,1142,2440,970,1320,1969,3297,364,1715,1748,2669,2675,158,916,1383,1634,3100,1788,984,1189,1678,2698,1003,3182,2664,500,1081,1094,2360,1200,2927,1481,818,3095,1706,2991,2122,3030,2705,2148,3357,2614,485,2104,1285,3101,3055,1063,2160,661,2819,3009,764,2738,2292,725,2914,3077,1816,2038,904,1479,588,1390,2380,816,406,1686,553,2544,336,1330,1473,291,1332,1444,1676,2899,624,1566,476,2748,3236,783,207,1882,2377,1110,2405,181,474,557,3321,932,2297,2359,2958,2736,1588,852,2363,2833,1160,2037,1675,1868,1915,1246,1166,1772,709,762,499,1639,457,850,1024,1183,2152,2523,1487,3333,2855,906,2622,2916,1335,145,1106,3359,2764,1044,3156,2151,621,908,2624,2019,911,2593,3172,2904,3175,607,1371,855,2128,91,1493,221,599,25,3272,1280,3290,1398,294,2368,2376,2866,1923,765,2399,3261,2720,1822,3334,2900,2537,831,1689,2167,2674,1102,2242,2831,3323,3295,2397,1736,372,1631,2053,2687,1632,2838,2266,2861,3058,606,2496,1600,667,1799,55,3227,3344,1520,1312,3024,2682,2504,646,2801,175,2126,1880,3132,2562,229,896,1721,2076,1955,556,938,1001,662,3129,2984,1064,3243,638,918,2808,3242,1670,213,978,1399,356,875,1696,1527,3264,870,2657,897,1120,1637,839,1054,3317,3244,2570,1677,3327,1413,2540,1505,228,853,367,422,1828,1210,670,784,1326,677,2457,520,1186,199,1370,3339,3137,761,1103,2056,2194,448,1446,85,1625,2920,2517,198,2948,2780,2555,2016,389,656,2042,15,1803,1542,3214,3113,1173,1227,2255,3003,627,2485,1513,2125,581,1871,2272,3287,887,2741,1718,2590,518,1138,1908,1034,1388,2109,2514,285,930,1234,921,2775,381,2260,3188,50,164,1317,196,2199,230,1933,648,587,595,2954,2921,1864,793,687,542,51,261,730,1347,950,1277,1878,2190,872,1651,1891,2344,2684,27,248,30,801,94,3257,3094,471,1073,342,2734,3076,1723,39,747,26,2305,3311,2933,1313,1151,2586,1077,1297,3360,2849,1925,1454,2195,1938,2577,3228,2549,146,1690,3256,977,2982,1415,1658,1593,111,1616,461,2262,3350,1893,2728,1807,840,2351,1819,2161,3291,3154,492,2832,142,566,660,131,514,3174,2192,1858,886,1687,3171,841,2599,1229,763,1766,2878,2956,3109,858,3187,1742,1568,973,441,1960,909,3150,1847,2874,2228,2789,769,2468,106,2236,2673,2026,535,2820,1027,2171,2799,446,880,573,844,618,1850,2713,2,776,1641,1404,2600,2088,191,789,2403,1461,188,1489,3252,2955,940,2587,487,265,1450,1867,2116,3060,3205,2551,949,215,1986,3000,2296,1341,2086,2531,192,2081,2836,1258,1856,1384,2426,912,615,1899,1243,1252,1595,2469,509,2515,3015,3123,2386,1407,1395,391,2853,3033,1378,2516,2395,379,3354,3106,3226,1086,597,1838,2020,455,830,1031,1968,1416,88,1051,1855,1007,1130,3267,318,2241,3141,636,710,186,1769,1340,2609,2374,2872,3049,2541,1954,1927,823,3062,3248,1306,1076,2950,1154,1849,1498,1581,3011,303,413,623,1993,929,511,951,1175,2972,490,2576,212,3177,3305,2449,3166,1759,2603,138,2859,2090,1067,837,2902,857,1617,3185,2383,2773,348,87,2425,564,29,2458,3017,343,185,1865,2857,3071,2306,982,1424,631,1638,544,1427,1928,1382,785,3080,2672,3200,2947,3224,3189,2269,2704,768,412,2259,717,2288,2233,1097,97,612,2787,1360,2847,2379,401,2462,454,2628,2232,1746,1765,927,2873,1929,502,1854,877,483,1304,1198,68,494,1842,817,2817,1618,2333,1273,326,3201,1197,1319,1762,1749,1482,1825,1972,2637,1716,3085,3072,1583,1248,1172,241,3330,2680,1512,2754,95,3131,778,814,1269,2204,2102,1570,2879,3002,1903,2765,1519,2617,432,53,2484,2388,2686,3169,2695,49,1661,122,2165,2352,1266,405,1207,2918,965,2238,2136,847,529,2201,399,1439,2063,690,3210,1860,2620,1521,72,2444,2044,3048,836,907,1237,2337,527,2802,846,669,2144,2809,2271,1448,154,1373,2751,898,775,1030,2115,546,203,387,1996,2501,2867,1963,3275,3351,2953,939,1674,2941,2060,707,1462,1758,1548,1474,466,133,2994,2310,1823,1508,672,1386,1840,2134,1037,1774,1874,3304,1469,2234,1028,1796,1170,353,3010,3239,1495,862,3293,1453,2712,640,739,3006,1491,1503,1254,1761,693,820,1377,2602,104,2518,1789,2045,2989,603,268,2278,981,328,2998,2746,2611,1995,1890,3144,2597,3240,1375,3025,2338,202,3067,570,2940,69,2490,2243,2970,397,67,1050,1629,3234,1131,781,804,2400,3349,1918,995,2372,3126,1668,2419,2138,227,2041,3093,3329,997,1949,1695,2776,1381,2477,3142,893,380,22,2322,174,2140,1008,1510,450,331,900,967,611,1423,301,2095,1775,2510,1403,1215,3043,2942,2710,1455,1545,204,293,1627,1787,3279,1279,431,3340,1901,167,1169,258,1814,2304,1139,1134,632,2845,2634,2996,934,75,149,1208,1098,1162,277,469,1126,579,1047,2511,1122,2343,1707,1206,1085,467,478,2951,1046,2437,366,2733,251,2929,2230,2046,1116,1136,2649,1655,2382,57,2145,1994,2894,1623,44,1727,543,868,652,112,1038,1112,3056,738,3332,3335,2559,1129,1645,2446,1391,2997,156,668,1343,2974,2005,1829,2923,2435,3197,1671,1069,1556,2219,3012,1659,3192,3217,2286,914,1006,2928,270,2488,3303,885,205,2579,2009,423,1598,402,2348,2693,2613,3268,1888,1417,910,942,2527,2416,273,2556,1147,819,1911,1569,610,2404,3167,2782,1485,675,1967,1597,247,2308,1879,1966,2939,1157,1726,3044,1877,1114,3206,398,1182,1763,2781,2681,1480,1872,2460,3022,2671,1518,2806,2763,2003,2164,2398,16,1832,2519,663,664,3262,1804,1346,349,383,1649,985,19,674,1261,1620,1599,400,3053,136,238,1948,1869,1113,274,1065,1885,2497,1514,121,2218,777,1233,2605,1002,2031,1681,2282,1196,3052,3235,36,565,253,2429,2417,1115,1944,1820,2824,2890,583,322,231,2936,3018,1432,102,2083,1793,2217,2905,1262,1798,365,3184,278,3294,2427,2554,2182,2656,3338,3135,48,1806,2850,3247,3202,2791,3035,1564,223,1667,2625,1902,1497,311,2226,1904,105,1898,1032,2990,2869,1778,333,3298,1092,3179,2124,2227,3209,1699,604,1523,2414,1471,129,2120,2265,811,201,139,3138,1271,1612,2827,653,173,1531,2601,3345,2406,2147,1083,3225,407,430,1951,1589,375,1431,10,78,33,428,688,3198,3277,2015,3051,2539,3127,3222,759,2665,447,1405,1004,237,182,419,729,151,370,1502,1541,2569,1036,2727,3105,1123,172,715,3016,462,3307,1017,1711,7,2915,766,236,1042,2678,1192,1176,3028,2887,2385,537,209,2174,3342,2473,2766,1302,235,427,2317,2215,115,2546,3099,684,2202,2615,1300,2110,2621,1374,384,3348,2772,1250,1336,2196,394,1973,2980,35,571,1212,1460,2532,2487,408,2627,1896,3309,3288,3122,1408,1256,2208,2106,98,3063,1861,1013,2571,2828,746,605,2370,1557,3115,1020,2524,417,1333,3328,1730,350,2166,2839,3066,2235,719,1255,1165,354,179,790,3218,1188,925,695,2391,1133,1646,1418,2307,2093,1839,654,1654,2978,1167,1048,744,290,2558,1611,1636,787,2898,2030,1354,4,1830,1055,3233,1158,962,1910,969,2717,1365,2821,1496,577,2033,3091,3041,2326,2986,284,2082,2561,233,382,2319,1912,1275,2341,1195,2168,2117,2685,3181,1666,1025,926,1056,2315,61,1961,1780,1931,1409,2121,1980,332,130,493,2526,1563,2381,2711,2790,2332,2281,582,1984,2378,46,549,403,2767,756,740,1653,676,2591,2752,1862,2784,393,3180,1321,2737,3121,1035,2186,1426,540,1419,2744,2742,2796,1892,701,2170,3306,2371,1818,915,282,3276,1348,2024,1906,2216,1976,1744,2285,320,2856,659,2466,3045,1155,1108,972,703,103,2930,3128,2324,1141,2792,2393,536,3164,3146,1983,2536,2983,2173,1544,3310,3237,2892,2690,2865,2659,594,3147,1656,2749,2863,3278,424,2610,600,443,475,2034,83,1771,1053,2882,2619,760,678,1851,1529,38,2375,791,2007,1621,2270,1095,2969,1652,1228,1953,3283,109,2169,3213,2482,3087,580,1679,2679,608,1592,70,2442,1998,2834,2150,838,630,345,1193,1466,2959,1316,521,1697,2350,1700,3114,395,54,727,1714,773,1016,3068,2893,1989,1610,2709,1615,2135,2246,1100,2896,1096,3296,955,1080,77,1230,302,266,1720,860,2401,1291,2361,1857,1535,1528,246,2638,2313,325,2123,2654,180,3300,1240,2652,2965,2616,2903,786,1924,1956,436,1440,2247,1072,1921,1909,2852,2908,1797,508,1066,1852,696,722,3069,714,465,2785,1125,334,782,1756,2560,3108,2876,741,2079,589,1061,280,1767,1339,3124,473,3170,295,643,116,74,426,263,2486,637,306,1387,826,150,1345,1492,1745,2464,2492,3273,2730,1428,2823,2703,748,107,1894,3312,1338,3315,865,2964,539,3230,1288,101,2279,2249,3089,1052,1071,2509,1362,2864,165,2880,3322,2858,392,1451,1232,708,772,1808,3285,2811,2875,2036,206,1472,1770,1590,1152,60,937,639,805,279,2294,359,1549,2105,438,352,2198,355,304,2944,2428,3313,2762,481,3191,1567,2745,2981,2054,1318,884,1402,317,515,1970,1717,2177,3090,119,1145,2392,28,1397,2714,516,704,3097,1079,3,147,3219,655,388,161,2261,3032,813,1060,3050,362,1293,385,1328,1062,160,3073,3143,1222,874,2277,3289,2342,1434,2596,2454,2410,11,806,3140,2099,1323,2369,2943,697,2089,1801,335,699,1543,856,2411,2050,1538,2700,732,1709,3158,376,2702,259,390,507,80,2267,3083,1475,2323,1310,3249,905,3259,2023,522,2520,2886,3082,3165,2450,1420,2303,2798,1516,249,1743,1421,3153,344,2494,614,3148,1613,2004,271,2481,144,2851,1802,757,1088,1014,148,2631,2800,2618,2810,168,1992,264,3086,1604,1606,2641,1571,312,1464,1900,1870,2087,2213,2180,3145,1156,1591,2456,519,1441,1357,3336,3251,1082,954,829,547,979,1624,649,1633,2075,378,617,110,1282,3159,195,1561,679,964,1090,1226,2932,2694,3223,1406,1458,1507,132,3302,1685,2952,64,2830,2668,2735,216,2014,1249,2743,2888,1784,1331,2051,2803,2987,1217,2770,943,1190,244,1010,2563,832,3023,560,842,3220,3096,3280,723,774,1220,275,1368,269,1022,2612,993,2757,2854,3314,575,2630,2438,3039,1204,1945,641,517,513,1465,2461,3320,1253,66,584,2424,3059,966,96,2567,698,2349,2039,562,410,292,218,1859,1299,2761,620,498,749,3118,845,712,1950,2396,958,2883,2475,650,2071,2248,341,1710,1118,2922,2557,959,40,779,2137,495,585,1594,971,3134,297,3190,802,176,1843,1524,2022,1795,750,2884,1361,524,1425,1560,1483,531,2522,2655,882,329,2451,114,2992,3271,2925,2677,43,619,1218,1663,52,2302,1553,157,3119,1334,141,2552,3274,1149,700,2945,2118,1289,2598,3042,523,2250,2651,1247,3269,226,3212,1863,1873,2960,1725,2966,1438,1905,2130,1174,2098,1575,1242,1274,170,810,2432,243,1163,3231,2658,2409,79,1644,1305,2826,2320,1741,1735,683,56,1701,1265,935,3019,272,177,1539,1179,286,1981,307,812,2786,3203,363,2439,459,1999,2309,2676,76,538,289,442,2917,1582,863,1936,2797,1257,1805,1209,2692,2154,2183,414,2755,2471,47,2205,2328,923,859,1692,1307,1349,445,952,702,3054,2191,2013,3075,947,2064,2505,1977,596,183,2846,3004,281,1457,1259,2107,169,425,2367,2067,999,2048,2961,1308,1596,848,1783,1202,2912,2706,2644,559,404,894,1213,1739,2275,2080,2747,411,1934,1184,2445,974,869,609,2663,1643,135,3040,2564,71,989,178,3111,2290,3061,2723,2814,991,2542,1216,260,2078,2327,2632,1148,3116,321,2495,2244,1719,1309,250,2724,2176,629,673,1930,1959,225,2729,1143,2716,2452,2689,2534,90,753,1283,1389,3078,14,2455,1964,2212,1919,1470,1579,310,1587,2585,2474,1351,3325,994,2163,1009,1511,827,2816,2985,137,32,2146,1121,867,2207,1159,309,3139,3057,2503,2433,512,254,1607,1199,561,2268,338,1985,2604,1372,452,1180,1526,2052,2648,2818,1942,1876,1344,2843,3178,737,434,2062,2480,2092,108,2113,2701,3125,2967,2623,1040,2070,735,3079,6,1367,1680,3221,558,2365,2768,2300,2085,2158,3316,1287,1135,1203,2251,497,1411,3014,742,2430,797,125,3027,2529,945,1442,374,1813,1608,477,2289,752,2357,2493,545,2909,2670,651,1939,724,1171,2032,2862,1546,1630,3246,2132,2225,873,283,3008,2175,1628,2538,1292,1414,2312,3263,2661,2239,528,2273,2049,743,2318,3337,1468,2422,3007,1550,948,2035,2639,2157,1459,1922,1223,2077,113,2507,1648,415,1068,2860,3253,2901,2783,1626,2975,2193,1021,731,2589,767,890,1463,128,2731,1917,2848,3161,2683,658,3005,1965,339,645,1886,12,758,792,1127,902,255,2335,117,81,1833,1128,2084,2114,2907,1225,3255,2726,1091,2188,1043,2189,2283,2807,1303,2935,2660,1937,1554,3241,957,1897,745,313,711,1982,682,420,1683,189,1058,288,828,1941,2008,1609,2420,2274,1244,3216,3308,2301,1205,1831,3098,2356,361,554,2459,2575,2142,23,2299,2825,799,1211,1662,2545,340,1437,2325,2897,1791,2156,1657,834,234,439,1887,1574,503,2339,986,2583,1449,3020,963,1824,65,1694,222,2057,1580,1314,1394,506,2753,1732,960,686,1486,2708,9,2073,1846,63,1750,510,706,1619,1429,1525,296,2221,1713,479,2572,1105,3211,2968,3021,1889,1853,1327,3194,1914,3196,551,1506,1547,421,1565,1267,357,1821,2412,2203,2387,45,2500,1971,2074,1012,3136,647,368,3065,2650,2329,2017,692,1682,2804,2223,2316,1101,2607,1703,681,1809,276,1712,41,73,822,2231,369,143,3318,2835,1952,2707,2506,1916,1033,1057,1177,197,919,2979,257,1488,3081,1642,2066,1445,2415,37,3104,1329,460,2006,990,956,2895,2535,2573,569,1691,2162,464,3266,2423,433,626,3112,59,1836,1019,2220,232,815,2926,3232,1552,1393,3064,1059,327,2108,2626,58,1926,2028,2868,1991,574,2758,1392,1785,1018,2841,642,2153,2467,1884,1260,187,2877,635,754,1353,1515,1350,2636,468,1494,3282,2224,613,1005,2187,2813,2756,2976,2595,210,373,1768,592,219,2068,987,3270,3088,924,3281,2069,3326,1940,214,2822,319,2550,3343,123,3102,2000,691,1585,3120,89,2181,525,3152,3110,892,2840,1601,1089,920,1364,84,866,694,2298,1264,2829,1178,1664,1400,563,3208,1041,996,1322,2499,1107,2002,2697,1811,2844,2645,2871,1039,2513,1810,484,2293,634,936,1704,224,2284,3074,2999,734,576,5,1366,2418,2937,1747,184,1286,20,93,2931,1476,453,2100,2345,601,2240,2608,2548,671,3215,3013,1396,2252,3352,2257,2521,2502,337,2691,2588,2055,1537,2470,2447,1029,809,1185,3162,62,1137,239,1385,2072,2881,418,1728,2358,2111,1355,1990,1943,262,3037,716,2159,1380,2254,736,1117,555,190,2547,770,351,2566,1688,794,2021,2443,854,1436,1298,2280,1669,572,2222,3229,2777,3245,2291,2584,3155,316,18,931,1140,552,1555,3358,1467,1530,256,1622,3346,2347,13,2949,795,721,1754,1251,1875,1698,800,1603,1452,2647,1087,1722,1559,3070,1866,2759,530,803,913,2662,1827,1635,2721,3034,835,2287,2214,267,34,2578,456,444,2453,488,1075,140,2127,598,211,1536,1245,2200,2172,3186,17,1779,3133,1164,3193,1817,2646,968,780,2760,2962,1540,1011,1777,458,861,1430,666,396,602,751,3092,1987,1729,864,1358,1435,1238,821,2769,2119,2209,1572,2094,1221,315,1168,833,2771,1997,798,550,2441,2097,1501,482,3149,3324,435,1,2606,879,1757,2699,1958,1153,377,1325,1844,2047,788,1191,2885,2434,2012,1263,849,3084,2633,992,2059,358,871,371,1835,2384,82,1146,3031,586,1650,1782,496,1000,881,1755,3284,134,2553,2131,1957,323,2463,299,2010,1119,2237,308,1812,1477,1109,2688,976,2574,1533,2794,2103,1500,2465,705,2253,217,1647,1290,1672,2525,1708,1132,3157,895,449,1913,2667,590,1049,946,2018,961,1268,126,878,1781,3183,1369,3238,1753,1935,2946,1181,2472,1456,2891,2491,2666,440,2394,3258,1278,953,3168,3341,616,3038,2027,2719,2256,1150,1401,3173,2889,1895,2413,1979,86,1484,3347,644,3117,2139,1239,3130,1576,1093,1947,808,287,2143,245,1499,2530,720,2321,3250,1296,504,2718,416,2001,1837,548,2788,2346,2512,2779,2390,2355,2528,100,1241,3107,1294,2483,1311,3292,127,755,1422,2091,922,3047,1907,2938,2149,578,1751,1776,1379,2973,2421,200,3151,1352,1214,2910,2750,1562,2842,1433,3319,2408,3356,2040,2913,2263,2508,1270,2155,2129,903,298,491,1848,552,85,142,2607,2821,2447,1741,1872,1634,2035,224,916,132,425,2651,1075,237,3299,489,2731,2643,778,712,2986,683,1736,2106,3123,2686,2739,2464,1708,3347,2827,1152,2098,1763,2058,1806,2874,2726,684,1340,2052,549,1783,972,964,2297,2541,3259,1336,1496,1300,1207,2703,2845,2071,327,2255,690,838,2509,1751,3165,1059,3111,1703,1873,286,983,2354,2302,3127,43,3096,1005,60,460,1868,2927,365,2977,488,363,3156,2082,2128,2347,872,951,1579,2948,220,366,514,713,2286,831,123,1194,1592,999,3359,2579,1471,1541,63,2104,3226,1384,2086,2574,3071,2956,2499,108,290,2220,596,1886,820,3120,2060,1852,2048,93,1682,331,154,2638,670,509,3079,694,1004,2331,304,2036,2914,186,147,3029,2518,104,1915,2201,2486,292,2172,1076,985,2345,159,895,2081,2976,380,1631,2431,3019,774,2526,2835,2194,2077,1312,2328,341,52,1521,2528,1455,3356,447,293,2423,3073,2832,2135,2524,168,630,1573,2682,1197,2662,3132,691,392,625,2964,889,22,3151,2141,2905,607,1962,3006,3247,3232,256,904,2656,760,2536,2772,910,986,1401,445,1421,2332,781,987,2244,638,1954,1389,822,2519,1279,2307,2848,2007,2858,2426,1823,2514,2207,3199,635,938,2348,2271,2259,893,585,885,1204,1341,2924,178,2853,2341,1528,2017,2099,3003,174,3025,735,1196,2569,397,2483,1424,2896,2351,2955,21,924,2059,2318,2193,3214,2665,2422,381,3107,3117,1311,772,3285,1743,3251,2190,3011,2166,394,78,2517,1778,1252,1935,1790,2761,1081,1726,2709,2242,3255,1124,1218,97,1406,2522,1442,3069,1853,2084,3085,486,116,845,1785,2118,2044,393,1028,3204,650,1506,1831,934,1809,2381,2970,2136,2226,146,1609,702,1748,223,1982,2454,1078,1610,2991,668,2719,2793,2480,299,2599,334,2529,3283,1356,2723,1247,438,90,1275,3337,1964,2598,2887,1089,686,756,2103,2467,2254,1912,3005,923,674,2636,1481,2740,980,821,162,2605,3087,1283,1540,535,1805,1274,2369,2695,2004,880,320,2630,387,2655,2704,1086,1270,2824,1870,3358,1547,500,1266,2264,491,1504,3315,406,2373,2092,1096,150,1614,3181,1871,294,319,3114,133,2632,321,1651,860,1257,348,3103,2696,2132,2333,911,263,1267,3338,1202,3223,2054,2175,664,2661,2530,126,1545,2625,2836,2100,297,2951,2208,2489,1261,1119,1662,2711,1044,2055,3109,1910,1418,708,1774,1176,2463,2177,2900,1446,1842,1947,3168,1061,3047,1181,1434,3147,1884,1161,79,3159,2466,2152,1423,2279,3081,1881,1106,1750,758,1836,751,1956,1807,2856,1568,804,1550,1937,245,1067,814,67,2070,26,198,410,1586,2994,2432,1199,3198,2698,1777,99,2919,677,1587,1017,1484,1372,2538,850,1672,3048,3192,2697,1832,3083,1241,2484,969,1828,3164,228,1363,9,1679,1107,1613,689,19,3296,1998,2306,715,581,1755,3233,3065,1792,374,2170,2181,308,2762,1360,2029,1376,2560,3179,1054,926,2978,2729,1346,1318,2939,704,1262,371,3099,2878,1820,44,1946,1253,1186,876,3280,958,1454,856,1527,328,766,3203,1530,3357,2156,1393,332,3084,2747,265,388,2764,1332,333,3070,144,2786,1064,513,723,580,1989,1791,1534,2743,2657,2102,2803,1338,1876,2461,3102,2311,1462,3183,2748,973,2782,2430,944,2324,2767,2312,906,2032,3022,1844,1123,2611,3244,2806,1623,1950,2715,1150,1590,903,1220,1482,2737,1352,3171,2408,2521,2409,1333,3354,2702,1945,3272,278,1497,3028,351,1469,558,3288,1309,1246,1647,1696,1802,72,2314,1057,1908,49,1142,1074,41,307,2282,1766,846,129,2233,279,2270,2620,2292,40,1826,456,2961,1006,1539,1863,873,436,1681,1214,1201,3023,1556,1049,3177,2906,2109,1944,2626,200,780,145,1510,1223,202,942,3277,481,679,2239,561,701,231,777,2083,180,3324,2983,2966,219,1000,1007,967,1658,280,271,633,225,1324,2291,2902,2913,250,2240,2829,1251,819,2645,2941,3208,355,1709,1918,2238,3146,1316,309,583,1559,854,2838,2658,867,1971,261,649,703,2797,1926,2993,2513,3101,1615,184,620,1640,466,1676,1636,2274,2881,3215,1012,2693,621,467,634,1137,1447,399,2149,2613,832,1092,3015,1135,106,2947,1351,283,3135,172,1952,507,2571,1793,939,175,1558,1977,25,149,2376,138,1618,2074,858,210,2169,505,1380,2168,27,2219,3052,1742,2744,2069,2203,2957,2929,1936,258,586,427,962,2456,1003,3287,37,602,1603,336,3267,2828,1357,3185,1248,2979,3212,2670,3349,1803,2377,1890,2653,629,976,2061,1691,1706,707,495,1022,494,2752,3268,2250,2659,1493,3020,2165,1874,2146,681,2981,2619,15,2573,2009,1894,2283,1317,1500,3140,318,418,98,919,563,1813,2352,947,571,1185,2138,124,3000,2050,1972,1620,1111,2200,595,2857,463,653,2710,3334,3303,3049,2868,2501,1754,1430,3187,673,131,1315,578,3112,2721,357,540,1660,2812,2356,2544,2379,2150,3149,2641,2125,841,762,1473,2700,2424,2586,2073,1850,2720,1063,2277,1566,301,2429,790,669,1342,100,2849,1242,978,550,2155,2434,3007,3076,214,1784,3290,2400,1415,152,2237,468,3317,3231,1020,892,205,3241,2001,143,2722,7,1039,2915,1303,2615,449,1976,1824,2520,2862,2339,248,2585,2543,1115,2493,1439,1134,2093,1768,2933,2134,216,465,160,1900,1639,562,1299,2601,1231,1174,1529,88,536,2436,2317,2349,567,2687,2614,2273,1160,2296,628,3142,1771,446,1453,2792,1729,2037,1903,1531,2024,1837,2415,193,2940,533,1994,3067,1038,2015,2813,2516,440,2196,295,3050,2844,1398,1431,352,2690,1965,2393,1217,3273,574,564,2788,2101,2062,2491,2336,2195,1732,1104,1810,1128,2301,13,312,343,1068,1897,1326,94,2382,3041,2085,1724,2525,2313,2163,786,411,1378,905,2992,246,1331,2802,570,1337,212,2451,1219,612,125,190,239,1467,3261,1291,2523,1943,2027,1645,1237,3200,1190,1452,1595,1680,1319,1487,2294,1782,1986,2811,2685,2877,2504,1211,1514,189,2289,2127,2327,2753,2142,1735,2612,1970,2285,1657,1635,1507,208,3294,257,3002,1011,2843,1328,1116,518,1968,2556,3174,555,997,1617,2795,2005,2210,2284,2143,1263,2187,2873,532,284,2330,2217,87,497,1772,1879,2859,2568,14,1069,2834,1577,2453,3258,725,3219,2885,1286,637,1170,322,1084,1097,1574,866,1265,2562,1093,2496,1167,1306,3304,587,2180,1065,1470,622,1707,1215,1991,3017,2542,1444,2041,1459,1284,326,1814,1925,2591,1694,2105,2384,931,3253,3158,38,1085,3094,1867,3172,2582,1841,1780,1685,1310,2479,1759,405,1046,80,1990,1091,1032,603,389,1399,747,1146,2776,1225,206,2394,1339,1048,724,2245,1417,2880,91,1227,1683,834,2389,2616,3113,2975,115,2114,2353,3040,2989,2148,1229,1765,2618,483,61,2215,1553,957,2578,1569,1302,324,757,1875,2425,1992,692,112,989,761,1734,251,75,1602,2846,1080,3154,1517,2124,3327,2471,627,857,3012,236,451,971,1105,665,524,1465,2232,1448,1554,2593,148,1551,2631,2042,501,616,956,2229,2300,213,2773,3323,1411,1892,3229,1855,742,1250,861,1710,520,1240,511,2547,1087,110,2909,2492,3175,71,1713,1203,556,401,2916,1761,170,2116,211,1799,1705,1037,3106,1901,218,2329,2038,785,2995,1801,47,2552,1593,270,2741,114,461,2751,813,1885,560,816,69,1627,3091,2580,1343,2669,920,2113,1628,1348,3242,1180,1195,1133,642,1420,589,359,1760,2224,166,1933,1260,2938,1633,1838,1646,827,592,1697,1457,2488,1397,201,2581,453,2674,416,1896,1979,3189,815,943,2882,3193,2872,2402,752,54,74,1789,2368,817,1570,484,1159,1280,1851,2755,383,46,364,238,2039,1235,3263,1179,806,1436,2272,1877,2555,2623,1098,1272,928,591,1396,3269,197,2717,1654,1029,2310,1816,151,2904,3307,3136,559,3353,241,1653,991,779,1491,1849,2895,862,573,2893,2316,2411,2942,693,1451,432,2567,1659,222,1856,439,979,452,179,3137,2416,993,1781,3252,2325,1460,2784,660,1693,2047,897,1426,1621,289,2595,1717,1307,68,3180,1483,313,2732,1047,877,2476,314,741,2507,651,1913,1228,1564,344,1143,1833,2875,2097,671,2617,55,2473,2603,2026,2971,1643,2689,1859,1993,2666,1163,1688,526,792,2855,3032,2954,1878,164,2917,2162,2850,2675,508,2199,3245,1168,3186,1114,2963,1425,966,119,3284,1739,302,1808,2159,3313,1138,1847,130,655,1893,3211,1216,1182,1624,1327,1955,3234,1821,605,1103,1175,377,1232,1916,2831,382,954,1756,2129,2321,988,498,3276,915,1110,1480,600,1888,1737,367,1601,879,2926,482,1525,891,2122,2768,3297,1388,2263,2775,2338,2184,3066,617,1583,548,2010,2371,3336,2678,2807,2396,1923,1255,2126,2944,1921,1313,2847,1723,1036,84,2692,196,3039,176,2147,1386,3004,2770,2173,2860,656,1938,1537,1699,1390,2045,2610,995,3331,3148,2677,121,641,1963,1714,1132,107,3169,2609,3196,2667,3068,485,908,1959,2385,1687,2506,476,2760,3228,839,2990,3249,765,864,1394,1812,2589,2925,1364,2490,990,182,1244,955,1125,3046,1148,1369,2584,409,471,1494,1400,1981,1695,1797,2021,646,412,1563,543,2452,403,749,3360,2968,1026,3045,3122,1524,614,298,2890,2511,769,1779,1385,1811,1359,711,2987,362,3321,2025,402,764,1704,3238,968,984,2826,1130,1383,2660,1408,2714,1361,2281,738,1001,1951,3262,1920,1171,528,1120,2539,2028,2439,1391,2839,23,3143,2205,2249,65,510,349,2647,2852,3345,3139,2798,2446,852,2886,1716,368,912,1403,1891,408,1305,998,2840,2783,3305,1740,139,888,2176,1762,437,2078,2861,672,2932,1625,606,3340,824,3095,259,2822,45,2202,2928,3163,1141,3197,914,2699,2694,35,829,2221,2644,3209,2326,338,557,1034,3088,1719,678,883,2650,2362,3138,3342,2067,946,1052,2056,269,385,937,636,644,1571,775,361,3055,2903,3257,1641,2204,565,1845,2531,675,1757,2594,347,42,2894,718,2185,470,1800,544,3042,826,659,2965,3162,490,631,2596,2145,435,1667,310,1230,2075,2418,207,443,330,287,134,191,2160,519,2470,81,2,2090,812,120,898,2183,350,3104,720,2361,1298,1198,1770,2248,2864,2340,2809,1009,2515,2364,1188,1072,2212,1287,1293,881,2974,1661,3021,1013,1321,3144,965,1050,3034,516,2189,1461,1983,878,855,2227,2275,1239,2606,1689,551,3213,2551,1776,1463,2777,199,2535,457,680,1960,1189,1848,1549,1164,1419,2950,2561,1206,1637,2107,619,835,2527,417,2475,2707,1975,2563,2051,3016,1395,2342,3339,1542,1381,487,517,1498,2197,3184,2833,1367,3161,230,3344,1575,2234,3210,375,771,1296,1520,2879,474,1523,1555,3286,315,1584,1787,2808,768,2996,1127,1147,2922,3282,515,3075,398,2684,404,1183,3059,1066,699,2780,2997,1212,1656,1668,3227,736,1882,3077,2810,1604,547,793,743,788,2386,455,171,1200,663,2391,103,2672,472,3322,3320,2387,1090,3078,1379,1987,1980,2012,77,2068,1883,1819,479,288,422,2363,3009,2664,588,2112,1652,407,3010,5,918,419,2198,2637,933,579,64,3195,1058,3206,1233,462,1932,710,2763,266,787,797,803,1835,2111,2600,590,169,1626,1984,1153,56,1650,2804,10,2765,255,887,1292,3348,1666,2668,372,3335,3312,1273,608,379,2458,1144,2144,66,420,11,2188,2478,360,2365,2121,1077,907,2870,1818,818,1435,1996,2343,1930,272,1825,2823,1958,2602,128,2309,531,2276,2508,925,2663,1502,1747,2246,1503,1655,2537,1702,1546,2592,2000,1939,1861,2891,229,1767,267,1083,2407,3160,2366,3093,2236,1948,632,728,770,3129,92,1109,705,706,1988,3152,1371,2268,795,2837,1472,623,215,539,624,2487,303,597,2510,828,3274,2959,639,1145,1468,109,2498,3275,3281,3236,1712,24,1899,1024,682,1839,2866,1622,1347,901,1118,30,3038,1733,2367,2412,1511,2624,1731,1607,1023,941,1619,2876,3222,2734,2899,3295,1140,2395,62,2235,1062,811,1919,734,1476,2680,2733,3061,2410,1606,473,527,2404,2794,2673,262,1113,2002,3,609,2654,1788,1258,96,3157,1501,2398,975,1904,733,3254,2604,2842,1753,3202,1288,1071,2495,2867,2383,3270,1245,3080,611,3119,2791,459,2320,666,2816,2344,825,260,39,1578,645,2230,1629,2577,395,3271,2269,1489,50,2403,932,2958,3188,2053,582,2374,1208,3328,390,767,203,1906,1416,2315,798,2814,1909,1365,1720,1997,1597,3250,1043,3089,1322,1692,662,2380,2046,300,2131,3033,2444,576,1677,917,1329,3036,2477,1428,2013,2934,2445,849,492,285,3301,1581,3246,2985,141,137,2137,2022,796,276,444,2825,3224,1495,2871,17,20,1042,2627,554,325,1518,3027,2161,232,429,3074,2322,18,3173,3330,1377,1985,244,3053,102,3153,1445,2472,3343,296,1290,2350,1016,242,3086,1407,1995,851,2016,2360,823,950,1126,1644,698,1474,415,316,317,1166,869,1616,1464,1678,3118,1700,2019,833,1268,2011,593,2252,2080,76,2910,345,1967,729,940,3058,935,909,1588,840,2139,2256,1344,2503,2706,3243,2049,1055,1349,1187,2946,161,2448,763,618,1409,2218,3256,2583,3264,1858,1151,3121,2883,414,3130,3237,1131,1561,810,323,657,842,2164,2889,541,1887,192,430,1512,1095,538,1684,1478,1673,1350,3013,187,2683,2608,737,1405,572,685,746,2449,2008,2262,2898,3008,2576,2251,3225,1021,1515,1663,3176,1192,1295,503,2943,953,1907,2712,82,1264,3051,3235,1285,2937,1953,3060,1794,1387,1486,57,2988,1041,1866,1323,2023,2133,2278,1045,2911,413,688,127,2892,1526,2532,1608,3098,2228,3133,373,3167,2043,996,1880,2089,1100,2998,974,1544,1222,949,2003,1056,1221,700,2901,870,493,254,2357,1269,830,1281,2533,809,2931,2421,2949,2308,922,1243,837,569,335,2293,1345,577,1728,1413,1834,506,859,2969,1722,661,3024,2566,1898,2117,3090,2628,610,2223,2972,2679,2497,2485,1440,2247,2851,504,274,337,1492,1449,275,2980,584,2057,221,3266,1129,8,1099,1535,1572,755,727,2257,2505,281,652,2652,111,3239,235,183,1073,2500,1730,268,2789,2072,1191,1905,1224,1973,2064,1922,2785,3291,2442,370,3178,2727,687,1184,1030,1966,101,1490,2462,1374,1,1934,1612,3201,2554,3155,882,2066,599,2758,3134,1638,1589,2646,1433,3194,896,1014,936,1675,1929,2549,2457,86,2790,2805,1796,696,434,3026,378,2649,961,3216,2130,240,1591,1422,1429,799,441,226,807,247,1924,843,2481,1516,2587,3043,1505,1443,2427,794,2417,1942,1362,2841,3265,1773,2465,894,442,1552,2115,1277,3306,1157,1370,3056,249,3207,2738,900,1532,2818,1738,2754,2590,2572,2241,2428,185,2854,3278,1301,959,2096,2769,886,1178,1718,1320,140,2095,356,667,1927,1978,2967,2401,1864,181,12,1538,358,2392,1335,167,2815,2267,1276,3191,3014,195,2225,3221,2031,2243,3326,1931,3314,36,2640,1485,3182,3170,2414,3279,709,2216,1860,2771,1477,2158,1325,1259,848,73,1580,648,615,1209,1019,194,1671,277,2179,1334,3150,158,1226,227,3325,992,726,1289,1158,970,1543,717,2358,1249,1600,963,1499,2540,234,598,2231,3293,2378,2725,2559,884,553,3057,2897,1466,1082,2076,469,647,3309,2930,173,2088,566,1458,204,1648,3316,1177,89,273,48,3190,1725,714,2817,1840,748,695,1094,2397,2375,1822,1165,477,1862,1193,2438,1605,1136,1560,1122,3037,464,2884,2157,2288,2746,2304,2435,601,2960,2151,1522,1314,2745,1727,3044,105,2214,784,1519,2921,1795,3341,1969,2973,759,1508,2800,2280,1940,1664,2597,2936,2588,3126,537,2570,2918,948,2413,502,264,2648,2730,3082,2443,153,776,480,1775,546,2962,2550,3205,3310,1053,1382,1392,697,1599,2433,1829,1533,791,3072,1764,2206,29,1173,499,844,1432,2474,902,1278,450,2222,2634,1642,2213,2440,329,3100,2863,2534,805,745,2298,2305,1456,1649,2671,1210,2018,1758,2468,1412,1149,1565,1353,1040,4,1827,31,28,981,1213,2091,2759,594,522,2633,568,730,3092,2006,2907,913,1297,2186,3018,1236,3131,2801,53,545,927,3108,2020,1025,2287,3292,1404,754,2420,1010,1156,2757,1857,3054,34,3105,2701,1060,1002,1669,1294,2119,2982,1031,1917,2334,311,3220,1513,2565,113,2830,542,135,2260,1562,982,731,2865,802,1410,2450,305,431,1854,2716,2123,739,836,740,2553,1567,1843,3355,1974,1902,977,2419,716,2290,2622,929,512,530,2261,2265,136,534,2558,421,209,952,2642,575,960,1889,2253,1594,2718,2063,1088,2372,448,2756,801,1169,70,1611,2390,875,890,782,2708,732,3248,658,282,2346,2359,750,2796,994,3311,3332,396,2437,2120,2014,1437,51,2399,1536,424,2494,478,1596,1121,2705,1070,853,525,2766,1172,2455,753,1139,1117,1999,16,1949,118,1015,921,2469,1427,475,1865,1366,1632,2108,2557,1869,1008,1035,1155,2923,3166,1928,1102,59,3063,783,2564,3001,2266,3030,2335,376,1585,1630,1698,2691,3350,3218,1804,2724,1479,2110,426,252,346,3300,1957,2040,2548,1375,163,2787,1355,676,2888,2405,1745,2999,1769,3308,1108,1308,1715,6,2140,2546,2676,789,2984,354,3110,2935,1670,1690,1402,1941,3318,386,3329,2912,654,2034,1786,2778,2171,808,3217,521,33,2167,2295,874,722,339,2781,2258,1509,177,2030,3116,2736,243,2869,800,2681,1576,1101,1256,2639,1598,1914,1238,1271,3333,3128,1033,3351,188,156,369,1079,1798,2545,2774,2174,2079,3240,2355,2750,2323,3097,2065,3031,1162,3298,3346,1911,353,2319,2094,2819,95,773,2153,1557,1830,32,2713,496,604,2154,217,306,744,458,2303,3125,3035,2575,1358,3064,2406,1711,3115,3062,3145,2920,2459,1674,640,2502,2635,2441,400,1450,2211,847,2178,868,1254,2460,2512,1846,1282,2621,3260,865,1488,1438,1354,2033,3352,1475,1330,2742,454,2953,1018,1749,391,2728,930,1205,643,2629,899,155,1665,83,3302,117,529,1548,433,1817,2945,2820,253,342,1752,2952,428,2087,613,157,1686,2749,1234,1895,2908,165,719,1368,1746,2192,1441,863,1112,523,1721,291,2209,2779,1815,1582,384,2337,340,871,2191,1304,1701,3124,626,2799,1373,3230,2370,1961,2299,2688,122,2388,2482,945,423,721,1744,58,3141,3289,1154,2735,1027,2182,3319,233,1414,1051,2563,83,2562,334,1300,3253,1734,2977,2375,1994,3124,2894,3002,2055,2253,2200,45,1614,230,2782,3250,1188,2630,2070,2336,2565,2082,233,2074,2668,2251,2526,920,21,2412,671,1092,3118,1001,1636,2821,2771,2433,2935,3208,1887,2786,3129,1214,53,1383,398,2381,1303,2663,1997,1000,2423,799,3281,3011,2707,3243,1662,840,190,312,516,1025,2197,1014,3180,23,2258,2066,2790,92,822,1372,2708,1210,682,2443,243,1760,171,112,2497,2307,2341,93,406,1185,328,2545,2047,3172,895,1748,817,2288,3342,1689,698,1156,764,2879,662,2326,2064,638,3263,2612,1854,2014,2186,968,2504,2262,703,2988,2406,1431,3319,2752,2699,2777,1268,2160,452,730,1301,1643,545,2173,1083,686,1543,2298,3317,2623,2784,3358,2534,1106,2584,1595,459,2188,454,1726,1677,24,399,476,2136,743,2159,2428,2987,33,1676,3040,924,714,3090,2018,1093,268,2028,627,2609,507,2048,2626,1611,2043,1235,2669,1566,2293,2352,18,200,2961,1992,1491,2236,3359,1874,2100,748,690,3301,3106,687,1497,1776,1559,2347,2863,3091,2430,2702,330,2062,846,1309,1948,2721,2049,3094,2686,461,1819,1544,1917,1835,2671,2415,2976,1718,1031,1245,2920,828,1494,572,2421,2364,2880,2291,2242,955,2488,2625,2165,2424,1152,2280,409,414,365,2881,2739,2384,2392,1319,2573,2680,2090,2842,2302,2295,2996,1124,1193,2116,898,2174,317,1453,2441,1977,1132,2992,1307,1218,521,3056,1951,2853,303,1163,1785,1890,849,2030,857,820,1991,745,161,2255,3147,3309,419,3264,331,2268,1630,1652,3328,742,2170,808,265,757,497,1555,408,1212,63,2058,765,979,1913,679,2490,851,1251,1960,1417,3337,2855,1469,1789,1853,170,448,1138,1886,1191,1755,3058,47,1915,3061,606,449,1200,2120,956,1749,2319,2464,79,432,688,2604,1858,980,2776,1475,342,1761,2358,429,1089,3352,941,1294,1818,1893,2700,702,1443,494,3205,69,128,2223,985,813,1261,718,1947,2414,916,1967,1373,2995,1022,1367,1596,1524,1510,3176,2243,2527,1829,2312,49,1950,1408,2979,1404,2960,529,2837,641,1725,483,1982,1008,3143,878,288,1456,1867,426,2986,309,1439,552,154,1343,2608,3213,3004,3214,2859,3032,2745,1116,252,520,926,2496,2885,2990,611,3259,1480,2154,121,1759,1028,2886,1209,34,339,3288,2339,2582,304,2787,3336,838,1817,3051,232,3018,2860,262,2650,1465,2349,707,1393,1326,327,584,2746,167,2785,2079,2283,1772,3257,2487,1128,3341,649,404,1440,964,1792,1044,292,1359,2125,1035,560,1684,681,2695,3025,2345,1168,1519,110,863,2926,98,1535,411,1783,2638,321,2182,819,652,1954,2705,957,1076,2950,2022,3351,2206,1074,2025,2177,3096,428,250,524,11,1385,2736,1445,2814,234,2432,1532,38,2507,2169,388,3276,2805,269,12,3048,2750,834,1644,2959,3295,1329,962,400,1466,1144,2720,719,2060,95,2978,261,1187,1240,1474,2129,2788,2261,1756,337,3177,2387,50,2252,1161,3086,229,447,2980,1507,1512,81,1602,530,2815,2089,602,1668,1560,759,733,1680,464,2087,2011,1464,3024,1965,1226,2118,2035,3054,421,616,2875,778,1233,3196,2247,3323,1468,3125,1091,1802,111,999,66,2265,2185,1557,2077,71,3192,197,282,1149,1624,3271,2724,625,2962,2560,1952,183,1312,3304,2121,2748,2137,2538,2683,1206,1916,3136,1479,2249,558,2494,1764,2219,2618,1429,1342,3209,1363,3114,1435,1057,1174,859,185,1728,915,3081,1264,1016,1104,1290,1899,2429,1521,1195,3181,2974,986,877,595,2225,677,2713,2652,375,824,140,56,1980,2969,2183,1270,2061,3315,3232,129,3042,3095,2662,1901,1592,251,866,2091,1412,1694,2893,2647,3312,1517,2101,2783,1587,1129,1910,592,1202,1621,2532,2965,818,237,1389,3284,2287,2026,1678,2260,1413,340,940,632,1628,2740,323,2491,2868,534,564,693,1565,1605,2530,1812,87,433,1473,2179,1743,509,541,2681,1105,2817,2888,2741,271,1905,1160,612,874,3330,1472,689,2103,451,1588,2,2603,1511,837,802,3246,3240,1166,3075,2510,2500,318,1419,1096,2586,2725,2068,3294,559,752,2020,2316,2294,1739,2214,1969,135,858,2646,1038,3152,1609,2050,496,589,3016,2166,1155,2765,2276,192,997,1976,7,1601,2006,2975,1707,1600,2536,3138,1176,2163,43,2119,4,975,1934,3316,1023,3275,1344,876,2382,296,1069,59,1722,2086,1369,737,3203,1007,1451,2071,2327,1576,896,276,2964,674,1165,938,1768,1432,22,2065,2053,2735,2823,3256,3201,801,1765,3277,1892,2311,2240,1708,1502,2063,2997,3307,1448,2589,48,2482,2321,1177,1071,298,26,1809,2789,2172,2802,841,2380,1695,1616,512,1575,942,2147,1496,3191,3159,1533,301,1650,779,203,1679,623,2202,992,1663,1503,604,1698,3063,1352,3272,1626,3088,3300,1111,786,1825,1625,2259,416,76,3085,1870,1114,450,2830,385,661,2361,120,1242,2566,3247,116,1631,1067,3045,2144,3188,2666,568,2774,2928,280,1629,601,1641,10,2451,1400,3021,316,3228,1357,2633,3122,2175,108,1556,746,2198,2585,2564,1423,3348,3043,2431,209,436,2365,887,1108,2297,382,2208,2489,2923,152,1010,1848,1894,2001,2187,3356,1883,3322,798,741,995,3022,1196,3262,3093,1313,3120,242,2760,14,2462,651,934,1767,1267,2812,1403,1207,1339,850,2767,1237,3130,1799,2744,1770,420,782,2254,3292,3270,2684,506,1658,1084,184,2897,1638,569,598,1938,168,1897,1852,2639,1447,1987,3303,775,3115,2127,2196,2637,3212,70,2896,519,1651,2795,1368,1891,2517,442,587,2233,1271,1831,561,685,2600,1460,1927,852,267,2640,2445,1606,485,505,2016,119,578,1923,821,1962,2535,2468,1642,1681,456,3175,2632,378,3220,1181,2622,223,2822,2357,2854,2356,1054,2032,1323,1205,2094,1175,599,659,2908,311,3308,20,3099,2401,526,2366,3157,2436,249,2417,1192,155,1700,1225,1169,1299,700,372,2081,2757,2460,832,1793,960,103,2917,37,90,2759,1428,868,3146,3113,1298,1585,473,2241,1720,2689,2051,2677,1735,762,1350,2448,3065,1730,2550,3076,1115,1998,2938,1751,1390,101,2285,2457,2844,2404,2072,744,2872,36,405,231,1087,1530,1961,2508,180,2685,1454,996,1564,387,2226,2002,402,2593,2486,2627,1889,3062,3265,588,622,2416,2803,1509,888,2211,2210,255,1667,2569,2046,1164,1856,2905,3326,1926,1661,1171,1437,397,2368,319,86,2388,1619,3217,1924,724,3010,3189,1036,1123,644,2558,2332,2402,1484,2701,2998,959,585,1824,2015,2279,2221,1974,1782,1826,2846,2648,2371,795,1427,1932,369,1888,2858,2865,2151,151,2918,2044,191,2519,2934,3069,2092,1232,3140,2816,1807,645,72,391,1673,2945,2273,1546,1244,3225,196,1702,3239,983,2289,1757,468,667,754,1640,1366,3354,2949,1056,64,2162,791,2621,1771,2135,2483,522,2426,2104,894,357,2467,236,143,976,971,2503,1598,1470,1669,2714,2605,2106,3148,2850,3119,2040,1211,1666,105,2828,619,1463,2256,30,1786,2470,3116,291,1839,1813,244,1861,2728,107,2696,2588,2395,381,2284,3218,207,104,1627,2344,1971,1221,906,3285,3186,1201,3155,2779,974,2522,219,2054,809,2839,2132,469,2568,2027,1844,146,1637,2747,2513,1569,3314,2093,2458,2499,3072,2229,810,1712,348,1086,1398,640,867,1580,909,2459,1153,1172,2549,773,1671,374,1052,811,2466,2449,1146,2456,1993,1452,2427,1495,501,2645,2275,478,1547,364,158,216,1701,41,350,1090,1444,2391,3350,1746,3009,3073,1904,3034,923,691,1477,913,925,1937,1337,2807,2272,848,751,124,46,1120,2692,1586,16,2657,401,3169,1304,2390,172,767,844,2942,984,1197,3098,2112,1131,1591,241,1670,2806,903,626,1561,2937,3173,427,1944,297,3258,2031,883,274,930,1296,165,2301,3329,2924,1513,932,1830,1236,3266,1762,148,3242,1269,1183,565,2706,177,3324,1386,1021,1430,3296,1857,1568,1234,1040,2539,1647,2874,455,2156,1247,1113,470,804,720,472,279,1397,2800,60,1778,367,3182,869,981,310,1919,3166,3035,1376,2469,2869,2597,2052,1230,1182,676,3089,199,1800,2039,2114,2007,1884,2561,538,2944,1590,2726,2019,3149,1095,2413,2095,351,1009,683,774,1410,843,2343,777,2037,2873,3306,2194,989,855,1414,2642,2531,481,35,1003,1577,735,275,356,2796,2723,2514,2115,3039,3230,175,2264,1082,284,1578,1737,571,2575,1978,860,1841,900,1635,816,2075,1216,749,1634,1394,3313,1846,2204,1340,2826,2567,901,1136,345,383,864,1584,1143,1060,273,2439,2515,5,729,716,2595,2737,2864,839,218,1306,2984,3287,166,2277,1198,2521,424,827,2915,1486,1574,1382,1918,3154,3059,3245,2485,2479,3092,256,1895,2540,1355,755,2999,2772,2571,2643,726,1170,544,1446,2594,2362,1239,2847,1877,1142,715,1873,736,1135,1425,2171,1655,2238,2773,3160,1696,1110,525,2411,1482,2533,792,1787,1262,2606,2925,3321,1570,1070,2164,1449,768,1252,1985,380,1026,173,631,2887,944,1493,3229,3013,2290,19,1908,15,3126,1,1589,2651,532,2655,1990,3311,3216,629,1263,349,785,1441,790,648,853,474,3111,2756,892,1805,324,871,3057,2731,2111,370,1406,1648,873,2833,2374,1518,3333,935,475,2729,78,1118,2480,1358,1401,2674,2250,1526,333,3127,2097,2481,1024,567,1674,2715,1705,788,3219,2029,3012,178,3167,518,1704,260,3280,2333,2161,1037,305,2898,787,2184,3261,2824,2340,228,2871,1837,1620,3241,3183,965,2124,1134,193,2574,2442,2471,2904,2192,1073,142,1795,2544,1909,2577,910,769,1803,2856,1213,1970,3293,2764,712,2838,1732,2450,2914,972,1112,1481,500,2067,937,1573,2769,600,825,1286,27,1190,84,1775,2827,2493,1766,1693,3344,2631,1308,352,954,554,2665,52,2932,566,2611,1311,2267,1173,2808,99,2085,2224,3031,440,2108,1005,1334,2322,2437,1297,1540,1033,704,1847,1711,57,978,1013,245,1333,2730,3036,1273,1360,1353,1525,438,2142,3074,2889,885,2096,1875,115,2981,1186,1597,2010,553,862,2614,2921,2342,1109,2590,537,127,3153,1823,2703,8,2505,945,13,2732,493,2474,3286,3224,2900,597,2281,1686,1338,150,1328,563,1864,2761,1462,2749,1623,410,1523,2109,2829,1081,3325,1840,653,368,993,1536,547,3050,2317,3100,1374,865,2008,1936,2694,1277,2134,1699,717,2801,3068,3055,3164,3255,739,2158,3299,1458,1550,3066,3,2601,211,961,29,1034,2512,396,395,1773,181,3215,2346,2687,697,1478,1409,695,2825,3289,28,579,2967,240,3145,377,2102,701,1004,220,2434,1012,343,144,1752,2473,3291,2425,2973,2325,2269,54,1930,2835,247,1501,169,3112,2770,1332,2056,202,939,373,1356,75,747,3105,1582,3298,1459,1371,2719,508,2286,159,376,2516,2350,2000,812,1639,1416,3131,2738,32,1981,3015,1581,1322,2438,443,2780,253,1219,272,2910,928,590,2832,1999,2555,3204,2410,1241,936,2634,156,3195,3151,654,3005,149,1498,1253,1553,621,1305,176,1880,1362,780,624,2141,967,770,1461,591,2798,1157,2330,6,3320,1442,1754,1045,293,2360,2985,670,1537,2710,673,3165,829,435,2624,1645,1483,1020,943,2840,3227,1869,1912,3282,2012,504,1399,2679,2331,17,593,2244,1222,139,1796,2682,2851,2672,912,3079,2930,2943,2385,1801,1395,570,988,1649,1903,3067,1545,1002,2718,3052,3137,2906,1604,437,42,963,1011,2691,2110,1100,1145,2818,1072,2009,1217,1804,605,2820,533,1365,2313,208,1571,2205,2656,613,1370,3064,1567,3360,711,665,2353,1731,557,114,734,3210,1784,495,2399,1552,1061,2579,1349,439,756,966,281,1798,2455,2895,706,1079,1816,1421,1361,766,3194,1822,2152,2447,2231,1231,2484,2947,1745,1295,2813,1030,1850,2495,574,1797,2078,479,831,889,540,732,1953,299,3331,1137,68,536,465,73,2518,3310,1288,3101,1154,3338,326,636,1029,2355,911,1167,2809,212,882,1955,2989,1433,2193,2876,1101,2553,417,77,3345,830,881,2673,513,668,1821,2794,1274,2581,1284,905,783,1986,551,1420,1062,431,482,3302,2373,195,594,917,1094,2181,132,2477,794,2636,2903,1612,3335,835,580,239,1964,789,608,951,390,656,1158,1500,1180,194,2389,1275,1929,2635,2861,235,2213,2107,806,1781,2405,1691,2292,1402,362,1922,663,1747,1941,2216,2845,2113,607,2239,2335,1849,3251,633,467,1351,308,413,2105,2370,2130,226,2592,2033,80,1249,1871,713,2397,2901,2819,815,2257,1810,2653,2308,2463,2338,430,160,1080,2099,3353,484,2069,3132,1039,1150,760,198,2551,1827,1248,3274,2139,872,1966,1949,61,1097,145,2407,2912,3234,3141,1321,581,722,3233,313,444,1504,1381,637,642,2758,1331,617,2523,2146,914,2305,527,1426,2670,3238,3339,1490,1418,3158,3179,215,1729,1527,460,2133,336,805,1956,2954,341,1979,2576,1727,3254,1250,477,285,2690,1292,2328,1320,2596,130,870,1265,2300,1715,987,246,2234,1522,2422,1189,2379,141,2658,2041,1687,2899,2372,257,666,3278,678,1599,3237,1933,807,2834,1774,2354,263,1102,187,2957,1341,1882,2059,2878,1147,2953,1140,40,1806,2168,543,2394,2751,102,1845,3170,2892,2675,2506,2167,2877,1208,1959,2209,1724,2117,2363,675,1380,1968,854,1281,2661,680,1199,1059,1862,2502,2303,31,1318,1541,1119,897,3327,3001,2452,217,2972,2543,2201,2711,270,3017,771,919,3144,3297,946,2005,1907,1335,499,1714,100,3135,583,1660,205,814,2084,893,918,1794,657,1046,3026,3060,126,1256,3174,2955,394,2768,2883,3244,3084,2195,1063,2797,238,306,329,684,2717,2849,1610,264,3027,1348,586,546,511,2542,2420,740,125,2619,1492,1808,1763,3007,550,1103,952,1863,2150,1562,122,1716,753,1324,266,286,1940,1551,1139,1064,3197,856,9,800,1415,88,1921,1243,1788,2660,1293,118,462,407,1659,453,1945,1615,2537,3041,123,157,3305,2966,3162,875,2083,2126,3260,861,2712,2453,2793,466,363,1898,3349,1709,1723,879,1055,134,344,3185,1224,1872,1220,188,221,1017,2602,360,1957,2882,1750,1618,1741,82,3082,51,259,615,2190,635,3080,1499,3347,1302,2351,2913,1194,2435,2472,2742,2554,2232,803,2572,1325,1779,502,836,1048,1656,384,2931,2128,823,696,2003,1238,1122,1364,361,487,1278,2968,620,2529,1738,1697,664,2775,1117,1085,283,446,2098,2867,2676,2616,669,884,705,254,2266,2559,3033,2753,55,295,763,1685,97,488,74,1911,842,3128,2148,164,2230,947,1963,950,2810,3121,3236,1291,517,2419,2329,2641,2922,1375,3053,1162,2140,2080,1833,2528,933,2841,1654,294,1548,503,2478,2299,3044,2475,3107,3019,2263,1820,2149,1914,1811,3283,1488,2304,1692,953,2073,204,3029,577,2131,3023,1327,2088,1246,603,1836,393,1531,826,1379,2644,359,2598,3003,491,2228,1583,2688,1438,1896,2993,1280,136,1539,2157,2929,206,1995,1834,2727,1283,1814,392,2138,575,2831,2511,1617,793,3134,2994,555,346,3252,2440,609,2021,2492,1223,1018,1315,647,899,3340,3071,797,486,1485,2870,96,2557,320,1066,761,1257,471,692,2296,2933,1508,44,1733,2004,1721,1006,658,445,3006,2409,2359,1736,2378,354,1514,1815,1613,3198,2220,1450,1529,3163,639,224,1043,2393,2123,1289,1996,2607,515,2911,289,2956,2377,3161,153,708,3268,2278,1378,1572,3078,3103,3000,2541,2400,2848,2309,2017,227,258,225,2155,977,1790,3279,1422,138,2525,2318,1646,610,1354,2324,2693,3249,970,1528,2376,2314,2754,2678,3334,528,1758,1345,2552,1487,1041,1330,2587,2143,1593,1777,2548,278,1958,510,1534,1276,2907,699,1184,2852,2461,2804,1983,1972,2178,514,147,3184,784,847,2583,1050,2963,2245,2866,628,355,2884,2927,2036,3207,3117,1127,1178,2153,1925,2811,655,3102,2217,2857,490,723,958,2271,725,3077,2042,3221,1391,1392,1832,109,1098,1920,358,3231,1879,3248,2227,1675,2836,1657,3187,1520,994,694,2180,2654,186,2337,25,2891,2791,969,2733,335,1931,982,3357,3108,386,1878,2617,1125,441,1988,643,614,556,3318,709,1851,65,582,3014,325,1690,576,290,2890,1865,3343,3030,3267,389,531,179,973,2613,2237,2306,2315,3206,1607,3133,1538,322,1347,1542,1866,2778,1672,2045,1828,535,1317,2408,1258,1928,1133,3038,2946,1088,1860,2334,3290,2763,2722,2716,1973,1843,1396,1515,596,2509,1653,1148,189,315,2755,880,379,3020,422,277,1042,1255,1266,3273,3269,1608,2076,3047,2578,2310,1769,2191,1868,845,113,1838,3200,1019,2274,1316,3070,3142,886,1780,1346,2235,94,1688,929,85,1287,2991,2524,990,833,1254,2982,412,1744,3222,2122,2610,1622,302,2862,213,1516,2743,672,3097,2024,542,2936,1049,991,163,1077,3193,1632,91,3156,1579,1942,2649,1753,3332,89,1272,2799,2970,3049,2940,1455,3028,353,2971,2057,222,2176,549,2248,1384,1563,1436,927,2570,731,2199,1159,902,1791,1015,2215,721,1665,2958,1906,423,1310,650,646,1710,562,1411,1078,1121,62,3171,1939,1260,1203,1740,2383,2620,1683,772,758,2476,2792,2369,2023,3202,1900,1032,2320,776,3104,248,1975,1717,1407,908,630,1549,210,2916,1885,3008,106,634,2664,434,2403,2348,2038,3190,1984,2941,201,214,3199,314,1377,2222,2659,2843,1099,492,2034,2952,1489,425,1989,2580,3123,2762,3087,3046,2212,2367,1053,2398,1130,133,2386,39,2446,1387,1842,182,2983,1859,1229,2599,2145,1594,2203,2697,1476,1065,728,548,174,463,2501,2207,1703,1505,727,907,1279,1881,3109,3346,480,2615,1742,3037,1558,1058,1855,2951,891,2766,3139,660,307,1902,2498,1467,1943,332,1713,1314,2246,58,137,1047,1506,2734,1179,781,366,1706,2704,2709,710,1633,2282,2418,1457,371,904,338,1434,1719,3223,1215,1068,1141,458,2939,2667,2013,1227,67,1126,750,2454,3150,287,931,1204,415,300,573,1282,922,890,948,1336,3235,738,1603,2218,2591,1471,2628,2189,1424,2547,2948,3168,2556,2698,539,418,2909,3110,3226,796,117,2919,1876,1285,498,2629,1051,2546,403,2520,1075,162,489,1664,2323,618,1554,1388,949,2902,1259,347,523,1027,457,2781,3211,3178,1228,1107,1682,1946,1935,3083,1405,2465,3355,998,1151,2270,131,921,2444,2396,2506,3182,749,3003,2235,1877,3011,250,2527,2244,1976,1788,2571,1661,2726,1827,1812,1799,647,277,124,1373,1437,913,737,2723,3288,2570,1264,722,2620,151,296,3225,464,265,425,2445,883,280,828,1987,3106,1191,258,1236,51,1434,2099,2123,203,326,3190,2001,139,3202,3135,2982,878,2825,1751,3041,1931,979,2493,1929,275,796,3308,2200,1561,3141,925,1865,238,2020,2181,2741,408,1922,239,1531,2488,3301,3297,1916,2436,1875,1760,1441,2753,2045,3215,2533,2495,1151,2755,223,329,2316,500,1597,1363,1609,622,2538,1716,2093,2053,1802,1850,2073,2661,255,2543,2621,2999,706,2272,2984,1205,2468,2474,3119,1823,842,2162,713,1515,3012,1634,1112,1648,1990,1838,805,1551,1774,360,1649,310,1323,912,2594,3259,337,2483,918,2685,1438,2926,592,1227,1094,1466,1591,2367,2083,2925,560,2384,2125,1162,1541,3035,1297,1888,253,1005,1213,95,1336,970,2264,2194,379,2027,3262,3164,1949,937,2230,2262,1801,2009,1053,1936,1266,2189,1773,268,2855,1226,1183,2323,229,1632,854,186,1635,2419,1964,1697,2517,742,1003,2250,1674,300,2216,350,2343,1843,2857,3216,1307,2330,3292,2591,2173,839,161,1351,1587,1911,2558,1384,299,594,1509,2712,2188,1290,480,496,2067,3068,2568,662,1161,2112,1601,519,1337,1471,132,1122,696,506,2956,1221,3086,2716,1571,1019,1500,2603,2313,766,1834,66,1392,1577,1059,1569,2023,194,2851,448,1078,2386,125,1937,1698,1989,2442,3096,2902,476,2609,3077,1444,1106,1462,3336,586,1974,2398,824,2467,1194,1729,2051,1957,840,2148,2177,2391,1645,2960,2807,142,946,446,1063,2308,1752,1694,2693,2873,1535,1472,965,2095,1998,2029,899,303,1423,1304,2501,915,1873,3339,2134,3042,1293,674,1372,324,2204,1279,2497,1928,3201,1756,2070,534,3156,1738,3165,1499,1017,567,1670,3198,2388,1430,2155,1309,2657,2276,3087,1832,38,1822,2523,3354,1281,1428,1354,1291,2390,1467,438,1758,1853,325,2766,1882,107,1093,2076,1113,947,1403,1225,2166,2331,2700,2600,2988,78,2882,1160,2750,2449,1954,2240,224,3020,2853,1677,1316,1952,3251,2838,655,2184,417,1913,2048,1732,1185,105,2246,917,1315,3168,1642,2831,403,2764,1038,2602,1789,474,1140,3105,2354,1364,2967,2208,1440,1734,1739,989,160,1688,3084,1087,328,1339,1237,663,2030,1135,1782,803,999,719,1712,2561,2578,3193,772,774,419,2429,2933,3000,2622,82,1464,1764,1769,314,2928,2668,572,2012,2870,968,2587,841,2504,240,1522,2480,1447,1234,2122,1487,823,535,1744,2351,487,1262,28,3013,2237,2972,85,1459,3298,1798,1277,1610,1224,2730,115,1766,1189,2222,3070,1158,1724,2662,1641,92,1187,1921,401,3291,1418,618,218,2791,2334,1723,1010,2452,2077,2253,2364,2106,10,746,943,187,196,2465,1104,598,517,1231,2196,3276,1511,2121,1209,1368,2252,2552,1389,457,2333,1073,756,2362,2358,2738,86,435,171,2373,1136,1280,2489,1691,1614,3057,1667,2827,2743,2654,3266,3034,2381,3267,2409,3200,1950,93,2889,1600,876,2691,1197,3218,2032,3076,1295,726,1797,2763,2233,392,1971,2627,2028,2433,1385,589,1312,2101,44,743,1180,439,2526,2350,3184,2143,817,806,163,794,2420,3305,562,1033,2802,2625,3160,2085,3056,2060,697,2019,397,2078,1512,3069,2819,2698,411,639,1898,625,3214,2535,1845,2223,357,3278,847,2848,1778,1173,1856,2720,658,1177,2592,2416,2418,1287,1057,2461,3213,62,1915,272,1086,2569,3347,1993,2104,120,755,558,169,3326,2494,1968,2283,2192,2097,2303,3090,3098,2310,1510,2317,2115,966,2964,1096,2935,1885,992,1646,346,1844,685,2804,3133,3157,1415,1676,3131,2511,4,2697,2595,1408,2008,590,811,2687,2327,219,2476,2740,2824,889,2663,179,608,210,959,1452,1324,230,1581,1203,2171,643,2899,2837,3121,3169,1436,1044,1217,309,423,1145,1298,104,2829,87,1547,2107,2072,822,3300,226,945,508,1421,3073,509,2985,929,287,2016,335,2087,2424,1128,69,795,1958,270,2965,972,1602,3356,211,1894,2534,2850,1370,1685,2736,1365,1494,3033,1593,667,748,1951,2079,3264,996,958,2758,556,3045,724,2996,1040,628,2961,1489,2794,821,1143,872,1332,2680,1963,109,2957,1851,282,1573,2389,2788,2536,2498,1252,1707,852,2876,2728,676,1961,2128,727,588,582,1907,2425,2160,3149,2187,2356,636,1064,1528,1792,2370,2808,3177,3261,1478,415,2229,2054,3138,2659,3236,853,249,1084,2772,2990,393,686,1422,317,1240,2515,1465,297,1414,252,2236,2026,3212,3116,150,416,1457,383,2238,595,1701,3223,2793,2799,1653,2549,2454,863,2163,2273,617,1689,708,1560,1947,2010,1204,2906,1002,850,668,2900,3220,2646,1852,981,2938,1195,3304,1043,81,1555,222,3239,3238,3332,1538,2290,1903,3148,845,1897,1920,3089,3021,3161,2660,1241,354,1077,3245,2987,512,2094,1034,3159,2842,2744,3166,1046,2368,2546,1102,2038,1848,3360,2800,256,2075,540,3270,698,2579,1080,3340,849,1101,1570,1516,2704,2209,2583,1506,2178,862,1825,453,2555,1037,1633,2547,511,1427,72,2291,2203,165,200,1666,1746,3269,3118,1496,2554,1811,1016,1027,1362,143,1208,1887,2690,3204,2185,3208,3287,1962,550,1047,1069,466,987,2050,1622,290,752,1693,2410,2231,1228,1533,900,2156,634,156,610,2892,2404,276,1580,2875,1200,692,2542,2346,1314,923,1722,2901,1230,1615,701,491,2762,1776,2379,311,1828,2922,1004,2482,1861,1994,2715,137,2221,409,3043,651,759,3007,563,175,2632,1207,3279,2991,407,2145,1020,1480,1318,3037,424,1416,2136,2393,3132,815,3246,315,731,808,2369,1260,1563,205,2218,579,2377,2254,1588,2710,2849,2320,2721,1018,1175,1376,729,2893,302,2619,2981,1999,2458,1606,374,1644,2324,3294,2642,2914,2450,2440,330,185,1638,1743,369,2789,1761,352,1869,2120,1099,831,2918,2443,632,2564,55,2867,234,164,2801,880,3052,2507,1604,963,2227,2459,2948,1335,1301,130,1718,1159,2146,1594,809,3153,950,2563,1796,1883,971,2342,1687,3139,91,2042,1342,1386,2037,1267,1268,536,3293,2610,673,619,465,2338,2997,1731,1144,2572,2066,1253,867,712,2175,434,1060,3321,1804,773,2457,3110,1076,2056,3333,2049,1611,368,3114,2478,892,2472,593,2737,482,3210,3072,1978,2361,2092,1321,941,2828,991,2751,23,1854,1532,1061,718,1909,734,42,986,123,1272,2752,2775,716,2004,2512,97,3097,1574,1222,144,1818,3283,2318,2881,190,45,2098,1605,2665,3178,2919,1380,2976,2962,2084,2858,2432,1849,557,1791,2161,933,2041,442,543,1680,1876,2694,1103,215,1292,2214,2176,3025,807,641,1174,1640,1607,2243,776,116,1056,2295,530,2798,1460,1501,1394,1576,2211,600,486,513,3127,1070,709,1583,960,601,1620,1181,3268,36,767,1132,2545,3299,2167,17,3144,1133,499,888,3108,20,539,1382,2880,386,684,1639,775,431,3286,693,433,782,1153,2677,3224,1497,2666,3123,2071,3181,2708,2814,1878,895,1108,3036,1381,236,1814,429,1613,2040,2219,1098,882,364,399,1238,2363,984,2531,2499,1730,244,2717,2153,2062,61,114,2754,2469,1893,428,2856,1030,3174,1359,1771,2116,2201,94,1505,400,112,3271,1808,2413,2937,31,1664,327,2790,3172,15,2114,3189,2215,1015,526,2088,2460,949,2473,750,312,3009,2995,613,2611,377,602,3307,1401,884,2731,34,765,2553,2574,2261,2924,1327,2615,2401,2406,2565,887,3173,1141,2395,289,2821,157,318,1214,241,745,1157,1114,897,1455,1482,2655,830,1997,1443,426,2915,2464,1575,1317,2514,2516,1120,2871,3046,503,997,2640,955,3032,3319,410,2734,106,3163,1745,1946,2975,874,1276,231,1032,2854,2612,3054,1235,1150,2301,2340,2897,1074,3058,3211,1826,394,1927,2284,615,2182,1627,184,1477,1322,1735,37,1007,1692,978,1553,3258,477,3325,2347,672,308,1352,2129,2044,1683,547,1165,479,1453,764,2839,246,1118,2863,2664,1402,189,523,2126,2909,1682,3102,365,896,2843,2727,1831,1629,3125,2279,455,3351,1199,568,1970,2633,2989,3120,2905,322,2942,2760,2100,642,294,848,2108,406,699,516,1700,1736,738,173,2423,802,259,3274,1271,2168,2503,969,2879,3053,47,88,108,1244,1794,985,3129,661,2890,2270,1618,2674,323,356,340,2329,235,810,859,1036,732,3285,367,1960,3282,2147,58,2274,1816,257,1982,504,1863,3006,1107,974,162,976,2113,2779,1631,2652,7,2298,2063,2707,1212,2286,1686,3260,1334,1083,879,344,2761,1469,2895,2355,1924,1679,3219,669,301,2689,2946,2220,1375,2703,1445,1671,1704,1986,2206,2813,1846,232,389,1599,456,1842,1941,1754,2682,1727,1783,3194,3346,2081,1483,2297,1862,2739,1263,2300,885,666,980,3124,1142,3111,2281,1216,1024,9,2463,993,279,768,1419,2920,1830,1258,2968,591,2170,493,3140,384,216,2110,1942,1013,800,603,1407,1152,942,2628,529,1585,702,2817,2149,1669,689,1097,1975,2451,577,1866,1326,273,1193,2397,490,3067,1725,730,2954,1202,2117,865,1809,332,2434,2481,2529,627,8,1009,2232,2903,1383,1524,2626,48,138,2296,3154,3183,3112,1546,13,3230,1740,2949,3242,2796,2470,2179,1934,898,267,518,2963,168,3122,3275,2034,837,791,3107,1702,3310,1548,1138,3303,798,1675,2248,1475,2593,1012,2575,1079,781,74,2058,2475,1248,1955,3109,1742,2714,1534,2822,2086,967,1479,1300,3015,321,780,420,1871,412,793,378,1288,3100,2430,1655,783,1874,1251,361,70,1089,103,286,2584,1493,1720,3048,221,305,1184,1058,2266,3104,2151,2713,3243,494,3044,2805,1338,3345,2172,2421,1625,3002,285,3231,2280,1054,3250,2624,2372,2617,49,122,191,2135,333,46,1710,3244,645,826,580,2986,2448,1473,881,2556,3311,2011,3209,1793,3314,3142,1857,2069,1665,2669,1896,640,2686,1763,1468,3171,1008,2186,3113,1302,2576,2111,818,1110,1006,1859,3192,1835,596,1983,136,3061,1959,2405,2065,2033,242,469,1906,1935,2638,485,2696,3331,2859,2319,2898,2910,3355,2931,2427,152,2941,846,2352,801,829,1525,3228,520,192,2786,1091,2809,1219,2325,1543,904,2670,894,266,575,1755,1130,695,2599,553,2884,65,2784,2585,3312,2258,2378,2590,1345,209,90,1815,1695,2541,2446,544,2832,2806,3195,2383,1404,1837,786,1690,1503,3217,1672,951,714,3179,2105,1980,546,2958,2321,2024,681,2562,2635,2679,449,1495,359,271,484,193,1125,1996,129,1396,739,626,501,140,3055,430,2217,977,75,372,2269,1176,757,366,1948,1805,2193,2142,2332,40,866,2866,2748,616,938,1119,1072,870,1507,355,1518,2580,1319,180,820,2769,1696,60,1786,1406,507,2267,1565,2537,2080,646,3145,437,63,3324,2394,1285,2195,2650,1042,2747,2306,1717,131,1807,481,2102,1660,2417,2623,2601,3196,2228,19,2560,812,1711,2733,1121,1139,128,2339,1313,2455,57,1559,262,1977,1305,149,1090,2447,2840,2980,3167,2006,2074,2288,2438,375,789,274,3026,2522,1967,2695,1075,2518,33,2314,2385,1456,18,1397,102,1925,1399,1325,2312,2702,2212,1596,740,2336,2256,2059,475,2735,804,2299,1254,1508,2055,581,2886,3059,2477,2242,1023,363,2639,788,447,2519,1616,336,2847,956,341,1757,1603,2636,2978,1539,11,2380,26,147,2392,2923,1374,1855,537,1969,2658,587,1357,3126,2305,2888,398,2159,2911,1523,1926,1636,148,599,1095,3316,1220,1557,961,710,443,468,940,73,2826,2939,413,3191,1984,181,2629,995,3150,1215,1923,725,304,751,1889,864,2127,715,1146,1821,1356,3273,3229,1172,753,954,1182,1355,1134,444,1550,2940,2247,1552,101,445,2025,2945,505,2951,2724,2510,2532,1347,2444,2140,2017,1872,1520,2345,901,549,1488,3062,2255,2974,3147,1433,3066,3348,1451,2836,2022,2719,584,3175,1703,1579,2768,3335,2818,1884,2399,53,1785,924,554,1486,1328,79,1953,2651,1432,2052,3265,3049,1864,135,2606,3038,35,754,492,861,926,1504,3256,1411,834,2260,41,3309,483,679,1284,1779,1719,3257,2729,922,1377,1169,432,760,2844,3027,220,3065,1154,1899,2607,2645,2400,524,2471,893,1540,110,2183,2268,2137,1055,3004,2874,2307,1369,1824,1795,1945,67,1817,3254,2277,1598,1657,2275,838,2169,1081,691,349,1530,371,1156,3289,3071,3019,1424,1612,2132,510,3327,1662,583,471,1709,2453,2846,2675,533,844,1341,2374,2749,939,2830,3306,1275,56,2841,936,2653,2672,1249,3290,2502,982,914,404,921,3080,1721,2403,3130,1578,50,2943,1409,2678,931,3235,683,113,707,2778,1273,2810,488,1914,1790,1985,29,902,2944,2412,576,578,2709,3017,153,2557,3079,1819,1556,1115,2158,146,307,1656,927,675,1713,1572,1178,2492,2979,3187,1071,541,2349,552,2598,797,1021,1784,624,3095,711,2491,1450,2676,2366,1608,2767,816,2456,459,2422,25,2082,1737,2500,1066,1031,1261,3272,2797,1943,183,2118,1502,52,1485,1331,3115,3018,2124,604,2815,263,2036,1829,1461,1448,1658,1206,1390,2046,1647,548,771,2864,2705,3284,778,334,1028,96,1549,542,2150,3085,3357,2861,2414,159,3227,292,2068,1617,436,245,1454,206,1651,1137,3030,288,3101,1164,1892,3281,3063,3343,1521,1595,1242,2428,611,1166,1780,2292,1378,1919,451,2259,385,2015,254,720,2908,154,2932,2699,2226,1147,1246,2265,126,1320,1353,2119,3028,133,478,2344,2157,1400,574,121,644,207,2154,998,348,2096,2544,2089,1545,339,680,2540,2869,3233,703,1705,167,1879,873,3039,3255,83,2287,1966,2959,1348,145,3010,3008,1544,1449,1167,1663,1481,3051,373,952,199,1344,3234,787,54,585,1810,1289,1149,32,2249,1858,2426,1806,717,497,1678,1836,2359,2490,2484,1116,2833,531,3240,903,612,2357,198,2746,1867,1901,2311,3199,2577,2387,12,1395,1537,1011,2530,1303,814,2365,3330,1127,1367,2671,1111,907,2904,3188,2732,909,1,473,3248,3280,390,89,2992,269,761,2375,2439,597,1944,1188,2141,3352,2865,3358,59,2315,664,648,117,454,792,2509,2003,2435,1278,2241,1759,98,1245,565,1476,660,5,629,84,2376,2582,1753,1492,111,566,1626,1105,213,3092,1726,871,1519,747,2353,827,2198,3117,2887,3093,2581,1536,875,2133,1517,1708,682,910,338,3241,396,1029,2031,2966,2656,1714,2462,2773,1513,962,2,2771,1803,3022,2304,521,2130,2007,2513,2371,2550,1886,1310,784,217,2559,201,2018,3047,2834,2180,994,1211,278,178,2257,298,1584,2335,2614,657,2811,957,2803,3162,1767,1446,3078,1410,2649,973,670,1388,243,100,1470,1045,2637,2035,1250,2820,1247,1558,2441,2520,2271,3222,2567,3359,2293,1065,741,638,770,204,1770,1391,1652,293,376,1484,2548,983,1163,522,911,119,177,1529,345,3203,2912,916,1637,2970,860,1000,2225,1329,2718,650,1429,2894,1306,2191,515,2969,295,605,665,1918,607,3064,2688,3136,3016,1092,118,545,2916,2934,3082,225,2131,427,2885,3143,158,3296,1542,2588,2415,1940,728,71,2521,2496,1917,2551,2643,1741,1562,2341,877,1265,551,1039,905,76,1490,1890,247,3024,1938,452,1554,2757,261,886,762,606,353,2013,1841,704,1973,1349,182,1564,77,2692,1179,1001,1643,3263,2684,1148,1833,3252,1659,975,2138,2860,1781,313,2742,2782,3134,2759,3206,342,3247,1283,1417,291,654,656,825,2000,2883,2348,1014,2955,2816,928,2947,3040,1100,2792,3180,1155,3334,1979,166,422,1567,2913,2812,320,1728,3317,779,2823,1420,2795,1699,990,21,690,2337,43,170,1366,559,3349,1777,2774,3207,174,609,721,948,2245,1650,2328,1904,633,532,1168,3302,2205,1333,2047,1088,2983,3158,2251,467,1190,677,2466,2777,2021,30,208,1393,1715,2539,472,2199,630,1463,1171,3152,1035,1210,891,141,932,3197,2780,2090,3088,1566,2064,2411,1068,1932,1085,1965,1860,2152,331,202,2872,1296,856,2431,2971,1051,2993,2508,1939,555,988,934,2785,620,495,2566,1981,3205,391,1902,1201,402,1787,1239,799,3353,1619,2604,1498,1360,2486,3,1243,2950,1623,1527,785,1474,2891,671,2202,2994,2326,1972,3253,3295,99,3249,1988,2868,237,2573,1126,2002,2765,2207,857,1218,2302,920,1582,1050,2360,2930,3328,1673,1346,1431,1992,1439,1765,1371,233,3277,1361,3083,2756,212,1232,649,2644,2597,1257,1442,64,1491,1748,2878,813,2402,564,890,2109,1026,440,2278,1654,2479,1259,1274,2487,351,953,2396,155,614,2524,3031,1269,919,1820,1750,3313,2998,1912,777,1294,1308,571,1398,2681,319,3137,1049,2783,1630,3320,1256,248,1233,2039,3091,1379,2091,1109,833,1299,723,2641,80,2921,2382,2309,2706,1067,2294,2608,2043,1956,3329,6,1624,251,22,1025,260,3146,2213,405,316,908,3103,2234,2896,836,1628,2210,868,1895,362,769,705,3338,1170,2776,382,421,1255,735,3050,858,3323,1117,27,68,1900,3186,2407,1413,2165,414,3185,418,1868,2927,3075,869,228,1762,3232,623,470,2647,14,525,2586,1131,3350,134,3001,1813,3337,528,281,1412,2437,930,2781,2907,1186,637,458,3060,700,1991,736,197,2224,3318,1910,127,387,2845,635,3023,2630,1905,1839,1706,2770,2589,1426,1229,2877,1768,2667,489,1387,1589,527,2005,2787,1358,1908,2917,2648,2952,3237,2485,790,1800,1052,1586,1123,570,2673,284,1062,188,694,2683,3155,744,2239,733,1041,462,538,1681,380,573,758,2057,1343,1747,2289,832,906,964,1840,763,2977,3344,1847,1022,2190,1668,2862,2725,24,2139,659,502,2929,3170,621,1749,2711,2528,441,2061,1880,687,1621,227,1435,561,3315,855,1405,2613,652,851,463,1930,1568,1124,3005,347,835,395,2282,2285,498,450,1048,381,2164,3029,195,3099,843,3014,460,3226,1772,1891,1192,2103,2174,935,172,3342,2722,2408,3074,819,1311,631,2263,1330,1933,370,2596,3128,1458,1425,3094,264,1526,1684,1590,3221,461,214,2701,1592,2197,1870,2144,1350,653,343,514,1286,39,1995,2505,1196,1198,283,2525,358,1775,2322,1733,2014,1514,2618,3341,1082,3081,688,1340,306,2631,3322,3151,2745,388,176,2835,944,2852,2634,2616,2605,569,2936,16,1129,3176,1881,1270,2973,2953,678,1223,1282,1986,2435,1120,3335,2147,1821,2414,3354,2739,1260,2705,2902,1621,2445,967,2648,2243,1770,1426,1651,1591,2007,3330,1368,704,492,3264,2061,2993,2447,2930,1451,880,619,1438,2066,2286,2192,3248,1896,2125,2370,2292,2055,671,3343,3038,378,23,2561,3278,772,2508,1976,1400,526,3324,3295,939,3119,1094,389,508,1495,695,1566,957,2053,444,2002,2298,1188,278,2964,1329,304,2877,83,1208,2299,725,2866,2051,3194,1017,988,2163,1033,1088,1216,2749,2975,1148,1112,652,2545,2483,1440,1279,2787,1302,448,107,2169,1248,1699,1306,3251,663,1083,729,2444,142,1137,1320,3067,2491,236,360,1071,3266,2723,1866,2500,169,2020,2637,2046,1330,743,1958,3260,228,1768,1521,961,1233,201,2609,349,2658,1305,2159,3351,1159,1630,164,2611,2273,3051,3238,3270,4,1182,171,1353,3181,2030,932,2269,311,2142,1324,773,192,429,1177,2195,1461,2230,2091,2391,796,1582,545,2245,661,2934,286,2745,981,298,261,2394,1910,1164,3085,595,191,3174,2618,2009,1509,2350,3288,580,3054,705,3142,2716,1168,1454,1355,2194,2470,216,123,2856,2064,767,1737,1867,499,2568,769,1077,1414,2016,111,1399,1540,833,1187,2661,2543,457,1066,2520,1519,1157,462,157,1655,1756,1360,2517,2489,2638,2708,1319,2809,2434,1535,827,2079,476,1413,2102,447,2535,2954,153,3070,3223,489,770,2530,1384,179,1764,1538,2021,222,2577,1944,1928,1035,2805,1074,1868,1067,49,1627,3203,723,859,2991,2410,1191,2415,501,2565,3355,3334,470,2950,1169,2065,624,1960,2337,2108,1405,2831,3317,390,2655,1294,2144,1937,1152,1444,2721,826,1421,1404,922,674,2921,418,1038,1280,2538,2347,2812,1257,685,846,566,1916,1317,3197,1998,386,1893,2863,963,2217,749,3193,2226,2781,1948,1190,325,3135,490,3152,397,2128,2979,2792,1118,1386,1588,1968,320,565,1762,1036,1939,2598,1719,450,591,281,289,367,1741,1773,2173,998,3358,1822,3031,1861,2215,1220,1806,2889,654,506,2155,2512,1462,250,1061,650,3005,1363,2308,212,1487,2223,3176,2084,2699,466,2157,2133,3044,3339,792,976,2300,2212,3359,1325,1531,3170,2208,3242,1242,669,299,380,35,2086,1995,2288,387,2738,71,1034,1032,2137,51,2789,1512,953,1852,3263,2478,2729,960,105,753,1930,426,160,2049,347,1082,26,3282,3234,1726,1215,1723,2606,3216,1114,1135,2626,2727,2484,617,1628,257,760,356,427,3023,421,590,850,2706,741,804,436,3136,221,1568,346,2786,2311,313,3296,1213,1466,1644,2280,76,1585,1751,2564,449,500,1475,1249,1549,2034,70,659,1226,3191,3137,2265,2572,758,2647,1124,2584,784,2251,3047,483,1435,2882,2920,1079,1365,2467,2320,151,2335,921,1682,653,1063,950,1029,477,3353,1881,2017,2385,2294,555,1875,430,1517,1914,375,598,102,572,1486,3179,2734,658,2833,1801,599,147,3341,2675,1660,1179,1203,1669,2591,3185,3287,837,2857,258,2342,1559,2029,1796,1786,1594,3168,924,3165,1170,3289,1971,56,62,1560,60,2553,2629,1167,1865,284,301,1661,1895,1072,593,3275,143,1765,471,1076,411,1823,774,3117,3315,2773,1068,1401,2570,771,1577,759,373,1367,1925,3220,1650,818,1918,2290,1139,1799,1814,2640,453,1831,2755,813,2270,3078,892,324,790,3071,2566,1096,2986,920,2019,681,3088,2628,2022,315,1979,2663,193,626,252,428,1609,569,2999,306,1827,2349,1670,919,2669,3080,2348,618,514,997,1482,52,3178,3177,2005,2446,1022,3035,2992,29,2333,2589,2617,1955,564,731,2264,1376,1685,3232,1040,1472,1155,150,2136,1422,1846,905,1763,2033,1147,3222,2138,1620,2887,2712,3292,103,3081,1752,1899,170,3229,445,2417,1552,128,3350,1433,1943,3086,2062,2560,2258,3006,1132,2180,3015,3066,1978,680,1314,1044,2395,1322,2989,57,1366,992,1759,1497,1310,716,2896,943,1493,2304,2656,579,2522,1780,223,745,2937,110,2143,1892,2103,146,727,3262,1805,3009,844,3049,1149,601,2952,897,97,106,1455,2571,1478,3018,2165,1301,2674,2397,1219,703,384,708,1871,801,1950,644,2523,3069,3286,2861,33,43,3104,3202,98,2087,2750,2671,353,2513,459,2762,1460,1612,2784,1584,39,1059,290,3201,2151,1428,3148,520,1476,1304,600,1847,2042,3079,719,1456,2521,1240,197,154,2811,2432,2953,3154,1467,2595,2567,1224,2368,3126,305,225,1042,3007,1488,1542,1289,510,2822,101,1532,1222,673,966,1101,2616,2516,1932,1064,1897,1941,2639,987,2703,1023,385,91,129,1013,75,1522,1843,1452,1502,2070,2532,2795,2262,310,3013,730,472,2283,781,2037,2767,3011,794,761,2344,1347,1729,1583,1851,732,2524,3352,917,3002,1358,2130,679,53,581,1663,1710,2778,2867,84,392,2462,285,2085,2229,2649,2334,441,853,863,1698,706,2386,3276,2817,1014,2558,1228,1883,1845,1189,2600,1696,1991,3094,2339,2924,2504,1051,359,3116,1744,1254,422,2912,2178,1721,2662,789,3169,683,293,2043,2319,1832,446,394,1615,736,2929,292,1104,178,2111,2023,2886,3182,58,2741,3303,2620,1646,1600,1481,3211,1128,858,925,929,2544,262,3214,696,162,2302,606,3245,3267,2959,1217,174,172,635,1037,1785,2423,962,2367,1510,1541,3319,1807,1640,3213,2777,374,641,2429,2323,1672,666,1448,2200,1725,2199,800,609,2830,469,2668,3337,952,1442,585,1931,1580,2981,2698,277,2109,1299,788,1595,2799,463,2710,132,247,3109,2366,1889,85,868,2408,3323,2579,1281,2176,2454,1090,1230,553,577,2643,2028,1235,475,2150,1515,16,1378,1755,302,1181,220,2494,2844,2891,1619,2599,1586,717,249,1506,2457,1171,534,1001,2988,3129,2383,1100,2210,1715,583,3277,900,2431,700,1418,2990,2,2127,433,2903,2824,1238,2187,3308,2551,2341,2204,2289,296,2619,1664,2514,2040,2892,1961,3265,2393,2153,2481,2542,2305,2961,3167,916,829,2793,1027,1544,1688,3204,2160,2871,728,2717,3175,2185,2634,2167,3061,3208,2082,2000,1915,2399,1489,2803,47,2540,44,2509,108,1359,574,1545,1160,2796,1728,260,2115,2340,1252,3196,560,1514,1798,1069,2918,1880,1550,2607,229,276,2630,605,1175,3144,141,1518,196,80,836,242,1335,2904,2942,1443,809,1874,1864,1604,1046,3130,1774,867,712,969,48,2113,886,1321,1569,335,3338,1408,1196,2221,303,2477,702,895,862,1205,361,1288,318,3261,2836,2254,2850,1009,928,1691,1265,874,297,182,2474,1804,1000,2205,184,2883,2404,2701,672,2306,1049,568,3219,319,2644,2563,860,2949,2664,2089,2685,1949,357,2365,715,503,331,1379,3314,1247,34,2249,2263,1745,1198,2056,198,1819,2312,215,3253,3340,2107,1309,1223,2829,256,990,2692,2573,2951,2932,1334,1690,140,507,893,687,2960,2060,2450,2785,3122,1284,2359,3059,158,582,2623,1641,1385,2612,823,541,1516,1480,1416,3226,2529,1872,204,1323,930,2156,1117,983,7,2035,231,2238,584,95,2838,1633,1469,2614,2725,2003,2317,1129,3108,878,2092,1601,1058,370,1045,2916,3139,933,2673,2910,2689,2851,812,746,354,1346,1262,697,2730,710,234,112,782,3138,1520,2996,1394,415,830,2451,3344,711,2696,887,1450,2406,2794,544,1134,2873,38,2413,898,2834,491,2220,2967,909,368,1898,2099,2027,2338,1561,632,571,1008,92,3053,413,2382,1382,208,2380,2840,3045,2482,2098,1704,439,2424,1447,1625,2369,1605,126,505,1024,399,2808,2583,2927,1047,2869,343,876,1824,1085,3120,3157,1204,327,1415,2994,1578,927,3072,1952,255,1886,894,1436,2635,480,2900,1468,30,1296,1282,2014,1735,2398,1972,965,538,1597,1964,59,1055,3159,587,1718,1390,186,1210,464,2307,2977,623,1953,1904,1291,912,907,720,3215,2396,1361,896,345,1598,2720,945,465,3300,2531,1146,2181,388,1357,2955,308,1562,2633,2933,2813,2069,1732,722,1403,2702,2966,1576,1025,668,530,2047,2969,1350,86,410,2586,1141,2928,2083,484,3026,2148,1199,2759,139,1315,1808,977,3,3106,2503,537,497,188,1178,189,1180,2331,3146,1705,1396,802,1127,783,2222,811,551,185,596,1790,1244,89,1797,176,1668,709,1694,2681,1946,2496,718,1021,1267,2441,1923,3101,288,1245,2063,2926,3123,2376,240,138,1917,1687,540,3217,3259,3096,3189,1662,889,237,3091,2899,2587,1484,1850,519,1924,2031,2418,2672,2645,3240,1905,946,272,1689,3074,2010,576,2841,2149,810,1749,1156,513,667,1005,2224,2917,1637,2182,640,1261,3065,3318,954,2126,1470,36,3320,1911,2372,1614,1348,1271,873,978,2250,1166,524,1409,1742,2601,124,3161,614,517,2077,1811,1471,396,419,2962,3113,1163,849,2190,1070,2209,238,625,2525,1959,187,2816,3125,478,3003,243,2711,2919,87,1643,1483,202,485,454,2487,2255,1286,2874,1333,383,2433,3299,675,866,431,473,2652,996,3110,2732,1473,1080,638,2700,400,2427,156,2768,2751,1006,3227,273,1192,2691,645,1434,2860,50,64,2719,558,815,3115,2377,1427,1714,3145,1015,2667,3327,3133,2486,3272,1206,831,1272,1599,1102,1290,1115,1862,1406,120,883,1750,1891,1268,2268,1369,1513,1590,1642,610,3221,2214,1692,452,2868,903,217,3246,3357,1528,1263,1211,2207,2944,1041,309,2296,2804,1936,636,3254,379,12,263,2104,3132,300,1992,2459,130,177,163,1783,594,628,2439,498,2507,2631,2622,991,561,3345,1812,1375,1536,312,211,1174,657,1143,1110,1292,1239,908,2430,2358,1122,1760,2428,1010,1869,2387,2754,1794,2941,2898,1065,443,283,1727,314,620,1626,1997,2582,74,793,2718,3172,1894,1351,3249,3310,2938,1833,1854,1848,2695,2328,2057,1193,488,3017,1579,3209,1441,1829,1616,2603,1776,1081,3301,888,899,1176,3040,2835,3212,3077,2757,2120,763,2775,1158,104,911,266,1526,1990,2893,923,2161,2518,1057,1108,2351,2847,3250,646,1523,1722,1709,2650,2731,440,2458,495,294,942,1432,451,562,1144,2823,1679,3349,152,2388,603,2592,1356,2801,3291,1857,2278,3057,2203,183,1153,1900,1165,1607,2314,165,934,2683,611,2501,3235,2820,2625,2479,1251,406,1345,3155,269,748,2946,190,2748,2604,2760,2641,259,3128,539,2578,2242,1825,2697,2321,363,655,1352,3305,3073,2329,1389,481,856,455,3131,1474,1491,73,1711,543,3028,2164,72,2958,467,2678,412,502,1173,2693,119,32,2940,264,1485,1453,1784,1130,1297,24,2295,842,2790,2390,1999,1738,2228,570,339,1575,649,1490,2779,3336,1445,2276,2828,2443,554,1800,2502,1912,3329,3166,54,947,1397,275,218,307,944,843,865,1909,2939,2714,291,2403,2044,1956,1372,1636,1543,2154,232,1863,2686,2119,979,1733,3171,3027,2469,3331,3346,1859,403,1530,2980,377,1922,588,3097,518,6,235,3326,1730,159,494,17,2050,1092,2378,3162,742,1631,1116,951,2247,2152,2052,2742,3004,122,2858,1402,27,999,2684,2100,1012,3268,941,2528,1673,2737,2492,1686,3173,2146,817,1834,1140,2211,670,2279,3149,549,3099,2963,3076,832,1884,1030,2088,1855,547,1547,2875,2123,2038,1980,3164,690,1103,1,559,1553,3294,2539,1457,854,2534,765,3298,713,2379,28,69,926,1449,2097,2202,698,2485,2012,622,3304,168,512,701,2948,22,398,3055,1934,677,1273,195,3046,2124,1016,3281,1218,3279,806,648,99,816,822,1002,2490,879,1539,1548,766,3192,2325,2694,2174,1570,1975,1464,1674,1424,3190,2557,1458,2853,692,2246,3290,3156,1504,2285,1107,1423,615,3333,1340,2982,2426,2791,755,350,2526,210,1966,1666,2213,1050,134,688,1337,3241,995,251,1362,2968,575,1635,2405,1043,279,2925,739,1567,1151,1753,2901,511,3207,1214,795,1501,631,2409,1795,1091,133,835,2284,516,2764,751,5,1097,1212,239,1126,365,3063,2193,3124,1459,968,958,2897,1328,2499,2735,2261,117,1557,1775,629,2802,2357,330,1338,2536,2819,1283,2131,2135,233,2688,1250,2425,2473,1011,1412,665,845,3060,3347,2449,949,2884,3050,1841,869,2452,3309,205,372,3020,460,791,2865,918,2724,2585,973,1761,351,1571,2549,1259,870,2594,1093,1629,1882,2998,532,786,738,1410,316,633,2353,1860,2733,2374,1890,1106,3025,1757,2233,3090,2073,2915,2769,3158,2309,1056,66,1554,1551,2048,227,3228,405,2849,144,2461,1623,1255,2170,1879,1610,2519,3112,2234,2318,2175,780,371,2025,1185,1653,423,3342,1503,1162,1712,2232,352,1665,1967,219,2316,18,1327,1237,2094,1817,456,694,1766,2505,1417,857,1815,2068,1988,1617,1938,114,115,409,1713,2636,1731,785,2275,3041,828,332,65,2713,270,1677,1344,872,807,3010,1927,1789,2770,1746,3153,882,2018,3273,2078,567,557,2121,676,1747,972,2575,3255,166,2141,3105,2419,1717,230,1945,1105,776,1592,974,127,1671,756,1706,656,2206,1700,2736,744,989,3024,2574,1380,2074,1572,1856,355,1754,137,3037,797,2453,1086,2354,1007,1496,2722,852,1957,573,1381,2303,2885,404,740,245,821,3274,2036,1888,2797,1877,1084,1984,2132,2657,3311,597,2198,2870,586,1793,3014,955,55,2923,3019,2810,1693,2475,362,2788,1300,180,2581,2957,1810,1209,1241,1734,724,1332,2162,959,116,994,3062,2821,2293,2122,634,1942,2093,155,2740,1373,1336,2460,2888,1820,1858,11,1724,209,1099,3316,1039,342,3029,964,1229,432,1511,1125,1269,768,504,1095,37,1701,2384,42,552,1275,1019,1207,699,1818,1903,2878,612,369,2326,2495,2753,3271,3039,737,1195,3306,3102,2201,2407,280,1921,2297,2364,2984,3321,31,2227,2973,2356,2651,2080,1645,2776,2726,2715,2653,814,3199,2947,3206,1987,13,1499,1703,2466,2117,321,395,2076,1236,735,496,358,762,527,161,322,2235,1792,2906,3230,825,3111,2045,3328,1145,3052,2552,408,1524,1849,1788,915,461,391,3280,333,1028,777,2024,2392,1779,40,1813,1926,248,1089,113,647,1587,2026,2972,2880,2890,2096,2666,902,1826,2116,2660,25,1681,1494,542,2448,2075,79,2184,1982,2987,2510,2908,2140,3089,1278,1589,2281,2253,734,200,41,1624,63,486,2511,90,1611,2327,2237,323,2277,1119,714,2129,2072,2438,2506,546,1258,1748,1388,2352,2196,2256,203,2597,3043,3236,2744,890,2456,149,535,3312,2680,2515,438,3224,2704,1996,3000,747,752,1508,458,2665,3307,1053,1954,1707,1243,2013,1684,2872,1060,1830,1657,2859,2004,604,1853,613,2855,3107,938,2058,2556,468,1161,1702,616,1878,1339,326,1777,1429,3332,3163,2970,474,2879,1632,805,3225,2259,1113,3034,1133,1031,2814,2646,2248,2602,3187,2216,3008,637,3186,2943,2654,1981,334,100,1608,214,1075,3127,2854,402,2832,2983,885,1929,864,364,2554,3258,1425,1154,2402,3150,707,241,1431,67,381,1885,1392,592,2218,2533,678,77,88,2562,1652,2219,523,2913,970,1739,3030,1667,2772,2842,642,3140,1316,1183,437,393,556,2373,2106,948,1638,2707,145,621,1901,2105,627,1970,931,1446,2559,1658,1772,2291,1078,2679,1383,1020,3082,265,348,3313,775,1505,1430,528,630,317,1374,1048,1648,1507,2054,521,3118,1136,2782,871,2761,1232,1287,1887,3247,167,1527,414,2798,2420,1989,1778,1370,1026,417,779,1342,2375,914,194,3092,1603,2252,136,884,2687,1150,891,2548,726,935,207,3095,2090,985,3114,3160,131,1197,1816,3297,2613,482,1537,2541,1364,2421,536,3322,2965,2783,3075,1654,3283,1391,96,682,819,366,877,841,271,3205,341,1111,2239,2158,2931,2271,181,1782,287,1407,2670,337,61,2621,46,3360,2371,173,693,2839,21,1647,1842,2411,2287,2240,1977,1697,2363,2974,1087,1274,1656,1533,1940,3121,1839,980,2907,3033,607,1121,8,1270,246,416,2241,2188,2848,2763,2837,1341,1908,550,1781,1184,2172,660,2480,956,118,2911,1920,2488,1963,2976,861,3231,2627,1680,1295,2922,199,2336,10,855,2864,3239,2576,3147,2416,1201,2191,525,2266,3244,1256,1933,3269,2476,1343,3068,848,1618,1492,3143,1828,2437,2590,691,3083,9,1307,1622,2401,2412,1246,689,1437,3257,1326,2588,2815,3022,420,1951,1387,1109,2145,2468,798,2746,479,1919,975,1683,2177,93,3141,2827,799,1593,2472,1172,1803,3210,2825,2110,3252,401,662,1606,2422,1736,2360,1720,2546,3032,1123,94,1902,2183,434,3016,3098,2134,2471,3325,2225,2780,971,1802,834,1994,1003,125,2978,2322,721,329,2881,1965,1529,1870,3087,2067,3103,1439,226,135,589,282,3084,1018,295,2436,2381,1276,940,2709,1596,984,3180,81,937,2112,2995,1767,563,267,1525,1969,1573,1613,2690,2313,1534,1809,2555,2345,2315,2197,3184,993,936,2118,522,3021,1371,1973,1649,904,175,1838,2610,2800,2676,2605,803,643,1574,820,2774,2527,2346,206,2766,442,2936,1264,20,1331,1313,2008,1293,1200,3237,3064,1393,1142,1678,1962,2580,424,2956,2985,2282,3198,1985,2171,808,2909,1743,2071,982,14,1835,1298,1186,2806,2001,2114,2756,1758,1411,2059,3183,2905,1202,2945,3036,82,548,2765,2547,3100,2894,1500,1308,1675,1098,1695,435,224,875,1234,901,840,1285,1498,2752,778,2569,2442,2743,824,3293,529,787,1907,1266,1876,2608,2006,376,493,2593,2758,1054,3195,3302,1837,3134,509,1913,2032,2537,1581,2168,1947,2081,2343,1231,2015,2826,2260,533,639,2807,1138,2493,253,45,1565,2914,407,910,1708,2463,1073,344,2846,2497,2355,78,3256,213,274,1253,913,1564,2464,851,2041,2935,1873,336,3056,1639,1420,2139,2310,15,382,2728,2465,2324,1398,2862,1479,1062,3200,2257,1787,1906,3058,3284,847,2400,578,2186,340,2272,754,1463,733,2596,2498,2843,1558,1602,2361,3042,1555,3348,68,2642,651,2852,1546,3001,2845,2330,3285,254,684,3093,1395,487,3233,2440,2101,2971,2189,515,1740,1840,1659,602,1935,2677,3012,764,2895,1634,906,2682,664,2274,2659,757,3218,2332,1769,1993,3048,1225,1194,881,1465,2615,2362,1983,750,2039,1556,3188,2389,2876,1791,121,2267,2997,2095,2236,1311,1974,1131,3151,2747,2550,244,1354,1221,1312,1844,1419,2771,2179,328,1477,2624,19,1303,1318,2632,109,2818,3243,3356,1377,2455,1227,425,986,608,1349,1563,2166,838,1716,2244,686,338,268,2231,1052,1676,148,2301,531,1004,1771,839,2011,1277,1836]},"spiketimes":[10.150000000000091,10.160000000000082,10.170000000000073,10.180000000000064,10.190000000000055,10.200000000000045,10.210000000000036,10.220000000000027,10.230000000000018,10.240000000000009,22.450000000000045,22.460000000000036,22.470000000000027,22.480000000000018,22.490000000000009,22.5,22.509999999999991,22.519999999999982,22.529999999999973,22.539999999999964,338.04999999999995,338.05999999999995,338.06999999999994,338.07999999999993,338.09000000000015,338.09999999999991,338.11000000000013,338.11999999999989,338.13000000000011,338.13999999999987],"frameTimes":[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9,5,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6,6.1,6.2,6.3,6.4,6.5,6.6,6.7,6.8,6.9,7,7.1,7.2,7.3,7.4,7.5,7.6,7.7,7.8,7.9,8,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,8.9,9,9.1,9.2,9.3,9.4,9.5,9.6,9.7,9.8,9.9,10,10.1,10.2,10.3,10.4,10.5,10.6,10.7,10.8,10.9,11,11.1,11.2,11.3,11.4,11.5,11.6,11.7,11.8,11.9,12,12.1,12.2,12.3,12.4,12.5,12.6,12.7,12.8,12.9,13,13.1,13.2,13.3,13.4,13.5,13.6,13.7,13.8,13.9,14,14.1,14.2,14.3,14.4,14.5,14.6,14.7,14.8,14.9,15,15.1,15.2,15.3,15.4,15.5,15.6,15.7,15.8,15.9,16,16.1,16.2,16.3,16.4,16.5,16.6,16.7,16.8,16.9,17,17.1,17.2,17.3,17.4,17.5,17.6,17.7,17.8,17.9,18,18.1,18.2,18.3,18.4,18.5,18.6,18.7,18.8,18.9,19,19.1,19.2,19.3,19.4,19.5,19.6,19.7,19.8,19.9,20,20.1,20.2,20.3,20.4,20.5,20.6,20.7,20.8,20.9,21,21.1,21.2,21.3,21.4,21.5,21.6,21.7,21.8,21.9,22,22.1,22.2,22.3,22.4,22.5,22.6,22.7,22.8,22.9,23,23.1,23.2,23.3,23.4,23.5,23.6,23.7,23.8,23.9,24,24.1,24.2,24.3,24.4,24.5,24.6,24.7,24.8,24.9,25,25.1,25.2,25.3,25.4,25.5,25.6,25.7,25.8,25.9,26,26.1,26.2,26.3,26.4,26.5,26.6,26.7,26.8,26.9,27,27.1,27.2,27.3,27.4,27.5,27.6,27.7,27.8,27.9,28,28.1,28.2,28.3,28.4,28.5,28.6,28.7,28.8,28.9,29,29.1,29.2,29.3,29.4,29.5,29.6,29.7,29.8,29.9,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,31,31.1,31.2,31.3,31.4,31.5,31.6,31.7,31.8,31.9,32,32.1,32.2,32.3,32.4,32.5,32.6,32.7,32.8,32.9,33,33.1,33.2,33.3,33.4,33.5,33.6,33.7,33.8,33.9,34,34.1,34.2,34.3,34.4,34.5,34.6,34.7,34.8,34.9,35,35.1,35.2,35.3,35.4,35.5,35.6,35.7,35.8,35.9,36,36.1,36.2,36.3,36.4,36.5,36.6,36.7,36.8,36.9,37,37.1,37.2,37.3,37.4,37.5,37.6,37.7,37.8,37.9,38,38.1,38.2,38.3,38.4,38.5,38.6,38.7,38.8,38.9,39,39.1,39.2,39.3,39.4,39.5,39.6,39.7,39.8,39.9,40,40.1,40.2,40.3,40.4,40.5,40.6,40.7,40.8,40.9,41,41.1,41.2,41.3,41.4,41.5,41.6,41.7,41.8,41.9,42,42.1,42.2,42.3,42.4,42.5,42.6,42.7,42.8,42.9,43,43.1,43.2,43.3,43.4,43.5,43.6,43.7,43.8,43.9,44,44.1,44.2,44.3,44.4,44.5,44.6,44.7,44.8,44.9,45,45.1,45.2,45.3,45.4,45.5,45.6,45.7,45.8,45.9,46,46.1,46.2,46.3,46.4,46.5,46.6,46.7,46.8,46.9,47,47.1,47.2,47.3,47.4,47.5,47.6,47.7,47.8,47.9,48,48.1,48.2,48.3,48.4,48.5,48.6,48.7,48.8,48.9,49,49.1,49.2,49.3,49.4,49.5,49.6,49.7,49.8,49.9,50,50.1,50.2,50.3,50.4,50.5,50.6,50.7,50.8,50.9,51,51.1,51.2,51.3,51.4,51.5,51.6,51.7,51.8,51.9,52,52.1,52.2,52.3,52.4,52.5,52.6,52.7,52.8,52.9,53,53.1,53.2,53.3,53.4,53.5,53.6,53.7,53.8,53.9,54,54.1,54.2,54.3,54.4,54.5,54.6,54.7,54.8,54.9,55,55.1,55.2,55.3,55.4,55.5,55.6,55.7,55.8,55.9,56,56.1,56.2,56.3,56.4,56.5,56.6,56.7,56.8,56.9,57,57.1,57.2,57.3,57.4,57.5,57.6,57.7,57.8,57.9,58,58.1,58.2,58.3,58.4,58.5,58.6,58.7,58.8,58.9,59,59.1,59.2,59.3,59.4,59.5,59.6,59.7,59.8,59.9,60,60.1,60.2,60.3,60.4,60.5,60.6,60.7,60.8,60.9,61,61.1,61.2,61.3,61.4,61.5,61.6,61.7,61.8,61.9,62,62.1,62.2,62.3,62.4,62.5,62.6,62.7,62.8,62.9,63,63.1,63.2,63.3,63.4,63.5,63.6,63.7,63.8,63.9,64,64.1,64.2,64.3,64.4,64.5,64.6,64.7,64.8,64.9,65,65.1,65.2,65.3,65.4,65.5,65.6,65.7,65.8,65.9,66,66.1,66.2,66.3,66.4,66.5,66.6,66.7,66.8,66.9,67,67.1,67.2,67.3,67.4,67.5,67.6,67.7,67.8,67.9,68,68.1,68.2,68.3,68.4,68.5,68.6,68.7,68.8,68.9,69,69.1,69.2,69.3,69.4,69.5,69.6,69.7,69.8,69.9,70,70.1,70.2,70.3,70.4,70.5,70.6,70.7,70.8,70.9,71,71.1,71.2,71.3,71.4,71.5,71.6,71.7,71.8,71.9,72,72.1,72.2,72.3,72.4,72.5,72.6,72.7,72.8,72.9,73,73.1,73.2,73.3,73.4,73.5,73.6,73.7,73.8,73.9,74,74.1,74.2,74.3,74.4,74.5,74.6,74.7,74.8,74.9,75,75.1,75.2,75.3,75.4,75.5,75.6,75.7,75.8,75.9,76,76.1,76.2,76.3,76.4,76.5,76.6,76.7,76.8,76.9,77,77.1,77.2,77.3,77.4,77.5,77.6,77.7,77.8,77.9,78,78.1,78.2,78.3,78.4,78.5,78.6,78.7,78.8,78.9,79,79.1,79.2,79.3,79.4,79.5,79.6,79.7,79.8,79.9,80,80.1,80.2,80.3,80.4,80.5,80.6,80.7,80.8,80.9,81,81.1,81.2,81.3,81.4,81.5,81.6,81.7,81.8,81.9,82,82.1,82.2,82.3,82.4,82.5,82.6,82.7,82.8,82.9,83,83.1,83.2,83.3,83.4,83.5,83.6,83.7,83.8,83.9,84,84.1,84.2,84.3,84.4,84.5,84.6,84.7,84.8,84.9,85,85.1,85.2,85.3,85.4,85.5,85.6,85.7,85.8,85.9,86,86.1,86.2,86.3,86.4,86.5,86.6,86.7,86.8,86.9,87,87.1,87.2,87.3,87.4,87.5,87.6,87.7,87.8,87.9,88,88.1,88.2,88.3,88.4,88.5,88.6,88.7,88.8,88.9,89,89.1,89.2,89.3,89.4,89.5,89.6,89.7,89.8,89.9,90,90.1,90.2,90.3,90.4,90.5,90.6,90.7,90.8,90.9,91,91.1,91.2,91.3,91.4,91.5,91.6,91.7,91.8,91.9,92,92.1,92.2,92.3,92.4,92.5,92.6,92.7,92.8,92.9,93,93.1,93.2,93.3,93.4,93.5,93.6,93.7,93.8,93.9,94,94.1,94.2,94.3,94.4,94.5,94.6,94.7,94.8,94.9,95,95.1,95.2,95.3,95.4,95.5,95.6,95.7,95.8,95.9,96,96.1,96.2,96.3,96.4,96.5,96.6,96.7,96.8,96.9,97,97.1,97.2,97.3,97.4,97.5,97.6,97.7,97.8,97.9,98,98.1,98.2,98.3,98.4,98.5,98.6,98.7,98.8,98.9,99,99.1,99.2,99.3,99.4,99.5,99.6,99.7,99.8,99.9,100,100.1,100.2,100.3,100.4,100.5,100.6,100.7,100.8,100.9,101,101.1,101.2,101.3,101.4,101.5,101.6,101.7,101.8,101.9,102,102.1,102.2,102.3,102.4,102.5,102.6,102.7,102.8,102.9,103,103.1,103.2,103.3,103.4,103.5,103.6,103.7,103.8,103.9,104,104.1,104.2,104.3,104.4,104.5,104.6,104.7,104.8,104.9,105,105.1,105.2,105.3,105.4,105.5,105.6,105.7,105.8,105.9,106,106.1,106.2,106.3,106.4,106.5,106.6,106.7,106.8,106.9,107,107.1,107.2,107.3,107.4,107.5,107.6,107.7,107.8,107.9,108,108.1,108.2,108.3,108.4,108.5,108.6,108.7,108.8,108.9,109,109.1,109.2,109.3,109.4,109.5,109.6,109.7,109.8,109.9,110,110.1,110.2,110.3,110.4,110.5,110.6,110.7,110.8,110.9,111,111.1,111.2,111.3,111.4,111.5,111.6,111.7,111.8,111.9,112,112.1,112.2,112.3,112.4,112.5,112.6,112.7,112.8,112.9,113,113.1,113.2,113.3,113.4,113.5,113.6,113.7,113.8,113.9,114,114.1,114.2,114.3,114.4,114.5,114.6,114.7,114.8,114.9,115,115.1,115.2,115.3,115.4,115.5,115.6,115.7,115.8,115.9,116,116.1,116.2,116.3,116.4,116.5,116.6,116.7,116.8,116.9,117,117.1,117.2,117.3,117.4,117.5,117.6,117.7,117.8,117.9,118,118.1,118.2,118.3,118.4,118.5,118.6,118.7,118.8,118.9,119,119.1,119.2,119.3,119.4,119.5,119.6,119.7,119.8,119.9,120,120.1,120.2,120.3,120.4,120.5,120.6,120.7,120.8,120.9,121,121.1,121.2,121.3,121.4,121.5,121.6,121.7,121.8,121.9,122,122.1,122.2,122.3,122.4,122.5,122.6,122.7,122.8,122.9,123,123.1,123.2,123.3,123.4,123.5,123.6,123.7,123.8,123.9,124,124.1,124.2,124.3,124.4,124.5,124.6,124.7,124.8,124.9,125,125.1,125.2,125.3,125.4,125.5,125.6,125.7,125.8,125.9,126,126.1,126.2,126.3,126.4,126.5,126.6,126.7,126.8,126.9,127,127.1,127.2,127.3,127.4,127.5,127.6,127.7,127.8,127.9,128,128.1,128.2,128.3,128.4,128.5,128.6,128.7,128.8,128.9,129,129.1,129.2,129.3,129.4,129.5,129.6,129.7,129.8,129.9,130,130.1,130.2,130.3,130.4,130.5,130.6,130.7,130.8,130.9,131,131.1,131.2,131.3,131.4,131.5,131.6,131.7,131.8,131.9,132,132.1,132.2,132.3,132.4,132.5,132.6,132.7,132.8,132.9,133,133.1,133.2,133.3,133.4,133.5,133.6,133.7,133.8,133.9,134,134.1,134.2,134.3,134.4,134.5,134.6,134.7,134.8,134.9,135,135.1,135.2,135.3,135.4,135.5,135.6,135.7,135.8,135.9,136,136.1,136.2,136.3,136.4,136.5,136.6,136.7,136.8,136.9,137,137.1,137.2,137.3,137.4,137.5,137.6,137.7,137.8,137.9,138,138.1,138.2,138.3,138.4,138.5,138.6,138.7,138.8,138.9,139,139.1,139.2,139.3,139.4,139.5,139.6,139.7,139.8,139.9,140,140.1,140.2,140.3,140.4,140.5,140.6,140.7,140.8,140.9,141,141.1,141.2,141.3,141.4,141.5,141.6,141.7,141.8,141.9,142,142.1,142.2,142.3,142.4,142.5,142.6,142.7,142.8,142.9,143,143.1,143.2,143.3,143.4,143.5,143.6,143.7,143.8,143.9,144,144.1,144.2,144.3,144.4,144.5,144.6,144.7,144.8,144.9,145,145.1,145.2,145.3,145.4,145.5,145.6,145.7,145.8,145.9,146,146.1,146.2,146.3,146.4,146.5,146.6,146.7,146.8,146.9,147,147.1,147.2,147.3,147.4,147.5,147.6,147.7,147.8,147.9,148,148.1,148.2,148.3,148.4,148.5,148.6,148.7,148.8,148.9,149,149.1,149.2,149.3,149.4,149.5,149.6,149.7,149.8,149.9,150,150.1,150.2,150.3,150.4,150.5,150.6,150.7,150.8,150.9,151,151.1,151.2,151.3,151.4,151.5,151.6,151.7,151.8,151.9,152,152.1,152.2,152.3,152.4,152.5,152.6,152.7,152.8,152.9,153,153.1,153.2,153.3,153.4,153.5,153.6,153.7,153.8,153.9,154,154.1,154.2,154.3,154.4,154.5,154.6,154.7,154.8,154.9,155,155.1,155.2,155.3,155.4,155.5,155.6,155.7,155.8,155.9,156,156.1,156.2,156.3,156.4,156.5,156.6,156.7,156.8,156.9,157,157.1,157.2,157.3,157.4,157.5,157.6,157.7,157.8,157.9,158,158.1,158.2,158.3,158.4,158.5,158.6,158.7,158.8,158.9,159,159.1,159.2,159.3,159.4,159.5,159.6,159.7,159.8,159.9,160,160.1,160.2,160.3,160.4,160.5,160.6,160.7,160.8,160.9,161,161.1,161.2,161.3,161.4,161.5,161.6,161.7,161.8,161.9,162,162.1,162.2,162.3,162.4,162.5,162.6,162.7,162.8,162.9,163,163.1,163.2,163.3,163.4,163.5,163.6,163.7,163.8,163.9,164,164.1,164.2,164.3,164.4,164.5,164.6,164.7,164.8,164.9,165,165.1,165.2,165.3,165.4,165.5,165.6,165.7,165.8,165.9,166,166.1,166.2,166.3,166.4,166.5,166.6,166.7,166.8,166.9,167,167.1,167.2,167.3,167.4,167.5,167.6,167.7,167.8,167.9,168,168.1,168.2,168.3,168.4,168.5,168.6,168.7,168.8,168.9,169,169.1,169.2,169.3,169.4,169.5,169.6,169.7,169.8,169.9,170,170.1,170.2,170.3,170.4,170.5,170.6,170.7,170.8,170.9,171,171.1,171.2,171.3,171.4,171.5,171.6,171.7,171.8,171.9,172,172.1,172.2,172.3,172.4,172.5,172.6,172.7,172.8,172.9,173,173.1,173.2,173.3,173.4,173.5,173.6,173.7,173.8,173.9,174,174.1,174.2,174.3,174.4,174.5,174.6,174.7,174.8,174.9,175,175.1,175.2,175.3,175.4,175.5,175.6,175.7,175.8,175.9,176,176.1,176.2,176.3,176.4,176.5,176.6,176.7,176.8,176.9,177,177.1,177.2,177.3,177.4,177.5,177.6,177.7,177.8,177.9,178,178.1,178.2,178.3,178.4,178.5,178.6,178.7,178.8,178.9,179,179.1,179.2,179.3,179.4,179.5,179.6,179.7,179.8,179.9,180,180.1,180.2,180.3,180.4,180.5,180.6,180.7,180.8,180.9,181,181.1,181.2,181.3,181.4,181.5,181.6,181.7,181.8,181.9,182,182.1,182.2,182.3,182.4,182.5,182.6,182.7,182.8,182.9,183,183.1,183.2,183.3,183.4,183.5,183.6,183.7,183.8,183.9,184,184.1,184.2,184.3,184.4,184.5,184.6,184.7,184.8,184.9,185,185.1,185.2,185.3,185.4,185.5,185.6,185.7,185.8,185.9,186,186.1,186.2,186.3,186.4,186.5,186.6,186.7,186.8,186.9,187,187.1,187.2,187.3,187.4,187.5,187.6,187.7,187.8,187.9,188,188.1,188.2,188.3,188.4,188.5,188.6,188.7,188.8,188.9,189,189.1,189.2,189.3,189.4,189.5,189.6,189.7,189.8,189.9,190,190.1,190.2,190.3,190.4,190.5,190.6,190.7,190.8,190.9,191,191.1,191.2,191.3,191.4,191.5,191.6,191.7,191.8,191.9,192,192.1,192.2,192.3,192.4,192.5,192.6,192.7,192.8,192.9,193,193.1,193.2,193.3,193.4,193.5,193.6,193.7,193.8,193.9,194,194.1,194.2,194.3,194.4,194.5,194.6,194.7,194.8,194.9,195,195.1,195.2,195.3,195.4,195.5,195.6,195.7,195.8,195.9,196,196.1,196.2,196.3,196.4,196.5,196.6,196.7,196.8,196.9,197,197.1,197.2,197.3,197.4,197.5,197.6,197.7,197.8,197.9,198,198.1,198.2,198.3,198.4,198.5,198.6,198.7,198.8,198.9,199,199.1,199.2,199.3,199.4,199.5,199.6,199.7,199.8,199.9,200,200.1,200.2,200.3,200.4,200.5,200.6,200.7,200.8,200.9,201,201.1,201.2,201.3,201.4,201.5,201.6,201.7,201.8,201.9,202,202.1,202.2,202.3,202.4,202.5,202.6,202.7,202.8,202.9,203,203.1,203.2,203.3,203.4,203.5,203.6,203.7,203.8,203.9,204,204.1,204.2,204.3,204.4,204.5,204.6,204.7,204.8,204.9,205,205.1,205.2,205.3,205.4,205.5,205.6,205.7,205.8,205.9,206,206.1,206.2,206.3,206.4,206.5,206.6,206.7,206.8,206.9,207,207.1,207.2,207.3,207.4,207.5,207.6,207.7,207.8,207.9,208,208.1,208.2,208.3,208.4,208.5,208.6,208.7,208.8,208.9,209,209.1,209.2,209.3,209.4,209.5,209.6,209.7,209.8,209.9,210,210.1,210.2,210.3,210.4,210.5,210.6,210.7,210.8,210.9,211,211.1,211.2,211.3,211.4,211.5,211.6,211.7,211.8,211.9,212,212.1,212.2,212.3,212.4,212.5,212.6,212.7,212.8,212.9,213,213.1,213.2,213.3,213.4,213.5,213.6,213.7,213.8,213.9,214,214.1,214.2,214.3,214.4,214.5,214.6,214.7,214.8,214.9,215,215.1,215.2,215.3,215.4,215.5,215.6,215.7,215.8,215.9,216,216.1,216.2,216.3,216.4,216.5,216.6,216.7,216.8,216.9,217,217.1,217.2,217.3,217.4,217.5,217.6,217.7,217.8,217.9,218,218.1,218.2,218.3,218.4,218.5,218.6,218.7,218.8,218.9,219,219.1,219.2,219.3,219.4,219.5,219.6,219.7,219.8,219.9,220,220.1,220.2,220.3,220.4,220.5,220.6,220.7,220.8,220.9,221,221.1,221.2,221.3,221.4,221.5,221.6,221.7,221.8,221.9,222,222.1,222.2,222.3,222.4,222.5,222.6,222.7,222.8,222.9,223,223.1,223.2,223.3,223.4,223.5,223.6,223.7,223.8,223.9,224,224.1,224.2,224.3,224.4,224.5,224.6,224.7,224.8,224.9,225,225.1,225.2,225.3,225.4,225.5,225.6,225.7,225.8,225.9,226,226.1,226.2,226.3,226.4,226.5,226.6,226.7,226.8,226.9,227,227.1,227.2,227.3,227.4,227.5,227.6,227.7,227.8,227.9,228,228.1,228.2,228.3,228.4,228.5,228.6,228.7,228.8,228.9,229,229.1,229.2,229.3,229.4,229.5,229.6,229.7,229.8,229.9,230,230.1,230.2,230.3,230.4,230.5,230.6,230.7,230.8,230.9,231,231.1,231.2,231.3,231.4,231.5,231.6,231.7,231.8,231.9,232,232.1,232.2,232.3,232.4,232.5,232.6,232.7,232.8,232.9,233,233.1,233.2,233.3,233.4,233.5,233.6,233.7,233.8,233.9,234,234.1,234.2,234.3,234.4,234.5,234.6,234.7,234.8,234.9,235,235.1,235.2,235.3,235.4,235.5,235.6,235.7,235.8,235.9,236,236.1,236.2,236.3,236.4,236.5,236.6,236.7,236.8,236.9,237,237.1,237.2,237.3,237.4,237.5,237.6,237.7,237.8,237.9,238,238.1,238.2,238.3,238.4,238.5,238.6,238.7,238.8,238.9,239,239.1,239.2,239.3,239.4,239.5,239.6,239.7,239.8,239.9,240,240.1,240.2,240.3,240.4,240.5,240.6,240.7,240.8,240.9,241,241.1,241.2,241.3,241.4,241.5,241.6,241.7,241.8,241.9,242,242.1,242.2,242.3,242.4,242.5,242.6,242.7,242.8,242.9,243,243.1,243.2,243.3,243.4,243.5,243.6,243.7,243.8,243.9,244,244.1,244.2,244.3,244.4,244.5,244.6,244.7,244.8,244.9,245,245.1,245.2,245.3,245.4,245.5,245.6,245.7,245.8,245.9,246,246.1,246.2,246.3,246.4,246.5,246.6,246.7,246.8,246.9,247,247.1,247.2,247.3,247.4,247.5,247.6,247.7,247.8,247.9,248,248.1,248.2,248.3,248.4,248.5,248.6,248.7,248.8,248.9,249,249.1,249.2,249.3,249.4,249.5,249.6,249.7,249.8,249.9,250,250.1,250.2,250.3,250.4,250.5,250.6,250.7,250.8,250.9,251,251.1,251.2,251.3,251.4,251.5,251.6,251.7,251.8,251.9,252,252.1,252.2,252.3,252.4,252.5,252.6,252.7,252.8,252.9,253,253.1,253.2,253.3,253.4,253.5,253.6,253.7,253.8,253.9,254,254.1,254.2,254.3,254.4,254.5,254.6,254.7,254.8,254.9,255,255.1,255.2,255.3,255.4,255.5,255.6,255.7,255.8,255.9,256,256.1,256.2,256.3,256.4,256.5,256.6,256.7,256.8,256.9,257,257.1,257.2,257.3,257.4,257.5,257.6,257.7,257.8,257.9,258,258.1,258.2,258.3,258.4,258.5,258.6,258.7,258.8,258.9,259,259.1,259.2,259.3,259.4,259.5,259.6,259.7,259.8,259.9,260,260.1,260.2,260.3,260.4,260.5,260.6,260.7,260.8,260.9,261,261.1,261.2,261.3,261.4,261.5,261.6,261.7,261.8,261.9,262,262.1,262.2,262.3,262.4,262.5,262.6,262.7,262.8,262.9,263,263.1,263.2,263.3,263.4,263.5,263.6,263.7,263.8,263.9,264,264.1,264.2,264.3,264.4,264.5,264.6,264.7,264.8,264.9,265,265.1,265.2,265.3,265.4,265.5,265.6,265.7,265.8,265.9,266,266.1,266.2,266.3,266.4,266.5,266.6,266.7,266.8,266.9,267,267.1,267.2,267.3,267.4,267.5,267.6,267.7,267.8,267.9,268,268.1,268.2,268.3,268.4,268.5,268.6,268.7,268.8,268.9,269,269.1,269.2,269.3,269.4,269.5,269.6,269.7,269.8,269.9,270,270.1,270.2,270.3,270.4,270.5,270.6,270.7,270.8,270.9,271,271.1,271.2,271.3,271.4,271.5,271.6,271.7,271.8,271.9,272,272.1,272.2,272.3,272.4,272.5,272.6,272.7,272.8,272.9,273,273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274,274.1,274.2,274.3,274.4,274.5,274.6,274.7,274.8,274.9,275,275.1,275.2,275.3,275.4,275.5,275.6,275.7,275.8,275.9,276,276.1,276.2,276.3,276.4,276.5,276.6,276.7,276.8,276.9,277,277.1,277.2,277.3,277.4,277.5,277.6,277.7,277.8,277.9,278,278.1,278.2,278.3,278.4,278.5,278.6,278.7,278.8,278.9,279,279.1,279.2,279.3,279.4,279.5,279.6,279.7,279.8,279.9,280,280.1,280.2,280.3,280.4,280.5,280.6,280.7,280.8,280.9,281,281.1,281.2,281.3,281.4,281.5,281.6,281.7,281.8,281.9,282,282.1,282.2,282.3,282.4,282.5,282.6,282.7,282.8,282.9,283,283.1,283.2,283.3,283.4,283.5,283.6,283.7,283.8,283.9,284,284.1,284.2,284.3,284.4,284.5,284.6,284.7,284.8,284.9,285,285.1,285.2,285.3,285.4,285.5,285.6,285.7,285.8,285.9,286,286.1,286.2,286.3,286.4,286.5,286.6,286.7,286.8,286.9,287,287.1,287.2,287.3,287.4,287.5,287.6,287.7,287.8,287.9,288,288.1,288.2,288.3,288.4,288.5,288.6,288.7,288.8,288.9,289,289.1,289.2,289.3,289.4,289.5,289.6,289.7,289.8,289.9,290,290.1,290.2,290.3,290.4,290.5,290.6,290.7,290.8,290.9,291,291.1,291.2,291.3,291.4,291.5,291.6,291.7,291.8,291.9,292,292.1,292.2,292.3,292.4,292.5,292.6,292.7,292.8,292.9,293,293.1,293.2,293.3,293.4,293.5,293.6,293.7,293.8,293.9,294,294.1,294.2,294.3,294.4,294.5,294.6,294.7,294.8,294.9,295,295.1,295.2,295.3,295.4,295.5,295.6,295.7,295.8,295.9,296,296.1,296.2,296.3,296.4,296.5,296.6,296.7,296.8,296.9,297,297.1,297.2,297.3,297.4,297.5,297.6,297.7,297.8,297.9,298,298.1,298.2,298.3,298.4,298.5,298.6,298.7,298.8,298.9,299,299.1,299.2,299.3,299.4,299.5,299.6,299.7,299.8,299.9,300,300.1,300.2,300.3,300.4,300.5,300.6,300.7,300.8,300.9,301,301.1,301.2,301.3,301.4,301.5,301.6,301.7,301.8,301.9,302,302.1,302.2,302.3,302.4,302.5,302.6,302.7,302.8,302.9,303,303.1,303.2,303.3,303.4,303.5,303.6,303.7,303.8,303.9,304,304.1,304.2,304.3,304.4,304.5,304.6,304.7,304.8,304.9,305,305.1,305.2,305.3,305.4,305.5,305.6,305.7,305.8,305.9,306,306.1,306.2,306.3,306.4,306.5,306.6,306.7,306.8,306.9,307,307.1,307.2,307.3,307.4,307.5,307.6,307.7,307.8,307.9,308,308.1,308.2,308.3,308.4,308.5,308.6,308.7,308.8,308.9,309,309.1,309.2,309.3,309.4,309.5,309.6,309.7,309.8,309.9,310,310.1,310.2,310.3,310.4,310.5,310.6,310.7,310.8,310.9,311,311.1,311.2,311.3,311.4,311.5,311.6,311.7,311.8,311.9,312,312.1,312.2,312.3,312.4,312.5,312.6,312.7,312.8,312.9,313,313.1,313.2,313.3,313.4,313.5,313.6,313.7,313.8,313.9,314,314.1,314.2,314.3,314.4,314.5,314.6,314.7,314.8,314.9,315,315.1,315.2,315.3,315.4,315.5,315.6,315.7,315.8,315.9,316,316.1,316.2,316.3,316.4,316.5,316.6,316.7,316.8,316.9,317,317.1,317.2,317.3,317.4,317.5,317.6,317.7,317.8,317.9,318,318.1,318.2,318.3,318.4,318.5,318.6,318.7,318.8,318.9,319,319.1,319.2,319.3,319.4,319.5,319.6,319.7,319.8,319.9,320,320.1,320.2,320.3,320.4,320.5,320.6,320.7,320.8,320.9,321,321.1,321.2,321.3,321.4,321.5,321.6,321.7,321.8,321.9,322,322.1,322.2,322.3,322.4,322.5,322.6,322.7,322.8,322.9,323,323.1,323.2,323.3,323.4,323.5,323.6,323.7,323.8,323.9,324,324.1,324.2,324.3,324.4,324.5,324.6,324.7,324.8,324.9,325,325.1,325.2,325.3,325.4,325.5,325.6,325.7,325.8,325.9,326,326.1,326.2,326.3,326.4,326.5,326.6,326.7,326.8,326.9,327,327.1,327.2,327.3,327.4,327.5,327.6,327.7,327.8,327.9,328,328.1,328.2,328.3,328.4,328.5,328.6,328.7,328.8,328.9,329,329.1,329.2,329.3,329.4,329.5,329.6,329.7,329.8,329.9,330,330.1,330.2,330.3,330.4,330.5,330.6,330.7,330.8,330.9,331,331.1,331.2,331.3,331.4,331.5,331.6,331.7,331.8,331.9,332,332.1,332.2,332.3,332.4,332.5,332.6,332.7,332.8,332.9,333,333.1,333.2,333.3,333.4,333.5,333.6,333.7,333.8,333.9,334,334.1,334.2,334.3,334.4,334.5,334.6,334.7,334.8,334.9,335,335.1,335.2,335.3,335.4,335.5,335.6,335.7,335.8,335.9,336,336.1,336.2,336.3,336.4,336.5,336.6,336.7,336.8,336.9,337,337.1,337.2,337.3,337.4,337.5,337.6,337.7,337.8,337.9,338,338.1,338.2,338.3,338.4,338.5,338.6,338.7,338.8,338.9,339,339.1,339.2,339.3,339.4,339.5,339.6,339.7,339.8,339.9,340,340.1,340.2,340.3,340.4,340.5,340.6,340.7,340.8,340.9,341,341.1,341.2,341.3,341.4,341.5,341.6,341.7,341.8,341.9,342,342.1,342.2,342.3,342.4,342.5,342.6,342.7,342.8,342.9,343,343.1,343.2,343.3,343.4,343.5,343.6,343.7,343.8,343.9,344,344.1,344.2,344.3,344.4,344.5,344.6,344.7,344.8,344.9,345,345.1,345.2,345.3,345.4,345.5,345.6,345.7,345.8,345.9,346,346.1,346.2,346.3,346.4,346.5,346.6,346.7,346.8,346.9,347,347.1,347.2,347.3,347.4,347.5,347.6,347.7,347.8,347.9,348,348.1,348.2,348.3,348.4,348.5,348.6,348.7,348.8,348.9,349,349.1,349.2,349.3,349.4,349.5,349.6,349.7,349.8,349.9,350,350.1,350.2,350.3,350.4,350.5,350.6,350.7,350.8,350.9,351,351.1,351.2,351.3,351.4,351.5,351.6,351.7,351.8,351.9,352,352.1,352.2,352.3,352.4,352.5,352.6,352.7,352.8,352.9,353,353.1,353.2,353.3,353.4,353.5,353.6,353.7,353.8,353.9,354,354.1,354.2,354.3,354.4,354.5,354.6,354.7,354.8,354.9,355,355.1,355.2,355.3,355.4,355.5,355.6,355.7,355.8,355.9,356,356.1,356.2,356.3,356.4,356.5,356.6,356.7,356.8,356.9,357,357.1,357.2,357.3,357.4,357.5,357.6,357.7,357.8,357.9,358,358.1,358.2,358.3,358.4,358.5,358.6,358.7,358.8,358.9,359,359.1,359.2,359.3,359.4,359.5,359.6,359.7,359.8,359.9,360,360.1,360.2,360.3,360.4,360.5,360.6,360.7,360.8,360.9,361,361.1,361.2,361.3,361.4,361.5,361.6,361.7,361.8,361.9,362,362.1,362.2,362.3,362.4,362.5,362.6,362.7,362.8,362.9,363,363.1,363.2,363.3,363.4,363.5,363.6,363.7,363.8,363.9,364,364.1,364.2,364.3,364.4,364.5,364.6,364.7,364.8,364.9,365,365.1,365.2,365.3,365.4,365.5,365.6,365.7,365.8,365.9,366,366.1,366.2,366.3,366.4,366.5,366.6,366.7,366.8,366.9,367,367.1,367.2,367.3,367.4,367.5,367.6,367.7,367.8,367.9,368,368.1,368.2,368.3,368.4,368.5,368.6,368.7,368.8,368.9,369,369.1,369.2,369.3,369.4,369.5,369.6,369.7,369.8,369.9,370,370.1,370.2,370.3,370.4,370.5,370.6,370.7,370.8,370.9,371,371.1,371.2,371.3,371.4,371.5,371.6,371.7,371.8,371.9,372,372.1,372.2,372.3,372.4,372.5,372.6,372.7,372.8,372.9,373,373.1,373.2,373.3,373.4,373.5,373.6,373.7,373.8,373.9,374,374.1,374.2,374.3,374.4,374.5,374.6,374.7,374.8,374.9,375,375.1,375.2,375.3,375.4,375.5,375.6,375.7,375.8,375.9,376,376.1,376.2,376.3,376.4,376.5,376.6,376.7,376.8,376.9,377,377.1,377.2,377.3,377.4,377.5,377.6,377.7,377.8,377.9,378,378.1,378.2,378.3,378.4,378.5,378.6,378.7,378.8,378.9,379,379.1,379.2,379.3,379.4,379.5,379.6,379.7,379.8,379.9,380,380.1,380.2,380.3,380.4,380.5,380.6,380.7,380.8,380.9,381,381.1,381.2,381.3,381.4,381.5,381.6,381.7,381.8,381.9,382,382.1,382.2,382.3,382.4,382.5,382.6,382.7,382.8,382.9,383,383.1,383.2,383.3,383.4,383.5,383.6,383.7,383.8,383.9,384,384.1,384.2,384.3,384.4,384.5,384.6,384.7,384.8,384.9,385,385.1,385.2,385.3,385.4,385.5,385.6,385.7,385.8,385.9,386,386.1,386.2,386.3,386.4,386.5,386.6,386.7,386.8,386.9,387,387.1,387.2,387.3,387.4,387.5,387.6,387.7,387.8,387.9,388,388.1,388.2,388.3,388.4,388.5,388.6,388.7,388.8,388.9,389,389.1,389.2,389.3,389.4,389.5,389.6,389.7,389.8,389.9,390,390.1,390.2,390.3,390.4,390.5,390.6,390.7,390.8,390.9,391,391.1,391.2,391.3,391.4,391.5,391.6,391.7,391.8,391.9,392,392.1,392.2,392.3,392.4,392.5,392.6,392.7,392.8,392.9,393,393.1,393.2,393.3,393.4,393.5,393.6,393.7,393.8,393.9,394,394.1,394.2,394.3,394.4,394.5,394.6,394.7,394.8,394.9,395,395.1,395.2,395.3,395.4,395.5,395.6,395.7,395.8,395.9,396,396.1,396.2,396.3,396.4,396.5,396.6,396.7,396.8,396.9,397,397.1,397.2,397.3,397.4,397.5,397.6,397.7,397.8,397.9,398,398.1,398.2,398.3,398.4,398.5,398.6,398.7,398.8,398.9,399,399.1,399.2,399.3,399.4,399.5,399.6,399.7,399.8,399.9,400,400.1,400.2,400.3,400.4,400.5,400.6,400.7,400.8,400.9,401,401.1,401.2,401.3,401.4,401.5,401.6,401.7,401.8,401.9,402,402.1,402.2,402.3,402.4,402.5,402.6,402.7,402.8,402.9,403,403.1,403.2,403.3,403.4,403.5,403.6,403.7,403.8,403.9,404,404.1,404.2,404.3,404.4,404.5,404.6,404.7,404.8,404.9,405,405.1,405.2,405.3,405.4,405.5,405.6,405.7,405.8,405.9,406,406.1,406.2,406.3,406.4,406.5,406.6,406.7,406.8,406.9,407,407.1,407.2,407.3,407.4,407.5,407.6,407.7,407.8,407.9,408,408.1,408.2,408.3,408.4,408.5,408.6,408.7,408.8,408.9,409,409.1,409.2,409.3,409.4,409.5,409.6,409.7,409.8,409.9,410,410.1,410.2,410.3,410.4,410.5,410.6,410.7,410.8,410.9,411,411.1,411.2,411.3,411.4,411.5,411.6,411.7,411.8,411.9,412,412.1,412.2,412.3,412.4,412.5,412.6,412.7,412.8,412.9,413,413.1,413.2,413.3,413.4,413.5,413.6,413.7,413.8,413.9,414,414.1,414.2,414.3,414.4,414.5,414.6,414.7,414.8,414.9,415,415.1,415.2,415.3,415.4,415.5,415.6,415.7,415.8,415.9,416,416.1,416.2,416.3,416.4,416.5,416.6,416.7,416.8,416.9,417,417.1,417.2,417.3,417.4,417.5,417.6,417.7,417.8,417.9,418,418.1,418.2,418.3,418.4,418.5,418.6,418.7,418.8,418.9,419,419.1,419.2,419.3,419.4,419.5,419.6,419.7,419.8,419.9,420,420.1,420.2,420.3,420.4,420.5,420.6,420.7,420.8,420.9,421,421.1,421.2,421.3,421.4,421.5,421.6,421.7,421.8,421.9,422,422.1,422.2,422.3,422.4,422.5,422.6,422.7,422.8,422.9,423,423.1,423.2,423.3,423.4,423.5,423.6,423.7,423.8,423.9,424,424.1,424.2,424.3,424.4,424.5,424.6,424.7,424.8,424.9,425,425.1,425.2,425.3,425.4,425.5,425.6,425.7,425.8,425.9,426,426.1,426.2,426.3,426.4,426.5,426.6,426.7,426.8,426.9,427,427.1,427.2,427.3,427.4,427.5,427.6,427.7,427.8,427.9,428,428.1,428.2,428.3,428.4,428.5,428.6,428.7,428.8,428.9,429,429.1,429.2,429.3,429.4,429.5,429.6,429.7,429.8,429.9,430,430.1,430.2,430.3,430.4,430.5,430.6,430.7,430.8,430.9,431,431.1,431.2,431.3,431.4,431.5,431.6,431.7,431.8,431.9,432,432.1,432.2,432.3,432.4,432.5,432.6,432.7,432.8,432.9,433,433.1,433.2,433.3,433.4,433.5,433.6,433.7,433.8,433.9,434,434.1,434.2,434.3,434.4,434.5,434.6,434.7,434.8,434.9,435,435.1,435.2,435.3,435.4,435.5,435.6,435.7,435.8,435.9,436,436.1,436.2,436.3,436.4,436.5,436.6,436.7,436.8,436.9,437,437.1,437.2,437.3,437.4,437.5,437.6,437.7,437.8,437.9,438,438.1,438.2,438.3,438.4,438.5,438.6,438.7,438.8,438.9,439,439.1,439.2,439.3,439.4,439.5,439.6,439.7,439.8,439.9,440,440.1,440.2,440.3,440.4,440.5,440.6,440.7,440.8,440.9,441,441.1,441.2,441.3,441.4,441.5,441.6,441.7,441.8,441.9,442,442.1,442.2,442.3,442.4,442.5,442.6,442.7,442.8,442.9,443,443.1,443.2,443.3,443.4,443.5,443.6,443.7,443.8,443.9,444,444.1,444.2,444.3,444.4,444.5,444.6,444.7,444.8,444.9,445,445.1,445.2,445.3,445.4,445.5,445.6,445.7,445.8,445.9,446,446.1,446.2,446.3,446.4,446.5,446.6,446.7,446.8,446.9,447,447.1,447.2,447.3,447.4,447.5,447.6,447.7,447.8,447.9,448,448.1,448.2,448.3,448.4,448.5,448.6,448.7,448.8,448.9,449,449.1,449.2,449.3,449.4,449.5,449.6,449.7,449.8,449.9,450,450.1,450.2,450.3,450.4,450.5,450.6,450.7,450.8,450.9,451,451.1,451.2,451.3,451.4,451.5,451.6,451.7,451.8,451.9,452,452.1,452.2,452.3,452.4,452.5,452.6,452.7,452.8,452.9,453,453.1,453.2,453.3,453.4,453.5,453.6,453.7,453.8,453.9,454,454.1,454.2,454.3,454.4,454.5,454.6,454.7,454.8,454.9,455,455.1,455.2,455.3,455.4,455.5,455.6,455.7,455.8,455.9,456,456.1,456.2,456.3,456.4,456.5,456.6,456.7,456.8,456.9,457,457.1,457.2,457.3,457.4,457.5,457.6,457.7,457.8,457.9,458,458.1,458.2,458.3,458.4,458.5,458.6,458.7,458.8,458.9,459,459.1,459.2,459.3,459.4,459.5,459.6,459.7,459.8,459.9,460,460.1,460.2,460.3,460.4,460.5,460.6,460.7,460.8,460.9,461,461.1,461.2,461.3,461.4,461.5,461.6,461.7,461.8,461.9,462,462.1,462.2,462.3,462.4,462.5,462.6,462.7,462.8,462.9,463,463.1,463.2,463.3,463.4,463.5,463.6,463.7,463.8,463.9,464,464.1,464.2,464.3,464.4,464.5,464.6,464.7,464.8,464.9,465,465.1,465.2,465.3,465.4,465.5,465.6,465.7,465.8,465.9,466,466.1,466.2,466.3,466.4,466.5,466.6,466.7,466.8,466.9,467,467.1,467.2,467.3,467.4,467.5,467.6,467.7,467.8,467.9,468,468.1,468.2,468.3,468.4,468.5,468.6,468.7,468.8,468.9,469,469.1,469.2,469.3,469.4,469.5,469.6,469.7,469.8,469.9,470,470.1,470.2,470.3,470.4,470.5,470.6,470.7,470.8,470.9,471,471.1,471.2,471.3,471.4,471.5,471.6,471.7,471.8,471.9,472,472.1,472.2,472.3,472.4,472.5,472.6,472.7,472.8,472.9,473,473.1,473.2,473.3,473.4,473.5,473.6,473.7,473.8,473.9,474,474.1,474.2,474.3,474.4,474.5,474.6,474.7,474.8,474.9,475,475.1,475.2,475.3,475.4,475.5,475.6,475.7,475.8,475.9,476,476.1,476.2,476.3,476.4,476.5,476.6,476.7,476.8,476.9,477,477.1,477.2,477.3,477.4,477.5,477.6,477.7,477.8,477.9,478,478.1,478.2,478.3,478.4,478.5,478.6,478.7,478.8,478.9,479,479.1,479.2,479.3,479.4,479.5,479.6,479.7,479.8,479.9,480,480.1,480.2,480.3,480.4,480.5,480.6,480.7,480.8,480.9,481,481.1,481.2,481.3,481.4,481.5,481.6,481.7,481.8,481.9,482,482.1,482.2,482.3,482.4,482.5,482.6,482.7,482.8,482.9,483,483.1,483.2,483.3,483.4,483.5,483.6,483.7,483.8,483.9,484,484.1,484.2,484.3,484.4,484.5,484.6,484.7,484.8,484.9,485,485.1,485.2,485.3,485.4,485.5,485.6,485.7,485.8,485.9,486,486.1,486.2,486.3,486.4,486.5,486.6,486.7,486.8,486.9,487,487.1,487.2,487.3,487.4,487.5,487.6,487.7,487.8,487.9,488,488.1,488.2,488.3,488.4,488.5,488.6,488.7,488.8,488.9,489,489.1,489.2,489.3,489.4,489.5,489.6,489.7,489.8,489.9,490,490.1,490.2,490.3,490.4,490.5,490.6,490.7,490.8,490.9,491,491.1,491.2,491.3,491.4,491.5,491.6,491.7,491.8,491.9,492,492.1,492.2,492.3,492.4,492.5,492.6,492.7,492.8,492.9,493,493.1,493.2,493.3,493.4,493.5,493.6,493.7,493.8,493.9,494,494.1,494.2,494.3,494.4,494.5,494.6,494.7,494.8,494.9,495,495.1,495.2,495.3,495.4,495.5,495.6,495.7,495.8,495.9,496,496.1,496.2,496.3,496.4,496.5,496.6,496.7,496.8,496.9,497,497.1,497.2,497.3,497.4,497.5,497.6,497.7,497.8,497.9,498,498.1,498.2,498.3,498.4,498.5,498.6,498.7,498.8,498.9,499,499.1,499.2,499.3,499.4,499.5,499.6,499.7,499.8,499.9,500,500.1,500.2,500.3,500.4,500.5,500.6,500.7,500.8,500.9,501,501.1,501.2,501.3,501.4,501.5,501.6,501.7,501.8,501.9,502,502.1,502.2,502.3,502.4,502.5,502.6,502.7,502.8,502.9,503,503.1,503.2,503.3,503.4,503.5,503.6,503.7,503.8,503.9,504,504.1,504.2,504.3,504.4,504.5,504.6,504.7,504.8,504.9,505,505.1,505.2,505.3,505.4,505.5,505.6,505.7,505.8,505.9,506,506.1,506.2,506.3,506.4,506.5,506.6,506.7,506.8,506.9,507,507.1,507.2,507.3,507.4,507.5,507.6,507.7,507.8,507.9,508,508.1,508.2,508.3,508.4,508.5,508.6,508.7,508.8,508.9,509,509.1,509.2,509.3,509.4,509.5,509.6,509.7,509.8,509.9,510,510.1,510.2,510.3,510.4,510.5,510.6,510.7,510.8,510.9,511,511.1,511.2,511.3,511.4,511.5,511.6,511.7,511.8,511.9,512,512.1,512.2,512.3,512.4,512.5,512.6,512.7,512.8,512.9,513,513.1,513.2,513.3,513.4,513.5,513.6,513.7,513.8,513.9,514,514.1,514.2,514.3,514.4,514.5,514.6,514.7,514.8,514.9,515,515.1,515.2,515.3,515.4,515.5,515.6,515.7,515.8,515.9,516,516.1,516.2,516.3,516.4,516.5,516.6,516.7,516.8,516.9,517,517.1,517.2,517.3,517.4,517.5,517.6,517.7,517.8,517.9,518,518.1,518.2,518.3,518.4,518.5,518.6,518.7,518.8,518.9,519,519.1,519.2,519.3,519.4,519.5,519.6,519.7,519.8,519.9,520,520.1,520.2,520.3,520.4,520.5,520.6,520.7,520.8,520.9,521,521.1,521.2,521.3,521.4,521.5,521.6,521.7,521.8,521.9,522,522.1,522.2,522.3,522.4,522.5,522.6,522.7,522.8,522.9,523,523.1,523.2,523.3,523.4,523.5,523.6,523.7,523.8,523.9,524,524.1,524.2,524.3,524.4,524.5,524.6,524.7,524.8,524.9,525,525.1,525.2,525.3,525.4,525.5,525.6,525.7,525.8,525.9,526,526.1,526.2,526.3,526.4,526.5,526.6,526.7,526.8,526.9,527,527.1,527.2,527.3,527.4,527.5,527.6,527.7,527.8,527.9,528,528.1,528.2,528.3,528.4,528.5,528.6,528.7,528.8,528.9,529,529.1,529.2,529.3,529.4,529.5,529.6,529.7,529.8,529.9,530,530.1,530.2,530.3,530.4,530.5,530.6,530.7,530.8,530.9,531,531.1,531.2,531.3,531.4,531.5,531.6,531.7,531.8,531.9,532,532.1,532.2,532.3,532.4,532.5,532.6,532.7,532.8,532.9,533,533.1,533.2,533.3,533.4,533.5,533.6,533.7,533.8,533.9,534,534.1,534.2,534.3,534.4,534.5,534.6,534.7,534.8,534.9,535,535.1,535.2,535.3,535.4,535.5,535.6,535.7,535.8,535.9,536,536.1,536.2,536.3,536.4,536.5,536.6,536.7,536.8,536.9,537,537.1,537.2,537.3,537.4,537.5,537.6,537.7,537.8,537.9,538,538.1,538.2,538.3,538.4,538.5,538.6,538.7,538.8,538.9,539,539.1,539.2,539.3,539.4,539.5,539.6,539.7,539.8,539.9,540,540.1,540.2,540.3,540.4,540.5,540.6,540.7,540.8,540.9,541,541.1,541.2,541.3,541.4,541.5,541.6,541.7,541.8,541.9,542,542.1,542.2,542.3,542.4,542.5,542.6,542.7,542.8,542.9,543,543.1,543.2,543.3,543.4,543.5,543.6,543.7,543.8,543.9,544,544.1,544.2,544.3,544.4,544.5,544.6,544.7,544.8,544.9,545,545.1,545.2,545.3,545.4,545.5,545.6,545.7,545.8,545.9,546,546.1,546.2,546.3,546.4,546.5,546.6,546.7,546.8,546.9,547,547.1,547.2,547.3,547.4,547.5,547.6,547.7,547.8,547.9,548,548.1,548.2,548.3,548.4,548.5,548.6,548.7,548.8,548.9,549,549.1,549.2,549.3,549.4,549.5,549.6,549.7,549.8,549.9,550,550.1,550.2,550.3,550.4,550.5,550.6,550.7,550.8,550.9,551,551.1,551.2,551.3,551.4,551.5,551.6,551.7,551.8,551.9,552,552.1,552.2,552.3,552.4,552.5,552.6,552.7,552.8,552.9,553,553.1,553.2,553.3,553.4,553.5,553.6,553.7,553.8,553.9,554,554.1,554.2,554.3,554.4,554.5,554.6,554.7,554.8,554.9,555,555.1,555.2,555.3,555.4,555.5,555.6,555.7,555.8,555.9,556,556.1,556.2,556.3,556.4,556.5,556.6,556.7,556.8,556.9,557,557.1,557.2,557.3,557.4,557.5,557.6,557.7,557.8,557.9,558,558.1,558.2,558.3,558.4,558.5,558.6,558.7,558.8,558.9,559,559.1,559.2,559.3,559.4,559.5,559.6,559.7,559.8,559.9,560,560.1,560.2,560.3,560.4,560.5,560.6,560.7,560.8,560.9,561,561.1,561.2,561.3,561.4,561.5,561.6,561.7,561.8,561.9,562,562.1,562.2,562.3,562.4,562.5,562.6,562.7,562.8,562.9,563,563.1,563.2,563.3,563.4,563.5,563.6,563.7,563.8,563.9,564,564.1,564.2,564.3,564.4,564.5,564.6,564.7,564.8,564.9,565,565.1,565.2,565.3,565.4,565.5,565.6,565.7,565.8,565.9,566,566.1,566.2,566.3,566.4,566.5,566.6,566.7,566.8,566.9,567,567.1,567.2,567.3,567.4,567.5,567.6,567.7,567.8,567.9,568,568.1,568.2,568.3,568.4,568.5,568.6,568.7,568.8,568.9,569,569.1,569.2,569.3,569.4,569.5,569.6,569.7,569.8,569.9,570,570.1,570.2,570.3,570.4,570.5,570.6,570.7,570.8,570.9,571,571.1,571.2,571.3,571.4,571.5,571.6,571.7,571.8,571.9,572,572.1,572.2,572.3,572.4,572.5,572.6,572.7,572.8,572.9,573,573.1,573.2,573.3,573.4,573.5,573.6,573.7,573.8,573.9,574,574.1,574.2,574.3,574.4,574.5,574.6,574.7,574.8,574.9,575,575.1,575.2,575.3,575.4,575.5,575.6,575.7,575.8,575.9,576,576.1,576.2,576.3,576.4,576.5,576.6,576.7,576.8,576.9,577,577.1,577.2,577.3,577.4,577.5,577.6,577.7,577.8,577.9,578,578.1,578.2,578.3,578.4,578.5,578.6,578.7,578.8,578.9,579,579.1,579.2,579.3,579.4,579.5,579.6,579.7,579.8,579.9,580,580.1,580.2,580.3,580.4,580.5,580.6,580.7,580.8,580.9,581,581.1,581.2,581.3,581.4,581.5,581.6,581.7,581.8,581.9,582,582.1,582.2,582.3,582.4,582.5,582.6,582.7,582.8,582.9,583,583.1,583.2,583.3,583.4,583.5,583.6,583.7,583.8,583.9,584,584.1,584.2,584.3,584.4,584.5,584.6,584.7,584.8,584.9,585,585.1,585.2,585.3,585.4,585.5,585.6,585.7,585.8,585.9,586,586.1,586.2,586.3,586.4,586.5,586.6,586.7,586.8,586.9,587,587.1,587.2,587.3,587.4,587.5,587.6,587.7,587.8,587.9,588,588.1,588.2,588.3,588.4,588.5,588.6,588.7,588.8,588.9,589,589.1,589.2,589.3,589.4,589.5,589.6,589.7,589.8,589.9,590,590.1,590.2,590.3,590.4,590.5,590.6,590.7,590.8,590.9,591,591.1,591.2,591.3,591.4,591.5,591.6,591.7,591.8,591.9,592,592.1,592.2,592.3,592.4,592.5,592.6,592.7,592.8,592.9,593,593.1,593.2,593.3,593.4,593.5,593.6,593.7,593.8,593.9,594,594.1,594.2,594.3,594.4,594.5,594.6,594.7,594.8,594.9,595,595.1,595.2,595.3,595.4,595.5,595.6,595.7,595.8,595.9,596,596.1,596.2,596.3,596.4,596.5,596.6,596.7,596.8,596.9,597,597.1,597.2,597.3,597.4,597.5,597.6,597.7,597.8,597.9,598,598.1,598.2,598.3,598.4,598.5,598.6,598.7,598.8,598.9,599,599.1,599.2,599.3,599.4,599.5,599.6,599.7,599.8,599.9,600,600.1,600.2,600.3,600.4,600.5,600.6,600.7,600.8,600.9,601,601.1,601.2,601.3,601.4,601.5,601.6,601.7,601.8,601.9,602,602.1,602.2,602.3,602.4,602.5,602.6,602.7,602.8,602.9,603,603.1,603.2,603.3,603.4,603.5,603.6,603.7,603.8,603.9,604,604.1,604.2,604.3,604.4,604.5,604.6,604.7,604.8,604.9,605,605.1,605.2,605.3,605.4,605.5,605.6,605.7,605.8,605.9,606,606.1,606.2,606.3,606.4,606.5,606.6,606.7,606.8,606.9,607,607.1,607.2,607.3,607.4,607.5,607.6,607.7,607.8,607.9,608,608.1,608.2,608.3,608.4,608.5,608.6,608.7,608.8,608.9,609,609.1,609.2,609.3,609.4,609.5,609.6,609.7,609.8,609.9,610,610.1,610.2,610.3,610.4,610.5,610.6,610.7,610.8,610.9,611,611.1,611.2,611.3,611.4,611.5,611.6,611.7,611.8,611.9,612,612.1,612.2,612.3,612.4,612.5,612.6,612.7,612.8,612.9,613,613.1,613.2,613.3,613.4,613.5,613.6,613.7,613.8,613.9,614,614.1,614.2,614.3,614.4,614.5,614.6,614.7,614.8,614.9,615,615.1,615.2,615.3,615.4,615.5,615.6,615.7,615.8,615.9,616,616.1,616.2,616.3,616.4,616.5,616.6,616.7,616.8,616.9,617,617.1,617.2,617.3,617.4,617.5,617.6,617.7,617.8,617.9,618,618.1,618.2,618.3,618.4,618.5,618.6,618.7,618.8,618.9,619,619.1,619.2,619.3,619.4,619.5,619.6,619.7,619.8,619.9,620,620.1,620.2,620.3,620.4,620.5,620.6,620.7,620.8,620.9,621,621.1,621.2,621.3,621.4,621.5,621.6,621.7,621.8,621.9,622,622.1,622.2,622.3,622.4,622.5,622.6,622.7,622.8,622.9,623,623.1,623.2,623.3,623.4,623.5,623.6,623.7,623.8,623.9,624,624.1,624.2,624.3,624.4,624.5,624.6,624.7,624.8,624.9,625,625.1,625.2,625.3,625.4,625.5,625.6,625.7,625.8,625.9,626,626.1,626.2,626.3,626.4,626.5,626.6,626.7,626.8,626.9,627,627.1,627.2,627.3,627.4,627.5,627.6,627.7,627.8,627.9,628,628.1,628.2,628.3,628.4,628.5,628.6,628.7,628.8,628.9,629,629.1,629.2,629.3,629.4,629.5,629.6,629.7,629.8,629.9,630,630.1,630.2,630.3,630.4,630.5,630.6,630.7,630.8,630.9,631,631.1,631.2,631.3,631.4,631.5,631.6,631.7,631.8,631.9,632,632.1,632.2,632.3,632.4,632.5,632.6,632.7,632.8,632.9,633,633.1,633.2,633.3,633.4,633.5,633.6,633.7,633.8,633.9,634,634.1,634.2,634.3,634.4,634.5,634.6,634.7,634.8,634.9,635,635.1,635.2,635.3,635.4,635.5,635.6,635.7,635.8,635.9,636,636.1,636.2,636.3,636.4,636.5,636.6,636.7,636.8,636.9,637,637.1,637.2,637.3,637.4,637.5,637.6,637.7,637.8,637.9,638,638.1,638.2,638.3,638.4,638.5,638.6,638.7,638.8,638.9,639,639.1,639.2,639.3,639.4,639.5,639.6,639.7,639.8,639.9,640,640.1,640.2,640.3,640.4,640.5,640.6,640.7,640.8,640.9,641,641.1,641.2,641.3,641.4,641.5,641.6,641.7,641.8,641.9,642,642.1,642.2,642.3,642.4,642.5,642.6,642.7,642.8,642.9,643,643.1,643.2,643.3,643.4,643.5,643.6,643.7,643.8,643.9,644,644.1,644.2,644.3,644.4,644.5,644.6,644.7,644.8,644.9,645,645.1,645.2,645.3,645.4,645.5,645.6,645.7,645.8,645.9,646,646.1,646.2,646.3,646.4,646.5,646.6,646.7,646.8,646.9,647,647.1,647.2,647.3,647.4,647.5,647.6,647.7,647.8,647.9,648,648.1,648.2,648.3,648.4,648.5,648.6,648.7,648.8,648.9,649,649.1,649.2,649.3,649.4,649.5,649.6,649.7,649.8,649.9,650,650.1,650.2,650.3,650.4,650.5,650.6,650.7,650.8,650.9,651,651.1,651.2,651.3,651.4,651.5,651.6,651.7,651.8,651.9,652,652.1,652.2,652.3,652.4,652.5,652.6,652.7,652.8,652.9,653,653.1,653.2,653.3,653.4,653.5,653.6,653.7,653.8,653.9,654,654.1,654.2,654.3,654.4,654.5,654.6,654.7,654.8,654.9,655,655.1,655.2,655.3,655.4,655.5,655.6,655.7,655.8,655.9,656,656.1,656.2,656.3,656.4,656.5,656.6,656.7,656.8,656.9,657,657.1,657.2,657.3,657.4,657.5,657.6,657.7,657.8,657.9,658,658.1,658.2,658.3,658.4,658.5,658.6,658.7,658.8,658.9,659,659.1,659.2,659.3,659.4,659.5,659.6,659.7,659.8,659.9,660,660.1,660.2,660.3,660.4,660.5,660.6,660.7,660.8,660.9,661,661.1,661.2,661.3,661.4,661.5,661.6,661.7,661.8,661.9,662,662.1,662.2,662.3,662.4,662.5,662.6,662.7,662.8,662.9,663,663.1,663.2,663.3,663.4,663.5,663.6,663.7,663.8,663.9,664,664.1,664.2,664.3,664.4,664.5,664.6,664.7,664.8,664.9,665,665.1,665.2,665.3,665.4,665.5,665.6,665.7,665.8,665.9,666,666.1,666.2,666.3,666.4,666.5,666.6,666.7,666.8,666.9,667,667.1,667.2,667.3,667.4,667.5,667.6,667.7,667.8,667.9,668,668.1,668.2,668.3,668.4,668.5,668.6,668.7,668.8,668.9,669,669.1,669.2,669.3,669.4,669.5,669.6,669.7,669.8,669.9,670,670.1,670.2,670.3,670.4,670.5,670.6,670.7,670.8,670.9,671,671.1,671.2,671.3,671.4,671.5,671.6,671.7,671.8,671.9,672,672.1,672.2,672.3,672.4,672.5,672.6,672.7,672.8,672.9,673,673.1,673.2,673.3,673.4,673.5,673.6,673.7,673.8,673.9,674,674.1,674.2,674.3,674.4,674.5,674.6,674.7,674.8,674.9,675,675.1,675.2,675.3,675.4,675.5,675.6,675.7,675.8,675.9,676,676.1,676.2,676.3,676.4,676.5,676.6,676.7,676.8,676.9,677,677.1,677.2,677.3,677.4,677.5,677.6,677.7,677.8,677.9,678,678.1,678.2,678.3,678.4,678.5,678.6,678.7,678.8,678.9,679,679.1,679.2,679.3,679.4,679.5,679.6,679.7,679.8,679.9,680,680.1,680.2,680.3,680.4,680.5,680.6,680.7,680.8,680.9,681,681.1,681.2,681.3,681.4,681.5,681.6,681.7,681.8,681.9,682,682.1,682.2,682.3,682.4,682.5,682.6,682.7,682.8,682.9,683,683.1,683.2,683.3,683.4,683.5,683.6,683.7,683.8,683.9,684,684.1,684.2,684.3,684.4,684.5,684.6,684.7,684.8,684.9,685,685.1,685.2,685.3,685.4,685.5,685.6,685.7,685.8,685.9,686,686.1,686.2,686.3,686.4,686.5,686.6,686.7,686.8,686.9,687,687.1,687.2,687.3,687.4,687.5,687.6,687.7,687.8,687.9,688,688.1,688.2,688.3,688.4,688.5,688.6,688.7,688.8,688.9,689,689.1,689.2,689.3,689.4,689.5,689.6,689.7,689.8,689.9,690,690.1,690.2,690.3,690.4,690.5,690.6,690.7,690.8,690.9,691,691.1,691.2,691.3,691.4,691.5,691.6,691.7,691.8,691.9,692,692.1,692.2,692.3,692.4,692.5,692.6,692.7,692.8,692.9,693,693.1,693.2,693.3,693.4,693.5,693.6,693.7,693.8,693.9,694,694.1,694.2,694.3,694.4,694.5,694.6,694.7,694.8,694.9,695,695.1,695.2,695.3,695.4,695.5,695.6,695.7,695.8,695.9,696,696.1,696.2,696.3,696.4,696.5,696.6,696.7,696.8,696.9,697,697.1,697.2,697.3,697.4,697.5,697.6,697.7,697.8,697.9,698,698.1,698.2,698.3,698.4,698.5,698.6,698.7,698.8,698.9,699,699.1,699.2,699.3,699.4,699.5,699.6,699.7,699.8,699.9,700,700.1,700.2,700.3,700.4,700.5,700.6,700.7,700.8,700.9,701,701.1,701.2,701.3,701.4,701.5,701.6,701.7,701.8,701.9,702,702.1,702.2,702.3,702.4,702.5,702.6,702.7,702.8,702.9,703,703.1,703.2,703.3,703.4,703.5,703.6,703.7,703.8,703.9,704,704.1,704.2,704.3,704.4,704.5,704.6,704.7,704.8,704.9,705,705.1,705.2,705.3,705.4,705.5,705.6,705.7,705.8,705.9,706,706.1,706.2,706.3,706.4,706.5,706.6,706.7,706.8,706.9,707,707.1,707.2,707.3,707.4,707.5,707.6,707.7,707.8,707.9,708,708.1,708.2,708.3,708.4,708.5,708.6,708.7,708.8,708.9,709,709.1,709.2,709.3,709.4,709.5,709.6,709.7,709.8,709.9,710,710.1,710.2,710.3,710.4,710.5,710.6,710.7,710.8,710.9,711,711.1,711.2,711.3,711.4,711.5,711.6,711.7,711.8,711.9,712,712.1,712.2,712.3,712.4,712.5,712.6,712.7,712.8,712.9,713,713.1,713.2,713.3,713.4,713.5,713.6,713.7,713.8,713.9,714,714.1,714.2,714.3,714.4,714.5,714.6,714.7,714.8,714.9,715,715.1,715.2,715.3,715.4,715.5,715.6,715.7,715.8,715.9,716,716.1,716.2,716.3,716.4,716.5,716.6,716.7,716.8,716.9,717,717.1,717.2,717.3,717.4,717.5,717.6,717.7,717.8,717.9,718,718.1,718.2,718.3,718.4,718.5,718.6,718.7,718.8,718.9,719,719.1,719.2,719.3,719.4,719.5,719.6,719.7,719.8,719.9,720,720.1,720.2,720.3,720.4,720.5,720.6,720.7,720.8,720.9,721,721.1,721.2,721.3,721.4,721.5,721.6,721.7,721.8,721.9,722,722.1,722.2,722.3,722.4,722.5,722.6,722.7,722.8,722.9,723,723.1,723.2,723.3,723.4,723.5,723.6,723.7,723.8,723.9,724,724.1,724.2,724.3,724.4,724.5,724.6,724.7,724.8,724.9,725,725.1,725.2,725.3,725.4,725.5,725.6,725.7,725.8,725.9,726,726.1,726.2,726.3,726.4,726.5,726.6,726.7,726.8,726.9,727,727.1,727.2,727.3,727.4,727.5,727.6,727.7,727.8,727.9,728,728.1,728.2,728.3,728.4,728.5,728.6,728.7,728.8,728.9,729,729.1,729.2,729.3,729.4,729.5,729.6,729.7,729.8,729.9,730,730.1,730.2,730.3,730.4,730.5,730.6,730.7,730.8,730.9,731,731.1,731.2,731.3,731.4,731.5,731.6,731.7,731.8,731.9,732,732.1,732.2,732.3,732.4,732.5,732.6,732.7,732.8,732.9,733,733.1,733.2,733.3,733.4,733.5,733.6,733.7,733.8,733.9,734,734.1,734.2,734.3,734.4,734.5,734.6,734.7,734.8,734.9,735,735.1,735.2,735.3,735.4,735.5,735.6,735.7,735.8,735.9,736,736.1,736.2,736.3,736.4,736.5,736.6,736.7,736.8,736.9,737,737.1,737.2,737.3,737.4,737.5,737.6,737.7,737.8,737.9,738,738.1,738.2,738.3,738.4,738.5,738.6,738.7,738.8,738.9,739,739.1,739.2,739.3,739.4,739.5,739.6,739.7,739.8,739.9,740,740.1,740.2,740.3,740.4,740.5,740.6,740.7,740.8,740.9,741,741.1,741.2,741.3,741.4,741.5,741.6,741.7,741.8,741.9,742,742.1,742.2,742.3,742.4,742.5,742.6,742.7,742.8,742.9,743,743.1,743.2,743.3,743.4,743.5,743.6,743.7,743.8,743.9,744,744.1,744.2,744.3,744.4,744.5,744.6,744.7,744.8,744.9,745,745.1,745.2,745.3,745.4,745.5,745.6,745.7,745.8,745.9,746,746.1,746.2,746.3,746.4,746.5,746.6,746.7,746.8,746.9,747,747.1,747.2,747.3,747.4,747.5,747.6,747.7,747.8,747.9,748,748.1,748.2,748.3,748.4,748.5,748.6,748.7,748.8,748.9,749,749.1,749.2,749.3,749.4,749.5,749.6,749.7,749.8,749.9,750,750.1,750.2,750.3,750.4,750.5,750.6,750.7,750.8,750.9,751,751.1,751.2,751.3,751.4,751.5,751.6,751.7,751.8,751.9,752,752.1,752.2,752.3,752.4,752.5,752.6,752.7,752.8,752.9,753,753.1,753.2,753.3,753.4,753.5,753.6,753.7,753.8,753.9,754,754.1,754.2,754.3,754.4,754.5,754.6,754.7,754.8,754.9,755,755.1,755.2,755.3,755.4,755.5,755.6,755.7,755.8,755.9,756,756.1,756.2,756.3,756.4,756.5,756.6,756.7,756.8,756.9,757,757.1,757.2,757.3,757.4,757.5,757.6,757.7,757.8,757.9,758,758.1,758.2,758.3,758.4,758.5,758.6,758.7,758.8,758.9,759,759.1,759.2,759.3,759.4,759.5,759.6,759.7,759.8,759.9,760,760.1,760.2,760.3,760.4,760.5,760.6,760.7,760.8,760.9,761,761.1,761.2,761.3,761.4,761.5,761.6,761.7,761.8,761.9,762,762.1,762.2,762.3,762.4,762.5,762.6,762.7,762.8,762.9,763,763.1,763.2,763.3,763.4,763.5,763.6,763.7,763.8,763.9,764,764.1,764.2,764.3,764.4,764.5,764.6,764.7,764.8,764.9,765,765.1,765.2,765.3,765.4,765.5,765.6,765.7,765.8,765.9,766,766.1,766.2,766.3,766.4,766.5,766.6,766.7,766.8,766.9,767,767.1,767.2,767.3,767.4,767.5,767.6,767.7,767.8,767.9,768,768.1,768.2,768.3,768.4,768.5,768.6,768.7,768.8,768.9,769,769.1,769.2,769.3,769.4,769.5,769.6,769.7,769.8,769.9,770,770.1,770.2,770.3,770.4,770.5,770.6,770.7,770.8,770.9,771,771.1,771.2,771.3,771.4,771.5,771.6,771.7,771.8,771.9,772,772.1,772.2,772.3,772.4,772.5,772.6,772.7,772.8,772.9,773,773.1,773.2,773.3,773.4,773.5,773.6,773.7,773.8,773.9,774,774.1,774.2,774.3,774.4,774.5,774.6,774.7,774.8,774.9,775,775.1,775.2,775.3,775.4,775.5,775.6,775.7,775.8,775.9,776,776.1,776.2,776.3,776.4,776.5,776.6,776.7,776.8,776.9,777,777.1,777.2,777.3,777.4,777.5,777.6,777.7,777.8,777.9,778,778.1,778.2,778.3,778.4,778.5,778.6,778.7,778.8,778.9,779,779.1,779.2,779.3,779.4,779.5,779.6,779.7,779.8,779.9,780,780.1,780.2,780.3,780.4,780.5,780.6,780.7,780.8,780.9,781,781.1,781.2,781.3,781.4,781.5,781.6,781.7,781.8,781.9,782,782.1,782.2,782.3,782.4,782.5,782.6,782.7,782.8,782.9,783,783.1,783.2,783.3,783.4,783.5,783.6,783.7,783.8,783.9,784,784.1,784.2,784.3,784.4,784.5,784.6,784.7,784.8,784.9,785,785.1,785.2,785.3,785.4,785.5,785.6,785.7,785.8,785.9,786,786.1,786.2,786.3,786.4,786.5,786.6,786.7,786.8,786.9,787,787.1,787.2,787.3,787.4,787.5,787.6,787.7,787.8,787.9,788,788.1,788.2,788.3,788.4,788.5,788.6,788.7,788.8,788.9,789,789.1,789.2,789.3,789.4,789.5,789.6,789.7,789.8,789.9,790,790.1,790.2,790.3,790.4,790.5,790.6,790.7,790.8,790.9,791,791.1,791.2,791.3,791.4,791.5,791.6,791.7,791.8,791.9,792,792.1,792.2,792.3,792.4,792.5,792.6,792.7,792.8,792.9,793,793.1,793.2,793.3,793.4,793.5,793.6,793.7,793.8,793.9,794,794.1,794.2,794.3,794.4,794.5,794.6,794.7,794.8,794.9,795,795.1,795.2,795.3,795.4,795.5,795.6,795.7,795.8,795.9,796,796.1,796.2,796.3,796.4,796.5,796.6,796.7,796.8,796.9,797,797.1,797.2,797.3,797.4,797.5,797.6,797.7,797.8,797.9,798,798.1,798.2,798.3,798.4,798.5,798.6,798.7,798.8,798.9,799,799.1,799.2,799.3,799.4,799.5,799.6,799.7,799.8,799.9,800,800.1,800.2,800.3,800.4,800.5,800.6,800.7,800.8,800.9,801,801.1,801.2,801.3,801.4,801.5,801.6,801.7,801.8,801.9,802,802.1,802.2,802.3,802.4,802.5,802.6,802.7,802.8,802.9,803,803.1,803.2,803.3,803.4,803.5,803.6,803.7,803.8,803.9,804,804.1,804.2,804.3,804.4,804.5,804.6,804.7,804.8,804.9,805,805.1,805.2,805.3,805.4,805.5,805.6,805.7,805.8,805.9,806,806.1,806.2,806.3,806.4,806.5,806.6,806.7,806.8,806.9,807,807.1,807.2,807.3,807.4,807.5,807.6,807.7,807.8,807.9,808,808.1,808.2,808.3,808.4,808.5,808.6,808.7,808.8,808.9,809,809.1,809.2,809.3,809.4,809.5,809.6,809.7,809.8,809.9,810,810.1,810.2,810.3,810.4,810.5,810.6,810.7,810.8,810.9,811,811.1,811.2,811.3,811.4,811.5,811.6,811.7,811.8,811.9,812,812.1,812.2,812.3,812.4,812.5,812.6,812.7,812.8,812.9,813,813.1,813.2,813.3,813.4,813.5,813.6,813.7,813.8,813.9,814,814.1,814.2,814.3,814.4,814.5,814.6,814.7,814.8,814.9,815,815.1,815.2,815.3,815.4,815.5,815.6,815.7,815.8,815.9,816,816.1,816.2,816.3,816.4,816.5,816.6,816.7,816.8,816.9,817,817.1,817.2,817.3,817.4,817.5,817.6,817.7,817.8,817.9,818,818.1,818.2,818.3,818.4,818.5,818.6,818.7,818.8,818.9,819,819.1,819.2,819.3,819.4,819.5,819.6,819.7,819.8,819.9,820,820.1,820.2,820.3,820.4,820.5,820.6,820.7,820.8,820.9,821,821.1,821.2,821.3,821.4,821.5,821.6,821.7,821.8,821.9,822,822.1,822.2,822.3,822.4,822.5,822.6,822.7,822.8,822.9,823,823.1,823.2,823.3,823.4,823.5,823.6,823.7,823.8,823.9,824,824.1,824.2,824.3,824.4,824.5,824.6,824.7,824.8,824.9,825,825.1,825.2,825.3,825.4,825.5,825.6,825.7,825.8,825.9,826,826.1,826.2,826.3,826.4,826.5,826.6,826.7,826.8,826.9,827,827.1,827.2,827.3,827.4,827.5,827.6,827.7,827.8,827.9,828,828.1,828.2,828.3,828.4,828.5,828.6,828.7,828.8,828.9,829,829.1,829.2,829.3,829.4,829.5,829.6,829.7,829.8,829.9,830,830.1,830.2,830.3,830.4,830.5,830.6,830.7,830.8,830.9,831,831.1,831.2,831.3,831.4,831.5,831.6,831.7,831.8,831.9,832,832.1,832.2,832.3,832.4,832.5,832.6,832.7,832.8,832.9,833,833.1,833.2,833.3,833.4,833.5,833.6,833.7,833.8,833.9,834,834.1,834.2,834.3,834.4,834.5,834.6,834.7,834.8,834.9,835,835.1,835.2,835.3,835.4,835.5,835.6,835.7,835.8,835.9,836,836.1,836.2,836.3,836.4,836.5,836.6,836.7,836.8,836.9,837,837.1,837.2,837.3,837.4,837.5,837.6,837.7,837.8,837.9,838,838.1,838.2,838.3,838.4,838.5,838.6,838.7,838.8,838.9,839,839.1,839.2,839.3,839.4,839.5,839.6,839.7,839.8,839.9,840,840.1,840.2,840.3,840.4,840.5,840.6,840.7,840.8,840.9,841,841.1,841.2,841.3,841.4,841.5,841.6,841.7,841.8,841.9,842,842.1,842.2,842.3,842.4,842.5,842.6,842.7,842.8,842.9,843,843.1,843.2,843.3,843.4,843.5,843.6,843.7,843.8,843.9,844,844.1,844.2,844.3,844.4,844.5,844.6,844.7,844.8,844.9,845,845.1,845.2,845.3,845.4,845.5,845.6,845.7,845.8,845.9,846,846.1,846.2,846.3,846.4,846.5,846.6,846.7,846.8,846.9,847,847.1,847.2,847.3,847.4,847.5,847.6,847.7,847.8,847.9,848,848.1,848.2,848.3,848.4,848.5,848.6,848.7,848.8,848.9,849,849.1,849.2,849.3,849.4,849.5,849.6,849.7,849.8,849.9,850,850.1,850.2,850.3,850.4,850.5,850.6,850.7,850.8,850.9,851,851.1,851.2,851.3,851.4,851.5,851.6,851.7,851.8,851.9,852,852.1,852.2,852.3,852.4,852.5,852.6,852.7,852.8,852.9,853,853.1,853.2,853.3,853.4,853.5,853.6,853.7,853.8,853.9,854,854.1,854.2,854.3,854.4,854.5,854.6,854.7,854.8,854.9,855,855.1,855.2,855.3,855.4,855.5,855.6,855.7,855.8,855.9,856,856.1,856.2,856.3,856.4,856.5,856.6,856.7,856.8,856.9,857,857.1,857.2,857.3,857.4,857.5,857.6,857.7,857.8,857.9,858,858.1,858.2,858.3,858.4,858.5,858.6,858.7,858.8,858.9,859,859.1,859.2,859.3,859.4,859.5,859.6,859.7,859.8,859.9,860,860.1,860.2,860.3,860.4,860.5,860.6,860.7,860.8,860.9,861,861.1,861.2,861.3,861.4,861.5,861.6,861.7,861.8,861.9,862,862.1,862.2,862.3,862.4,862.5,862.6,862.7,862.8,862.9,863,863.1,863.2,863.3,863.4,863.5,863.6,863.7,863.8,863.9,864,864.1,864.2,864.3,864.4,864.5,864.6,864.7,864.8,864.9,865,865.1,865.2,865.3,865.4,865.5,865.6,865.7,865.8,865.9,866,866.1,866.2,866.3,866.4,866.5,866.6,866.7,866.8,866.9,867,867.1,867.2,867.3,867.4,867.5,867.6,867.7,867.8,867.9,868,868.1,868.2,868.3,868.4,868.5,868.6,868.7,868.8,868.9,869,869.1,869.2,869.3,869.4,869.5,869.6,869.7,869.8,869.9,870,870.1,870.2,870.3,870.4,870.5,870.6,870.7,870.8,870.9,871,871.1,871.2,871.3,871.4,871.5,871.6,871.7,871.8,871.9,872,872.1,872.2,872.3,872.4,872.5,872.6,872.7,872.8,872.9,873,873.1,873.2,873.3,873.4,873.5,873.6,873.7,873.8,873.9,874,874.1,874.2,874.3,874.4,874.5,874.6,874.7,874.8,874.9,875,875.1,875.2,875.3,875.4,875.5,875.6,875.7,875.8,875.9,876,876.1,876.2,876.3,876.4,876.5,876.6,876.7,876.8,876.9,877,877.1,877.2,877.3,877.4,877.5,877.6,877.7,877.8,877.9,878,878.1,878.2,878.3,878.4,878.5,878.6,878.7,878.8,878.9,879,879.1,879.2,879.3,879.4,879.5,879.6,879.7,879.8,879.9,880,880.1,880.2,880.3,880.4,880.5,880.6,880.7,880.8,880.9,881,881.1,881.2,881.3,881.4,881.5,881.6,881.7,881.8,881.9,882,882.1,882.2,882.3,882.4,882.5,882.6,882.7,882.8,882.9,883,883.1,883.2,883.3,883.4,883.5,883.6,883.7,883.8,883.9,884,884.1,884.2,884.3,884.4,884.5,884.6,884.7,884.8,884.9,885,885.1,885.2,885.3,885.4,885.5,885.6,885.7,885.8,885.9,886,886.1,886.2,886.3,886.4,886.5,886.6,886.7,886.8,886.9,887,887.1,887.2,887.3,887.4,887.5,887.6,887.7,887.8,887.9,888,888.1,888.2,888.3,888.4,888.5,888.6,888.7,888.8,888.9,889,889.1,889.2,889.3,889.4,889.5,889.6,889.7,889.8,889.9,890,890.1,890.2,890.3,890.4,890.5,890.6,890.7,890.8,890.9,891,891.1,891.2,891.3,891.4,891.5,891.6,891.7,891.8,891.9,892,892.1,892.2,892.3,892.4,892.5,892.6,892.7,892.8,892.9,893,893.1,893.2,893.3,893.4,893.5,893.6,893.7,893.8,893.9,894,894.1,894.2,894.3,894.4,894.5,894.6,894.7,894.8,894.9,895,895.1,895.2,895.3,895.4,895.5,895.6,895.7,895.8,895.9,896,896.1,896.2,896.3,896.4,896.5,896.6,896.7,896.8,896.9,897,897.1,897.2,897.3,897.4,897.5,897.6,897.7,897.8,897.9,898,898.1,898.2,898.3,898.4,898.5,898.6,898.7,898.8,898.9,899,899.1,899.2,899.3,899.4,899.5,899.6,899.7,899.8,899.9,900,900.1,900.2,900.3,900.4,900.5,900.6,900.7,900.8,900.9,901,901.1,901.2,901.3,901.4,901.5,901.6,901.7,901.8,901.9,902,902.1,902.2,902.3,902.4,902.5,902.6,902.7,902.8,902.9,903,903.1,903.2,903.3,903.4,903.5,903.6,903.7,903.8,903.9,904,904.1,904.2,904.3,904.4,904.5,904.6,904.7,904.8,904.9,905,905.1,905.2,905.3,905.4,905.5,905.6,905.7,905.8,905.9,906,906.1,906.2,906.3,906.4,906.5,906.6,906.7,906.8,906.9,907,907.1,907.2,907.3,907.4,907.5,907.6,907.7,907.8,907.9,908,908.1,908.2,908.3,908.4,908.5,908.6,908.7,908.8,908.9,909,909.1,909.2,909.3,909.4,909.5,909.6,909.7,909.8,909.9,910,910.1,910.2,910.3,910.4,910.5,910.6,910.7,910.8,910.9,911,911.1,911.2,911.3,911.4,911.5,911.6,911.7,911.8,911.9,912,912.1,912.2,912.3,912.4,912.5,912.6,912.7,912.8,912.9,913,913.1,913.2,913.3,913.4,913.5,913.6,913.7,913.8,913.9,914,914.1,914.2,914.3,914.4,914.5,914.6,914.7,914.8,914.9,915,915.1,915.2,915.3,915.4,915.5,915.6,915.7,915.8,915.9,916,916.1,916.2,916.3,916.4,916.5,916.6,916.7,916.8,916.9,917,917.1,917.2,917.3,917.4,917.5,917.6,917.7,917.8,917.9,918,918.1,918.2,918.3,918.4,918.5,918.6,918.7,918.8,918.9,919,919.1,919.2,919.3,919.4,919.5,919.6,919.7,919.8,919.9,920,920.1,920.2,920.3,920.4,920.5,920.6,920.7,920.8,920.9,921,921.1,921.2,921.3,921.4,921.5,921.6,921.7,921.8,921.9,922,922.1,922.2,922.3,922.4,922.5,922.6,922.7,922.8,922.9,923,923.1,923.2,923.3,923.4,923.5,923.6,923.7,923.8,923.9,924,924.1,924.2,924.3,924.4,924.5,924.6,924.7,924.8,924.9,925,925.1,925.2,925.3,925.4,925.5,925.6,925.7,925.8,925.9,926,926.1,926.2,926.3,926.4,926.5,926.6,926.7,926.8,926.9,927,927.1,927.2,927.3,927.4,927.5,927.6,927.7,927.8,927.9,928,928.1,928.2,928.3,928.4,928.5,928.6,928.7,928.8,928.9,929,929.1,929.2,929.3,929.4,929.5,929.6,929.7,929.8,929.9,930,930.1,930.2,930.3,930.4,930.5,930.6,930.7,930.8,930.9,931,931.1,931.2,931.3,931.4,931.5,931.6,931.7,931.8,931.9,932,932.1,932.2,932.3,932.4,932.5,932.6,932.7,932.8,932.9,933,933.1,933.2,933.3,933.4,933.5,933.6,933.7,933.8,933.9,934,934.1,934.2,934.3,934.4,934.5,934.6,934.7,934.8,934.9,935,935.1,935.2,935.3,935.4,935.5,935.6,935.7,935.8,935.9,936,936.1,936.2,936.3,936.4,936.5,936.6,936.7,936.8,936.9,937,937.1,937.2,937.3,937.4,937.5,937.6,937.7,937.8,937.9,938,938.1,938.2,938.3,938.4,938.5,938.6,938.7,938.8,938.9,939,939.1,939.2,939.3,939.4,939.5,939.6,939.7,939.8,939.9,940,940.1,940.2,940.3,940.4,940.5,940.6,940.7,940.8,940.9,941,941.1,941.2,941.3,941.4,941.5,941.6,941.7,941.8,941.9,942,942.1,942.2,942.3,942.4,942.5,942.6,942.7,942.8,942.9,943,943.1,943.2,943.3,943.4,943.5,943.6,943.7,943.8,943.9,944,944.1,944.2,944.3,944.4,944.5,944.6,944.7,944.8,944.9,945,945.1,945.2,945.3,945.4,945.5,945.6,945.7,945.8,945.9,946,946.1,946.2,946.3,946.4,946.5,946.6,946.7,946.8,946.9,947,947.1,947.2,947.3,947.4,947.5,947.6,947.7,947.8,947.9,948,948.1,948.2,948.3,948.4,948.5,948.6,948.7,948.8,948.9,949,949.1,949.2,949.3,949.4,949.5,949.6,949.7,949.8,949.9,950,950.1,950.2,950.3,950.4,950.5,950.6,950.7,950.8,950.9,951,951.1,951.2,951.3,951.4,951.5,951.6,951.7,951.8,951.9,952,952.1,952.2,952.3,952.4,952.5,952.6,952.7,952.8,952.9,953,953.1,953.2,953.3,953.4,953.5,953.6,953.7,953.8,953.9,954,954.1,954.2,954.3,954.4,954.5,954.6,954.7,954.8,954.9,955,955.1,955.2,955.3,955.4,955.5,955.6,955.7,955.8,955.9,956,956.1,956.2,956.3,956.4,956.5,956.6,956.7,956.8,956.9,957,957.1,957.2,957.3,957.4,957.5,957.6,957.7,957.8,957.9,958,958.1,958.2,958.3,958.4,958.5,958.6,958.7,958.8,958.9,959,959.1,959.2,959.3,959.4,959.5,959.6,959.7,959.8,959.9,960,960.1,960.2,960.3,960.4,960.5,960.6,960.7,960.8,960.9,961,961.1,961.2,961.3,961.4,961.5,961.6,961.7,961.8,961.9,962,962.1,962.2,962.3,962.4,962.5,962.6,962.7,962.8,962.9,963,963.1,963.2,963.3,963.4,963.5,963.6,963.7,963.8,963.9,964,964.1,964.2,964.3,964.4,964.5,964.6,964.7,964.8,964.9,965,965.1,965.2,965.3,965.4,965.5,965.6,965.7,965.8,965.9,966,966.1,966.2,966.3,966.4,966.5,966.6,966.7,966.8,966.9,967,967.1,967.2,967.3,967.4,967.5,967.6,967.7,967.8,967.9,968,968.1,968.2,968.3,968.4,968.5,968.6,968.7,968.8,968.9,969,969.1,969.2,969.3,969.4,969.5,969.6,969.7,969.8,969.9,970,970.1,970.2,970.3,970.4,970.5,970.6,970.7,970.8,970.9,971,971.1,971.2,971.3,971.4,971.5,971.6,971.7,971.8,971.9,972,972.1,972.2,972.3,972.4,972.5,972.6,972.7,972.8,972.9,973,973.1,973.2,973.3,973.4,973.5,973.6,973.7,973.8,973.9,974,974.1,974.2,974.3,974.4,974.5,974.6,974.7,974.8,974.9,975,975.1,975.2,975.3,975.4,975.5,975.6,975.7,975.8,975.9,976,976.1,976.2,976.3,976.4,976.5,976.6,976.7,976.8,976.9,977,977.1,977.2,977.3,977.4,977.5,977.6,977.7,977.8,977.9,978,978.1,978.2,978.3,978.4,978.5,978.6,978.7,978.8,978.9,979,979.1,979.2,979.3,979.4,979.5,979.6,979.7,979.8,979.9,980,980.1,980.2,980.3,980.4,980.5,980.6,980.7,980.8,980.9,981,981.1,981.2,981.3,981.4,981.5,981.6,981.7,981.8,981.9,982,982.1,982.2,982.3,982.4,982.5,982.6,982.7,982.8,982.9,983,983.1,983.2,983.3,983.4,983.5,983.6,983.7,983.8,983.9,984,984.1,984.2,984.3,984.4,984.5,984.6,984.7,984.8,984.9,985,985.1,985.2,985.3,985.4,985.5,985.6,985.7,985.8,985.9,986,986.1,986.2,986.3,986.4,986.5,986.6,986.7,986.8,986.9,987,987.1,987.2,987.3,987.4,987.5,987.6,987.7,987.8,987.9,988,988.1,988.2,988.3,988.4,988.5,988.6,988.7,988.8,988.9,989,989.1,989.2,989.3,989.4,989.5,989.6,989.7,989.8,989.9,990,990.1,990.2,990.3,990.4,990.5,990.6,990.7,990.8,990.9,991,991.1,991.2,991.3,991.4,991.5,991.6,991.7,991.8,991.9,992,992.1,992.2,992.3,992.4,992.5,992.6,992.7,992.8,992.9,993,993.1,993.2,993.3,993.4,993.5,993.6,993.7,993.8,993.9,994,994.1,994.2,994.3,994.4,994.5,994.6,994.7,994.8,994.9,995,995.1,995.2,995.3,995.4,995.5,995.6,995.7,995.8,995.9,996,996.1,996.2,996.3,996.4,996.5,996.6,996.7,996.8,996.9,997,997.1,997.2,997.3,997.4,997.5,997.6,997.7,997.8,997.9,998,998.1,998.2,998.3,998.4,998.5,998.6,998.7,998.8,998.9,999,999.1,999.2,999.3,999.4,999.5,999.6,999.7,999.8,999.9,1000,1000.1,1000.2,1000.3,1000.4,1000.5,1000.6,1000.7,1000.8,1000.9,1001,1001.1,1001.2,1001.3,1001.4,1001.5,1001.6,1001.7,1001.8,1001.9,1002,1002.1,1002.2,1002.3,1002.4,1002.5,1002.6,1002.7,1002.8,1002.9,1003,1003.1,1003.2,1003.3,1003.4,1003.5,1003.6,1003.7,1003.8,1003.9,1004,1004.1,1004.2,1004.3,1004.4,1004.5,1004.6,1004.7,1004.8,1004.9,1005,1005.1,1005.2,1005.3,1005.4,1005.5,1005.6,1005.7,1005.8,1005.9,1006,1006.1,1006.2,1006.3,1006.4,1006.5,1006.6,1006.7,1006.8,1006.9,1007,1007.1,1007.2,1007.3,1007.4,1007.5,1007.6,1007.7,1007.8,1007.9,1008,1008.1,1008.2,1008.3,1008.4,1008.5,1008.6,1008.7,1008.8,1008.9,1009,1009.1,1009.2,1009.3,1009.4,1009.5,1009.6,1009.7,1009.8,1009.9,1010,1010.1,1010.2,1010.3,1010.4,1010.5,1010.6,1010.7,1010.8,1010.9,1011,1011.1,1011.2,1011.3,1011.4,1011.5,1011.6,1011.7,1011.8,1011.9,1012,1012.1,1012.2,1012.3,1012.4,1012.5,1012.6,1012.7,1012.8,1012.9,1013,1013.1,1013.2,1013.3,1013.4,1013.5,1013.6,1013.7,1013.8,1013.9,1014,1014.1,1014.2,1014.3,1014.4,1014.5,1014.6,1014.7,1014.8,1014.9,1015,1015.1,1015.2,1015.3,1015.4,1015.5,1015.6,1015.7,1015.8,1015.9,1016,1016.1,1016.2,1016.3,1016.4,1016.5,1016.6,1016.7,1016.8,1016.9,1017,1017.1,1017.2,1017.3,1017.4,1017.5,1017.6,1017.7,1017.8,1017.9,1018,1018.1,1018.2,1018.3,1018.4,1018.5,1018.6,1018.7,1018.8,1018.9,1019,1019.1,1019.2,1019.3,1019.4,1019.5,1019.6,1019.7,1019.8,1019.9,1020,1020.1,1020.2,1020.3,1020.4,1020.5,1020.6,1020.7,1020.8,1020.9,1021,1021.1,1021.2,1021.3,1021.4,1021.5,1021.6,1021.7,1021.8,1021.9,1022,1022.1,1022.2,1022.3,1022.4,1022.5,1022.6,1022.7,1022.8,1022.9,1023,1023.1,1023.2,1023.3,1023.4,1023.5,1023.6,1023.7,1023.8,1023.9,1024,1024.1,1024.2,1024.3,1024.4,1024.5,1024.6,1024.7,1024.8,1024.9,1025,1025.1,1025.2,1025.3,1025.4,1025.5,1025.6,1025.7,1025.8,1025.9,1026,1026.1,1026.2,1026.3,1026.4,1026.5,1026.6,1026.7,1026.8,1026.9,1027,1027.1,1027.2,1027.3,1027.4,1027.5,1027.6,1027.7,1027.8,1027.9,1028,1028.1,1028.2,1028.3,1028.4,1028.5,1028.6,1028.7,1028.8,1028.9,1029,1029.1,1029.2,1029.3,1029.4,1029.5,1029.6,1029.7,1029.8,1029.9,1030,1030.1,1030.2,1030.3,1030.4,1030.5,1030.6,1030.7,1030.8,1030.9,1031,1031.1,1031.2,1031.3,1031.4,1031.5,1031.6,1031.7,1031.8,1031.9,1032,1032.1,1032.2,1032.3,1032.4,1032.5,1032.6,1032.7,1032.8,1032.9,1033,1033.1,1033.2,1033.3,1033.4,1033.5,1033.6,1033.7,1033.8,1033.9,1034,1034.1,1034.2,1034.3,1034.4,1034.5,1034.6,1034.7,1034.8,1034.9,1035,1035.1,1035.2,1035.3,1035.4,1035.5,1035.6,1035.7,1035.8,1035.9,1036,1036.1,1036.2,1036.3,1036.4,1036.5,1036.6,1036.7,1036.8,1036.9,1037,1037.1,1037.2,1037.3,1037.4,1037.5,1037.6,1037.7,1037.8,1037.9,1038,1038.1,1038.2,1038.3,1038.4,1038.5,1038.6,1038.7,1038.8,1038.9,1039,1039.1,1039.2,1039.3,1039.4,1039.5,1039.6,1039.7,1039.8,1039.9,1040,1040.1,1040.2,1040.3,1040.4,1040.5,1040.6,1040.7,1040.8,1040.9,1041,1041.1,1041.2,1041.3,1041.4,1041.5,1041.6,1041.7,1041.8,1041.9,1042,1042.1,1042.2,1042.3,1042.4,1042.5,1042.6,1042.7,1042.8,1042.9,1043,1043.1,1043.2,1043.3,1043.4,1043.5,1043.6,1043.7,1043.8,1043.9,1044,1044.1,1044.2,1044.3,1044.4,1044.5,1044.6,1044.7,1044.8,1044.9,1045,1045.1,1045.2,1045.3,1045.4,1045.5,1045.6,1045.7,1045.8,1045.9,1046,1046.1,1046.2,1046.3,1046.4,1046.5,1046.6,1046.7,1046.8,1046.9,1047,1047.1,1047.2,1047.3,1047.4,1047.5,1047.6,1047.7,1047.8,1047.9,1048,1048.1,1048.2,1048.3,1048.4,1048.5,1048.6,1048.7,1048.8,1048.9,1049,1049.1,1049.2,1049.3,1049.4,1049.5,1049.6,1049.7,1049.8,1049.9,1050,1050.1,1050.2,1050.3,1050.4,1050.5,1050.6,1050.7,1050.8,1050.9,1051,1051.1,1051.2,1051.3,1051.4,1051.5,1051.6,1051.7,1051.8,1051.9,1052,1052.1,1052.2,1052.3,1052.4,1052.5,1052.6,1052.7,1052.8,1052.9,1053,1053.1,1053.2,1053.3,1053.4,1053.5,1053.6,1053.7,1053.8,1053.9,1054,1054.1,1054.2,1054.3,1054.4,1054.5,1054.6,1054.7,1054.8,1054.9,1055,1055.1,1055.2,1055.3,1055.4,1055.5,1055.6,1055.7,1055.8,1055.9,1056,1056.1,1056.2,1056.3,1056.4,1056.5,1056.6,1056.7,1056.8,1056.9,1057,1057.1,1057.2,1057.3,1057.4,1057.5,1057.6,1057.7,1057.8,1057.9,1058,1058.1,1058.2,1058.3,1058.4,1058.5,1058.6,1058.7,1058.8,1058.9,1059,1059.1,1059.2,1059.3,1059.4,1059.5,1059.6,1059.7,1059.8,1059.9,1060,1060.1,1060.2,1060.3,1060.4,1060.5,1060.6,1060.7,1060.8,1060.9,1061,1061.1,1061.2,1061.3,1061.4,1061.5,1061.6,1061.7,1061.8,1061.9,1062,1062.1,1062.2,1062.3,1062.4,1062.5,1062.6,1062.7,1062.8,1062.9,1063,1063.1,1063.2,1063.3,1063.4,1063.5,1063.6,1063.7,1063.8,1063.9,1064,1064.1,1064.2,1064.3,1064.4,1064.5,1064.6,1064.7,1064.8,1064.9,1065,1065.1,1065.2,1065.3,1065.4,1065.5,1065.6,1065.7,1065.8,1065.9,1066,1066.1,1066.2,1066.3,1066.4,1066.5,1066.6,1066.7,1066.8,1066.9,1067,1067.1,1067.2,1067.3,1067.4,1067.5,1067.6,1067.7,1067.8,1067.9,1068,1068.1,1068.2,1068.3,1068.4,1068.5,1068.6,1068.7,1068.8,1068.9,1069,1069.1,1069.2,1069.3,1069.4,1069.5,1069.6,1069.7,1069.8,1069.9,1070,1070.1,1070.2,1070.3,1070.4,1070.5,1070.6,1070.7,1070.8,1070.9,1071,1071.1,1071.2,1071.3,1071.4,1071.5,1071.6,1071.7,1071.8,1071.9,1072,1072.1,1072.2,1072.3,1072.4,1072.5,1072.6,1072.7,1072.8,1072.9,1073,1073.1,1073.2,1073.3,1073.4,1073.5,1073.6,1073.7,1073.8,1073.9,1074,1074.1,1074.2,1074.3,1074.4,1074.5,1074.6,1074.7,1074.8,1074.9,1075,1075.1,1075.2,1075.3,1075.4,1075.5,1075.6,1075.7,1075.8,1075.9,1076,1076.1,1076.2,1076.3,1076.4,1076.5,1076.6,1076.7,1076.8,1076.9,1077,1077.1,1077.2,1077.3,1077.4,1077.5,1077.6,1077.7,1077.8,1077.9,1078,1078.1,1078.2,1078.3,1078.4,1078.5,1078.6,1078.7,1078.8,1078.9,1079,1079.1,1079.2,1079.3,1079.4,1079.5,1079.6,1079.7,1079.8,1079.9,1080,1080.1,1080.2,1080.3,1080.4,1080.5,1080.6,1080.7,1080.8,1080.9,1081,1081.1,1081.2,1081.3,1081.4,1081.5,1081.6,1081.7,1081.8,1081.9,1082,1082.1,1082.2,1082.3,1082.4,1082.5,1082.6,1082.7,1082.8,1082.9,1083,1083.1,1083.2,1083.3,1083.4,1083.5,1083.6,1083.7,1083.8,1083.9,1084,1084.1,1084.2,1084.3,1084.4,1084.5,1084.6,1084.7,1084.8,1084.9,1085,1085.1,1085.2,1085.3,1085.4,1085.5,1085.6,1085.7,1085.8,1085.9,1086,1086.1,1086.2,1086.3,1086.4,1086.5,1086.6,1086.7,1086.8,1086.9,1087,1087.1,1087.2,1087.3,1087.4,1087.5,1087.6,1087.7,1087.8,1087.9,1088,1088.1,1088.2,1088.3,1088.4,1088.5,1088.6,1088.7,1088.8,1088.9,1089,1089.1,1089.2,1089.3,1089.4,1089.5,1089.6,1089.7,1089.8,1089.9,1090,1090.1,1090.2,1090.3,1090.4,1090.5,1090.6,1090.7,1090.8,1090.9,1091,1091.1,1091.2,1091.3,1091.4,1091.5,1091.6,1091.7,1091.8,1091.9,1092,1092.1,1092.2,1092.3,1092.4,1092.5,1092.6,1092.7,1092.8,1092.9,1093,1093.1,1093.2,1093.3,1093.4,1093.5,1093.6,1093.7,1093.8,1093.9,1094,1094.1,1094.2,1094.3,1094.4,1094.5,1094.6,1094.7,1094.8,1094.9,1095,1095.1,1095.2,1095.3,1095.4,1095.5,1095.6,1095.7,1095.8,1095.9,1096,1096.1,1096.2,1096.3,1096.4,1096.5,1096.6,1096.7,1096.8,1096.9,1097,1097.1,1097.2,1097.3,1097.4,1097.5,1097.6,1097.7,1097.8,1097.9,1098,1098.1,1098.2,1098.3,1098.4,1098.5,1098.6,1098.7,1098.8,1098.9,1099,1099.1,1099.2,1099.3,1099.4,1099.5,1099.6,1099.7,1099.8,1099.9,1100,1100.1,1100.2,1100.3,1100.4,1100.5,1100.6,1100.7,1100.8,1100.9,1101,1101.1,1101.2,1101.3,1101.4,1101.5,1101.6,1101.7,1101.8,1101.9,1102,1102.1,1102.2,1102.3,1102.4,1102.5,1102.6,1102.7,1102.8,1102.9,1103,1103.1,1103.2,1103.3,1103.4,1103.5,1103.6,1103.7,1103.8,1103.9,1104,1104.1,1104.2,1104.3,1104.4,1104.5,1104.6,1104.7,1104.8,1104.9,1105,1105.1,1105.2,1105.3,1105.4,1105.5,1105.6,1105.7,1105.8,1105.9,1106,1106.1,1106.2,1106.3,1106.4,1106.5,1106.6,1106.7,1106.8,1106.9,1107,1107.1,1107.2,1107.3,1107.4,1107.5,1107.6,1107.7,1107.8,1107.9,1108,1108.1,1108.2,1108.3,1108.4,1108.5,1108.6,1108.7,1108.8,1108.9,1109,1109.1,1109.2,1109.3,1109.4,1109.5,1109.6,1109.7,1109.8,1109.9,1110,1110.1,1110.2,1110.3,1110.4,1110.5,1110.6,1110.7,1110.8,1110.9,1111,1111.1,1111.2,1111.3,1111.4,1111.5,1111.6,1111.7,1111.8,1111.9,1112,1112.1,1112.2,1112.3,1112.4,1112.5,1112.6,1112.7,1112.8,1112.9,1113,1113.1,1113.2,1113.3,1113.4,1113.5,1113.6,1113.7,1113.8,1113.9,1114,1114.1,1114.2,1114.3,1114.4,1114.5,1114.6,1114.7,1114.8,1114.9,1115,1115.1,1115.2,1115.3,1115.4,1115.5,1115.6,1115.7,1115.8,1115.9,1116,1116.1,1116.2,1116.3,1116.4,1116.5,1116.6,1116.7,1116.8,1116.9,1117,1117.1,1117.2,1117.3,1117.4,1117.5,1117.6,1117.7,1117.8,1117.9,1118,1118.1,1118.2,1118.3,1118.4,1118.5,1118.6,1118.7,1118.8,1118.9,1119,1119.1,1119.2,1119.3,1119.4,1119.5,1119.6,1119.7,1119.8,1119.9,1120,1120.1,1120.2,1120.3,1120.4,1120.5,1120.6,1120.7,1120.8,1120.9,1121,1121.1,1121.2,1121.3,1121.4,1121.5,1121.6,1121.7,1121.8,1121.9,1122,1122.1,1122.2,1122.3,1122.4,1122.5,1122.6,1122.7,1122.8,1122.9,1123,1123.1,1123.2,1123.3,1123.4,1123.5,1123.6,1123.7,1123.8,1123.9,1124,1124.1,1124.2,1124.3,1124.4,1124.5,1124.6,1124.7,1124.8,1124.9,1125,1125.1,1125.2,1125.3,1125.4,1125.5,1125.6,1125.7,1125.8,1125.9,1126,1126.1,1126.2,1126.3,1126.4,1126.5,1126.6,1126.7,1126.8,1126.9,1127,1127.1,1127.2,1127.3,1127.4,1127.5,1127.6,1127.7,1127.8,1127.9,1128,1128.1,1128.2,1128.3,1128.4,1128.5,1128.6,1128.7,1128.8,1128.9,1129,1129.1,1129.2,1129.3,1129.4,1129.5,1129.6,1129.7,1129.8,1129.9,1130,1130.1,1130.2,1130.3,1130.4,1130.5,1130.6,1130.7,1130.8,1130.9,1131,1131.1,1131.2,1131.3,1131.4,1131.5,1131.6,1131.7,1131.8,1131.9,1132,1132.1,1132.2,1132.3,1132.4,1132.5,1132.6,1132.7,1132.8,1132.9,1133,1133.1,1133.2,1133.3,1133.4,1133.5,1133.6,1133.7,1133.8,1133.9,1134,1134.1,1134.2,1134.3,1134.4,1134.5,1134.6,1134.7,1134.8,1134.9,1135,1135.1,1135.2,1135.3,1135.4,1135.5,1135.6,1135.7,1135.8,1135.9,1136,1136.1,1136.2,1136.3,1136.4,1136.5,1136.6,1136.7,1136.8,1136.9,1137,1137.1,1137.2,1137.3,1137.4,1137.5,1137.6,1137.7,1137.8,1137.9,1138,1138.1,1138.2,1138.3,1138.4,1138.5,1138.6,1138.7,1138.8,1138.9,1139,1139.1,1139.2,1139.3,1139.4,1139.5,1139.6,1139.7,1139.8,1139.9,1140,1140.1,1140.2,1140.3,1140.4,1140.5,1140.6,1140.7,1140.8,1140.9,1141,1141.1,1141.2,1141.3,1141.4,1141.5,1141.6,1141.7,1141.8,1141.9,1142,1142.1,1142.2,1142.3,1142.4,1142.5,1142.6,1142.7,1142.8,1142.9,1143,1143.1,1143.2,1143.3,1143.4,1143.5,1143.6,1143.7,1143.8,1143.9,1144,1144.1,1144.2,1144.3,1144.4,1144.5,1144.6,1144.7,1144.8,1144.9,1145,1145.1,1145.2,1145.3,1145.4,1145.5,1145.6,1145.7,1145.8,1145.9,1146,1146.1,1146.2,1146.3,1146.4,1146.5,1146.6,1146.7,1146.8,1146.9,1147,1147.1,1147.2,1147.3,1147.4,1147.5,1147.6,1147.7,1147.8,1147.9,1148,1148.1,1148.2,1148.3,1148.4,1148.5,1148.6,1148.7,1148.8,1148.9,1149,1149.1,1149.2,1149.3,1149.4,1149.5,1149.6,1149.7,1149.8,1149.9,1150,1150.1,1150.2,1150.3,1150.4,1150.5,1150.6,1150.7,1150.8,1150.9,1151,1151.1,1151.2,1151.3,1151.4,1151.5,1151.6,1151.7,1151.8,1151.9,1152,1152.1,1152.2,1152.3,1152.4,1152.5,1152.6,1152.7,1152.8,1152.9,1153,1153.1,1153.2,1153.3,1153.4,1153.5,1153.6,1153.7,1153.8,1153.9,1154,1154.1,1154.2,1154.3,1154.4,1154.5,1154.6,1154.7,1154.8,1154.9,1155,1155.1,1155.2,1155.3,1155.4,1155.5,1155.6,1155.7,1155.8,1155.9,1156,1156.1,1156.2,1156.3,1156.4,1156.5,1156.6,1156.7,1156.8,1156.9,1157,1157.1,1157.2,1157.3,1157.4,1157.5,1157.6,1157.7,1157.8,1157.9,1158,1158.1,1158.2,1158.3,1158.4,1158.5,1158.6,1158.7,1158.8,1158.9,1159,1159.1,1159.2,1159.3,1159.4,1159.5,1159.6,1159.7,1159.8,1159.9,1160,1160.1,1160.2,1160.3,1160.4,1160.5,1160.6,1160.7,1160.8,1160.9,1161,1161.1,1161.2,1161.3,1161.4,1161.5,1161.6,1161.7,1161.8,1161.9,1162,1162.1,1162.2,1162.3,1162.4,1162.5,1162.6,1162.7,1162.8,1162.9,1163,1163.1,1163.2,1163.3,1163.4,1163.5,1163.6,1163.7,1163.8,1163.9,1164,1164.1,1164.2,1164.3,1164.4,1164.5,1164.6,1164.7,1164.8,1164.9,1165,1165.1,1165.2,1165.3,1165.4,1165.5,1165.6,1165.7,1165.8,1165.9,1166,1166.1,1166.2,1166.3,1166.4,1166.5,1166.6,1166.7,1166.8,1166.9,1167,1167.1,1167.2,1167.3,1167.4,1167.5,1167.6,1167.7,1167.8,1167.9,1168,1168.1,1168.2,1168.3,1168.4,1168.5,1168.6,1168.7,1168.8,1168.9,1169,1169.1,1169.2,1169.3,1169.4,1169.5,1169.6,1169.7,1169.8,1169.9,1170,1170.1,1170.2,1170.3,1170.4,1170.5,1170.6,1170.7,1170.8,1170.9,1171,1171.1,1171.2,1171.3,1171.4,1171.5,1171.6,1171.7,1171.8,1171.9,1172,1172.1,1172.2,1172.3,1172.4,1172.5,1172.6,1172.7,1172.8,1172.9,1173,1173.1,1173.2,1173.3,1173.4,1173.5,1173.6,1173.7,1173.8,1173.9,1174,1174.1,1174.2,1174.3,1174.4,1174.5,1174.6,1174.7,1174.8,1174.9,1175,1175.1,1175.2,1175.3,1175.4,1175.5,1175.6,1175.7,1175.8,1175.9,1176,1176.1,1176.2,1176.3,1176.4,1176.5,1176.6,1176.7,1176.8,1176.9,1177,1177.1,1177.2,1177.3,1177.4,1177.5,1177.6,1177.7,1177.8,1177.9,1178,1178.1,1178.2,1178.3,1178.4,1178.5,1178.6,1178.7,1178.8,1178.9,1179,1179.1,1179.2,1179.3,1179.4,1179.5,1179.6,1179.7,1179.8,1179.9,1180,1180.1,1180.2,1180.3,1180.4,1180.5,1180.6,1180.7,1180.8,1180.9,1181,1181.1,1181.2,1181.3,1181.4,1181.5,1181.6,1181.7,1181.8,1181.9,1182,1182.1,1182.2,1182.3,1182.4,1182.5,1182.6,1182.7,1182.8,1182.9,1183,1183.1,1183.2,1183.3,1183.4,1183.5,1183.6,1183.7,1183.8,1183.9,1184,1184.1,1184.2,1184.3,1184.4,1184.5,1184.6,1184.7,1184.8,1184.9,1185,1185.1,1185.2,1185.3,1185.4,1185.5,1185.6,1185.7,1185.8,1185.9,1186,1186.1,1186.2,1186.3,1186.4,1186.5,1186.6,1186.7,1186.8,1186.9,1187,1187.1,1187.2,1187.3,1187.4,1187.5,1187.6,1187.7,1187.8,1187.9,1188,1188.1,1188.2,1188.3,1188.4,1188.5,1188.6,1188.7,1188.8,1188.9,1189,1189.1,1189.2,1189.3,1189.4,1189.5,1189.6,1189.7,1189.8,1189.9,1190,1190.1,1190.2,1190.3,1190.4,1190.5,1190.6,1190.7,1190.8,1190.9,1191,1191.1,1191.2,1191.3,1191.4,1191.5,1191.6,1191.7,1191.8,1191.9,1192,1192.1,1192.2,1192.3,1192.4,1192.5,1192.6,1192.7,1192.8,1192.9,1193,1193.1,1193.2,1193.3,1193.4,1193.5,1193.6,1193.7,1193.8,1193.9,1194,1194.1,1194.2,1194.3,1194.4,1194.5,1194.6,1194.7,1194.8,1194.9,1195,1195.1,1195.2,1195.3,1195.4,1195.5,1195.6,1195.7,1195.8,1195.9,1196,1196.1,1196.2,1196.3,1196.4,1196.5,1196.6,1196.7,1196.8,1196.9,1197,1197.1,1197.2,1197.3,1197.4,1197.5,1197.6,1197.7,1197.8,1197.9,1198,1198.1,1198.2,1198.3,1198.4,1198.5,1198.6,1198.7,1198.8,1198.9,1199,1199.1,1199.2,1199.3,1199.4,1199.5,1199.6,1199.7,1199.8,1199.9,1200,1200.1,1200.2,1200.3,1200.4,1200.5,1200.6,1200.7,1200.8,1200.9,1201,1201.1,1201.2,1201.3,1201.4,1201.5,1201.6,1201.7,1201.8,1201.9,1202,1202.1,1202.2,1202.3,1202.4,1202.5,1202.6,1202.7,1202.8,1202.9,1203,1203.1,1203.2,1203.3,1203.4,1203.5,1203.6,1203.7,1203.8,1203.9,1204,1204.1,1204.2,1204.3,1204.4,1204.5,1204.6,1204.7,1204.8,1204.9,1205,1205.1,1205.2,1205.3,1205.4,1205.5,1205.6,1205.7,1205.8,1205.9,1206,1206.1,1206.2,1206.3,1206.4,1206.5,1206.6,1206.7,1206.8,1206.9,1207,1207.1,1207.2,1207.3,1207.4,1207.5,1207.6,1207.7,1207.8,1207.9,1208,1208.1,1208.2,1208.3,1208.4,1208.5,1208.6,1208.7,1208.8,1208.9,1209,1209.1,1209.2,1209.3,1209.4,1209.5,1209.6,1209.7,1209.8,1209.9,1210,1210.1,1210.2,1210.3,1210.4,1210.5,1210.6,1210.7,1210.8,1210.9,1211,1211.1,1211.2,1211.3,1211.4,1211.5,1211.6,1211.7,1211.8,1211.9,1212,1212.1,1212.2,1212.3,1212.4,1212.5,1212.6,1212.7,1212.8,1212.9,1213,1213.1,1213.2,1213.3,1213.4,1213.5,1213.6,1213.7,1213.8,1213.9,1214,1214.1,1214.2,1214.3,1214.4,1214.5,1214.6,1214.7,1214.8,1214.9,1215,1215.1,1215.2,1215.3,1215.4,1215.5,1215.6,1215.7,1215.8,1215.9,1216,1216.1,1216.2,1216.3,1216.4,1216.5,1216.6,1216.7,1216.8,1216.9,1217,1217.1,1217.2,1217.3,1217.4,1217.5,1217.6,1217.7,1217.8,1217.9,1218,1218.1,1218.2,1218.3,1218.4,1218.5,1218.6,1218.7,1218.8,1218.9,1219,1219.1,1219.2,1219.3,1219.4,1219.5,1219.6,1219.7,1219.8,1219.9,1220,1220.1,1220.2,1220.3,1220.4,1220.5,1220.6,1220.7,1220.8,1220.9,1221,1221.1,1221.2,1221.3,1221.4,1221.5,1221.6,1221.7,1221.8,1221.9,1222,1222.1,1222.2,1222.3,1222.4,1222.5,1222.6,1222.7,1222.8,1222.9,1223,1223.1,1223.2,1223.3,1223.4,1223.5,1223.6,1223.7,1223.8,1223.9,1224,1224.1,1224.2,1224.3,1224.4,1224.5,1224.6,1224.7,1224.8,1224.9,1225,1225.1,1225.2,1225.3,1225.4,1225.5,1225.6,1225.7,1225.8,1225.9,1226,1226.1,1226.2,1226.3,1226.4,1226.5,1226.6,1226.7,1226.8,1226.9,1227,1227.1,1227.2,1227.3,1227.4,1227.5,1227.6,1227.7,1227.8,1227.9,1228,1228.1,1228.2,1228.3,1228.4,1228.5,1228.6,1228.7,1228.8,1228.9,1229,1229.1,1229.2,1229.3,1229.4,1229.5,1229.6,1229.7,1229.8,1229.9,1230,1230.1,1230.2,1230.3,1230.4,1230.5,1230.6,1230.7,1230.8,1230.9,1231,1231.1,1231.2,1231.3,1231.4,1231.5,1231.6,1231.7,1231.8,1231.9,1232,1232.1,1232.2,1232.3,1232.4,1232.5,1232.6,1232.7,1232.8,1232.9,1233,1233.1,1233.2,1233.3,1233.4,1233.5,1233.6,1233.7,1233.8,1233.9,1234,1234.1,1234.2,1234.3,1234.4,1234.5,1234.6,1234.7,1234.8,1234.9,1235,1235.1,1235.2,1235.3,1235.4,1235.5,1235.6,1235.7,1235.8,1235.9,1236,1236.1,1236.2,1236.3,1236.4,1236.5,1236.6,1236.7,1236.8,1236.9,1237,1237.1,1237.2,1237.3,1237.4,1237.5,1237.6,1237.7,1237.8,1237.9,1238,1238.1,1238.2,1238.3,1238.4,1238.5,1238.6,1238.7,1238.8,1238.9,1239,1239.1,1239.2,1239.3,1239.4,1239.5,1239.6,1239.7,1239.8,1239.9,1240,1240.1,1240.2,1240.3,1240.4,1240.5,1240.6,1240.7,1240.8,1240.9,1241,1241.1,1241.2,1241.3,1241.4,1241.5,1241.6,1241.7,1241.8,1241.9,1242,1242.1,1242.2,1242.3,1242.4,1242.5,1242.6,1242.7,1242.8,1242.9,1243,1243.1,1243.2,1243.3,1243.4,1243.5,1243.6,1243.7,1243.8,1243.9,1244,1244.1,1244.2,1244.3,1244.4,1244.5,1244.6,1244.7,1244.8,1244.9,1245,1245.1,1245.2,1245.3,1245.4,1245.5,1245.6,1245.7,1245.8,1245.9,1246,1246.1,1246.2,1246.3,1246.4,1246.5,1246.6,1246.7,1246.8,1246.9,1247,1247.1,1247.2,1247.3,1247.4,1247.5,1247.6,1247.7,1247.8,1247.9,1248,1248.1,1248.2,1248.3,1248.4,1248.5,1248.6,1248.7,1248.8,1248.9,1249,1249.1,1249.2,1249.3,1249.4,1249.5,1249.6,1249.7,1249.8,1249.9,1250,1250.1,1250.2,1250.3,1250.4,1250.5,1250.6,1250.7,1250.8,1250.9,1251,1251.1,1251.2,1251.3,1251.4,1251.5,1251.6,1251.7,1251.8,1251.9,1252,1252.1,1252.2,1252.3,1252.4,1252.5,1252.6,1252.7,1252.8,1252.9,1253,1253.1,1253.2,1253.3,1253.4,1253.5,1253.6,1253.7,1253.8,1253.9,1254,1254.1,1254.2,1254.3,1254.4,1254.5,1254.6,1254.7,1254.8,1254.9,1255,1255.1,1255.2,1255.3,1255.4,1255.5,1255.6,1255.7,1255.8,1255.9,1256,1256.1,1256.2,1256.3,1256.4,1256.5,1256.6,1256.7,1256.8,1256.9,1257,1257.1,1257.2,1257.3,1257.4,1257.5,1257.6,1257.7,1257.8,1257.9,1258,1258.1,1258.2,1258.3,1258.4,1258.5,1258.6,1258.7,1258.8,1258.9,1259,1259.1,1259.2,1259.3,1259.4,1259.5,1259.6,1259.7,1259.8,1259.9,1260,1260.1,1260.2,1260.3,1260.4,1260.5,1260.6,1260.7,1260.8,1260.9,1261,1261.1,1261.2,1261.3,1261.4,1261.5,1261.6,1261.7,1261.8,1261.9,1262,1262.1,1262.2,1262.3,1262.4,1262.5,1262.6,1262.7,1262.8,1262.9,1263,1263.1,1263.2,1263.3,1263.4,1263.5,1263.6,1263.7,1263.8,1263.9,1264,1264.1,1264.2,1264.3,1264.4,1264.5,1264.6,1264.7,1264.8,1264.9,1265,1265.1,1265.2,1265.3,1265.4,1265.5,1265.6,1265.7,1265.8,1265.9,1266,1266.1,1266.2,1266.3,1266.4,1266.5,1266.6,1266.7,1266.8,1266.9,1267,1267.1,1267.2,1267.3,1267.4,1267.5,1267.6,1267.7,1267.8,1267.9,1268,1268.1,1268.2,1268.3,1268.4,1268.5,1268.6,1268.7,1268.8,1268.9,1269,1269.1,1269.2,1269.3,1269.4,1269.5,1269.6,1269.7,1269.8,1269.9,1270,1270.1,1270.2,1270.3,1270.4,1270.5,1270.6,1270.7,1270.8,1270.9,1271,1271.1,1271.2,1271.3,1271.4,1271.5,1271.6,1271.7,1271.8,1271.9,1272,1272.1,1272.2,1272.3,1272.4,1272.5,1272.6,1272.7,1272.8,1272.9,1273,1273.1,1273.2,1273.3,1273.4,1273.5,1273.6,1273.7,1273.8,1273.9,1274,1274.1,1274.2,1274.3,1274.4,1274.5,1274.6,1274.7,1274.8,1274.9,1275,1275.1,1275.2,1275.3,1275.4,1275.5,1275.6,1275.7,1275.8,1275.9,1276,1276.1,1276.2,1276.3,1276.4,1276.5,1276.6,1276.7,1276.8,1276.9,1277,1277.1,1277.2,1277.3,1277.4,1277.5,1277.6,1277.7,1277.8,1277.9,1278,1278.1,1278.2,1278.3,1278.4,1278.5,1278.6,1278.7,1278.8,1278.9,1279,1279.1,1279.2,1279.3,1279.4,1279.5,1279.6,1279.7,1279.8,1279.9,1280,1280.1,1280.2,1280.3,1280.4,1280.5,1280.6,1280.7,1280.8,1280.9,1281,1281.1,1281.2,1281.3,1281.4,1281.5,1281.6,1281.7,1281.8,1281.9,1282,1282.1,1282.2,1282.3,1282.4,1282.5,1282.6,1282.7,1282.8,1282.9,1283,1283.1,1283.2,1283.3,1283.4,1283.5,1283.6,1283.7,1283.8,1283.9,1284,1284.1,1284.2,1284.3,1284.4,1284.5,1284.6,1284.7,1284.8,1284.9,1285,1285.1,1285.2,1285.3,1285.4,1285.5,1285.6,1285.7,1285.8,1285.9,1286,1286.1,1286.2,1286.3,1286.4,1286.5,1286.6,1286.7,1286.8,1286.9,1287,1287.1,1287.2,1287.3,1287.4,1287.5,1287.6,1287.7,1287.8,1287.9,1288,1288.1,1288.2,1288.3,1288.4,1288.5,1288.6,1288.7,1288.8,1288.9,1289,1289.1,1289.2,1289.3,1289.4,1289.5,1289.6,1289.7,1289.8,1289.9,1290,1290.1,1290.2,1290.3,1290.4,1290.5,1290.6,1290.7,1290.8,1290.9,1291,1291.1,1291.2,1291.3,1291.4,1291.5,1291.6,1291.7,1291.8,1291.9,1292,1292.1,1292.2,1292.3,1292.4,1292.5,1292.6,1292.7,1292.8,1292.9,1293,1293.1,1293.2,1293.3,1293.4,1293.5,1293.6,1293.7,1293.8,1293.9,1294,1294.1,1294.2,1294.3,1294.4,1294.5,1294.6,1294.7,1294.8,1294.9,1295,1295.1,1295.2,1295.3,1295.4,1295.5,1295.6,1295.7,1295.8,1295.9,1296,1296.1,1296.2,1296.3,1296.4,1296.5,1296.6,1296.7,1296.8,1296.9,1297,1297.1,1297.2,1297.3,1297.4,1297.5,1297.6,1297.7,1297.8,1297.9,1298,1298.1,1298.2,1298.3,1298.4,1298.5,1298.6,1298.7,1298.8,1298.9,1299,1299.1,1299.2,1299.3,1299.4,1299.5,1299.6,1299.7,1299.8,1299.9,1300,1300.1,1300.2,1300.3,1300.4,1300.5,1300.6,1300.7,1300.8,1300.9,1301,1301.1,1301.2,1301.3,1301.4,1301.5,1301.6,1301.7,1301.8,1301.9,1302,1302.1,1302.2,1302.3,1302.4,1302.5,1302.6,1302.7,1302.8,1302.9,1303,1303.1,1303.2,1303.3,1303.4,1303.5,1303.6,1303.7,1303.8,1303.9,1304,1304.1,1304.2,1304.3,1304.4,1304.5,1304.6,1304.7,1304.8,1304.9,1305,1305.1,1305.2,1305.3,1305.4,1305.5,1305.6,1305.7,1305.8,1305.9,1306,1306.1,1306.2,1306.3,1306.4,1306.5,1306.6,1306.7,1306.8,1306.9,1307,1307.1,1307.2,1307.3,1307.4,1307.5,1307.6,1307.7,1307.8,1307.9,1308,1308.1,1308.2,1308.3,1308.4,1308.5,1308.6,1308.7,1308.8,1308.9,1309,1309.1,1309.2,1309.3,1309.4,1309.5,1309.6,1309.7,1309.8,1309.9,1310,1310.1,1310.2,1310.3,1310.4,1310.5,1310.6,1310.7,1310.8,1310.9,1311,1311.1,1311.2,1311.3,1311.4,1311.5,1311.6,1311.7,1311.8,1311.9,1312,1312.1,1312.2,1312.3,1312.4,1312.5,1312.6,1312.7,1312.8,1312.9,1313,1313.1,1313.2,1313.3,1313.4,1313.5,1313.6,1313.7,1313.8,1313.9,1314,1314.1,1314.2,1314.3,1314.4,1314.5,1314.6,1314.7,1314.8,1314.9,1315,1315.1,1315.2,1315.3,1315.4,1315.5,1315.6,1315.7,1315.8,1315.9,1316,1316.1,1316.2,1316.3,1316.4,1316.5,1316.6,1316.7,1316.8,1316.9,1317,1317.1,1317.2,1317.3,1317.4,1317.5,1317.6,1317.7,1317.8,1317.9,1318,1318.1,1318.2,1318.3,1318.4,1318.5,1318.6,1318.7,1318.8,1318.9,1319,1319.1,1319.2,1319.3,1319.4,1319.5,1319.6,1319.7,1319.8,1319.9,1320,1320.1,1320.2,1320.3,1320.4,1320.5,1320.6,1320.7,1320.8,1320.9,1321,1321.1,1321.2,1321.3,1321.4,1321.5,1321.6,1321.7,1321.8,1321.9,1322,1322.1,1322.2,1322.3,1322.4,1322.5,1322.6,1322.7,1322.8,1322.9,1323,1323.1,1323.2,1323.3,1323.4,1323.5,1323.6,1323.7,1323.8,1323.9,1324,1324.1,1324.2,1324.3,1324.4,1324.5,1324.6,1324.7,1324.8,1324.9,1325,1325.1,1325.2,1325.3,1325.4,1325.5,1325.6,1325.7,1325.8,1325.9,1326,1326.1,1326.2,1326.3,1326.4,1326.5,1326.6,1326.7,1326.8,1326.9,1327,1327.1,1327.2,1327.3,1327.4,1327.5,1327.6,1327.7,1327.8,1327.9,1328,1328.1,1328.2,1328.3,1328.4,1328.5,1328.6,1328.7,1328.8,1328.9,1329,1329.1,1329.2,1329.3,1329.4,1329.5,1329.6,1329.7,1329.8,1329.9,1330,1330.1,1330.2,1330.3,1330.4,1330.5,1330.6,1330.7,1330.8,1330.9,1331,1331.1,1331.2,1331.3,1331.4,1331.5,1331.6,1331.7,1331.8,1331.9,1332,1332.1,1332.2,1332.3,1332.4,1332.5,1332.6,1332.7,1332.8,1332.9,1333,1333.1,1333.2,1333.3,1333.4,1333.5,1333.6,1333.7,1333.8,1333.9,1334,1334.1,1334.2,1334.3,1334.4,1334.5,1334.6,1334.7,1334.8,1334.9,1335,1335.1,1335.2,1335.3,1335.4,1335.5,1335.6,1335.7,1335.8,1335.9,1336,1336.1,1336.2,1336.3,1336.4,1336.5,1336.6,1336.7,1336.8,1336.9,1337,1337.1,1337.2,1337.3,1337.4,1337.5,1337.6,1337.7,1337.8,1337.9,1338,1338.1,1338.2,1338.3,1338.4,1338.5,1338.6,1338.7,1338.8,1338.9,1339,1339.1,1339.2,1339.3,1339.4,1339.5,1339.6,1339.7,1339.8,1339.9,1340,1340.1,1340.2,1340.3,1340.4,1340.5,1340.6,1340.7,1340.8,1340.9,1341,1341.1,1341.2,1341.3,1341.4,1341.5,1341.6,1341.7,1341.8,1341.9,1342,1342.1,1342.2,1342.3,1342.4,1342.5,1342.6,1342.7,1342.8,1342.9,1343,1343.1,1343.2,1343.3,1343.4,1343.5,1343.6,1343.7,1343.8,1343.9,1344,1344.1,1344.2,1344.3,1344.4,1344.5,1344.6,1344.7,1344.8,1344.9,1345,1345.1,1345.2,1345.3,1345.4,1345.5,1345.6,1345.7,1345.8,1345.9,1346,1346.1,1346.2,1346.3,1346.4,1346.5,1346.6,1346.7,1346.8,1346.9,1347,1347.1,1347.2,1347.3,1347.4,1347.5,1347.6,1347.7,1347.8,1347.9,1348,1348.1,1348.2,1348.3,1348.4,1348.5,1348.6,1348.7,1348.8,1348.9,1349,1349.1,1349.2,1349.3,1349.4,1349.5,1349.6,1349.7,1349.8,1349.9,1350,1350.1,1350.2,1350.3,1350.4,1350.5,1350.6,1350.7,1350.8,1350.9,1351,1351.1,1351.2,1351.3,1351.4,1351.5,1351.6,1351.7,1351.8,1351.9,1352,1352.1,1352.2,1352.3,1352.4,1352.5,1352.6,1352.7,1352.8,1352.9,1353,1353.1,1353.2,1353.3,1353.4,1353.5,1353.6,1353.7,1353.8,1353.9,1354,1354.1,1354.2,1354.3,1354.4,1354.5,1354.6,1354.7,1354.8,1354.9,1355,1355.1,1355.2,1355.3,1355.4,1355.5,1355.6,1355.7,1355.8,1355.9,1356,1356.1,1356.2,1356.3,1356.4,1356.5,1356.6,1356.7,1356.8,1356.9,1357,1357.1,1357.2,1357.3,1357.4,1357.5,1357.6,1357.7,1357.8,1357.9,1358,1358.1,1358.2,1358.3,1358.4,1358.5,1358.6,1358.7,1358.8,1358.9,1359,1359.1,1359.2,1359.3,1359.4,1359.5,1359.6,1359.7,1359.8,1359.9,1360,1360.1,1360.2,1360.3,1360.4,1360.5,1360.6,1360.7,1360.8,1360.9,1361,1361.1,1361.2,1361.3,1361.4,1361.5,1361.6,1361.7,1361.8,1361.9,1362,1362.1,1362.2,1362.3,1362.4,1362.5,1362.6,1362.7,1362.8,1362.9,1363,1363.1,1363.2,1363.3,1363.4,1363.5,1363.6,1363.7,1363.8,1363.9,1364,1364.1,1364.2,1364.3,1364.4,1364.5,1364.6,1364.7,1364.8,1364.9,1365,1365.1,1365.2,1365.3,1365.4,1365.5,1365.6,1365.7,1365.8,1365.9,1366,1366.1,1366.2,1366.3,1366.4,1366.5,1366.6,1366.7,1366.8,1366.9,1367,1367.1,1367.2,1367.3,1367.4,1367.5,1367.6,1367.7,1367.8,1367.9,1368,1368.1,1368.2,1368.3,1368.4,1368.5,1368.6,1368.7,1368.8,1368.9,1369,1369.1,1369.2,1369.3,1369.4,1369.5,1369.6,1369.7,1369.8,1369.9,1370,1370.1,1370.2,1370.3,1370.4,1370.5,1370.6,1370.7,1370.8,1370.9,1371,1371.1,1371.2,1371.3,1371.4,1371.5,1371.6,1371.7,1371.8,1371.9,1372,1372.1,1372.2,1372.3,1372.4,1372.5,1372.6,1372.7,1372.8,1372.9,1373,1373.1,1373.2,1373.3,1373.4,1373.5,1373.6,1373.7,1373.8,1373.9,1374,1374.1,1374.2,1374.3,1374.4,1374.5,1374.6,1374.7,1374.8,1374.9,1375,1375.1,1375.2,1375.3,1375.4,1375.5,1375.6,1375.7,1375.8,1375.9,1376,1376.1,1376.2,1376.3,1376.4,1376.5,1376.6,1376.7,1376.8,1376.9,1377,1377.1,1377.2,1377.3,1377.4,1377.5,1377.6,1377.7,1377.8,1377.9,1378,1378.1,1378.2,1378.3,1378.4,1378.5,1378.6,1378.7,1378.8,1378.9,1379,1379.1,1379.2,1379.3,1379.4,1379.5,1379.6,1379.7,1379.8,1379.9,1380,1380.1,1380.2,1380.3,1380.4,1380.5,1380.6,1380.7,1380.8,1380.9,1381,1381.1,1381.2,1381.3,1381.4,1381.5,1381.6,1381.7,1381.8,1381.9,1382,1382.1,1382.2,1382.3,1382.4,1382.5,1382.6,1382.7,1382.8,1382.9,1383,1383.1,1383.2,1383.3,1383.4,1383.5,1383.6,1383.7,1383.8,1383.9,1384,1384.1,1384.2,1384.3,1384.4,1384.5,1384.6,1384.7,1384.8,1384.9,1385,1385.1,1385.2,1385.3,1385.4,1385.5,1385.6,1385.7,1385.8,1385.9,1386,1386.1,1386.2,1386.3,1386.4,1386.5,1386.6,1386.7,1386.8,1386.9,1387,1387.1,1387.2,1387.3,1387.4,1387.5,1387.6,1387.7,1387.8,1387.9,1388,1388.1,1388.2,1388.3,1388.4,1388.5,1388.6,1388.7,1388.8,1388.9,1389,1389.1,1389.2,1389.3,1389.4,1389.5,1389.6,1389.7,1389.8,1389.9,1390,1390.1,1390.2,1390.3,1390.4,1390.5,1390.6,1390.7,1390.8,1390.9,1391,1391.1,1391.2,1391.3,1391.4,1391.5,1391.6,1391.7,1391.8,1391.9,1392,1392.1,1392.2,1392.3,1392.4,1392.5,1392.6,1392.7,1392.8,1392.9,1393,1393.1,1393.2,1393.3,1393.4,1393.5,1393.6,1393.7,1393.8,1393.9,1394,1394.1,1394.2,1394.3,1394.4,1394.5,1394.6,1394.7,1394.8,1394.9,1395,1395.1,1395.2,1395.3,1395.4,1395.5,1395.6,1395.7,1395.8,1395.9,1396,1396.1,1396.2,1396.3,1396.4,1396.5,1396.6,1396.7,1396.8,1396.9,1397,1397.1,1397.2,1397.3,1397.4,1397.5,1397.6,1397.7,1397.8,1397.9,1398,1398.1,1398.2,1398.3,1398.4,1398.5,1398.6,1398.7,1398.8,1398.9,1399,1399.1,1399.2,1399.3,1399.4,1399.5,1399.6,1399.7,1399.8,1399.9,1400,1400.1,1400.2,1400.3,1400.4,1400.5,1400.6,1400.7,1400.8,1400.9,1401,1401.1,1401.2,1401.3,1401.4,1401.5,1401.6,1401.7,1401.8,1401.9,1402,1402.1,1402.2,1402.3,1402.4,1402.5,1402.6,1402.7,1402.8,1402.9,1403,1403.1,1403.2,1403.3,1403.4,1403.5,1403.6,1403.7,1403.8,1403.9,1404,1404.1,1404.2,1404.3,1404.4,1404.5,1404.6,1404.7,1404.8,1404.9,1405,1405.1,1405.2,1405.3,1405.4,1405.5,1405.6,1405.7,1405.8,1405.9,1406,1406.1,1406.2,1406.3,1406.4,1406.5,1406.6,1406.7,1406.8,1406.9,1407,1407.1,1407.2,1407.3,1407.4,1407.5,1407.6,1407.7,1407.8,1407.9,1408,1408.1,1408.2,1408.3,1408.4,1408.5,1408.6,1408.7,1408.8,1408.9,1409,1409.1,1409.2,1409.3,1409.4,1409.5,1409.6,1409.7,1409.8,1409.9,1410,1410.1,1410.2,1410.3,1410.4,1410.5,1410.6,1410.7,1410.8,1410.9,1411,1411.1,1411.2,1411.3,1411.4,1411.5,1411.6,1411.7,1411.8,1411.9,1412,1412.1,1412.2,1412.3,1412.4,1412.5,1412.6,1412.7,1412.8,1412.9,1413,1413.1,1413.2,1413.3,1413.4,1413.5,1413.6,1413.7,1413.8,1413.9,1414,1414.1,1414.2,1414.3,1414.4,1414.5,1414.6,1414.7,1414.8,1414.9,1415,1415.1,1415.2,1415.3,1415.4,1415.5,1415.6,1415.7,1415.8,1415.9,1416,1416.1,1416.2,1416.3,1416.4,1416.5,1416.6,1416.7,1416.8,1416.9,1417,1417.1,1417.2,1417.3,1417.4,1417.5,1417.6,1417.7,1417.8,1417.9,1418,1418.1,1418.2,1418.3,1418.4,1418.5,1418.6,1418.7,1418.8,1418.9,1419,1419.1,1419.2,1419.3,1419.4,1419.5,1419.6,1419.7,1419.8,1419.9,1420,1420.1,1420.2,1420.3,1420.4,1420.5,1420.6,1420.7,1420.8,1420.9,1421,1421.1,1421.2,1421.3,1421.4,1421.5,1421.6,1421.7,1421.8,1421.9,1422,1422.1,1422.2,1422.3,1422.4,1422.5,1422.6,1422.7,1422.8,1422.9,1423,1423.1,1423.2,1423.3,1423.4,1423.5,1423.6,1423.7,1423.8,1423.9,1424,1424.1,1424.2,1424.3,1424.4,1424.5,1424.6,1424.7,1424.8,1424.9,1425,1425.1,1425.2,1425.3,1425.4,1425.5,1425.6,1425.7,1425.8,1425.9,1426,1426.1,1426.2,1426.3,1426.4,1426.5,1426.6,1426.7,1426.8,1426.9,1427,1427.1,1427.2,1427.3,1427.4,1427.5,1427.6,1427.7,1427.8,1427.9,1428,1428.1,1428.2,1428.3,1428.4,1428.5,1428.6,1428.7,1428.8,1428.9,1429,1429.1,1429.2,1429.3,1429.4,1429.5,1429.6,1429.7,1429.8,1429.9,1430,1430.1,1430.2,1430.3,1430.4,1430.5,1430.6,1430.7,1430.8,1430.9,1431,1431.1,1431.2,1431.3,1431.4,1431.5,1431.6,1431.7,1431.8,1431.9,1432,1432.1,1432.2,1432.3,1432.4,1432.5,1432.6,1432.7,1432.8,1432.9,1433,1433.1,1433.2,1433.3,1433.4,1433.5,1433.6,1433.7,1433.8,1433.9,1434,1434.1,1434.2,1434.3,1434.4,1434.5,1434.6,1434.7,1434.8,1434.9,1435,1435.1,1435.2,1435.3,1435.4,1435.5,1435.6,1435.7,1435.8,1435.9,1436,1436.1,1436.2,1436.3,1436.4,1436.5,1436.6,1436.7,1436.8,1436.9,1437,1437.1,1437.2,1437.3,1437.4,1437.5,1437.6,1437.7,1437.8,1437.9,1438,1438.1,1438.2,1438.3,1438.4,1438.5,1438.6,1438.7,1438.8,1438.9,1439,1439.1,1439.2,1439.3,1439.4,1439.5,1439.6,1439.7,1439.8,1439.9,1440,1440.1,1440.2,1440.3,1440.4,1440.5,1440.6,1440.7,1440.8,1440.9,1441,1441.1,1441.2,1441.3,1441.4,1441.5,1441.6,1441.7,1441.8,1441.9,1442,1442.1,1442.2,1442.3,1442.4,1442.5,1442.6,1442.7,1442.8,1442.9,1443,1443.1,1443.2,1443.3,1443.4,1443.5,1443.6,1443.7,1443.8,1443.9,1444,1444.1,1444.2,1444.3,1444.4,1444.5,1444.6,1444.7,1444.8,1444.9,1445,1445.1,1445.2,1445.3,1445.4,1445.5,1445.6,1445.7,1445.8,1445.9,1446,1446.1,1446.2,1446.3,1446.4,1446.5,1446.6,1446.7,1446.8,1446.9,1447,1447.1,1447.2,1447.3,1447.4,1447.5,1447.6,1447.7,1447.8,1447.9,1448,1448.1,1448.2,1448.3,1448.4,1448.5,1448.6,1448.7,1448.8,1448.9,1449,1449.1,1449.2,1449.3,1449.4,1449.5,1449.6,1449.7,1449.8,1449.9,1450,1450.1,1450.2,1450.3,1450.4,1450.5,1450.6,1450.7,1450.8,1450.9,1451,1451.1,1451.2,1451.3,1451.4,1451.5,1451.6,1451.7,1451.8,1451.9,1452,1452.1,1452.2,1452.3,1452.4,1452.5,1452.6,1452.7,1452.8,1452.9,1453,1453.1,1453.2,1453.3,1453.4,1453.5,1453.6,1453.7,1453.8,1453.9,1454,1454.1,1454.2,1454.3,1454.4,1454.5,1454.6,1454.7,1454.8,1454.9,1455,1455.1,1455.2,1455.3,1455.4,1455.5,1455.6,1455.7,1455.8,1455.9,1456,1456.1,1456.2,1456.3,1456.4,1456.5,1456.6,1456.7,1456.8,1456.9,1457,1457.1,1457.2,1457.3,1457.4,1457.5,1457.6,1457.7,1457.8,1457.9,1458,1458.1,1458.2,1458.3,1458.4,1458.5,1458.6,1458.7,1458.8,1458.9,1459,1459.1,1459.2,1459.3,1459.4,1459.5,1459.6,1459.7,1459.8,1459.9,1460,1460.1,1460.2,1460.3,1460.4,1460.5,1460.6,1460.7,1460.8,1460.9,1461,1461.1,1461.2,1461.3,1461.4,1461.5,1461.6,1461.7,1461.8,1461.9,1462,1462.1,1462.2,1462.3,1462.4,1462.5,1462.6,1462.7,1462.8,1462.9,1463,1463.1,1463.2,1463.3,1463.4,1463.5,1463.6,1463.7,1463.8,1463.9,1464,1464.1,1464.2,1464.3,1464.4,1464.5,1464.6,1464.7,1464.8,1464.9,1465,1465.1,1465.2,1465.3,1465.4,1465.5,1465.6,1465.7,1465.8,1465.9,1466,1466.1,1466.2,1466.3,1466.4,1466.5,1466.6,1466.7,1466.8,1466.9,1467,1467.1,1467.2,1467.3,1467.4,1467.5,1467.6,1467.7,1467.8,1467.9,1468,1468.1,1468.2,1468.3,1468.4,1468.5,1468.6,1468.7,1468.8,1468.9,1469,1469.1,1469.2,1469.3,1469.4,1469.5,1469.6,1469.7,1469.8,1469.9,1470,1470.1,1470.2,1470.3,1470.4,1470.5,1470.6,1470.7,1470.8,1470.9,1471,1471.1,1471.2,1471.3,1471.4,1471.5,1471.6,1471.7,1471.8,1471.9,1472,1472.1,1472.2,1472.3,1472.4,1472.5,1472.6,1472.7,1472.8,1472.9,1473,1473.1,1473.2,1473.3,1473.4,1473.5,1473.6,1473.7,1473.8,1473.9,1474,1474.1,1474.2,1474.3,1474.4,1474.5,1474.6,1474.7,1474.8,1474.9,1475,1475.1,1475.2,1475.3,1475.4,1475.5,1475.6,1475.7,1475.8,1475.9,1476,1476.1,1476.2,1476.3,1476.4,1476.5,1476.6,1476.7,1476.8,1476.9,1477,1477.1,1477.2,1477.3,1477.4,1477.5,1477.6,1477.7,1477.8,1477.9,1478,1478.1,1478.2,1478.3,1478.4,1478.5,1478.6,1478.7,1478.8,1478.9,1479,1479.1,1479.2,1479.3,1479.4,1479.5,1479.6,1479.7,1479.8,1479.9,1480,1480.1,1480.2,1480.3,1480.4,1480.5,1480.6,1480.7,1480.8,1480.9,1481,1481.1,1481.2,1481.3,1481.4,1481.5,1481.6,1481.7,1481.8,1481.9,1482,1482.1,1482.2,1482.3,1482.4,1482.5,1482.6,1482.7,1482.8,1482.9,1483,1483.1,1483.2,1483.3,1483.4,1483.5,1483.6,1483.7,1483.8,1483.9,1484,1484.1,1484.2,1484.3,1484.4,1484.5,1484.6,1484.7,1484.8,1484.9,1485,1485.1,1485.2,1485.3,1485.4,1485.5,1485.6,1485.7,1485.8,1485.9,1486,1486.1,1486.2,1486.3,1486.4,1486.5,1486.6,1486.7,1486.8,1486.9,1487,1487.1,1487.2,1487.3,1487.4,1487.5,1487.6,1487.7,1487.8,1487.9,1488,1488.1,1488.2,1488.3,1488.4,1488.5,1488.6,1488.7,1488.8,1488.9,1489,1489.1,1489.2,1489.3,1489.4,1489.5,1489.6,1489.7,1489.8,1489.9,1490,1490.1,1490.2,1490.3,1490.4,1490.5,1490.6,1490.7,1490.8,1490.9,1491,1491.1,1491.2,1491.3,1491.4,1491.5,1491.6,1491.7,1491.8,1491.9,1492,1492.1,1492.2,1492.3,1492.4,1492.5,1492.6,1492.7,1492.8,1492.9,1493,1493.1,1493.2,1493.3,1493.4,1493.5,1493.6,1493.7,1493.8,1493.9,1494,1494.1,1494.2,1494.3,1494.4,1494.5,1494.6,1494.7,1494.8,1494.9,1495,1495.1,1495.2,1495.3,1495.4,1495.5,1495.6,1495.7,1495.8,1495.9,1496,1496.1,1496.2,1496.3,1496.4,1496.5,1496.6,1496.7,1496.8,1496.9,1497,1497.1,1497.2,1497.3,1497.4,1497.5,1497.6,1497.7,1497.8,1497.9,1498,1498.1,1498.2,1498.3,1498.4,1498.5,1498.6,1498.7,1498.8,1498.9,1499,1499.1,1499.2,1499.3,1499.4,1499.5,1499.6,1499.7,1499.8,1499.9,1500,1500.1,1500.2,1500.3,1500.4,1500.5,1500.6,1500.7,1500.8,1500.9,1501,1501.1,1501.2,1501.3,1501.4,1501.5,1501.6,1501.7,1501.8,1501.9,1502,1502.1,1502.2,1502.3,1502.4,1502.5,1502.6,1502.7,1502.8,1502.9,1503,1503.1,1503.2,1503.3,1503.4,1503.5,1503.6,1503.7,1503.8,1503.9,1504,1504.1,1504.2,1504.3,1504.4,1504.5,1504.6,1504.7,1504.8,1504.9,1505,1505.1,1505.2,1505.3,1505.4,1505.5,1505.6,1505.7,1505.8,1505.9,1506,1506.1,1506.2,1506.3,1506.4,1506.5,1506.6,1506.7,1506.8,1506.9,1507,1507.1,1507.2,1507.3,1507.4,1507.5,1507.6,1507.7,1507.8,1507.9,1508,1508.1,1508.2,1508.3,1508.4,1508.5,1508.6,1508.7,1508.8,1508.9,1509,1509.1,1509.2,1509.3,1509.4,1509.5,1509.6,1509.7,1509.8,1509.9,1510,1510.1,1510.2,1510.3,1510.4,1510.5,1510.6,1510.7,1510.8,1510.9,1511,1511.1,1511.2,1511.3,1511.4,1511.5,1511.6,1511.7,1511.8,1511.9,1512,1512.1,1512.2,1512.3,1512.4,1512.5,1512.6,1512.7,1512.8,1512.9,1513,1513.1,1513.2,1513.3,1513.4,1513.5,1513.6,1513.7,1513.8,1513.9,1514,1514.1,1514.2,1514.3,1514.4,1514.5,1514.6,1514.7,1514.8,1514.9,1515,1515.1,1515.2,1515.3,1515.4,1515.5,1515.6,1515.7,1515.8,1515.9,1516,1516.1,1516.2,1516.3,1516.4,1516.5,1516.6,1516.7,1516.8,1516.9,1517,1517.1,1517.2,1517.3,1517.4,1517.5,1517.6,1517.7,1517.8,1517.9,1518,1518.1,1518.2,1518.3,1518.4,1518.5,1518.6,1518.7,1518.8,1518.9,1519,1519.1,1519.2,1519.3,1519.4,1519.5,1519.6,1519.7,1519.8,1519.9,1520,1520.1,1520.2,1520.3,1520.4,1520.5,1520.6,1520.7,1520.8,1520.9,1521,1521.1,1521.2,1521.3,1521.4,1521.5,1521.6,1521.7,1521.8,1521.9,1522,1522.1,1522.2,1522.3,1522.4,1522.5,1522.6,1522.7,1522.8,1522.9,1523,1523.1,1523.2,1523.3,1523.4,1523.5,1523.6,1523.7,1523.8,1523.9,1524,1524.1,1524.2,1524.3,1524.4,1524.5,1524.6,1524.7,1524.8,1524.9,1525,1525.1,1525.2,1525.3,1525.4,1525.5,1525.6,1525.7,1525.8,1525.9,1526,1526.1,1526.2,1526.3,1526.4,1526.5,1526.6,1526.7,1526.8,1526.9,1527,1527.1,1527.2,1527.3,1527.4,1527.5,1527.6,1527.7,1527.8,1527.9,1528,1528.1,1528.2,1528.3,1528.4,1528.5,1528.6,1528.7,1528.8,1528.9,1529,1529.1,1529.2,1529.3,1529.4,1529.5,1529.6,1529.7,1529.8,1529.9,1530,1530.1,1530.2,1530.3,1530.4,1530.5,1530.6,1530.7,1530.8,1530.9,1531,1531.1,1531.2,1531.3,1531.4,1531.5,1531.6,1531.7,1531.8,1531.9,1532,1532.1,1532.2,1532.3,1532.4,1532.5,1532.6,1532.7,1532.8,1532.9,1533,1533.1,1533.2,1533.3,1533.4,1533.5,1533.6,1533.7,1533.8,1533.9,1534,1534.1,1534.2,1534.3,1534.4,1534.5,1534.6,1534.7,1534.8,1534.9,1535,1535.1,1535.2,1535.3,1535.4,1535.5,1535.6,1535.7,1535.8,1535.9,1536,1536.1,1536.2,1536.3,1536.4,1536.5,1536.6,1536.7,1536.8,1536.9,1537,1537.1,1537.2,1537.3,1537.4,1537.5,1537.6,1537.7,1537.8,1537.9,1538,1538.1,1538.2,1538.3,1538.4,1538.5,1538.6,1538.7,1538.8,1538.9,1539,1539.1,1539.2,1539.3,1539.4,1539.5,1539.6,1539.7,1539.8,1539.9,1540,1540.1,1540.2,1540.3,1540.4,1540.5,1540.6,1540.7,1540.8,1540.9,1541,1541.1,1541.2,1541.3,1541.4,1541.5,1541.6,1541.7,1541.8,1541.9,1542,1542.1,1542.2,1542.3,1542.4,1542.5,1542.6,1542.7,1542.8,1542.9,1543,1543.1,1543.2,1543.3,1543.4,1543.5,1543.6,1543.7,1543.8,1543.9,1544,1544.1,1544.2,1544.3,1544.4,1544.5,1544.6,1544.7,1544.8,1544.9,1545,1545.1,1545.2,1545.3,1545.4,1545.5,1545.6,1545.7,1545.8,1545.9,1546,1546.1,1546.2,1546.3,1546.4,1546.5,1546.6,1546.7,1546.8,1546.9,1547,1547.1,1547.2,1547.3,1547.4,1547.5,1547.6,1547.7,1547.8,1547.9,1548,1548.1,1548.2,1548.3,1548.4,1548.5,1548.6,1548.7,1548.8,1548.9,1549,1549.1,1549.2,1549.3,1549.4,1549.5,1549.6,1549.7,1549.8,1549.9,1550,1550.1,1550.2,1550.3,1550.4,1550.5,1550.6,1550.7,1550.8,1550.9,1551,1551.1,1551.2,1551.3,1551.4,1551.5,1551.6,1551.7,1551.8,1551.9,1552,1552.1,1552.2,1552.3,1552.4,1552.5,1552.6,1552.7,1552.8,1552.9,1553,1553.1,1553.2,1553.3,1553.4,1553.5,1553.6,1553.7,1553.8,1553.9,1554,1554.1,1554.2,1554.3,1554.4,1554.5,1554.6,1554.7,1554.8,1554.9,1555,1555.1,1555.2,1555.3,1555.4,1555.5,1555.6,1555.7,1555.8,1555.9,1556,1556.1,1556.2,1556.3,1556.4,1556.5,1556.6,1556.7,1556.8,1556.9,1557,1557.1,1557.2,1557.3,1557.4,1557.5,1557.6,1557.7,1557.8,1557.9,1558,1558.1,1558.2,1558.3,1558.4,1558.5,1558.6,1558.7,1558.8,1558.9,1559,1559.1,1559.2,1559.3,1559.4,1559.5,1559.6,1559.7,1559.8,1559.9,1560,1560.1,1560.2,1560.3,1560.4,1560.5,1560.6,1560.7,1560.8,1560.9,1561,1561.1,1561.2,1561.3,1561.4,1561.5,1561.6,1561.7,1561.8,1561.9,1562,1562.1,1562.2,1562.3,1562.4,1562.5,1562.6,1562.7,1562.8,1562.9,1563,1563.1,1563.2,1563.3,1563.4,1563.5,1563.6,1563.7,1563.8,1563.9,1564,1564.1,1564.2,1564.3,1564.4,1564.5,1564.6,1564.7,1564.8,1564.9,1565,1565.1,1565.2,1565.3,1565.4,1565.5,1565.6,1565.7,1565.8,1565.9,1566,1566.1,1566.2,1566.3,1566.4,1566.5,1566.6,1566.7,1566.8,1566.9,1567,1567.1,1567.2,1567.3,1567.4,1567.5,1567.6,1567.7,1567.8,1567.9,1568,1568.1,1568.2,1568.3,1568.4,1568.5,1568.6,1568.7,1568.8,1568.9,1569,1569.1,1569.2,1569.3,1569.4,1569.5,1569.6,1569.7,1569.8,1569.9,1570,1570.1,1570.2,1570.3,1570.4,1570.5,1570.6,1570.7,1570.8,1570.9,1571,1571.1,1571.2,1571.3,1571.4,1571.5,1571.6,1571.7,1571.8,1571.9,1572,1572.1,1572.2,1572.3,1572.4,1572.5,1572.6,1572.7,1572.8,1572.9,1573,1573.1,1573.2,1573.3,1573.4,1573.5,1573.6,1573.7,1573.8,1573.9,1574,1574.1,1574.2,1574.3,1574.4,1574.5,1574.6,1574.7,1574.8,1574.9,1575,1575.1,1575.2,1575.3,1575.4,1575.5,1575.6,1575.7,1575.8,1575.9,1576,1576.1,1576.2,1576.3,1576.4,1576.5,1576.6,1576.7,1576.8,1576.9,1577,1577.1,1577.2,1577.3,1577.4,1577.5,1577.6,1577.7,1577.8,1577.9,1578,1578.1,1578.2,1578.3,1578.4,1578.5,1578.6,1578.7,1578.8,1578.9,1579,1579.1,1579.2,1579.3,1579.4,1579.5,1579.6,1579.7,1579.8,1579.9,1580,1580.1,1580.2,1580.3,1580.4,1580.5,1580.6,1580.7,1580.8,1580.9,1581,1581.1,1581.2,1581.3,1581.4,1581.5,1581.6,1581.7,1581.8,1581.9,1582,1582.1,1582.2,1582.3,1582.4,1582.5,1582.6,1582.7,1582.8,1582.9,1583,1583.1,1583.2,1583.3,1583.4,1583.5,1583.6,1583.7,1583.8,1583.9,1584,1584.1,1584.2,1584.3,1584.4,1584.5,1584.6,1584.7,1584.8,1584.9,1585,1585.1,1585.2,1585.3,1585.4,1585.5,1585.6,1585.7,1585.8,1585.9,1586,1586.1,1586.2,1586.3,1586.4,1586.5,1586.6,1586.7,1586.8,1586.9,1587,1587.1,1587.2,1587.3,1587.4,1587.5,1587.6,1587.7,1587.8,1587.9,1588,1588.1,1588.2,1588.3,1588.4,1588.5,1588.6,1588.7,1588.8,1588.9,1589,1589.1,1589.2,1589.3,1589.4,1589.5,1589.6,1589.7,1589.8,1589.9,1590,1590.1,1590.2,1590.3,1590.4,1590.5,1590.6,1590.7,1590.8,1590.9,1591,1591.1,1591.2,1591.3,1591.4,1591.5,1591.6,1591.7,1591.8,1591.9,1592,1592.1,1592.2,1592.3,1592.4,1592.5,1592.6,1592.7,1592.8,1592.9,1593,1593.1,1593.2,1593.3,1593.4,1593.5,1593.6,1593.7,1593.8,1593.9,1594,1594.1,1594.2,1594.3,1594.4,1594.5,1594.6,1594.7,1594.8,1594.9,1595,1595.1,1595.2,1595.3,1595.4,1595.5,1595.6,1595.7,1595.8,1595.9,1596,1596.1,1596.2,1596.3,1596.4,1596.5,1596.6,1596.7,1596.8,1596.9,1597,1597.1,1597.2,1597.3,1597.4,1597.5,1597.6,1597.7,1597.8,1597.9,1598,1598.1,1598.2,1598.3,1598.4,1598.5,1598.6,1598.7,1598.8,1598.9,1599,1599.1,1599.2,1599.3,1599.4,1599.5,1599.6,1599.7,1599.8,1599.9,1600,1600.1,1600.2,1600.3,1600.4,1600.5,1600.6,1600.7,1600.8,1600.9,1601,1601.1,1601.2,1601.3,1601.4,1601.5,1601.6,1601.7,1601.8,1601.9,1602,1602.1,1602.2,1602.3,1602.4,1602.5,1602.6,1602.7,1602.8,1602.9,1603,1603.1,1603.2,1603.3,1603.4,1603.5,1603.6,1603.7,1603.8,1603.9,1604,1604.1,1604.2,1604.3,1604.4,1604.5,1604.6,1604.7,1604.8,1604.9,1605,1605.1,1605.2,1605.3,1605.4,1605.5,1605.6,1605.7,1605.8,1605.9,1606,1606.1,1606.2,1606.3,1606.4,1606.5,1606.6,1606.7,1606.8,1606.9,1607,1607.1,1607.2,1607.3,1607.4,1607.5,1607.6,1607.7,1607.8,1607.9,1608,1608.1,1608.2,1608.3,1608.4,1608.5,1608.6,1608.7,1608.8,1608.9,1609,1609.1,1609.2,1609.3,1609.4,1609.5,1609.6,1609.7,1609.8,1609.9,1610,1610.1,1610.2,1610.3,1610.4,1610.5,1610.6,1610.7,1610.8,1610.9,1611,1611.1,1611.2,1611.3,1611.4,1611.5,1611.6,1611.7,1611.8,1611.9,1612,1612.1,1612.2,1612.3,1612.4,1612.5,1612.6,1612.7,1612.8,1612.9,1613,1613.1,1613.2,1613.3,1613.4,1613.5,1613.6,1613.7,1613.8,1613.9,1614,1614.1,1614.2,1614.3,1614.4,1614.5,1614.6,1614.7,1614.8,1614.9,1615,1615.1,1615.2,1615.3,1615.4,1615.5,1615.6,1615.7,1615.8,1615.9,1616,1616.1,1616.2,1616.3,1616.4,1616.5,1616.6,1616.7,1616.8,1616.9,1617,1617.1,1617.2,1617.3,1617.4,1617.5,1617.6,1617.7,1617.8,1617.9,1618,1618.1,1618.2,1618.3,1618.4,1618.5,1618.6,1618.7,1618.8,1618.9,1619,1619.1,1619.2,1619.3,1619.4,1619.5,1619.6,1619.7,1619.8,1619.9,1620,1620.1,1620.2,1620.3,1620.4,1620.5,1620.6,1620.7,1620.8,1620.9,1621,1621.1,1621.2,1621.3,1621.4,1621.5,1621.6,1621.7,1621.8,1621.9,1622,1622.1,1622.2,1622.3,1622.4,1622.5,1622.6,1622.7,1622.8,1622.9,1623,1623.1,1623.2,1623.3,1623.4,1623.5,1623.6,1623.7,1623.8,1623.9,1624,1624.1,1624.2,1624.3,1624.4,1624.5,1624.6,1624.7,1624.8,1624.9,1625,1625.1,1625.2,1625.3,1625.4,1625.5,1625.6,1625.7,1625.8,1625.9,1626,1626.1,1626.2,1626.3,1626.4,1626.5,1626.6,1626.7,1626.8,1626.9,1627,1627.1,1627.2,1627.3,1627.4,1627.5,1627.6,1627.7,1627.8,1627.9,1628,1628.1,1628.2,1628.3,1628.4,1628.5,1628.6,1628.7,1628.8,1628.9,1629,1629.1,1629.2,1629.3,1629.4,1629.5,1629.6,1629.7,1629.8,1629.9,1630,1630.1,1630.2,1630.3,1630.4,1630.5,1630.6,1630.7,1630.8,1630.9,1631,1631.1,1631.2,1631.3,1631.4,1631.5,1631.6,1631.7,1631.8,1631.9,1632,1632.1,1632.2,1632.3,1632.4,1632.5,1632.6,1632.7,1632.8,1632.9,1633,1633.1,1633.2,1633.3,1633.4,1633.5,1633.6,1633.7,1633.8,1633.9,1634,1634.1,1634.2,1634.3,1634.4,1634.5,1634.6,1634.7,1634.8,1634.9,1635,1635.1,1635.2,1635.3,1635.4,1635.5,1635.6,1635.7,1635.8,1635.9,1636,1636.1,1636.2,1636.3,1636.4,1636.5,1636.6,1636.7,1636.8,1636.9,1637,1637.1,1637.2,1637.3,1637.4,1637.5,1637.6,1637.7,1637.8,1637.9,1638,1638.1,1638.2,1638.3,1638.4,1638.5,1638.6,1638.7,1638.8,1638.9,1639,1639.1,1639.2,1639.3,1639.4,1639.5,1639.6,1639.7,1639.8,1639.9,1640,1640.1,1640.2,1640.3,1640.4,1640.5,1640.6,1640.7,1640.8,1640.9,1641,1641.1,1641.2,1641.3,1641.4,1641.5,1641.6,1641.7,1641.8,1641.9,1642,1642.1,1642.2,1642.3,1642.4,1642.5,1642.6,1642.7,1642.8,1642.9,1643,1643.1,1643.2,1643.3,1643.4,1643.5,1643.6,1643.7,1643.8,1643.9,1644,1644.1,1644.2,1644.3,1644.4,1644.5,1644.6,1644.7,1644.8,1644.9,1645,1645.1,1645.2,1645.3,1645.4,1645.5,1645.6,1645.7,1645.8,1645.9,1646,1646.1,1646.2,1646.3,1646.4,1646.5,1646.6,1646.7,1646.8,1646.9,1647,1647.1,1647.2,1647.3,1647.4,1647.5,1647.6,1647.7,1647.8,1647.9,1648,1648.1,1648.2,1648.3,1648.4,1648.5,1648.6,1648.7,1648.8,1648.9,1649,1649.1,1649.2,1649.3,1649.4,1649.5,1649.6,1649.7,1649.8,1649.9,1650,1650.1,1650.2,1650.3,1650.4,1650.5,1650.6,1650.7,1650.8,1650.9,1651,1651.1,1651.2,1651.3,1651.4,1651.5,1651.6,1651.7,1651.8,1651.9,1652,1652.1,1652.2,1652.3,1652.4,1652.5,1652.6,1652.7,1652.8,1652.9,1653,1653.1,1653.2,1653.3,1653.4,1653.5,1653.6,1653.7,1653.8,1653.9,1654,1654.1,1654.2,1654.3,1654.4,1654.5,1654.6,1654.7,1654.8,1654.9,1655,1655.1,1655.2,1655.3,1655.4,1655.5,1655.6,1655.7,1655.8,1655.9,1656,1656.1,1656.2,1656.3,1656.4,1656.5,1656.6,1656.7,1656.8,1656.9,1657,1657.1,1657.2,1657.3,1657.4,1657.5,1657.6,1657.7,1657.8,1657.9,1658,1658.1,1658.2,1658.3,1658.4,1658.5,1658.6,1658.7,1658.8,1658.9,1659,1659.1,1659.2,1659.3,1659.4,1659.5,1659.6,1659.7,1659.8,1659.9,1660,1660.1,1660.2,1660.3,1660.4,1660.5,1660.6,1660.7,1660.8,1660.9,1661,1661.1,1661.2,1661.3,1661.4,1661.5,1661.6,1661.7,1661.8,1661.9,1662,1662.1,1662.2,1662.3,1662.4,1662.5,1662.6,1662.7,1662.8,1662.9,1663,1663.1,1663.2,1663.3,1663.4,1663.5,1663.6,1663.7,1663.8,1663.9,1664,1664.1,1664.2,1664.3,1664.4,1664.5,1664.6,1664.7,1664.8,1664.9,1665,1665.1,1665.2,1665.3,1665.4,1665.5,1665.6,1665.7,1665.8,1665.9,1666,1666.1,1666.2,1666.3,1666.4,1666.5,1666.6,1666.7,1666.8,1666.9,1667,1667.1,1667.2,1667.3,1667.4,1667.5,1667.6,1667.7,1667.8,1667.9,1668,1668.1,1668.2,1668.3,1668.4,1668.5,1668.6,1668.7,1668.8,1668.9,1669,1669.1,1669.2,1669.3,1669.4,1669.5,1669.6,1669.7,1669.8,1669.9,1670,1670.1,1670.2,1670.3,1670.4,1670.5,1670.6,1670.7,1670.8,1670.9,1671,1671.1,1671.2,1671.3,1671.4,1671.5,1671.6,1671.7,1671.8,1671.9,1672,1672.1,1672.2,1672.3,1672.4,1672.5,1672.6,1672.7,1672.8,1672.9,1673,1673.1,1673.2,1673.3,1673.4,1673.5,1673.6,1673.7,1673.8,1673.9,1674,1674.1,1674.2,1674.3,1674.4,1674.5,1674.6,1674.7,1674.8,1674.9,1675,1675.1,1675.2,1675.3,1675.4,1675.5,1675.6,1675.7,1675.8,1675.9,1676,1676.1,1676.2,1676.3,1676.4,1676.5,1676.6,1676.7,1676.8,1676.9,1677,1677.1,1677.2,1677.3,1677.4,1677.5,1677.6,1677.7,1677.8,1677.9,1678,1678.1,1678.2,1678.3,1678.4,1678.5,1678.6,1678.7,1678.8,1678.9,1679,1679.1,1679.2,1679.3,1679.4,1679.5,1679.6,1679.7,1679.8,1679.9]},"ngrid":{"data_size":8,"data_type":"double","data_dim":[200,200,36,2],"coordinates":[-0.1,-0.090000000000000011,-0.08,-0.07,-0.060000000000000005,-0.05,-0.040000000000000008,-0.03,-0.020000000000000004,-0.010000000000000009,0,0.009999999999999995,0.01999999999999999,0.03,0.040000000000000008,0.049999999999999989,0.06,0.07,0.079999999999999988,0.09,0.1,0.10999999999999999,0.12,0.13,0.14,0.15,0.16,0.16999999999999998,0.18,0.19,0.2,0.21,0.22,0.23,0.24,0.25,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200]},"reverse_correlation":{"method":"Hartley","dimension_labels":""}} \ No newline at end of file diff --git a/tests/+did2/fixtures/ndi_writer_outputs/speedtuning_calc.mock.1.json b/tests/+did2/fixtures/ndi_writer_outputs/speedtuning_calc.mock.1.json new file mode 100644 index 00000000..48f56d33 --- /dev/null +++ b/tests/+did2/fixtures/ndi_writer_outputs/speedtuning_calc.mock.1.json @@ -0,0 +1,2425 @@ +{ + "app": { + "name": "ndi.calc.vis.speed_tuning", + "version": "6b1ac939f905baf95d213fc4b3d60a60c094f288", + "url": "https://github.com/VH-Lab/NDIcalc-vis-matlab", + "os": "MACA64", + "os_version": "26.6.2", + "interpreter": "MATLAB", + "interpreter_version": "24.2" + }, + "base": { + "id": "412696f9b35ae4a1_408d67668360c3fa", + "session_id": "412696f9abd9edc3_40dbbdf6582271b2", + "name": "", + "datestamp": "2026-08-27T00:24:26.165Z" + }, + "calculator": {}, + "depends_on": [ + { + "name": "element_id", + "value": "412696f9b35624a3_c0d37615ecff28bc" + }, + { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b35a3db9_40d59f452ac5bd37" + } + ], + "document_class": { + "definition": "$NDICALCDOCUMENTPATH/calc/speedtuning_calc.json", + "validation": "$NDICALCSCHEMAPATH/calc/speedtuning_calc_v2_schema.json", + "class_name": "speedtuning_calc", + "property_list_name": "speedtuning_calc", + "class_version": 2, + "superclasses": [ + { + "definition": "$NDICALCDOCUMENTPATH/vision/speed_tuning.json" + }, + { + "definition": "$NDIDOCUMENTPATH/app.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/calculator.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + }, + { + "definition": "$NDIDOCUMENTPATH/base.json" + } + ] + }, + "speed_tuning": { + "properties": { + "response_units": [], + "response_type": "mean" + }, + "tuning_curve": { + "spatial_frequency": [ + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.4, + 0.4, + 0.4, + 0.4, + 0.4, + 0.4, + 0.4, + 0.8, + 0.8, + 0.8, + 0.8, + 0.8, + 0.8, + 0.8, + 1.2, + 1.2, + 1.2, + 1.2, + 1.2, + 1.2, + 1.2 + ], + "temporal_frequency": [ + 0.5, + 1, + 2, + 4, + 8, + 16, + 32, + 0.5, + 1, + 2, + 4, + 8, + 16, + 32, + 0.5, + 1, + 2, + 4, + 8, + 16, + 32, + 0.5, + 1, + 2, + 4, + 8, + 16, + 32, + 0.5, + 1, + 2, + 4, + 8, + 16, + 32, + 0.5, + 1, + 2, + 4, + 8, + 16, + 32, + 0.5, + 1, + 2, + 4, + 8, + 16, + 32 + ], + "mean": [ + 1.0341991708298761, + 1.7530782400507519, + 1.8407545932302025, + 1.1944520217765473, + 0.47904270077429079, + 0.2, + 0, + 1.5936302202115378, + 2.881665048193971, + 3.2325324786210614, + 2.23924294304111, + 0.95840916500819251, + 0.25404445513238344, + 0, + 1.8050669423232795, + 3.3721722900170961, + 3.8921399924396072, + 2.7817316863560722, + 1.2297184952824023, + 0.33588545228167088, + 0, + 1.9129058271185564, + 3.9320798546349778, + 5.002740043723688, + 3.9318876825665741, + 1.9139605449084975, + 0.57548217802698431, + 0.2, + 1.2284415751960889, + 2.7833647211398991, + 3.894541639512036, + 3.3747710007033143, + 1.8073615725815604, + 0.59828594405372493, + 0.2, + 0.47960778595581893, + 1.1949670447125544, + 1.8412893663977556, + 1.7533566174030213, + 1.0336333309616765, + 0.37727034049110941, + 0, + 0.21917759085116145, + 0.57748422782102637, + 0.94264895662103976, + 0.9489744852158809, + 0.5921702359326666, + 0.22839102563035857, + 0 + ], + "stddev": [ + 0.0012503366181880768, + 0.0018592485454280887, + 0.0011934762689928499, + 0.0014464469812889942, + 0.00056002624993953839, + 0, + 0, + 0.0014538537962630548, + 0.0030575358829443722, + 0.0027826503887139861, + 0.0016710932351359474, + 0.0011603625130600654, + 0.00022830256374132773, + 0, + 0.0015799851434641376, + 0.0029543740377244456, + 0.00091560491371479738, + 0.0013303327928467978, + 0.00066324795279031849, + 0.00076053136639792432, + 0, + 0.0019376347604902714, + 0.0033915481646636689, + 0.0054223527842804931, + 0.0042165846173310506, + 0.0017027733216142976, + 0.00052384319933074133, + 0, + 0.00084016136911134313, + 0.0032228831701585714, + 0.004260382177311204, + 0.0012976557193171291, + 0.0011533007755305761, + 0.00063678473435755225, + 0, + 0.0003988999551882618, + 0.00050259064566138538, + 0.0010560446113659341, + 0.0012258275810425059, + 0.0015249944301954374, + 0.00039425925202460013, + 0, + 9.8055535338735332E-5, + 0.00057354245826719266, + 0.00078931437029917755, + 0.00075939123423579427, + 0.0006825677504224821, + 0.000161346880111381, + 0 + ], + "stderr": [ + 0.00055916753460514786, + 0.0008314812269289624, + 0.00053373881340016728, + 0.0006468707552023114, + 0.00025045135280981907, + 0, + 0, + 0.00065018318355806407, + 0.0013673716155816911, + 0.0012444390853561373, + 0.00074733561410080364, + 0.00051892989154895869, + 0.0001021000103926175, + 0, + 0.00070659083684511382, + 0.0013212362358624777, + 0.00040947096551982327, + 0.0005949429115005171, + 0.0002966135016753447, + 0.00034011996685731161, + 0, + 0.000866536608004554, + 0.0015167464490305226, + 0.0024249498847272871, + 0.0018857139674464333, + 0.00076150337948053626, + 0.00023426980065090197, + 0, + 0.00037573158668045104, + 0.0014413171704029174, + 0.0019053008317192828, + 0.00058032927995689749, + 0.00051577178651791877, + 0.00028477879061152651, + 0, + 0.00017839348320451465, + 0.0002247653697108735, + 0.00047227750765731512, + 0.00054820675998103511, + 0.00068199824224511119, + 0.0001763180976570455, + 0, + 4.3851768517509014E-5, + 0.00025649598493355581, + 0.00035299211752128041, + 0.00033961008425374028, + 0.00030525357783875613, + 7.215651837731135E-5, + 0 + ], + "individual": [ + [ + 1.0340385278471933, + 1.7545596588439898, + 1.8413715329505671, + 1.1954395217272298, + 0.47817775750559005, + 0.2, + 0, + 1.5930696178811115, + 2.88366608329512, + 3.236527766085032, + 2.2400212459447206, + 0.95758840183907512, + 0.25431009339639238, + 0, + 1.806981827731112, + 3.3672532645219455, + 3.8909754219309445, + 2.7834366577178904, + 1.2295050804672478, + 0.3351401162250266, + 0, + 1.9143688467227551, + 3.9337232809903551, + 4.9978844808490868, + 3.9312984948888166, + 1.9142388458293236, + 0.57566987792020585, + 0.2, + 1.227755084507667, + 2.7798410514062839, + 3.8930746852813636, + 3.3746946072034136, + 1.8066087566526605, + 0.59749453157788668, + 0.2, + 0.47953038581918694, + 1.1952152587943252, + 1.8410884216802303, + 1.7543205364915924, + 1.0351852846236038, + 0.37722690616347887, + 0, + 0.21928002918610934, + 0.57731588702634529, + 0.94266889059990744, + 0.94812034202030515, + 0.59203012192786486, + 0.22858374456792768, + 0 + ], + [ + 1.035053685057475, + 1.7517175359690724, + 1.8390605834253844, + 1.1920341088797546, + 0.47959482605008857, + 0.2, + 0, + 1.594017801881731, + 2.8778951149227217, + 3.2320934045023182, + 2.2386425068789495, + 0.95940652604235188, + 0.25409146452295928, + 0, + 1.8054204867806674, + 3.3729899859304959, + 3.8933613534542642, + 2.7817386518390697, + 1.2290361019868581, + 0.33533923717379693, + 0, + 1.9104561261978232, + 3.9307683181276292, + 4.9962429178275611, + 3.9273703109519063, + 1.913045510936676, + 0.57589287722675153, + 0.2, + 1.2290736119564063, + 2.7865916124459575, + 3.8973580140948578, + 3.3730179352245075, + 1.8085576334762463, + 0.59868127588801012, + 0.2, + 0.47959292118438462, + 1.1948490486955723, + 1.8417128992837919, + 1.7520866333425824, + 1.0331487764810363, + 0.37723749199601131, + 0, + 0.21914686224049015, + 0.57757480545452766, + 0.9438798627950683, + 0.950024122174594, + 0.591452833440856, + 0.22835839172046729, + 0 + ], + [ + 1.0357409861808613, + 1.7506133236639236, + 1.8401390473164947, + 1.1956007657982093, + 0.47892333038508395, + 0.2, + 0, + 1.5944467394529431, + 2.8787947797222486, + 3.2290119656488749, + 2.2375429563261009, + 0.957097897873018, + 0.25382952903518319, + 0, + 1.806024476680371, + 3.3749850030805959, + 3.8921537374833752, + 2.7797196444857017, + 1.2306769262678976, + 0.33637457841414808, + 0, + 1.911898101369873, + 3.9367569213537839, + 5.0080930975376345, + 3.9384956576216434, + 1.9152471626685261, + 0.5756346345798693, + 0.2, + 1.2296004094298312, + 2.7865109998707407, + 3.8916860990987203, + 3.3756899562127822, + 1.8084376564399951, + 0.598092012529628, + 0.2, + 0.48022859647877147, + 1.194250120176648, + 1.8420207380496074, + 1.7520473905215306, + 1.0318053519397468, + 0.37793666954914973, + 0, + 0.21908461183500755, + 0.57748286135349292, + 0.94202594337290879, + 0.94939820552362664, + 0.592576420582163, + 0.2281996615768381, + 0 + ], + [ + 1.0336385635896232, + 1.753558369127898, + 1.8410370362850312, + 1.1948995279124239, + 0.47904210886103227, + 0.2, + 0, + 1.5914221358451877, + 2.883686143917819, + 3.2336152682248636, + 2.2382496438900121, + 0.95815363125811359, + 0.25420144222675384, + 0, + 1.8036454514377172, + 3.3720084385311071, + 3.8926060756775835, + 2.782080260271997, + 1.2300920505688833, + 0.33695695119774788, + 0, + 1.9152944169996455, + 3.9314687386492841, + 5.0073469561257111, + 3.9294678288046816, + 1.9115360253299731, + 0.57564924748807145, + 0.2, + 1.2278862337044887, + 2.7834826848275505, + 3.8901356688773707, + 3.3741313598834868, + 1.8073128866221182, + 0.5980207307100367, + 0.2, + 0.47911418040376658, + 1.1956130756382228, + 1.8395373888724469, + 1.7546385810490175, + 1.0327831066229545, + 0.37695628879902521, + 0, + 0.21909296164449027, + 0.57672500347089928, + 0.94189271268737207, + 0.94889307755697838, + 0.591667046425267, + 0.22852669912223061, + 0 + ], + [ + 1.0325240914742286, + 1.7549423126488748, + 1.8421647661735359, + 1.1942861845651189, + 0.4794754810696592, + 0.2, + 0, + 1.5951948059967154, + 2.884283119111946, + 3.23141398864422, + 2.2417583621657671, + 0.95979936802840327, + 0.25378974648062841, + 0, + 1.8032624689865293, + 3.3736247580213377, + 3.8916033736518694, + 2.781683217465702, + 1.2292823171211245, + 0.33561637839763475, + 0, + 1.9125116443026837, + 3.9276820140538353, + 5.0041327662784445, + 3.9328061205658202, + 1.9157351797779893, + 0.574564252920023, + 0.2, + 1.2278925363820512, + 2.7803972571489628, + 3.9004537302078677, + 3.3763211449923802, + 1.8058909297167816, + 0.59914116956306307, + 0.2, + 0.47957284589298521, + 1.1949077202580038, + 1.8420873841027003, + 1.7536899456103843, + 1.0352441351410415, + 0.37699434594788217, + 0, + 0.21928348934971, + 0.57832258179986629, + 0.94277737364994241, + 0.9484366788039, + 0.59312475728718206, + 0.22828663116432896, + 0 + ] + ], + "control_stddev": 0, + "control_stderr": 0 + }, + "significance": { + "visual_response_anova_p": 0, + "across_stimuli_anova_p": 0 + }, + "fit": { + "Priebe_fit_parameters": [ + 5.0004377023872, + 0.00175506056504544, + 0.19910958023307315, + 0.43415205097084725, + 0.4344436311528283, + 0.20002908238661457, + 1.9962562212887371 + ], + "Priebe_fit_spatial_frequencies": [ + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60 + ], + "Priebe_fit_temporal_frequencies": [ + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996 + ], + "Priebe_fit_values": [ + 7.5053921371371684E-7, + 1.8512515810154783E-5, + 0.00026504051364546787, + 0.0022115868277073473, + 0.010799835921670274, + 0.030989514857721258, + 0.052462199214578079, + 0.052607621418640824, + 0.031372165805652476, + 0.011169767925638719, + 0.002383662811264343, + 0.00030607713815053287, + 2.3739633810201602E-5, + 1.1164344407182223E-6, + 2.326231517656277E-6, + 6.3461301771575E-5, + 0.0010041258746863178, + 0.00925301241733466, + 0.049862375348100528, + 0.15776952559069485, + 0.29429691593812568, + 0.32493728039731068, + 0.21320148816738818, + 0.083458453400633834, + 0.019567684231369172, + 0.0027585716249703823, + 0.0002347355261771088, + 1.2102761072142586E-5, + 4.52076530268892E-6, + 0.00013642483049240589, + 0.0023859752325552071, + 0.024284249016102974, + 0.14442793279110541, + 0.50398019992669152, + 1.0360150810815925, + 1.2596510436155586, + 0.90948185443572283, + 0.39148253603297517, + 0.1008572876286077, + 0.01561233317207633, + 0.0014577072206954564, + 8.2409720874116439E-5, + 5.5085726733822333E-6, + 0.00018391090747147198, + 0.0035557758420283673, + 0.039977669136552894, + 0.26244651710307132, + 1.0101244591580238, + 2.2886359729207952, + 3.0647143765420473, + 2.4352593231965849, + 1.1528152297836376, + 0.32639074357505421, + 0.055484421653057232, + 0.0056850995494748327, + 0.00035245596635455941, + 4.2084571106505E-6, + 0.00015546758765264118, + 0.0033233973227029048, + 0.041281016390538966, + 0.29917876492550827, + 1.2702710129900874, + 3.1725374079764235, + 4.6795921233390665, + 4.09291793914192, + 2.1310891980104336, + 0.66316335230983181, + 0.1238179307831606, + 0.01392424728470372, + 0.00094678944272525573, + 2.01582122897749E-6, + 8.2409867161838311E-5, + 0.0019480422117456942, + 0.026736974386461394, + 0.21394886137602157, + 1.0022290588027665, + 2.759594497832047, + 4.4842871870535435, + 4.3176433857016745, + 2.4730192908058886, + 0.84595013172316758, + 0.17349811077829966, + 0.021417109111526247, + 0.0015974001652338582, + 6.0536175652383549E-7, + 2.7391398621255249E-5, + 0.00071609627092418429, + 0.010861553217150722, + 0.095977044482713464, + 0.49610738809282418, + 1.5061955445171036, + 2.6967173043579669, + 2.85874657426484, + 1.8014684605465618, + 0.67748545467309806, + 0.15264907522050217, + 0.020686880612925489, + 0.0016926823641128783, + 1.1397257487044761E-7, + 5.708650878814528E-6, + 0.00016507835809132876, + 0.0027674400327373076, + 0.027007963747811531, + 0.15406765893474952, + 0.515827015087766, + 1.01770793860775, + 1.1879794658463623, + 0.82373670541711019, + 0.34062424131704538, + 0.084327902679584246, + 0.01254768935351114, + 0.0011264924172989345, + 1.3452304511014884E-8, + 7.4597739445884345E-7, + 2.38640011486992E-5, + 0.00044224192539803089, + 0.0047672976984993983, + 0.030016726294678598, + 0.11084152611441456, + 0.24101594425763695, + 0.30983881039916294, + 0.23642972059933526, + 0.10751297327988443, + 0.02924930658656685, + 0.00477921578087575, + 0.00047082742694034467, + 9.9538820974431837E-10, + 6.1119440185697271E-8, + 2.163313550491501E-6, + 4.4322657968434924E-5, + 0.000527834207441965, + 0.0036687673478546529, + 0.014943957879219569, + 0.035817261427147369, + 0.050716060000588668, + 0.04259483091243476, + 0.021303222380762071, + 0.0063696629117137461, + 0.0011430446001199858, + 0.00012358493013129988, + 4.6171743473053004E-11, + 3.139664043966832E-9, + 1.2297234344144141E-7, + 2.7858943267109921E-6, + 3.6656962285130468E-5, + 0.000281300796256116, + 0.0012641031649182706, + 0.0033400431302175611, + 0.0052098736644024118, + 0.00481661768506, + 0.0026498310676176026, + 0.00087089010176174837, + 0.00017166149073983417, + 2.0371788107129669E-5, + 1.3425687211045206E-12, + 1.0111735006631837E-10, + 4.3832461704228107E-9, + 1.0981589118119044E-7, + 1.5967536985054183E-6, + 1.3530212407254435E-5, + 6.7087584276984288E-5, + 0.00019544022651642889, + 0.00033586909466994824, + 0.00034185910773311997, + 0.0002069039908653, + 7.4755939688047045E-5, + 1.6187330917025406E-5, + 2.1088332012889938E-6, + 2.4471563536122561E-14, + 2.0417164611900168E-12, + 9.7965544678704341E-11, + 2.7146646385029936E-9, + 4.3624526607692866E-8, + 4.0823481284597011E-7, + 2.2337446763479389E-6, + 7.1757466615250812E-6, + 1.3588240285931839E-5, + 1.5228638370033945E-5, + 1.014113726325742E-5, + 4.0285884371202593E-6, + 9.5842857493645326E-7, + 1.3708638283646054E-7, + 2.7960202423779804E-16, + 2.5845264214116378E-14, + 1.3728673234471716E-12, + 4.208296632819548E-11, + 7.4752146374228194E-10, + 7.7263809869880286E-9, + 4.6660095470032972E-8, + 1.6531054363796044E-7, + 3.4498154005463345E-7, + 4.2576813615943717E-7, + 3.1200451092157988E-7, + 1.3629324486012959E-7, + 3.5630003999192377E-8, + 5.5959645753663078E-9 + ], + "Priebe_fit_speed_tuning_index": 0.19910958023307315, + "Priebe_fit_spatial_frequency_preference": 0.20002908238661457, + "Priebe_fit_temporal_frequency_preference": 1.9962562212887371, + "sse": 0.036331903298028871, + "r_squared": 0.99956253993387512 + }, + "fit_no_speed": { + "Priebe_fit_parameters": [ + 4.9748713835591269, + 0.0018083020565228187, + 0, + 0.42986627888116719, + 0.43913977358744993, + 0.200097209613033, + 1.9533180646930004 + ], + "Priebe_fit_spatial_frequencies": [ + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60 + ], + "Priebe_fit_temporal_frequencies": [ + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996 + ], + "Priebe_fit_values": [ + 4.8411645842568627E-8, + 1.7116137059674631E-6, + 3.5401635856331742E-5, + 0.00043013115931873436, + 0.0030826403419174872, + 0.013084578536743776, + 0.033026943447309338, + 0.049772795431081804, + 0.04496353558430493, + 0.024445000272456895, + 0.0080294161508047968, + 0.0015996767666762038, + 0.00019404919995984416, + 1.4387552287873354E-5, + 2.9820027947703997E-7, + 1.0542993872508024E-5, + 0.00021806277234681187, + 0.0026494705909759727, + 0.0189880801507206, + 0.080596825589957038, + 0.20343542539923468, + 0.30658452629700206, + 0.27696102134428391, + 0.15057339584710547, + 0.049458639518139717, + 0.0098534980704234141, + 0.0011952811075354943, + 8.8622727828472465E-5, + 1.1629284104174628E-6, + 4.1115813595811289E-5, + 0.000850406289562275, + 0.010332467253937423, + 0.074050158186579021, + 0.31431338170573, + 0.7933622205084081, + 1.1956254918688465, + 1.0800990557901342, + 0.5872096437693517, + 0.19287995684346451, + 0.038426901772811113, + 0.0046613851631057985, + 0.00034561298259400255, + 2.8713401951781291E-6, + 0.00010151741687411748, + 0.002099704280658087, + 0.025511483145331547, + 0.18283429466143716, + 0.77605864530392965, + 1.9588590429773882, + 2.9520712560029905, + 2.6668295364379779, + 1.44985593098195, + 0.47623221512840441, + 0.094878331845746275, + 0.011509240348877504, + 0.00085333924256035792, + 4.4885188809875754E-6, + 0.00015869343631025063, + 0.0032822869000514194, + 0.0398799048514393, + 0.28580910929956727, + 1.2131456551369149, + 3.06211566792482, + 4.6147187967631655, + 4.1688249782379474, + 2.2664349323193256, + 0.74445281437846877, + 0.14831512636551855, + 0.017991404396634342, + 0.0013339517583294191, + 4.442303208780897E-6, + 0.00015705946215790125, + 0.0032484910980322746, + 0.039469284631469967, + 0.28286629888497339, + 1.200654598861258, + 3.030586841218267, + 4.5672037173144462, + 4.125901008485398, + 2.2430987680550931, + 0.73678761609036791, + 0.14678801164345845, + 0.017806157354084376, + 0.0013202168317674281, + 2.7835567196426394E-6, + 9.8413795890591938E-5, + 0.0020355114902452891, + 0.024731538414183678, + 0.17724462964737392, + 0.75233274712629616, + 1.8989722155072595, + 2.8618196462092285, + 2.5852984222348065, + 1.4055304996516362, + 0.46167270069812533, + 0.091977682965332971, + 0.011157376393399709, + 0.00082725069873383183, + 1.104278681983149E-6, + 3.9042228257153558E-5, + 0.00080751792472840236, + 0.0098113720660725646, + 0.07031560184651868, + 0.298461679816622, + 0.75335074743229768, + 1.1353267582760556, + 1.0256266430974994, + 0.55759502103542125, + 0.18315248180032709, + 0.036488925768992972, + 0.0044262984875246651, + 0.00032818275439514471, + 2.7736013304381135E-7, + 9.8061818999202639E-6, + 0.00020282314844265905, + 0.0024643086079513279, + 0.017661071431879453, + 0.07496420294354729, + 0.18921805423358279, + 0.28515843496872922, + 0.25760521037310119, + 0.14005036205282032, + 0.046002152851682181, + 0.0091648724828576229, + 0.0011117472042353491, + 8.2429203702685274E-5, + 4.4105842414566135E-8, + 1.5593802498578096E-6, + 3.2252961970655777E-5, + 0.00039187465743676845, + 0.0028084657477570082, + 0.011920816757177516, + 0.030089478218915368, + 0.045345929344245042, + 0.040964412185699565, + 0.022270825770872089, + 0.007315267995226216, + 0.0014573991476080708, + 0.00017679017693250586, + 1.3107902094546994E-5, + 4.4405313617302112E-9, + 1.569968177746325E-7, + 3.2471954121907835E-6, + 3.9453542001514243E-5, + 0.00028275347547021253, + 0.0012001757084726689, + 0.0030293780681777765, + 0.0045653820527282894, + 0.0041242553609035634, + 0.0022422040907334913, + 0.00073649374264157428, + 0.00014672946410780344, + 1.7799055230274025E-5, + 1.3196902530559596E-6, + 2.8304826530517169E-10, + 1.0007288162069673E-8, + 2.0698266798624509E-7, + 2.514846921230193E-6, + 1.8023266636645936E-5, + 7.6501577102302108E-5, + 0.00019309855900154037, + 0.00029100649566780748, + 0.00026288820649708378, + 0.00014292253035568883, + 4.6945570086365828E-5, + 9.3528267006065776E-6, + 1.1345470387663243E-6, + 8.411967092201496E-8, + 1.1422805692082496E-11, + 4.0385800653734168E-10, + 8.3530729131534527E-9, + 1.0149013877747129E-7, + 7.2735394617250846E-7, + 3.0873273483421621E-6, + 7.7927604202682309E-6, + 1.1743971126490686E-5, + 1.0609218531399986E-5, + 5.7678371266950366E-6, + 1.894553653676108E-6, + 3.7744630569476922E-7, + 4.5786220800126269E-8, + 3.3947661003614079E-9, + 2.9185814422583097E-13, + 1.031876506491141E-11, + 2.1342500474343322E-10, + 2.5931215464293391E-9, + 1.8584240916606338E-8, + 7.8882689139092421E-8, + 1.9910875278500418E-7, + 3.0006407455526203E-7, + 2.7107060346889194E-7, + 1.4737099495274381E-7, + 4.84067512311303E-8, + 9.64393348661502E-9, + 1.1698598220139002E-9, + 8.6737896173703563E-11 + ], + "Priebe_fit_speed_tuning_index": 0, + "Priebe_fit_spatial_frequency_preference": 0.200097209613033, + "Priebe_fit_temporal_frequency_preference": 1.9533180646930004, + "sse": 1.9451852659223632, + "r_squared": 0.97657868710936169, + "partial_r2": 0.98132213731281726, + "Priebe_fit_nested_F_test_p_value": 0 + }, + "fit_fullspeed": { + "Priebe_fit_parameters": [ + 4.17360172687855, + -0.13278633405812751, + 1, + 0.42482958801211351, + 0.6504702119624276, + 0.18115868896407877, + 1.9555011554717396 + ], + "Priebe_fit_spatial_frequencies": [ + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.019526617507028776, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.038128879126580278, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.074452803867646689, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.145381142344937, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.28388019593044905, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 0.55432200037542667, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 1.0824033677062019, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 2.1135676549518827, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 4.12708271734732, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 8.0587965641510149, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 15.736103807513459, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 30.72728801002145, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60 + ], + "Priebe_fit_temporal_frequencies": [ + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996, + 0.01, + 0.020596013734846576, + 0.0424195781765989, + 0.087367421475162937, + 0.17994206126805856, + 0.37060891653535383, + 0.76330663352187589, + 1.5721073907916066, + 3.2379145413397739, + 6.6688132365693438, + 13.735096901550886, + 28.288824443379095, + 58.263701677849937, + 119.99999999999996 + ], + "Priebe_fit_values": [ + 0.022010005558046625, + 0.032681405105956372, + 0.044078429971391643, + 0.05153190893254727, + 0.048810545131804446, + 0.033928709639712312, + 0.014934185643081922, + 0.003325252165820386, + 0.00026372765354956029, + 4.234259286927375E-6, + 5.3491856913139436E-9, + 1.0159557165266734E-13, + 1.3441825231736031E-21, + -1.2175951498700183E-26, + 0.0864997050440329, + 0.1363225591407432, + 0.20124018403511737, + 0.26905648960848633, + 0.31051645871741645, + 0.28858826408649851, + 0.1950734144555071, + 0.082379592558536024, + 0.017236230818816416, + 0.0012429324924440059, + 1.7190800305895488E-5, + 1.7060142722227517E-8, + 2.1564865089043946E-13, + 1.3816936466345822E-21, + 0.20543739283087048, + 0.336713960138028, + 0.52858432004385825, + 0.77561990939024794, + 1.0277056868541476, + 1.1704120738731929, + 1.06672371850117, + 0.70062096330983792, + 0.2835131429603947, + 0.055633219252248338, + 0.0036362969568369315, + 4.3099517931901328E-5, + 3.3295102279713567E-8, + 2.7542514277267277E-13, + 0.29888906815137761, + 0.50196180069489682, + 0.82065146604883543, + 1.2830833607324492, + 1.8710977061059479, + 2.4563596996787762, + 2.7594604616196023, + 2.4649721249329879, + 1.5717739927584518, + 0.60868464912095088, + 0.11179471610456305, + 0.0066017905098140631, + 6.6693851526534147E-5, + 3.9726938278461541E-8, + 0.26904244827628626, + 0.45797398213406265, + 0.7679819692612373, + 1.252287168710227, + 1.9497749100332091, + 2.8252058170651413, + 3.6736924001493878, + 4.06935702887395, + 3.5607107958643471, + 2.2023462864621317, + 0.81512753006816, + 0.13983688909168532, + 0.0074356749878479855, + 6.3665823131470151E-5, + 0.15092907619347221, + 0.25834165986182017, + 0.43942889806523422, + 0.73572912013110758, + 1.1964457116574834, + 1.854803535210422, + 2.6699459272579267, + 3.4378795908085604, + 3.7534293318685479, + 3.2151645626532561, + 1.9272373448427074, + 0.68080002595710909, + 0.10885562365248737, + 0.0051939261092701985, + 0.053049187543368348, + 0.09077621547598233, + 0.15534795032514653, + 0.2640289441127634, + 0.44133538985775916, + 0.71568545014111262, + 1.1045614350621473, + 1.5792323557229149, + 2.01300433468527, + 2.1652880148822229, + 1.8146297565863829, + 1.0531817929798633, + 0.35458412435121184, + 0.052725512497563486, + 0.011727941363045901, + 0.01997766371228521, + 0.034191929514361286, + 0.058499566595794895, + 0.099340791827460917, + 0.16576800120860749, + 0.26803261595490252, + 0.41177019991527963, + 0.58461914854000474, + 0.73748597257662174, + 0.78121715694445026, + 0.64012819435936763, + 0.35937953876652795, + 0.11515102105352593, + 0.0016353731275312445, + 0.002764645208289574, + 0.0047116597057973979, + 0.0080654109190417683, + 0.013795402302354999, + 0.023405333643405617, + 0.038986205607954634, + 0.062847124502318219, + 0.096092045137356974, + 0.13544890796445508, + 0.16904656216179592, + 0.17627055237575359, + 0.14112860346882983, + 0.076568010006612064, + 0.00014412116623401306, + 0.00024127012362630318, + 0.0004081578352882519, + 0.00069593014247142418, + 0.0011914606104701105, + 0.0020372729395675346, + 0.0034531157207386858, + 0.0057411205985313735, + 0.0092259571026141411, + 0.01403723951342719, + 0.019640171167124219, + 0.024243239158328465, + 0.024872668585722908, + 0.019444939027211543, + 8.038122129718402E-6, + 1.3305321216813204E-5, + 2.2292919193238935E-5, + 3.7738744602110916E-5, + 6.4375279382674838E-5, + 0.00011022550627956442, + 0.0001884064109787502, + 0.00031901741464104676, + 0.00052936453534672642, + 0.00084793300650800056, + 0.001283606322952126, + 0.0017822717207842344, + 0.002175176694285034, + 0.0021947338151107293, + 2.8398723548902067E-7, + 4.6432633482865442E-7, + 7.6931385993888517E-7, + 1.2900503636509444E-6, + 2.1853288028747417E-6, + 3.7293536716087715E-6, + 6.386054672873798E-6, + 1.091119204722695E-5, + 1.8455356707357674E-5, + 3.0562047821790754E-5, + 4.8790073598193883E-5, + 7.3473682685901888E-5, + 0.00010121685130734778, + 0.00012209715906201515, + 6.359342044920259E-9, + 1.026390719608863E-8, + 1.6798683158887974E-8, + 2.7858779662909929E-8, + 4.6754382990767774E-8, + 7.9252979134761875E-8, + 1.3530323390296841E-7, + 2.3170219369290183E-7, + 3.9571015658253185E-7, + 6.6854872966476669E-7, + 1.1047814726195287E-6, + 1.7575870742979987E-6, + 2.63254250637672E-6, + 3.5972707501252764E-6, + 9.028876044813514E-11, + 1.4379896549306967E-10, + 2.323333024354373E-10, + 3.8063629774398968E-10, + 6.3183065405792224E-10, + 1.061239817940892E-9, + 1.800044698615943E-9, + 3.0742707853707267E-9, + 5.2646981906592136E-9, + 8.986882019295543E-9, + 1.5165054854058296E-8, + 2.5005379229754034E-8, + 3.9638132088573279E-8, + 5.9041344178170326E-8 + ], + "Priebe_fit_speed_tuning_index": 1, + "Priebe_fit_spatial_frequency_preference": 0.18115868896407877, + "Priebe_fit_temporal_frequency_preference": 1.9555011554717396, + "sse": 18.744911953287936, + "r_squared": 0.7742989032166846, + "partial_r2": 0.99806177252853645, + "Priebe_fit_nested_F_test_p_value": 0 + } + }, + "speedtuning_calc": { + "input_parameters": { + "min_xi": 0, + "max_xi": 1 + }, + "depends_on": { + "name": "stimulus_tuningcurve_id", + "value": "412696f9b35a3db9_40d59f452ac5bd37" + } + } +} \ No newline at end of file From 11a0828cee421dacc5147ab8e3d0a59e9fee958f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 05:19:56 +0000 Subject: [PATCH 18/45] testRawV1RoundTripDaq: the depends_on version case keeps one struct array The renamed path quarantines a depends_on that jsondecode gives as a cell (entries with different keys); the carry-049 case is a version on one entry of the writer's struct array, as testRawV1RoundTripIngested states it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- tests/+did2/+unittest/testRawV1RoundTripDaq.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/+did2/+unittest/testRawV1RoundTripDaq.m b/tests/+did2/+unittest/testRawV1RoundTripDaq.m index 2e0ac366..491e0218 100644 --- a/tests/+did2/+unittest/testRawV1RoundTripDaq.m +++ b/tests/+did2/+unittest/testRawV1RoundTripDaq.m @@ -434,8 +434,11 @@ function verifyRoundTrip(testCase, r, label, expectedLost) end function v1 = setDep(v1, k, field, value) -d = num2cell(reshape(v1.depends_on, 1, [])); -d{k}.(field) = value; +% one entry gains FIELD; the others hold it empty (one struct array, as +% jsondecode gives entries that share their keys) +d = reshape(v1.depends_on, 1, []); +[d.(field)] = deal([]); +d(k).(field) = value; v1.depends_on = d; end From 10818664f776bd53a6a730d3195e8c95d0e3ea15 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 06:09:16 +0000 Subject: [PATCH 19/45] Bath and position-metadata family reads raw v1; round trips on the writers' output Phase 2 of the generic migration, the bath / position-metadata family (Decided by Jess Haley, 2026-10-26: [migrators read raw v1], [renames carry is temporary], [early migration pieces fixed] (1), [migration reliability practices] (a); did-schema V_eta_go_forward_class_audit.md). - did2.convert.rawV1Classes: + stimulus_bath, position_metadata, distance_metadata (one line each; the v1 names are the migrator names). - stimulus_bath: still defers every whole bath (needsSessionContext) to resolveDeferredBaths / NDI's stimulusBathToBath, which read the quarantined raw source. It first accounts for every v1 field (jRawAccount, plus the location's fields and a mixture_table that is not text); one the resolvers cannot read whole is carried (carry-049 as before, else no row yet). - position_metadata: reads ontologyNode (and universalRenames' ontology_node on the renamed path); the writer's units and dimensions carry it, carry-053, as before. A document naming no measurement, which used to pass through as a V2 position_metadata (a class to retire), is carried as v1 (no row yet). - distance_metadata: reshapes the v1 spelling itself (and the renamed one, until universalRenames is deleted); a field it does not read carries the document (no row yet). - Deleted: +migrators/position_metadata.m, distance_metadata.m and stimulus_bath.m (never reached, or reached only through distance's own +migrators_j migrator) and their tests in testMigrators. - +roundtrip inverses for the three classes; stimulus_bath's rebuilds from what resolveDeferredBaths assembles. - Fixtures: NDI templates copied verbatim from NDI-matlab locked main 3cb19a8 (stimulus_bath, position_metadata, distance_metadata); writer-shaped documents (stimulusDocMaker / marderbath, haley/doImport.m) with corpus Dab's four mixture tables. Test fixtures in testMigratorsJ and testFixtureCorpus now spell position_metadata.ontologyNode as v1 does. - testRawV1RoundTripBath, testRawV1RoundTripPosition: writer-shaped documents round trip; the lost paths are exactly the known findings (the coarse bath pass keeps neither the stimulator edge nor the epoch id, and a table with a pH or osm row loses those rows' nodes and places); nothing invented or unplaced; raw and renamed paths agree or both carry; unread fields carry; broken inputs fail. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/+migrators/Contents.m | 23 +- .../+convert/+migrators/distance_metadata.m | 158 ------- .../+convert/+migrators/position_metadata.m | 116 ----- .../+did2/+convert/+migrators/stimulus_bath.m | 209 --------- .../+convert/+migrators_j/distance_metadata.m | 225 +++++++++- .../+convert/+migrators_j/position_metadata.m | 60 ++- .../+convert/+migrators_j/stimulus_bath.m | 92 +++- .../+convert/+roundtrip/distance_metadata.m | 77 ++++ .../+convert/+roundtrip/position_metadata.m | 95 +++++ .../+did2/+convert/+roundtrip/stimulus_bath.m | 120 ++++++ src/did/+did2/+convert/rawV1Classes.m | 3 + tests/+did2/+unittest/testFixtureCorpus.m | 2 +- tests/+did2/+unittest/testMigrators.m | 193 +-------- tests/+did2/+unittest/testMigratorsJ.m | 5 +- .../+did2/+unittest/testRawV1RoundTripBath.m | 402 ++++++++++++++++++ .../+unittest/testRawV1RoundTripPosition.m | 362 ++++++++++++++++ .../ndi_templates/distance_metadata.json | 26 ++ .../ndi_templates/position_metadata.json | 20 + .../fixtures/ndi_templates/stimulus_bath.json | 24 ++ 19 files changed, 1497 insertions(+), 715 deletions(-) delete mode 100644 src/did/+did2/+convert/+migrators/distance_metadata.m delete mode 100644 src/did/+did2/+convert/+migrators/position_metadata.m delete mode 100644 src/did/+did2/+convert/+migrators/stimulus_bath.m create mode 100644 src/did/+did2/+convert/+roundtrip/distance_metadata.m create mode 100644 src/did/+did2/+convert/+roundtrip/position_metadata.m create mode 100644 src/did/+did2/+convert/+roundtrip/stimulus_bath.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripBath.m create mode 100644 tests/+did2/+unittest/testRawV1RoundTripPosition.m create mode 100644 tests/+did2/fixtures/ndi_templates/distance_metadata.json create mode 100644 tests/+did2/fixtures/ndi_templates/position_metadata.json create mode 100644 tests/+did2/fixtures/ndi_templates/stimulus_bath.json diff --git a/src/did/+did2/+convert/+migrators/Contents.m b/src/did/+did2/+convert/+migrators/Contents.m index de1757b1..209e82d4 100644 --- a/src/did/+did2/+convert/+migrators/Contents.m +++ b/src/did/+did2/+convert/+migrators/Contents.m @@ -44,24 +44,6 @@ % idiom (no label/label_id). Looks up the % name via ndi.ontology.lookup; falls back to % empty name when the lookup is unavailable. -% position_metadata - semantic-shape migrator: builds -% measurement (ontology_term), units -% (ontology_term), and dimensions -% (array-of-records with axis_1, axis_2 labels) -% from v1 ontologyNode/units/dimensions. -% distance_metadata - paired A/B endpoint migrator: discovers -% labels by regex-scanning ontology_node_X -% keys and builds an endpoints array-of-records -% with measurement, integer_ids, string_ids, -% numeric_values per endpoint. -% stimulus_bath - rename location.ontologyNode -> .node; -% parse the v1 CSV mixture_table into a -% mixture array-of-records; each amount is a -% V2 `concentration` composite with -% source_unit / source_value preserved and -% the appropriate canonical sub-field (molar, -% grams_per_liter, mass_fraction, -% volume_fraction) populated when computable. % % The calculator-base wrappers are all deleted, with their shared helper % calcCommon: the tuning family's (tuningcurve_calc, oridirtuning_calc, @@ -73,6 +55,11 @@ % is not switched, see there; [early migration pieces fixed] (1), Jess % Haley, 2026-10-26). % +% The position_metadata, distance_metadata and stimulus_bath base migrators +% are deleted too: each class has a +migrators_j migrator, which reads raw v1 +% (distance_metadata's reshapes the v1 spelling itself, where it used to hand +% the renamed body to the base migrator). +% % See did-schema's % did-schema's per-class conversion notes (deleted with did-schema #88) for the % per-class specifications. diff --git a/src/did/+did2/+convert/+migrators/distance_metadata.m b/src/did/+did2/+convert/+migrators/distance_metadata.m deleted file mode 100644 index 49c8c13f..00000000 --- a/src/did/+did2/+convert/+migrators/distance_metadata.m +++ /dev/null @@ -1,158 +0,0 @@ -function v2Body = distance_metadata(preBody) -%DISTANCE_METADATA Base migrator: did_v1 distance_metadata body -> the class-preserving V2 shape. -% -% v1 carries a paired A/B endpoint structure: -% -% distance_metadata.ontologyNode_A (after universalRenames: -% ontology_node_a) - CURIE -% distance_metadata.integerIDs_A (scalar or matrix) -% distance_metadata.ontologyStringValues_A (comma-separated did_uids) -% distance_metadata.ontologyNumericValues_A (matrix; often empty) -% (same set for endpoint B) -% distance_metadata.units (CURIE) -% -% V2 collapses both endpoints into a single -% `endpoints` array-of-records (mirrors the position_metadata -% dimensions pattern) with explicit per-endpoint `label`s -% preserved from v1: -% -% distance_metadata.endpoints(i).label - 'A', 'B' -% distance_metadata.endpoints(i).measurement (ontology_term) -% distance_metadata.endpoints(i).integer_ids - matrix -% distance_metadata.endpoints(i).string_ids - string array -% distance_metadata.endpoints(i).numeric_values - matrix -% distance_metadata.units (ontology_term) -% -% Ontology terms have their `name` resolved via ndi.ontology.lookup -% at conversion time; lookup failures (library unavailable, CURIE -% unknown) leave `name` empty. -% -% The migrator only walks endpoints actually present in the v1 -% doc. Most v1 docs in the JH corpus have endpoints 'A' and 'B'; -% any v1 doc that ships further endpoints (e.g., 'C') would be -% migrated as a 3-element array, preserving the v1 information. - -arguments - preBody (1,1) struct -end - -v2Body = preBody; -if ~isfield(v2Body, 'distance_metadata') ... - || ~isstruct(v2Body.distance_metadata) - error('did2:convert:missingBlock', ... - 'distance_metadata body is missing the distance_metadata property block.'); -end - -block = v2Body.distance_metadata; - -labels = discoverEndpointLabels(block); -endpoints = struct('label', {}, 'measurement', {}, ... - 'integer_ids', {}, 'string_ids', {}, 'numeric_values', {}); -for k = 1:numel(labels) - L = labels{k}; - endpoints(end+1) = buildEndpoint(block, L); %#ok -end - -unitsNode = ''; -if isfield(block, 'units') - unitsNode = char(block.units); -end - -newBlock = struct(); -newBlock.endpoints = endpoints; -newBlock.units = ontologyTerm(unitsNode); -v2Body.distance_metadata = newBlock; -end - -function labels = discoverEndpointLabels(block) -% Find every label X that appears as a suffix on `ontology_node_X` -% in the v1 block. v1 in the JH corpus uses 'A' and 'B'; this is -% future-proof for any single uppercase letter. -labels = {}; -fns = fieldnames(block); -seen = containers.Map('KeyType', 'char', 'ValueType', 'logical'); -for k = 1:numel(fns) - fn = fns{k}; - tokens = regexp(fn, '^ontology_node_(.+)$', 'tokens', 'once'); - if isempty(tokens); continue; end - L = upper(tokens{1}); - if ~seen.isKey(L) - seen(L) = true; - labels{end+1} = L; %#ok - end -end -labels = sort(labels); -end - -function ep = buildEndpoint(block, label) -% Build one V2 endpoint record from v1's per-label fields. -% All fields are tolerant of absence: missing v1 fields default to -% empty values of the right type. -nodeKey = sprintf('ontology_node_%s', lower(label)); -intIdsKey = sprintf('integer_i_ds_%s', lower(label)); -stringIdsKey = sprintf('ontology_string_values_%s', lower(label)); -numericKey = sprintf('ontology_numeric_values_%s', lower(label)); - -if isfield(block, nodeKey) - nodeVal = char(block.(nodeKey)); -else - nodeVal = ''; -end -if isfield(block, intIdsKey) - intIds = double(block.(intIdsKey)); - intIds = intIds(:)'; -else - intIds = []; -end -if isfield(block, stringIdsKey) - raw = block.(stringIdsKey); - if ischar(raw) - parts = strsplit(raw, ','); - parts = cellfun(@strtrim, parts, 'UniformOutput', false); - parts = parts(~cellfun('isempty', parts)); - stringIds = string(parts); - elseif isstring(raw) - stringIds = raw(:)'; - else - stringIds = string.empty(1, 0); - end -else - stringIds = string.empty(1, 0); -end -if isfield(block, numericKey) - nums = block.(numericKey); - if isnumeric(nums) - nums = double(nums(:)'); - else - nums = []; - end -else - nums = []; -end - -ep = struct( ... - 'label', label, ... - 'measurement', ontologyTerm(nodeVal), ... - 'integer_ids', intIds, ... - 'string_ids', stringIds, ... - 'numeric_values', nums); -end - -function term = ontologyTerm(curie) -% Build an ontology_term composite. Empty input yields a node-only, -% name-empty struct. ndi.ontology.lookup failures leave name ''. -term = struct('node', char(curie), 'name', ''); -if isempty(curie) - return; -end -try - [~, resolved] = ndi.ontology.lookup(char(curie)); - if isstring(resolved) && isscalar(resolved) - term.name = char(resolved); - elseif ischar(resolved) - term.name = resolved; - end -catch - % ndi.ontology not on path or curie unknown; leave name ''. -end -end diff --git a/src/did/+did2/+convert/+migrators/position_metadata.m b/src/did/+did2/+convert/+migrators/position_metadata.m deleted file mode 100644 index dbe5017b..00000000 --- a/src/did/+did2/+convert/+migrators/position_metadata.m +++ /dev/null @@ -1,116 +0,0 @@ -function v2Body = position_metadata(preBody) -%POSITION_METADATA Base migrator: did_v1 position_metadata body -> the class-preserving V2 shape. -% -% v1 carries three ontology-driven descriptor fields: -% -% position_metadata.ontologyNode (after universalRenames: -% ontology_node) - what kind of -% position -% position_metadata.units - unit (CURIE) -% position_metadata.dimensions - comma-separated -% per-axis CURIEs -% -% V2 re-shapes these into ontology_term composites and an -% array-of-records `dimensions` field with explicit per-axis -% identifiers: -% -% position_metadata.measurement (ontology_term) -% position_metadata.units (ontology_term) -% position_metadata.dimensions(i).axis - 'axis_1', 'axis_2', ... -% position_metadata.dimensions(i).node - per-axis CURIE -% position_metadata.dimensions(i).name - resolved label -% -% Human-readable names on the ontology terms are looked up via -% ndi.ontology.lookup. If the lookup throws (ndi-ontology-matlab -% not installed, CURIE unknown), the name stays empty -- the -% V2 ontology_term composite type only requires the value -% to be a struct; the inner-field-name shape is open. -% -% See did-schema's -% did-schema's per-class conversion notes (deleted with did-schema #88) -% for the full conversion spec. - -arguments - preBody (1,1) struct -end - -v2Body = preBody; -if ~isfield(v2Body, 'position_metadata') ... - || ~isstruct(v2Body.position_metadata) - error('did2:convert:missingBlock', ... - 'position_metadata body is missing the position_metadata property block.'); -end - -block = v2Body.position_metadata; - -if isfield(block, 'ontology_node') - measurementNode = char(block.ontology_node); -else - measurementNode = ''; -end -if isfield(block, 'units') - unitsNode = char(block.units); -else - unitsNode = ''; -end -if isfield(block, 'dimensions') - dimsRaw = block.dimensions; -else - dimsRaw = ''; -end - -newBlock = struct(); -newBlock.measurement = ontologyTerm(measurementNode); -newBlock.units = ontologyTerm(unitsNode); -newBlock.dimensions = buildDimensionRecords(dimsRaw); -v2Body.position_metadata = newBlock; -end - -function term = ontologyTerm(curie) -% Build an ontology_term composite (node + name). Looks up the -% human-readable name via ndi.ontology.lookup; leaves the name -% empty if the lookup is unavailable or fails. -term = struct('node', char(curie), 'name', ''); -if isempty(curie) - return; -end -try - [~, resolved] = ndi.ontology.lookup(char(curie)); - if isstring(resolved) && isscalar(resolved) - term.name = char(resolved); - elseif ischar(resolved) - term.name = resolved; - end -catch - % ndi.ontology not on the path or curie unknown; leave name '' -end -end - -function records = buildDimensionRecords(raw) -% Parse v1's comma-separated `dimensions` CURIE list into an array -% of per-axis structs with explicit positional axis labels. Empty -% input -> 0-element struct array (schema marks the field optional, -% so empty is allowed). -records = struct('axis', {}, 'node', {}, 'name', {}); -if isempty(raw) - return; -end -if isstring(raw) && isscalar(raw) - raw = char(raw); -end -if ~ischar(raw) - return; -end -parts = strsplit(raw, ','); -for k = 1:numel(parts) - curie = strtrim(parts{k}); - if isempty(curie) - continue; - end - term = ontologyTerm(curie); - records(end+1) = struct( ... - 'axis', sprintf('axis_%d', k), ... - 'node', term.node, ... - 'name', term.name); %#ok -end -end diff --git a/src/did/+did2/+convert/+migrators/stimulus_bath.m b/src/did/+did2/+convert/+migrators/stimulus_bath.m deleted file mode 100644 index 88634114..00000000 --- a/src/did/+did2/+convert/+migrators/stimulus_bath.m +++ /dev/null @@ -1,209 +0,0 @@ -function v2Body = stimulus_bath(preBody) -%STIMULUS_BATH Base migrator: did_v1 stimulus_bath body -> the class-preserving V2 shape. -% -% v1 stimulus_bath stores an ontology-typed bath location plus an -% inline CSV `mixture_table` listing chemicals: -% -% stimulus_bath.location - {ontologyNode, name} -% stimulus_bath.mixture_table - "ontologyName,name,value,ontologyUnit,unitName\n -% ,,, -% ,\n -% ..." -% -% V2 keeps `location` as an ontology_term composite (just -% renames `ontologyNode` -> `node`) and parses the mixture CSV -% into an array-of-records `mixture` field. Each chemical row -% becomes a record with the chemical identity as an ontology_term -% and the concentration as a `concentration` composite. -% -% The `concentration` composite carries source_unit / source_value -% verbatim plus optional canonical sub-fields populated whenever -% the source unit is computable into them: -% -% molar (canonical for source_unit in {Molar, M, -% Millimolar, mM, Micromolar, uM, μM, -% Nanomolar, nM, Picomolar, pM}) -% grams_per_liter (canonical for {g/L, g/l, grams per liter, -% mg/mL, mg/ml, mg/L, mg/l, ug/mL, ug/L, -% μg/mL, μg/L}) -% mass_fraction (canonical for {w/w, %w/w}) -% volume_fraction (canonical for {v/v, %v/v}) -% -% Unknown source units leave every canonical sub-field absent but -% still preserve source_unit / source_value -- consumers retain -% the raw value and can compute canonicals later when conventions -% firm up. - -arguments - preBody (1,1) struct -end - -v2Body = preBody; -if ~isfield(v2Body, 'stimulus_bath') ... - || ~isstruct(v2Body.stimulus_bath) - error('did2:convert:missingBlock', ... - 'stimulus_bath body is missing the stimulus_bath property block.'); -end - -block = v2Body.stimulus_bath; - -newBlock = struct(); -newBlock.location = locationToOntologyTerm(block); -newBlock.mixture = parseMixtureTable(block); -v2Body.stimulus_bath = newBlock; -end - -function term = locationToOntologyTerm(block) -% v1 location is a sub-struct {ontologyNode, name}. After -% universalRenames the inner field stays `ontologyNode` (the -% snake_case pass only renames top-level block fields, not nested -% struct fields). We rename here. -term = struct('node', '', 'name', ''); -if ~isfield(block, 'location') - return; -end -loc = block.location; -if ~isstruct(loc) || ~isscalar(loc) - return; -end -if isfield(loc, 'node') - term.node = char(loc.node); -elseif isfield(loc, 'ontologyNode') - term.node = char(loc.ontologyNode); -elseif isfield(loc, 'ontology_node') - term.node = char(loc.ontology_node); -end -if isfield(loc, 'name') - term.name = char(loc.name); -end -end - -function mix = parseMixtureTable(block) -% Parse the v1 CSV mixture_table into an array-of-records. Empty -% or missing -> 0-element struct array (schema marks the field -% optional). -mix = struct('chemical', {}, 'amount', {}); -if ~isfield(block, 'mixture_table') - return; -end -raw = block.mixture_table; -if isempty(raw); return; end -if isstring(raw) && isscalar(raw); raw = char(raw); end -if ~ischar(raw); return; end - -lines = strsplit(raw, newline); -lines = lines(~cellfun('isempty', lines)); -if isempty(lines); return; end - -% Detect header row -- if its first cell is the literal -% 'ontologyName' we skip it. -startIdx = 1; -firstCells = strsplit(lines{1}, ','); -if ~isempty(firstCells) && strcmpi(strtrim(firstCells{1}), 'ontologyName') - startIdx = 2; -end - -for k = startIdx:numel(lines) - cells = strsplit(lines{k}, ','); - cells = cellfun(@strtrim, cells, 'UniformOutput', false); - if numel(cells) < 5; continue; end - chemicalNode = cells{1}; - chemicalName = cells{2}; - valueStr = cells{3}; - unitNode = cells{4}; - unitName = cells{5}; - valueNum = parseDouble(valueStr); - mix(end+1) = struct( ... - 'chemical', struct('node', chemicalNode, 'name', chemicalName), ... - 'amount', buildConcentration(valueNum, unitName, unitNode)); %#ok -end -end - -function x = parseDouble(s) -x = NaN; -if isempty(s); return; end -try - x = str2double(s); -catch - x = NaN; -end -if ~isnumeric(x); x = NaN; end -end - -function c = buildConcentration(value, unitName, ~) -% Build a `concentration` composite. Always populates -% source_unit / source_value; optionally populates one or more -% canonical sub-fields if unit_name is recognised. -c = struct( ... - 'approximate', false, ... - 'source_unit', char(unitName), ... - 'source_value', value); -if isnan(value); return; end - -molarScale = molarScaleFor(unitName); -if ~isnan(molarScale) - c.molar = value * molarScale; - return; -end -gplScale = gramsPerLiterScaleFor(unitName); -if ~isnan(gplScale) - c.grams_per_liter = value * gplScale; - return; -end -if isMassFractionUnit(unitName) - c.grams_per_gram = value; % `mass_fraction` until 2026-10-22 (Jess Haley [ratio slots named by unit]) - return; -end -if isVolumeFractionUnit(unitName) - c.liters_per_liter = value; % `volume_fraction` until 2026-10-22 ([ratio slots named by unit]) - return; -end -% Unknown unit: leave canonicals absent; source-only. -end - -function s = molarScaleFor(u) -% Unit-table lookup for source units that convert to mol/L by a -% pure scalar. Greek mu spellings are normalised to 'u' at the -% caller. Unknown unit -> NaN. -u = lower(char(u)); -switch u - case {'molar', 'm', 'mol/l', 'mol l-1'} - s = 1; - case {'millimolar', 'mm', 'mmol/l'} - s = 1e-3; - case {'micromolar', 'um', 'mumolar', 'umol/l'} - s = 1e-6; - case {'nanomolar', 'nm', 'nmol/l'} - s = 1e-9; - case {'picomolar', 'pm', 'pmol/l'} - s = 1e-12; - otherwise - s = NaN; -end -end - -function s = gramsPerLiterScaleFor(u) -u = lower(char(u)); -switch u - case {'g/l', 'g l-1', 'grams per liter', 'grams per litre', 'mg/ml', 'mg ml-1'} - s = 1; - case {'mg/l', 'mg l-1'} - s = 1e-3; - case {'ug/ml', 'ug ml-1', 'mug/ml'} - s = 1e-3; - case {'ug/l', 'ug l-1'} - s = 1e-6; - otherwise - s = NaN; -end -end - -function tf = isMassFractionUnit(u) -u = char(u); -tf = any(strcmpi(u, {'w/w', '%w/w', '%(w/w)'})); -end - -function tf = isVolumeFractionUnit(u) -u = char(u); -tf = any(strcmpi(u, {'v/v', '%v/v', '%(v/v)'})); -end diff --git a/src/did/+did2/+convert/+migrators_j/distance_metadata.m b/src/did/+did2/+convert/+migrators_j/distance_metadata.m index e6d0841d..d7b133fb 100644 --- a/src/did/+did2/+convert/+migrators_j/distance_metadata.m +++ b/src/did/+did2/+convert/+migrators_j/distance_metadata.m @@ -4,17 +4,27 @@ % % Routed from did2.convert.v1_to_v2 only when TargetVersion == 'V_eta'. The v1 % doc is FLAT and records the two ENDPOINTS of a distance measurement, not the -% distance itself: `ontologyNode_A` is the animal-subject doc id, `ontologyNode_B` -% a patch (ontology_table_row) doc id, `ontologyNumericValues_A/_B` are `[]` by -% design, `units` a CURIE, and `depends_on element_id` points at the `distance` -% TIMESERIES element (where the actual distances over time live). -% -% The V_eta distance_metadata schema is shape-identical to the base migrator's output (the flat -% per-endpoint A/B fields collapse into a nested `endpoints` array-of-records + -% an `units` ontology_term), so this DELEGATES to the proven, tested base -% migrator (did2.convert.migrators.distance_metadata -- regex label discovery, -% string/numeric handling, ndi.ontology.lookup name resolution) and wraps its one -% body in the cell the J pipeline expects. +% distance itself: `ontologyNode_A` / `_B` name what each endpoint is (the JH +% writer: EMPTY:0000096 "subject document identifier" and EMPTY:0000134 +% "bacterial patch document identifier"), `ontologyStringValues_A` / `_B` the +% ids of those documents (comma-separated), `integerIDs_A` / `_B` their +% indices, `ontologyNumericValues_A/_B` are `[]` by design, `units` a CURIE, +% and `depends_on element_id` points at the `distance` TIMESERIES element +% (where the actual distances over time live). +% +% The V_eta distance_metadata collapses the flat per-endpoint A/B fields into +% a nested `endpoints` array-of-records + a `units` ontology_term: +% +% endpoints(i).label 'A', 'B' (the suffix, upper case) +% endpoints(i).measurement ontology_term {node: ontologyNode_X, +% name: ndi.ontology.lookup's, else ''} +% endpoints(i).integer_ids integerIDs_X, as a row +% endpoints(i).string_ids ontologyStringValues_X split on ',' +% endpoints(i).numeric_values ontologyNumericValues_X, as a row +% units ontology_term {node: units} +% +% Endpoints are found by the `ontologyNode_` fields the document holds, in +% label order, so a third endpoint would be kept too. % % It deliberately does NOT: % - emit a `length_observation`: there is no scalar distance in the metadata @@ -26,12 +36,195 @@ % 946faf95: 4156 JH orphans, a gating failure). The endpoints can only be % resolved by the second pass, which sees the migrated-id graph. % -% The reshape clears the ~2078 JH quarantines (the old J code read a nested -% `endpoints.numeric_values` that never exists -> no-vals passthrough of the flat -% doc -> failed the required non-empty `endpoints`). See -% schemas/V_eta_distance_metadata_plan.md. +% READS RAW v1 (did2.convert.rawV1Classes, 2026-10-27; Decided by Jess Haley, +% 2026-10-26 [migrators read raw v1] and [early migration pieces fixed] (1), +% did-schema V_eta_go_forward_class_audit.md): v1_to_v2 hands this migrator +% the document exactly as v1 wrote it (NDI distance_metadata.json + base.json +% at the locked NDI-matlab `main`, 3cb19a8, as +setup/+conv/+haley/doImport.m +% writes it), and the reshape the old base migrator +% (+migrators/distance_metadata.m, deleted) did on the universalRenames +% spelling (ontology_node_a, integer_i_ds_a, ...) is done here on the v1 +% spelling (and on that one, which v1_to_v2's 'RawV1Classes', {} path still +% hands it until universalRenames is deleted). Every v1 field and where it +% goes; +% did2.convert.roundtrip.distance_metadata rebuilds the v1 document and +% testRawV1RoundTripPosition compares the two: +% +% base.id, session_id, name, datestamp -> the same document's base (and +% its session edge) +% depends_on element_id -> the same edge +% distance_metadata._ -> endpoints(i), as above +% distance_metadata.units -> units.node +% +% What the renamed path would have discarded is carried, carry-049, as +% before; a field or edge no part of this migrator reads (e.g. an +% integerIDs_C with no ontologyNode_C) now carries the document whole as v1 +% (private/jRawAccount, jRawCarry; no register row yet). The JH writer's +% documents hang off an element of type `distance`, which is carried +% (carry-063), so v1_to_v2 carries them too (carry-064, [dependents of a +% carried document carry]). +% +% See schemas/V_eta_distance_metadata_plan.md (did-schema). arguments preBody (1,1) struct end -bodies = { did2.convert.migrators.distance_metadata(preBody) }; + +% THE RAW READ (see READS RAW v1 above) +src = preBody; +blk = struct(); +if isfield(src, 'distance_metadata') && isstruct(src.distance_metadata) ... + && isscalar(src.distance_metadata) + blk = src.distance_metadata; +end +suffixes = endpointSuffixes(blk); +read = {'units'}; +for k = 1:numel(suffixes) + x = suffixes{k}; + read = [read, {['ontologyNode_' x], ['integerIDs_' x], ... + ['ontologyNumericValues_' x], ['ontologyStringValues_' x]}]; %#ok +end +[preBody, collision, unplaced] = jRawAccount(src, ... + struct('distance_metadata', {read}), {'^element_id$'}); +if jRawCarry('distance_metadata', src, collision, unplaced) + bodies = {src}; + return; +end + +if ~isfield(preBody, 'distance_metadata') || ~isstruct(preBody.distance_metadata) + error('did2:convert:missingBlock', ... + 'distance_metadata body is missing the distance_metadata property block.'); +end + +% the endpoint labels: the v1 suffixes, and on the renamed path (v1_to_v2 +% 'RawV1Classes', {}, until universalRenames is deleted) the suffixes of the +% spelling that pass gives them (ontology_node_a, integer_i_ds_a, ...) +labels = upper(suffixes); +renamed = renamedSuffixes(blk); +labels = [labels, upper(renamed(~ismember(upper(renamed), labels)))]; +[labels, order] = sort(labels); +raw = [suffixes, repmat({''}, 1, numel(labels) - numel(suffixes))]; +raw = raw(order); +endpoints = struct('label', {}, 'measurement', {}, ... + 'integer_ids', {}, 'string_ids', {}, 'numeric_values', {}); +for k = 1:numel(labels) + endpoints(end+1) = buildEndpoint(blk, labels{k}, raw{k}); %#ok +end + +unitsNode = ''; +if isfield(blk, 'units') + unitsNode = char(blk.units); +end + +v2Body = preBody; +if isfield(v2Body, 'depends_on') && ~isempty(v2Body.depends_on) + % the {name, document_id} entries the renamed path gave the document + deps = did2.convert.v1read.readDependsOn(src); + v2Body.depends_on = struct('name', {deps.name}, 'document_id', {deps.document_id}); +end +v2Body.distance_metadata = struct('endpoints', endpoints, 'units', ontologyTerm(unitsNode)); +bodies = {v2Body}; +end + +function suffixes = endpointSuffixes(block) +% Every X with an `ontologyNode_X` field, as the document spells it. The JH +% writer uses 'A' and 'B'; any further suffix is an endpoint too. +suffixes = {}; +fns = fieldnames(block); +for k = 1:numel(fns) + tokens = regexp(fns{k}, '^ontologyNode_(.+)$', 'tokens', 'once'); + if ~isempty(tokens) && ~any(strcmp(suffixes, tokens{1})) + suffixes{end+1} = tokens{1}; %#ok + end +end +end + +function suffixes = renamedSuffixes(block) +% Every x with an `ontology_node_x` field (universalRenames' spelling). +suffixes = {}; +fns = fieldnames(block); +for k = 1:numel(fns) + tokens = regexp(fns{k}, '^ontology_node_(.+)$', 'tokens', 'once'); + if ~isempty(tokens) && ~any(strcmpi(suffixes, tokens{1})) + suffixes{end+1} = tokens{1}; %#ok + end +end +end + +function [v, found] = endpointField(block, rawName, x, renamedName, label) +% The v1 field _, else universalRenames' _