TMP-SCI-204 · Planned course · Unfinished learning resource

Unit 2 explained answer key and rubrics

For Scientific Computing and Reproducible Workflows, TMP-SCI-204. All records are fictional. Equivalent correct reasoning earns credit; numerical agreement without a justified input/method does not. Assessment is formative. Do not turn author-side logs into learner execution claims.

Readiness

R1

None of the file's tokens is yet a Python integer: they are characters decoded from bytes. The CSV parser returns field strings. The numeric parser checks the allowed spelling and converts 20 to integer 20 and 0 to integer 0. The explicit volume marker NA becomes None. The position/field matters: NA is not allowed as a duration. The domain validator then decides whether the converted values satisfy duration/volume bounds.

R2

The report may refer to the previous bytes, while the current path refers to different bytes. A filename is a location, not immutable input identity. Preserve the exact snapshot used by each run, its digest and a change record. A digest alone cannot regenerate an edited-away original. The report could still be correct, but the current pair does not establish its provenance.

R3

The duration belongs in observed time because volume was observed to be zero. Excluding it would discard a real observation period and can increase the pooled rate. Missing and zero are distinct data states, not interchangeable formatting choices.

R4

Inspect whether the output contains valid complete structured data and whether its values/digests match the expected input/source and independent calculation. Also inspect the actual process exit/error record and whether the completion marker is valid. A printed message could be stale, copied or unrelated to the empty file. Never infer completion from a label alone.

Guided practice

G1

0 succeeds as integer zero, an observed volume. NA succeeds as missing None. na and empty text fail; the contract defines no such missing spellings. 006 succeeds as integer 6, preserving its original lexical bytes in the raw snapshot. 6.0 fails the ASCII-digits-only token rule despite representing an understandable number outside this format. A quoted ID "Dock, east" parses as one string field containing a comma. Splitting on every comma would incorrectly create an extra field and lose the quoting structure.

G2

  1. UTF-8 decoding in the parser; (b) CSV record-shape check in the parser; (c) numeric-token parsing; (d) Unit 1 domain validation called by analysis; (e) the same domain validator; (f) the output-directory creation in the file-writing stage. The formula should receive valid typed observations and answer the quantity question. Mixing decoding, filesystem handling and arithmetic would make failures harder to isolate and tests harder to interpret. Parsing a valid integer is not the same as validating its scientific role.

G3

Volume 34 mL, observed 70 seconds, scheduled 100 seconds, coverage 7/10 = 70%. Pooled rate 17/35 mL/s. Equal-interval mean = (3/10 + 7/10 + 0)/3 = 1/3 mL/s. CRLF and LF versions parse to the same values and scientific result in this supplied format. Their raw bytes, byte counts and SHA-256 digests differ, so their complete report.json files differ too. The result field can match when the whole report does not. “Same analysis result” and “same input bytes” are separate assertions.

G4

input.csv preserves the exact input snapshot; report.json preserves the numerical result and input identity; two .py files preserve the executable source; run.json records environment/arguments and expected digests, with a completion status. The second direct command against the same existing destination fails with a filesystem existence error and exit status 2 through the CLI. It must leave the original run untouched. The displayed operating-system wording can differ; mark the behavior and evidence, not a memorized platform-specific error string. Tracing this behavior is not evidence that the learner executed it.

G5

Use the first folder's copied pipeline.py and input.csv, with a fresh second destination. The report bytes should match under unchanged source/input and checked conditions. input_argument, output_argument and normally invocation_argv differ because the path arguments differ. That is expected provenance, not failed reproducibility. A learner should preserve real outputs and the comparison result, or explicitly label a prediction. Merely duplicating a report file is not rerunning the analysis.

Independent practice

I1

Both records parse as ID A, duration 1, volume 2. Observed rate is 2 mL/s. Raw bytes differ, so the practical SHA-256 identity check differs; complete reports also differ because input byte count/digest are included. Parsed result values match. The numerical comparison supports equality of this calculated quantity; it does not prove input-byte identity. Leading-zero normalization is explicitly allowed by this contract and does not erase the preserved original spelling.

I2

