Assignment 7 built the Kozeny–Carmen model and turned the submission procedure into a script. Here you plot that model's results and a reservoir porosity map. The engineering work is short; the agent exercise is routing context to the file that already owns each responsibility instead of copying it.
Before writing plotting code, ask your agent to name which file is authoritative for each concern and to justify each answer from repository evidence:
- Plot appearance — the required figure elements in Problem 1 and Problem 2 below.
- Numerical fitting — the existing Kozeny–Carmen implementation.
- Tests — the public deterministic suite.
The correct answer for fitting is assignment7.py, which ships with this repository.
It is a normal module, not a notebook, so there is no nbconvert step to perform.
Ask the agent to propose a short AGENTS.md rule that records this reuse decision,
then review and explicitly approve the wording before it edits the instructions.
The completed instructor reference has that rule in place.
Implement two functions in assignment8.py. Each returns a matplotlib figure.
kozeny_carmen_plot(filename, **kwargs)— Problem 1.contour_plot(filename, **kwargs)— Problem 2.
Import the supplied model with from assignment7 import KozenyCarmen and reuse it.
Do not copy, reimplement or re-derive the fit: assignment8.py must contain no
SciPy curve_fit call and no normal-equation solving.
Use poro_perm.csv to reproduce the chart in images/poro_perm.png. Compute both fits with the supplied class, then plot:
- the data as black circles (
'ko') against$x=\phi^3/(1-\phi)^2$ and$y=\kappa$ ; - the free fit as a red line (
'r-'); - the through-origin fit as a blue line (
'b-').
Both fit lines are evaluated on np.linspace(0, 0.012, num=50). The axes are gridded,
labelled with r'$\frac{\phi^3}{(1-\phi)^2}$' and r'$\kappa$ (mD)', and carry the
legend ['Data', 'Fit', 'Fit Through Zero'] at loc='upper left'.
Nechelik.dat holds estimated reservoir porosity on an equally spaced
grid with contourf map of the field with NaN blocks left empty, the aspect ratio set to
'equal', a colorbar, and the title 'Porosity'.
The figures must match on content, not on rendered pixels: the tests inspect line data, labels, legend text and location, grid state, contour levels, aspect, title and colorbar presence. They do not compare images.
env -u SUBMISSION_VALIDATION python -m unittest -v
# Instructor environment additionally runs its private suite.
git diff --checkInitially the reader and reuse-contract checks pass; the two plotting checks fail on the intentional stubs, and the instruction-artifact check fails until the approved reuse rule is in place. Do not weaken tests to change this baseline. Passing tests support the review but do not replace your responsibility to inspect the figures and approve instruction changes.
The two student-editable deliverables are:
AGENTS.md(approved context-reuse rule)assignment8.py(two plotting functions that reuse the supplied model)
Everything else is protected, including assignment7.py, the data, the images,
test.py, test_submission.py and submission-policy.json. No conversation
transcript or extra evidence report is required. When ready, ask the agent to
submit assignment 8. Review its dry-run result, then explicitly authorize
execution. The exercise is formative: focus on routing context to the file that
already owns each responsibility.