Example input: header id,elapsed_s,volume_ml, followed by A,10, and a line ending. Our parser rejects the empty volume token. A changed parser could map it to missing and then return no observed rate. That changes the accepted input language and may hide a truncated export or omission. The choice requires a stated data dictionary and revised tests, not an assumption that empty always means missing. Preserve the original and document any authorized conversion.

I3

Wrong header order fails parsing before a new output folder exists. A duration token 86401 parses as an integer but fails analysis/domain validation before output creation. Duplicate A rows with otherwise valid values fail the same analysis stage. An existing destination fails when directory creation is attempted, after valid input analysis; it creates no new run and must not overwrite existing contents. In all cases original input and source stay unchanged. A sentinel file in a pre-existing test directory is a useful independent preservation check.

I4

The folder is a partial attempted run. It may contain a valid input snapshot, but no complete validated report or completion record has been established. Do not claim reproduction, success or that all listed files are intact. Preserve the original raw data and partial evidence, inspect the actual failure, correct the environmental issue if authorized, then rerun into a different new directory. Do not intentionally fill the disk or delete unrelated data for this exercise. Even a present completion file would require complete parsing and digest checks.

I5

Volume remains 34 mL, but observed time becomes all 100 seconds. The new rate is 34/100 = 17/50 = 0.34 mL/s and coverage becomes 100%. The program correctly computes the supplied altered packet; it does not establish that A3 was truly measured at zero. Successful execution and a new digest identify a changed computation, not a scientific justification for inventing an observation.

I6

Changing LF to CRLF or a permitted token 6 to 006 changes raw bytes without changing parsed values/totals. Changing a source comment changes source bytes while leaving input untouched and may leave output unchanged. Neither equality of numerical results nor a passing ordinary example proves identical inputs/source or full semantic equivalence of programs. Preserve both versions, compare the intended differences and rerun discriminating tests. A change to the formula can also happen to agree on one dataset, so outcome agreement is not a general correctness proof.

Audit tasks

H1

A digest does not authenticate who created the file or whether an instrument produced it; an attacker or mistaken analyst can hash fabricated data. It also does not establish measurement calibration, correct units, valid missingness policy or scientific accuracy. In this trusted exercise it is an integrity/identity aid when compared against a trustworthy reference, not a signature or certification.

H2

Two rows can use distinct IDs yet describe the same physical observation, or overlapping intervals. The schema has durations but no start/end timestamps, and it cannot verify the source's real-world identity. Correct parsing and unique labels do not prove nonoverlap or independence. Scientific metadata or a justified acquisition protocol would be needed. This is not permission to collect real data for the exercise.

H3

The raw-data folder is not the failed output directory, and deleting it would destroy the evidence needed for a retry. The fault may concern permission, capacity or an incomplete output, not input content. Inspect the exact failure, preserve raw/source/partial artifacts, resolve only the relevant authorized issue, and use a new output name. If cleanup is genuinely needed, verify disposability/recoverability first rather than erase broad directories.

Quiz: 30 points

Q1 — 6 points

The exact input is:

id,elapsed_s,volume_ml
B1,12,3
B2,48,36
B3,20,NA
B4,20,0

Observed volume is 39 mL, observed time 80 seconds, scheduled time 100 seconds. Rate = 39/80 = 0.4875 mL/s; coverage 80%. Observed IDs B1,B2,B4; missing B3. Rubric: valid header/records 2; volume and both time totals 2; rate with units 1; coverage 1. Do not replace B4's observed zero by missing.

Q2 — 6 points

36.0 fails the numeric-token parser because of the decimal point. It is rejected before any output directory is created. Do not infer that the physical measurement is invalid, but do not silently reinterpret an unfamiliar export either. An authoritative data dictionary or explicit source correction must establish intended units, value and permitted normalization. Preserve the bad-format copy; if converting is justified, create a named derived input and record the conversion. Rubric: correct stage/reason 2; no-output consequence 1; justified evidence requirement 2; preservation/change record 1.

Q3 — 6 points

Invoke the copied pipeline from the first run folder with that folder's input.csv and a new second output directory. Keep both copied source files together. Compare complete report.json bytes, and inspect recorded source/input digests. The path arguments in run.json can differ, so whole-run manifests need not match. Rubric: correct snapshot sources/input 2; new destination/no overwrite 1; report comparison 1; provenance distinction 1; accurate execution-versus-plan statement 1. This question asks for a procedure, not proof it was executed.

Q4 — 6 points

First parse run.json as complete JSON and confirm the expected completion status/known file list. Next recompute digests of the four known payload files and compare each with the manifest. Then check that input/source/environment and result correspond to the intended analysis, including independently calculated totals and an actual successful process record. Nonoverlap, real measurement accuracy and truthful missingness remain scientific assumptions, not digest results. Rubric: three meaningful inspection steps 4; remaining assumption with explanation 2. Avoid following arbitrary paths in an unfamiliar manifest.

Q5 — 6 points

Model wording, only if supported by the learner's actual execution:

“I calculated the pooled volume per second across observed B windows, retaining B3 as missing and B4 as a measured zero. My preserved CSV has the stated header and integer/NA format. Before running, I predicted 39 mL over 80 observed seconds, giving 0.4875 mL/s and 80% duration coverage. I used the saved pipeline and measurement module in my recorded Python environment, writing to a new directory. My output matched that prediction. I retained the source, raw bytes, report, manifest and actual command/output. A separate 36.0 copy failed token parsing before output creation, as expected. The successful run establishes this computation under the contract; it does not establish a full-period rate or prove the intervals did not overlap.”

Rubric: question/units 1; recoverable identity/procedure 1; independent prediction 1; discriminating test 1; scientific limit and honest status 1; actual completed execution evidence 1. Correctly labelled trace-only work can earn at most 5/6. The model note is not the learner's evidence.

Project: 40 points

P1 — 8 points

Input rows under the exact header are C1,15,9; C2,45,18; C3,30,NA; C4,10,0; C5,20,12. Observed IDs C1,C2,C4,C5. Volume 39 mL; observed time 90 seconds; scheduled time 120 seconds; rate 39/90 = 13/30 mL/s; coverage 3/4 = 75%.

The parser turns allowed byte/text tokens into typed records. Analysis applies the unchanged measurement contract and computes the report. The file stage preserves snapshots in a new directory. A token error belongs to parsing; zero duration or duplicate ID to domain analysis; existing destination or write failure to the file stage. Rubric: valid input/preservation 2; totals/rate/coverage 3; three interfaces and differentiated rejection examples 3.

P2 — 8 points

A complete first run needs all five expected files, a valid completion record with matching payload digests and actual process evidence. Reproduce from its preserved input and copied source in a fresh output directory. The report bytes should match; path arguments in the manifest can differ. Source/input preservation and refusal to overwrite are independent checks, not inferred merely from the matching rate.

Rubric: accurate independent prediction 1; actual first execution plus recoverable output 2; source/input/manifest preservation explanation and evidence structure 1; actual snapshot-based rerun with comparison 2; discriminating test designs/expectations 1; actual executed test evidence 1. Trace-only work can earn at most 3/8 here: prediction, preservation plan and test design. Five execution points remain outstanding. A planned command or copied author log earns no execution point. Preserve and explain real failures; a corrected verified run can supply the missing evidence.

P3 — 8 points

Revision A adds 6 observed mL in C3: volume 45 mL, observed and scheduled time both 120 seconds; rate 45/120 = 3/8 = 0.375 mL/s; coverage 100%. The added window's rate 6/30 = 0.2 is below the original 13/30, so including it lowers the pooled mean.

Revision B instead lengthens C2 to 60 seconds without changing any volume or filling C3. Volume remains 39 mL; observed time becomes 105 seconds; scheduled time becomes 135 seconds; rate 39/105 = 13/35 mL/s; coverage 105/135 = 7/9, approximately 77.78%. More observed time with unchanged volume lowers the rate. Coverage rises because the missing duration remains 30 seconds while total duration increases. These are two supplied alternative corrections, not evidence that either really happened in an experiment.

Rubric: A rate/coverage/totals 3; B rate/coverage/totals 3; separate preserved revisions 1; correct directional explanation 1. Applying both changes is a different, unrequested packet and cannot receive the intended result credit.

P4 — 8 points

The erroneous observed rate is 39/120 = 13/40 = 0.325 mL/s. It uses scheduled time while excluding unknown C3 volume, effectively treating that volume as zero when interpreted as a full-period rate. The correct observed-only denominator is 90 seconds. Editing the old report removes or obscures evidence of what the old run actually produced; an unchanged filename does not preserve its bytes or history.

Keep the original raw input, original source/report and error explanation. Correct the computation in a separately versioned source if the defect was in code, or correct the interpretation if the program already computed the right result. Run the justified corrected version into a fresh directory, preserve snapshots/actual output, check independently expected totals and record old versus new claims. Require complete parseable run.json, matching known payload digests and an actual completed run record; partial files alone are not completion.

Rubric: erroneous quotient and diagnosis 2; filename/overwrite mistake 2; recoverable correction workflow 2; completion-versus-partial evidence 2.

P5 — 8 points

A model report below illustrates interpretation. Replace any execution claims with the learner's actual status and evidence; the author's scenario runs are not learner work.

“The original fictional C packet contains 39 mL over 90 seconds with observed volumes. Its pooled observed rate is 13/30 mL/s and observed-duration coverage is 75%. C3's 30 seconds remain missing; C4's measured zero stays in the observed denominator. Dividing by all 120 scheduled seconds would give 0.325 mL/s and answer an unsupported question unless missing volume were explicitly assumed zero.

“I preserved the original CSV and derived the totals before executing the supplied pipeline. The completed output contains input/source snapshots, a report and a manifest. I recorded the actual command, interpreter and output, verified the listed payload digests, and reran the saved source/input into a separate directory. The report bytes matched. The destination-refusal and invalid-token tests distinguish preservation from merely obtaining a plausible number.

“In separate supplied revisions, filling C3 with 6 mL gives 0.375 mL/s with complete coverage. Changing only C2's duration to 60 seconds instead gives 13/35 mL/s and 7/9 coverage. Both rates fall for different reasons, and neither revision was combined with the other.

“My change log keeps original, A and B inputs and their results distinct. A matching digest supports byte consistency, not the truth of observations. A next scientific check would establish that the labelled windows were distinct and nonoverlapping. This remains a synthetic analysis, not evidence about a real collector or a future rate.”

Change log: original unchanged; A changes C3 volume from NA to 6; B instead changes C2 duration from 45 to 60. Rubric: original quantity/result 2; both revised interpretations 2; recoverable evidence/honest execution status 1; rejected shortcut 1; precise change log 1; specific scientific limit/next check 1. A clearly labelled trace-only report may earn interpretation points; it does not recover P2's missing execution points.

Delayed transfer

D1

The old parser only knows the explicit missing marker NA and integer volume tokens, so rejecting ND is correct under its contract. ND carries more information than missing: volume x satisfies 0 ≤ x < 5 mL. Replacing it by NA discards that bound; replacing it by zero selects one unobserved endpoint and falsely presents it as exact.

Total duration is 30 seconds; full-period volume is 10+x mL. Thus the full-period rate lies in [10/30,15/30) = [1/3,1/2) mL/s, with the upper endpoint excluded. This is a set of values compatible with the stated censoring, not a confidence interval or a probability distribution. A revised schema could include an observation kind (exact/missing/censored) and separate lower/upper bounds with inclusive/exclusive flags. Retain original tokens and document the instrument's detection rule before implementing a different analysis. The old exact-volume function must not be claimed to support this without revision.

D2

Digests do not reconstruct missing input/source. Matching report numbers establish only outcome agreement for those reported values, not that the same input, code or environment was used. Request the exact input bytes, executable source and dependencies or a preserved environment description, the command/arguments, actual outputs and the relation between those artifacts and recorded digests. A full run snapshot plus a known procedure can enable attempted reproduction. Do not request unrelated private files or credentials. This exercise requires only a description, not a real message or upload.

Marking limits

Quiz and project are separate formative groups. Actual execution, conceptual design and scientific interpretation are distinct outcomes. Internal mathematical/code review is not competent human specialist moderation, tested learner performance, timing, reliable marking or accessibility conformance. Learner execution access and whole-course validation remain unresolved. The reader and optional companion files are available separately; they do not provide an interpreter.