Instruction:
# Verify the Extraction–Crystallization Material Balance for an Amine Hydrochloride Process and Select a Low-Solvent Option

The process batch record for a chiral amine intermediate has completed post-reaction workup, liquid–liquid extraction, washing, solvent exchange, hydrochloride salt formation, crystallization, and drying. Read the batch basis, replicate stream analyses, unit-operation connections, solid characterization, material ledger, and extraction scenarios in /app/input, and compile an auditable process balance and release recommendation.

Harmonize the reporting basis for all analytical results, verify the inputs/outputs/recorded losses for each unit operation, determine the salt form and hydration state of the final solid, calculate reaction and workup yields, impurity purge, PMI/E-factor, and solvent recovery, and select from the provided extraction scenarios one that satisfies the process constraints. Retain the means and standard deviations of replicate analyses, and distinguish among wet cake, mother liquor, wash liquor, and dried solid.

Generate analysis.py, stream_inventory.csv, unit_operation_balance.csv, salt_form_assignment.csv, final_yield.csv, impurity_purge.csv, green_metrics.csv, extraction_scenario_screen.csv, recommended_extraction.csv, product_mass_flow.png, salt_form_comparison.png, extraction_scenario_screen.png, and workup_reconciliation_report.md under /app/output.

## Deliverable Files

The following content defines only the submission interface and does not prescribe the analytical methods or expected results. All files listed below are required and must be written to `/app/output/`.

### General Format

- CSV files must use UTF-8 encoding, be comma-delimited, and include headers. Column order is unrestricted, and additional columns are permitted, but none of the canonical fields listed below may be omitted.
- The canonical field names below have no separately defined aliases; submit them using the exact field names provided.
- Numeric fields must use decimal numbers; `fraction` and ratio fields are dimensionless. Flag fields must use the strings `yes` or `no`.
- `analysis.py` and `workup_reconciliation_report.md` must be UTF-8 plain text; PNG files must use the standard PNG binary format.
- Additional files are permitted but may not replace any of the required files listed below.

### `/app/output/analysis.py`

A source-code file capable of reconstructing the result files listed in this section from the input files in `/app/input/`.

### `/app/output/stream_inventory.csv`

Each row represents a liquid-phase/process stream or the final dried solid; the stable key is `stream_id`. For the final dried solid, concentration fields that are not applicable must use the numeric value `-1`.

| Field | Type | Unit/Meaning |
|---|---|---|
| `stream_id` | string | Stable stream identifier |
| `stage_order` | integer | Process sequence, dimensionless |
| `stream_type` | string | Stream category |
| `volume_L` | number | L |
| `n_assay_replicates` | integer | Number of analytical replicates, dimensionless |
| `analytical_basis` | string | Analytical reporting basis |
| `product_mean_g_L`, `product_sd_g_L` | number | g/L; mean and standard deviation of product concentration |
| `product_mass_kg`, `product_mass_sd_kg` | number | kg; mean and standard deviation of product mass |
| `starting_material_mean_g_L`, `starting_material_sd_g_L` | number | g/L; mean and standard deviation of starting-material concentration |
| `starting_material_mass_kg`, `starting_material_mass_sd_kg` | number | kg; mean and standard deviation of starting-material mass |
| `impurity_A_mean_g_L`, `impurity_A_sd_g_L` | number | g/L; mean and standard deviation of impurity A concentration |
| `impurity_A_mass_kg`, `impurity_A_mass_sd_kg` | number | kg; mean and standard deviation of impurity A mass |
| `impurity_B_mean_g_L`, `impurity_B_sd_g_L` | number | g/L; mean and standard deviation of impurity B concentration |
| `impurity_B_mass_kg`, `impurity_B_mass_sd_kg` | number | kg; mean and standard deviation of impurity B mass |

### `/app/output/unit_operation_balance.csv`

Each row represents one unit operation in `operation_map.json`; the stable key is `operation_id`. `input_streams`, `output_streams`, and `retained_streams` are semicolon-delimited strings of stream IDs.

| Field | Type | Unit/Meaning |
|---|---|---|
| `operation_id` | string | Stable unit-operation identifier |
| `sequence` | integer | Unit-operation sequence, dimensionless |
| `input_streams`, `output_streams`, `retained_streams` | string | Semicolon-delimited stream IDs |
| `product_input_kg`, `product_outputs_kg`, `product_known_loss_kg`, `product_retained_kg` | number | kg; product input, output, recorded loss, and retained mass |
| `product_closure_fraction`, `product_retained_recovery` | number | Dimensionless fraction |
| `starting_material_input_kg`, `starting_material_outputs_kg`, `starting_material_known_loss_kg`, `starting_material_retained_kg` | number | kg; starting-material input, output, recorded loss, and retained mass |
| `starting_material_closure_fraction`, `starting_material_retained_recovery` | number | Dimensionless fraction |
| `impurity_A_input_kg`, `impurity_A_outputs_kg`, `impurity_A_known_loss_kg`, `impurity_A_retained_kg` | number | kg; impurity A input, output, recorded loss, and retained mass |
| `impurity_A_closure_fraction`, `impurity_A_retained_recovery` | number | Dimensionless fraction |
| `impurity_B_input_kg`, `impurity_B_outputs_kg`, `impurity_B_known_loss_kg`, `impurity_B_retained_kg` | number | kg; impurity B input, output, recorded loss, and retained mass |
| `impurity_B_closure_fraction`, `impurity_B_retained_recovery` | number | Dimensionless fraction |
| `operation_status` | string | Unit-operation status label |

### `/app/output/salt_form_assignment.csv`

Each row represents one candidate solid form in `solid_form_candidates.csv`; the stable key is `candidate_id`.

| Field | Type | Unit/Meaning |
|---|---|---|
| `candidate_id` | string | Stable candidate-form identifier |
| `candidate_name`, `formula` | string | Candidate name and molecular-formula label |
| `molecular_weight_g_mol` | number | g/mol |
| `free_base_equivalent_wt_percent`, `chloride_wt_percent`, `water_wt_percent` | number | wt%; observed composition |
| `theoretical_free_base_equivalent_wt_percent`, `theoretical_chloride_wt_percent`, `theoretical_water_wt_percent` | number | wt%; theoretical candidate composition |
| `residual_free_base_equivalent_wt_percent`, `residual_chloride_wt_percent`, `residual_water_wt_percent` | number | wt%; residuals between the observed composition and candidate composition |
| `normalized_composition_rmse` | number | Dimensionless summary of composition error |
| `selected_form` | string | `yes`/`no` selection flag |

### `/app/output/final_yield.csv`

A single-row summary of final yield and product-mass basis; this table has no separate row key.

| Field | Type | Unit/Meaning |
|---|---|---|
| `limiting_reagent_mol` | number | mol |
| `product_free_base_mw_g_mol` | number | g/mol |
| `theoretical_free_base_kg`, `reaction_end_free_base_equivalent_kg` | number | kg |
| `reaction_assay_yield_fraction` | number | Dimensionless fraction |
| `wet_cake_mass_kg`, `dry_cake_mass_kg` | number | kg |
| `drying_loss_fraction` | number | Dimensionless fraction |
| `selected_salt_form`, `selected_salt_formula` | string | Selected salt form and molecular-formula label |
| `isolated_free_base_equivalent_kg` | number | kg |
| `isolated_product_mol` | number | mol |
| `workup_recovery_fraction`, `isolated_molar_yield_fraction` | number | Dimensionless fraction |

### `/app/output/impurity_purge.csv`

Each row represents a combination of one stage and one impurity; the stable composite key is `stage` + `impurity`. Stages must cover `extraction_train`, `aqueous_wash`, `crystallization`, and `overall_process`, and impurities must cover `starting_material`, `impurity_A`, and `impurity_B`.

| Field | Type | Unit/Meaning |
|---|---|---|
| `stage`, `impurity` | string | Stable stage and impurity identifiers |
| `input_stream`, `output_stream` | string | Corresponding stream identifiers |
| `product_recovery_fraction`, `impurity_mass_recovery_fraction` | number | Dimensionless fraction |
| `impurity_input_kg`, `impurity_output_kg` | number | kg |
| `input_impurity_to_product_ratio`, `output_impurity_to_product_ratio`, `purge_factor` | number | Dimensionless ratios |

### `/app/output/green_metrics.csv`

A single-row summary of material and green metrics based on the isolated product; this table has no separate row key.

| Field | Type | Unit/Meaning |
|---|---|---|
| `isolated_product_mass_kg`, `total_material_input_kg`, `solvent_input_kg`, `water_input_kg`, `recovered_solvent_kg` | number | kg |
| `process_mass_intensity_kg_per_kg`, `solvent_mass_intensity_kg_per_kg`, `E_factor_kg_per_kg` | number | kg/kg |
| `solvent_recovery_fraction` | number | Dimensionless fraction |

### `/app/output/extraction_scenario_screen.csv`

Each row represents one scenario in `extraction_scenarios.csv`; the stable key is `scenario_id`.

| Field | Type | Unit/Meaning |
|---|---|---|
| `scenario_id` | string | Stable scenario identifier |
| `number_of_stages` | integer | Number of extraction stages, dimensionless |
| `solvent_per_stage_L`, `total_solvent_L` | number | L |
| `measured_distribution_ratio` | number | Dimensionless ratio |
| `predicted_product_recovery_fraction`, `minimum_required_recovery_fraction` | number | Dimensionless fraction |
| `meets_recovery_requirement`, `selected_scenario` | string | `yes`/`no` flags |

### `/app/output/recommended_extraction.csv`

A single-row record of the recommended scenario; this table has no separate row key.

| Field | Type | Unit/Meaning |
|---|---|---|
| `selected_extraction_scenario` | string | Recommended scenario identifier |
| `number_of_stages` | integer | Number of extraction stages, dimensionless |
| `total_solvent_L` | number | L |
| `predicted_recovery_fraction` | number | Dimensionless fraction |
| `selection_basis` | string | Neutral textual description of the selection basis |

### PNG Images

- `/app/output/product_mass_flow.png`: Process-flow diagram showing product mass across process streams.
- `/app/output/salt_form_comparison.png`: Comparison plot of the compositions of candidate solid forms.
- `/app/output/extraction_scenario_screen.png`: Comparison plot for extraction-scenario screening.

### `/app/output/workup_reconciliation_report.md`

The report must cover the following neutral content categories: analytical reporting basis; stream and unit-operation balances; differentiation among wet cake, mother liquor, wash liquor, and dried solid; salt form and hydration state; reaction and workup yields; impurity purge; material and green metrics; extraction-scenario screening; and the basis for the recommendation.


Instruction:
# Verify Disulfide Connectivity Using Differential Alkylation and Nonreducing Mass Spectrometry and Determine Peptide Batch Disposition

Three production batches of DSB-21, a 21-aa disulfide-bonded peptide containing 6 cysteines, must now be verified. The product specifications, sequence, enzymatic digest peptides, candidate connectivities, nonreducing LC-HRMS/MS features, diagnostic ions, differential alkylation peak areas, and response factors for the batches are all located in /app/input.

Based on these records, identify the disulfide bonds actually observed, calculate the occupancy of each disulfide bond and the state closure for each cysteine, and determine whether BATCH_A, BATCH_B, and BATCH_C can be released according to the criteria specified in the product specifications. The results must be traceable to the feature_group, replicate measurements, and diagnostic ions. Do not count different ion channels from the same chromatographic group more than once, and do not claim that a specific connectivity has been localized solely on the basis of an identical precursor mass.

Generate analysis.py, feature_assignments.csv, diagnostic_match_table.csv, bond_occupancy.csv, free_thiol_summary.csv, cysteine_balance.csv, batch_release.csv, connectivity_map.png, cysteine_closure.png, batch_release_summary.png, and disulfide_mapping_report.md under /app/output. Units must be indicated for the corresponding fields. For data requiring replicate aggregation, retain the number of replicates and the mean/standard deviation. The localization and release tables must retain mass errors, diagnostic matches, and decision fields. The report must describe the analytical conventions and the basis for batch disposition.

## Deliverable Files

This section defines only the submission interface and does not prescribe the analytical method or expected results. All files listed below are required and must be written directly to `/app/output/`. CSV files must use UTF-8 encoding and English comma delimiters. Field names must use the canonical names specified below; column order is unrestricted, and additional columns are permitted. The instructor-provided materials do not specify field aliases; therefore, field aliases are not accepted. Composite stable keys must be unique within their respective files.

Type notation: `string` denotes a character string, `integer` denotes an integer, and `number` denotes a finite numerical value. The unit `1` denotes dimensionless, `count` denotes a count, `input-area` denotes the same signal units as the input peak areas, and `—` denotes not applicable.

### `/app/output/analysis.py`

- Format/encoding: UTF-8 Python source file.
- File semantics: An executable analysis entry point used to generate the result files listed in this section from `/app/input/`.

### `/app/output/feature_assignments.csv`

- Stable key: `batch_id`, `replicate`, `feature_group_id`.
- Row semantics: Each row represents the consolidation and connectivity-localization result for one batch, replicate measurement, and chromatographic feature group.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `batch_id` | string | — | Batch identifier |
| `replicate` | integer | — | Replicate measurement number |
| `feature_group_id` | string | — | Chromatographic feature group identifier |
| `peptide_pair` | string | — | Peptide-pair identifier |
| `retention_time_min` | number | min | Retention time |
| `charge` | integer | 1 | Charge state |
| `n_ion_channels` | integer | count | Number of consolidated ion channels |
| `ion_forms` | string | — | Ion-form labels; separate multiple labels with semicolons |
| `consolidated_area` | number | input-area | Consolidated peak area |
| `internal_standard_area` | number | input-area | Internal-standard peak area |
| `theoretical_linked_neutral_mass_Da` | number | Da | Theoretical neutral mass of the linked peptide |
| `neutral_mass_Da` | number | Da | Precursor neutral mass |
| `precursor_mass_error_ppm` | number | ppm | Precursor mass error |
| `best_adduct` | string | — | Ion-form label for the best mass match |
| `assigned_bond_id` | string | — | Identifier of the localized disulfide bond |
| `matched_diagnostic_ions` | integer | count | Number of matched diagnostic ions |
| `matched_intensity_fraction` | number | 1 | Fraction of ion intensity accounted for by matched ions |
| `assignment_score` | number | 1 | Candidate localization score |
| `selected_candidate` | string | — | Candidate-selection flag; use `yes`/`no` |
| `relative_response_factor` | number | 1 | Relative response factor |
| `corrected_occupancy_fraction` | number | 1 | Corrected occupancy fraction |
| `assignment_pass` | string | — | Localization decision flag; use `yes`/`no` |

### `/app/output/diagnostic_match_table.csv`

- Stable key: `batch_id`, `replicate`, `feature_group_id`, `candidate_bond_id`.
- Row semantics: Each row represents a diagnostic-ion matching summary for one candidate disulfide bond of one feature group.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `batch_id` | string | — | Batch identifier |
| `replicate` | integer | — | Replicate measurement number |
| `feature_group_id` | string | — | Chromatographic feature group identifier |
| `peptide_pair` | string | — | Peptide-pair identifier |
| `candidate_bond_id` | string | — | Candidate disulfide-bond identifier |
| `matched_diagnostic_ions` | integer | count | Number of matched diagnostic ions |
| `matched_intensity_fraction` | number | 1 | Fraction of ion intensity accounted for by matched ions |
| `assignment_score` | number | 1 | Candidate localization score |
| `selected_candidate` | string | — | Candidate-selection flag; use `yes`/`no` |

### `/app/output/bond_occupancy.csv`

- Stable key: `batch_id`, `bond_id`.
- Row semantics: Each row represents a replicate-measurement summary for one type of observed disulfide bond in one batch.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `batch_id` | string | — | Batch identifier |
| `bond_id` | string | — | Disulfide-bond identifier |
| `cys_a` | string | — | Identifier of the cysteine at one end of the disulfide bond |
| `cys_b` | string | — | Identifier of the cysteine at the other end of the disulfide bond |
| `peptide_pair` | string | — | Peptide-pair identifier |
| `bond_class` | string | — | Connectivity-class label |
| `n_replicates` | integer | count | Number of replicate measurements aggregated |
| `occupancy_fraction_mean` | number | 1 | Mean occupancy fraction |
| `occupancy_fraction_sd` | number | 1 | Standard deviation of the occupancy fraction |
| `assignment_pass_fraction` | number | 1 | Fraction passing the localization decision |

### `/app/output/free_thiol_summary.csv`

- Stable key: `batch_id`, `cys_id`.
- Row semantics: Each row represents a differential-alkylation replicate-measurement summary for one cysteine site in one batch.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `batch_id` | string | — | Batch identifier |
| `cys_id` | string | — | Cysteine-site identifier |
| `n_replicates` | integer | count | Number of replicate measurements aggregated |
| `free_thiol_fraction_mean` | number | 1 | Mean free-thiol fraction |
| `free_thiol_fraction_sd` | number | 1 | Standard deviation of the free-thiol fraction |
| `alkylation_closure_mean` | number | 1 | Mean alkylation-signal closure |

### `/app/output/cysteine_balance.csv`

- Stable key: `batch_id`, `cys_id`.
- Row semantics: Each row represents a summary of state composition and closure for one cysteine site in one batch.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `batch_id` | string | — | Batch identifier |
| `cys_id` | string | — | Cysteine-site identifier |
| `native_bond_occupancy` | number | 1 | Native-connectivity occupancy |
| `nonnative_bond_occupancy` | number | 1 | Nonnative-connectivity occupancy |
| `free_thiol_fraction` | number | 1 | Free-thiol fraction |
| `cysteine_state_closure` | number | 1 | Cysteine-state closure value |
| `closure_status` | string | — | Closure-status label |

### `/app/output/batch_release.csv`

- Stable key: `batch_id`.
- Row semantics: Each row represents a batch-level summary of connectivity, free thiols, closure, analytical quality, and release disposition.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `batch_id` | string | — | Batch identifier |
| `minimum_native_bond_occupancy` | number | 1 | Summary of native-connectivity occupancy |
| `maximum_nonnative_bond_occupancy` | number | 1 | Summary of nonnative-connectivity occupancy |
| `maximum_free_thiol_fraction` | number | 1 | Summary of the free-thiol fraction |
| `minimum_cysteine_closure` | number | 1 | Summary of the lower bound of cysteine closure |
| `maximum_cysteine_closure` | number | 1 | Summary of the upper bound of cysteine closure |
| `maximum_precursor_mass_error_ppm` | number | ppm | Summary of precursor mass error |
| `minimum_diagnostic_matches` | integer | count | Summary of the number of diagnostic-ion matches |
| `chemistry_decision` | string | — | Batch chemistry release-decision label |
| `failure_reasons` | string | — | Decision-reason labels; separate multiple labels with semicolons, and use `none` when there is no reason |

### `/app/output/disulfide_mapping_report.md`

- Format/encoding: UTF-8 Markdown text.
- Content categories: ion-channel consolidation conventions, precursor isomass limitations, diagnostic-ion localization evidence, differential alkylation results, cysteine-state closure, and the basis and conclusions for batch disposition. The content must not depend on fixed headings or a fixed paragraph order.

### PNG Images

- Format: Decodable PNG.
- `/app/output/connectivity_map.png`: Diagram of disulfide-bond connectivity and occupancy categories.
- `/app/output/cysteine_closure.png`: Diagram of cysteine-state composition and closure.
- `/app/output/batch_release_summary.png`: Diagram of batch-level summary metrics and disposition categories.


Instruction:
# Reconstruction of Deuterium Segregation at the CrN/Steel Interface from Overlapping Ions and Matrix Effects in ToF-SIMS

A deuterium-charged CrN/304L steel specimen has undergone positive-ion ToF-SIMS depth profiling at three locations. The attachments provide H, nominal m/z 2, Cr, Fe, N, and matrix-reference ion counts as functions of sputtering time for each location, together with deuterium-free hydrogen blank gradients, deuterium-containing standards, and independent crater-depth calibrations for the CrN and steel matrices. D+ and H2+ cannot be directly separated at nominal m/z 2, and the two materials also have different ion responses and sputtering rates.

Establish a complete calibration chain and recover the deuterium atomic percentage–depth profiles for the three locations. Determine the CrN/steel interface using the N14 layer marker; separately report the deuterium contents in the coating core, steel matrix, and interface peak; and calculate the interface depth, peak position, peak width, interfacial deuterium excess, and total areal deuterium inventory over the full profile. Summarize the mean/SD across the three locations. Finally, determine whether interfacial deuterium trapping is supported by the data, and explain how mass-peak overlap, matrix effects, and the depth scale affect the conclusions.

Generate analysis.py, calibration_results.csv, corrected_depth_profiles.csv, interface_metrics.csv, specimen_summary.csv, tof_sims_qc.csv, calibration_diagnostics.png, deuterium_depth_profiles.png, interface_summary.png, and tof_sims_report.md under /app/output. Retain explicit units and all three spot_id values in the CSV files; the figures and report must be verifiable from the CSV files. Do not read data from outside /app/input or hard-code reference results.

## Deliverable Files

This section defines only the submission format and does not prescribe the analytical method or expected results. All files are required and must be written to `/app/output/`. Except for PNG files, text and CSV files must use UTF-8 encoding. Numeric columns in CSV files must contain plain numeric values, with units expressed in field names or dedicated unit fields. Canonical field names must be written exactly as shown in the tables below; aliases are not specified.

### `/app/output/analysis.py` — Required

- Format: UTF-8 plain-text source file.
- Content category: An executable analysis script that reconstructs all other deliverable files from the task inputs in `/app/input/`.

### `/app/output/calibration_results.csv` — Required

- Format: CSV, UTF-8.
- Row semantics: Each row represents one calibration result for one material matrix; the stable composite key is `calibration_type`, `matrix`, and `parameter`.

| Canonical field | Type | Unit | Meaning |
|---|---|---|---|
| `calibration_type` | string | — | Calibration category |
| `matrix` | string | — | Material matrix identifier |
| `parameter` | string | — | Calibration quantity identifier |
| `estimate` | number | Given by `unit` | Estimated value of the calibration quantity |
| `sd` | number | Given by `unit` | Standard deviation of the calibration quantity |
| `unit` | string | — | Unit label for `estimate` and `sd` |
| `R2` | number | dimensionless | Calibration-fit summary statistic |
| `n_records` | integer | count | Number of records corresponding to this calibration row |

### `/app/output/corrected_depth_profiles.csv` — Required

- Format: CSV, UTF-8.
- Row semantics: Each row corresponds to one location–sputtering-time point in the input profiles; the stable composite key is `spot_id` and `sputter_time_s`, and `spot_id` must retain the input value.

| Canonical field | Type | Unit | Meaning |
|---|---|---|---|
| `spot_id` | string | — | Analysis-location identifier |
| `sputter_time_s` | number | s | Sputtering time |
| `depth_nm` | number | nm | Depth |
| `crn_fraction` | number | dimensionless | CrN compositional fraction |
| `matrix_reference_counts` | integer | count | Matrix-reference ion counts |
| `h1_ratio` | number | dimensionless | Normalized H1 ratio |
| `mz2_ratio` | number | dimensionless | Normalized nominal m/z 2 ratio |
| `h2_background_ratio` | number | dimensionless | H2 background ratio |
| `corrected_D_ratio` | number | dimensionless | Corrected deuterium response ratio |
| `D_at_percent` | number | at.% | Deuterium atomic percentage |
| `negative_after_blank_correction` | boolean | — | Flag indicating a negative value after blank correction |
| `cr52_ratio` | number | dimensionless | Normalized Cr52 ratio |
| `fe56_ratio` | number | dimensionless | Normalized Fe56 ratio |
| `n14_ratio` | number | dimensionless | Normalized N14 ratio |

### `/app/output/interface_metrics.csv` — Required

- Format: CSV, UTF-8.
- Row semantics: Each row corresponds to one analysis location; the stable key is `spot_id`, retaining the location identifier from the input.

| Canonical field | Type | Unit | Meaning |
|---|---|---|---|
| `spot_id` | string | — | Analysis-location identifier |
| `interface_time_s` | number | s | Interface time position |
| `interface_depth_nm` | number | nm | Interface depth |
| `coating_core_D_mean_at_percent` | number | at.% | Mean deuterium content in the coating core |
| `coating_core_D_sd_at_percent` | number | at.% | Standard deviation of the deuterium content in the coating core |
| `steel_bulk_D_mean_at_percent` | number | at.% | Mean deuterium content in the bulk steel matrix |
| `steel_bulk_D_sd_at_percent` | number | at.% | Standard deviation of the deuterium content in the bulk steel matrix |
| `interface_peak_D_at_percent` | number | at.% | Deuterium content at the interface peak |
| `interface_peak_depth_nm` | number | nm | Depth of the interfacial deuterium peak |
| `interface_FWHM_nm` | number | nm | Interface peak width |
| `interface_excess_D_atoms_nm2` | number | atoms nm^-2 | Interfacial deuterium excess |
| `total_D_inventory_atoms_nm2` | number | atoms nm^-2 | Total areal deuterium inventory over the full profile |
| `negative_correction_fraction` | number | dimensionless | Fraction of records with negative corrected values |

### `/app/output/specimen_summary.csv` — Required

- Format: CSV, UTF-8.
- Row semantics: Long-format table in which each row summarizes one metric across locations; the stable key is `metric`.
- Canonical keys for `metric`: `interface_depth`, `coating_core_D`, `steel_bulk_D`, `interface_peak_D`, `interface_peak_offset`, `interface_FWHM`, `interface_excess_D`, `total_D_inventory`.

| Canonical field | Type | Unit | Meaning |
|---|---|---|---|
| `metric` | string | — | Summary metric identifier |
| `estimate` | number | Given by `unit` | Estimate across locations |
| `sd` | number | Given by `unit` | Standard deviation across locations |
| `unit` | string | — | Unit label for `estimate` and `sd` |
| `n_spots` | integer | count | Number of analysis locations summarized |

### `/app/output/tof_sims_qc.csv` — Required

- Format: CSV, UTF-8.
- Row semantics: A single-row summary of global data, calibration, interface, and status information.

| Canonical field | Type | Unit | Meaning |
|---|---|---|---|
| `n_raw_rows` | integer | count | Number of raw profile records |
| `n_spots` | integer | count | Number of analysis locations |
| `CrN_sputter_rate_nm_s` | number | nm s^-1 | CrN sputtering rate |
| `steel_sputter_rate_nm_s` | number | nm s^-1 | Steel-matrix sputtering rate |
| `minimum_sputter_rate_R2` | number | dimensionless | Summary statistic for the sputtering-rate calibration fit |
| `minimum_H2_overlap_R2` | number | dimensionless | Summary statistic for the H2-overlap calibration fit |
| `minimum_D_sensitivity_R2` | number | dimensionless | Summary statistic for the deuterium-sensitivity calibration fit |
| `maximum_negative_correction_fraction` | number | dimensionless | Summary of the fraction of negatively corrected records across locations |
| `interface_depth_mean_nm` | number | nm | Mean interface depth across locations |
| `interface_depth_sd_nm` | number | nm | Standard deviation of interface depth across locations |
| `interface_peak_D_mean_at_percent` | number | at.% | Mean interfacial deuterium peak across locations |
| `steel_bulk_D_mean_at_percent` | number | at.% | Mean deuterium content in the bulk steel matrix across locations |
| `interface_excess_D_mean_atoms_nm2` | number | atoms nm^-2 | Mean interfacial deuterium excess across locations |
| `mass_overlap_correction_status` | string | — | Status of mass-peak-overlap treatment |
| `matrix_specific_sensitivity_status` | string | — | Status of matrix-response treatment |
| `piecewise_depth_scale_status` | string | — | Status of depth-scale treatment |
| `interface_trapping_status` | string | — | Status of the interfacial deuterium-trapping assessment |
| `overall_status` | string | — | Overall status |
| `failure_reasons` | string | — | Text summary of items that did not pass |

### PNG Images — Required

- `/app/output/calibration_diagnostics.png`: An openable PNG displaying the calibration results and diagnostic information reported in the CSV files.
- `/app/output/deuterium_depth_profiles.png`: An openable PNG displaying the deuterium atomic percentage–depth profile and interface position for each `spot_id`.
- `/app/output/interface_summary.png`: An openable PNG displaying a summary of interface and regional metrics across locations.
- Numerical values, units, and location identifiers in the figures must be verifiable from the deliverable CSV files.

### `/app/output/tof_sims_report.md` — Required

- Format: Markdown, UTF-8.
- Content category: A summary of calibration results; interface and regional metrics; location-specific results and repeatability; a determination of whether interfacial deuterium trapping is supported by the data; and the effects and limitations of mass-peak overlap, matrix response, and the depth scale. Quantitative statements in the report must be verifiable from the deliverable CSV files.

### `/app/output/calibration_results.csv` — Canonical row keys

- Canonical keys for `parameter`: `beta_H1_squared`, `mz2_intercept`, `D_response_per_at_percent`, `sputter_rate_nm_s`.
- Each canonical `parameter` key must be reported once per material matrix, with `matrix` retaining the matrix identifier used by the input files.


Instruction:
# Resolve Species in MEA/MDEA Capture Solvents Using Multiple Analytical Signals and Evaluate Absorption–Regeneration Operating Campaigns

A pilot-scale unit uses a mixed MEA/MDEA amine solvent to absorb CO2. The laboratory independently prepared three replicates each of the lean and rich solvents from two operating campaigns and performed quantitative 13C NMR, dual-endpoint acid titration, total inorganic carbon analysis, and ion chromatography. Calibrated analytical readings, measurement uncertainties, the response relationships between each signal and the solution species, sample pairing information, and operating acceptance criteria are provided in /app/input.

Integrate these analytical results to resolve free/protonated MEA, MEA carbamate, free/protonated MDEA, dissolved CO2, bicarbonate, carbonate, and HSS equivalents in each replicate. Summarize species concentrations and repeatability for each sample; check total amine, total inorganic carbon, and charge closure; and calculate CO2 loading, carbon-containing species fractions, and free-amine fractions. Then compare the paired lean/rich samples from the two operating campaigns in terms of working capacity, HSS level, and the species-based heat-release proxy, and provide operating conclusions and the reasons for them.

Generate analysis.py, replicate_speciation.csv, measurement_fit.csv, species_summary.csv, sample_balance.csv, campaign_performance.csv, co2_speciation.png, campaign_performance.png, analytical_fit_residuals.png, and amine_speciation_report.md under /app/output. All summary results must retain units and the means and standard deviations of the three independently prepared replicates. The figures, tables, and report must be consistent with the CSV files. Do not read data from outside /app/input or hard-code results in the script.

## Deliverable Files

This section defines only the submission format and does not prescribe the analytical method or expected results. All files listed below are required and must be placed directly under `/app/output/`.

### `/app/output/analysis.py`

- Format/encoding: text, UTF-8.

### `/app/output/replicate_speciation.csv`

- Format/encoding: comma-separated CSV, UTF-8; use a period as the decimal separator and include no index column.
- Row semantics: each row corresponds to one species in one independently prepared replicate of one sample, for a total of 108 rows; the stable key is `sample_id` + `replicate` + `species`.
- Required fields:

| Standard field | Type | Unit/meaning |
|---|---|---|
| `sample_id` | string | Sample identifier |
| `campaign_id` | string | Operating campaign identifier |
| `stream_role` | string | Sample stream-role identifier |
| `replicate` | integer | Independently prepared replicate identifier |
| `species` | string | Species identifier |
| `concentration_mmol_g_solution` | number | mmol/g solution |

### `/app/output/measurement_fit.csv`

- Format/encoding: comma-separated CSV, UTF-8; use a period as the decimal separator and include no index column.
- Row semantics: each row corresponds to one analytical signal in one independently prepared replicate of one sample, for a total of 144 rows; the stable key is `sample_id` + `replicate` + `signal_id`.
- Required fields:

| Standard field | Type | Unit/meaning |
|---|---|---|
| `sample_id`, `campaign_id`, `stream_role` | string | Sample, operating campaign, and stream-role identifiers |
| `replicate` | integer | Independently prepared replicate identifier |
| `method`, `signal_id`, `unit` | string | Analytical category, signal identifier, and unit of the values in that row |
| `observed_value`, `predicted_value`, `measurement_sd`, `residual` | number | As specified by `unit` in that row |
| `standardized_residual` | number | Dimensionless |

### `/app/output/species_summary.csv`

- Format/encoding: comma-separated CSV, UTF-8; use a period as the decimal separator and include no index column.
- Row semantics: each row corresponds to the summary of one species in one sample, for a total of 36 rows; the stable key is `sample_id` + `species`.
- Required fields:

| Standard field | Type | Unit/meaning |
|---|---|---|
| `sample_id`, `campaign_id`, `stream_role`, `species` | string | Sample, operating campaign, stream-role, and species identifiers |
| `n_replicates` | integer | Number of independently prepared replicates |
| `concentration_mean_mmol_g_solution` | number | mmol/g solution |
| `concentration_sd_mmol_g_solution` | number | mmol/g solution |

### `/app/output/sample_balance.csv`

- Format/encoding: comma-separated CSV, UTF-8; use a period as the decimal separator and include no index column.
- Row semantics: each row corresponds to the summary and closure results for one sample, for a total of 4 rows; the stable key is `sample_id`.
- Required fields:

| Standard field | Type | Unit/meaning |
|---|---|---|
| `sample_id`, `campaign_id`, `stream_role` | string | Sample, operating campaign, and stream-role identifiers |
| `n_replicates` | integer | Number of independently prepared replicates |
| `total_MEA_mmol_g_mean`, `total_MEA_mmol_g_sd`, `total_MDEA_mmol_g_mean`, `total_MDEA_mmol_g_sd`, `total_amine_mmol_g_mean`, `total_amine_mmol_g_sd`, `total_CO2_mmol_g_mean`, `total_CO2_mmol_g_sd` | number | mmol/g solution |
| `CO2_loading_mol_per_mol_amine_mean`, `CO2_loading_mol_per_mol_amine_sd` | number | mol CO2/mol amine |
| `carbamate_fraction_of_CO2_mean`, `carbamate_fraction_of_CO2_sd`, `bicarbonate_fraction_of_CO2_mean`, `bicarbonate_fraction_of_CO2_sd`, `carbonate_fraction_of_CO2_mean`, `carbonate_fraction_of_CO2_sd`, `free_amine_fraction_mean`, `free_amine_fraction_sd` | number | Dimensionless |
| `HSS_equivalent_per_mol_amine_mean`, `HSS_equivalent_per_mol_amine_sd` | number | mol equivalent/mol amine |
| `charge_residual_mmol_g_mean`, `charge_residual_mmol_g_sd` | number | mmol/g solution |
| `maximum_abs_standardized_fit_residual_mean`, `maximum_abs_standardized_fit_residual_sd` | number | Dimensionless |

### `/app/output/campaign_performance.csv`

- Format/encoding: comma-separated CSV, UTF-8; use a period as the decimal separator and include no index column.
- Row semantics: each row corresponds to one operating campaign, for a total of 2 rows; the stable key is `campaign_id`.
- Required fields:

| Standard field | Type | Unit/meaning |
|---|---|---|
| `campaign_id`, `lean_sample_id`, `rich_sample_id` | string | Operating campaign and paired-sample identifiers |
| `lean_loading_mol_per_mol`, `rich_loading_mol_per_mol`, `working_capacity_mol_per_mol` | number | mol CO2/mol amine |
| `maximum_HSS_per_mol_amine` | number | mol equivalent/mol amine |
| `maximum_abs_standardized_fit_residual` | number | Dimensionless |
| `maximum_abs_charge_residual_mmol_g` | number | mmol/g solution |
| `speciation_heat_proxy_kJ_mol_CO2` | number | kJ/mol CO2 |
| `campaign_decision`, `failure_reasons` | string | Operating campaign decision and reason codes |

The required fields in the five CSV files above may appear in any column order. Additional columns are permitted but must not replace the required fields.

### `/app/output/co2_speciation.png`, `/app/output/campaign_performance.png`, and `/app/output/analytical_fit_residuals.png`

- Format: PNG image.
- Image categories: carbon-containing species results, operating campaign results, and analytical fit residuals, respectively.

### `/app/output/amine_speciation_report.md`

- Format/encoding: Markdown, UTF-8.
- Content categories: integration of analytical signals, species balances, repeatability, closure checks, and the differences between and reasons for the decisions on the two operating campaigns.


Instruction:
# Joint Analysis of Proton-Coupled Binding Thermodynamics Using Multi-Buffer ITC and Dilution Blanks

The laboratory measured isothermal titration calorimetry data for the same ligand–receptor system in PIPES, MOPS, HEPES, and TRIS. Three independent titrations were performed in each buffer, and every binding experiment has a dilution blank from the same buffer and batch and using the same injection program. The per-injection integrated heats, heat uncertainties, measured cell/syringe concentrations, cell volume, buffer ionization enthalpies, and acceptance criteria are provided in /app/input.

Perform per-injection blank correction and uncertainty propagation, reconstruct the titration composition under finite-cell-volume conditions, and jointly fit the four buffers to determine the binding constant, number of active sites, intrinsic binding enthalpy, and number of protons taken up per binding event for each independent replicate. Then summarize the apparent binding enthalpies, fit residuals, and means/standard deviations of the three sets of global parameters at both the individual-titration and buffer levels; determine whether the data support a proton-coupled model; and provide the final acceptance conclusion.

Generate analysis.py, corrected_injection_heats.csv, run_fits.csv, buffer_summary.csv, replicate_global_fits.csv, global_thermodynamics.csv, itc_isotherms.png, buffer_enthalpy_linkage.png, itc_fit_residuals.png, and itc_linkage_report.md under /app/output. Retain explicit units in the results, and ensure that the figures, tables, and report are consistent with the CSV files. Do not read data from outside /app/input or hard-code reference results in the script.

## Deliverables

This section defines only the submission format and content categories; it does not prescribe the analysis method or results. All files listed below are required and must be written directly to `/app/output/`.

### `/app/output/analysis.py`

- Format and encoding: `.py` text file, UTF-8.

### General CSV Conventions

- Format and encoding: UTF-8, comma-separated CSV; use a period as the decimal separator; do not write an additional index column.
- The fields in the tables below are listed in the required column order. Fields separated by commas within the same table cell must appear consecutively in the file and retain the listed order.

### `/app/output/corrected_injection_heats.csv`

- Row semantics: Each row corresponds to one injection in a binding titration, for a total of 216 rows.
- Stable keys: `buffer_id`, `replicate`, and `injection_index`; `run_id` identifies the associated binding titration.

| Required field | Type | Unit | Meaning |
|---|---|---|---|
| `run_id`, `buffer_id` | string | — | Binding titration identifier and buffer identifier |
| `replicate`, `injection_index` | integer | — | Independent replicate number and injection number |
| `injection_volume_uL` | number | µL | Volume of a single injection |
| `molar_ratio_total_ligand_to_receptor` | number | dimensionless | Molar ratio of total ligand to receptor |
| `binding_heat_uJ`, `blank_heat_uJ` | number | µJ | Binding-titration heat and paired blank heat |
| `binding_heat_sd_uJ`, `blank_heat_sd_uJ` | number | µJ | Uncertainties of the binding-titration heat and paired blank heat |
| `corrected_heat_uJ`, `corrected_heat_sd_uJ` | number | µJ | Corrected heat and its uncertainty |
| `predicted_corrected_heat_uJ`, `residual_uJ` | number | µJ | Predicted corrected heat and residual |
| `standardized_residual` | number | dimensionless | Standardized residual |

### `/app/output/run_fits.csv`

- Row semantics: Each row corresponds to one binding titration, for a total of 12 rows.
- Stable key: `run_id`; `buffer_id` and `replicate` specify its buffer and independent-replicate identities.

| Required field | Type | Unit | Meaning |
|---|---|---|---|
| `run_id`, `buffer_id` | string | — | Binding titration identifier and buffer identifier |
| `replicate` | integer | — | Independent replicate number |
| `buffer_ionization_enthalpy_kJ_mol` | number | kJ/mol | Buffer ionization enthalpy |
| `Ka_M_inv_global_replicate` | number | M⁻¹ | Binding constant for the corresponding independent replicate |
| `n_sites_global_replicate` | number | dimensionless | Number of active sites for the corresponding independent replicate |
| `observed_binding_enthalpy_kJ_mol` | number | kJ/mol | Apparent binding enthalpy of the individual titration |
| `expected_from_linkage_kJ_mol` | number | kJ/mol | Apparent binding enthalpy corresponding to the proton-linkage relationship |
| `heat_rmse_uJ` | number | µJ | RMSE of the heat residuals |
| `maximum_abs_standardized_residual` | number | dimensionless | Maximum absolute standardized residual |

### `/app/output/buffer_summary.csv`

- Row semantics: Each row corresponds to one buffer, for a total of 4 rows.
- Stable key: `buffer_id`.

| Required field | Type | Unit | Meaning |
|---|---|---|---|
| `buffer_id` | string | — | Buffer identifier |
| `buffer_ionization_enthalpy_kJ_mol` | number | kJ/mol | Buffer ionization enthalpy |
| `n_runs` | integer | — | Number of titrations included in the summary |
| `observed_binding_enthalpy_mean_kJ_mol`, `observed_binding_enthalpy_sd_kJ_mol` | number | kJ/mol | Mean and standard deviation of the apparent binding enthalpy |
| `heat_rmse_mean_uJ` | number | µJ | Mean RMSE of the heat residuals |
| `maximum_abs_standardized_residual` | number | dimensionless | Maximum absolute standardized residual |

### `/app/output/replicate_global_fits.csv`

- Row semantics: Each row corresponds to the global result for one set of independent replicates, for a total of 3 rows.
- Stable key: `replicate`.

| Required field | Type | Unit | Meaning |
|---|---|---|---|
| `replicate` | integer | — | Independent replicate number |
| `Ka_M_inv` | number | M⁻¹ | Binding constant |
| `Kd_uM` | number | µM | Dissociation constant |
| `n_sites` | number | dimensionless | Number of active sites |
| `deltaH_intrinsic_kJ_mol` | number | kJ/mol | Intrinsic binding enthalpy |
| `protons_uptake_per_binding` | number | protons/binding event | Number of protons taken up per binding event |
| `deltaG_apparent_kJ_mol` | number | kJ/mol | Apparent binding free energy |
| `TdeltaS_linkage_intercept_kJ_mol` | number | kJ/mol | Entropic term corresponding to the proton-linkage intercept |
| `weighted_rmse` | number |  | Weighted residual RMSE |
| `maximum_abs_standardized_residual` | number | dimensionless | Maximum absolute standardized residual |

### `/app/output/global_thermodynamics.csv`

- Row semantics: A single-row summary of the three sets of independent replicates and the buffer proton-linkage results.

| Required field | Type | Unit | Meaning |
|---|---|---|---|
| `n_replicate_global_fits` | integer | — | Number of independent global results included in the summary |
| `Ka_M_inv_mean`, `Ka_M_inv_sd` | number | M⁻¹ | Mean and standard deviation of the binding constant |
| `Kd_uM_mean`, `Kd_uM_sd` | number | µM | Mean and standard deviation of the dissociation constant |
| `n_sites_mean`, `n_sites_sd` | number | dimensionless | Mean and standard deviation of the number of active sites |
| `deltaH_intrinsic_kJ_mol_mean`, `deltaH_intrinsic_kJ_mol_sd` | number | kJ/mol | Mean and standard deviation of the intrinsic binding enthalpy |
| `protons_uptake_per_binding_mean`, `protons_uptake_per_binding_sd` | number | protons/binding event | Mean and standard deviation of the number of protons taken up per binding event |
| `deltaG_apparent_kJ_mol_mean`, `deltaG_apparent_kJ_mol_sd` | number | kJ/mol | Mean and standard deviation of the apparent binding free energy |
| `TdeltaS_linkage_intercept_kJ_mol_mean`, `TdeltaS_linkage_intercept_kJ_mol_sd` | number | kJ/mol | Mean and standard deviation of the entropic term corresponding to the proton-linkage intercept |
| `weighted_rmse_mean`, `weighted_rmse_sd` | number |  | Mean and standard deviation of the weighted residual RMSE |
| `maximum_abs_standardized_residual_mean`, `maximum_abs_standardized_residual_sd` | number | dimensionless | Mean and standard deviation of the maximum absolute standardized residual |
| `buffer_linkage_intercept_kJ_mol` | number | kJ/mol | Intercept of the buffer enthalpy linkage |
| `buffer_linkage_slope_protons` | number | protons/binding event | Slope of the buffer enthalpy linkage |
| `buffer_linkage_R2` | number | dimensionless | Coefficient of determination for the buffer enthalpy linkage |
| `assessment_status`, `failure_reasons` | string | — | Acceptance status and reasons for failure |

### PNG Images

- `/app/output/itc_isotherms.png`: Blank-corrected ITC isotherms.
- `/app/output/buffer_enthalpy_linkage.png`: Plot of the relationship between buffer ionization enthalpy and apparent binding enthalpy.
- `/app/output/itc_fit_residuals.png`: ITC fit residual plot.
- All three figures must be valid, openable PNG files, clearly labeled, include units, and be consistent with the CSV contents.

### `/app/output/itc_linkage_report.md`

- Format and encoding: Markdown, UTF-8.
- Content categories: paired blanks, finite cell volume, measured concentrations, binding constants and numbers of active sites, differences in apparent binding enthalpy among buffers, intrinsic binding enthalpy, proton linkage, independent-replicate results and their summary, residuals, and the acceptance conclusion.


Instruction:
# Regression of Ethanol–Water NRTL Parameters from Two-Phase GC–VLE Data and Determination of the Atmospheric Azeotropic Limitation

A laboratory vapor–liquid equilibrium still was used to measure phase equilibria for the ethanol–water system near atmospheric pressure. Three independent experiments were conducted for each of 14 compositions. After equilibrium was reached, samples of the liquid phase and condensed vapor phase were collected separately and analyzed by GC using an internal standard. The raw peak areas, component response calibrations, equilibrium temperatures and absolute pressures, Antoine constants, NRTL conventions, and process acceptance criteria are provided in /app/input.

Recover the liquid- and vapor-phase mole fractions for each experimental point, verify composition closure, and regress the NRTL parameters separately for each of the three independent datasets. Report the pointwise bubble-point pressures, vapor-phase compositions, activity coefficients, and residuals, and then summarize the parameter means and standard deviations. Using the summarized parameters, project the ethanol–water azeotropic composition and temperature at 101.325 kPa, compare the direction of single-stage vapor enrichment on both sides of the azeotrope, and determine whether simple distillation can achieve an ethanol mole fraction of 0.95.

Generate analysis.py, normalized_vle_points.csv, replicate_nrtl_fits.csv, nrtl_parameter_summary.csv, azeotrope_projection.csv, distillation_screen.csv, txy_diagram.png, yx_equilibrium.png, vle_fit_residuals.png, and vle_nrtl_report.md under /app/output. Retain explicit units in the results, and ensure that the figures, tables, and report are consistent with the CSV files. Do not read data from outside /app/input or hard-code reference results.

## Deliverable File Formats

The following specifies only the submission interface and does not prescribe the computational results. All CSV files must use UTF-8 encoding, decimal points, and no index column; column order is not constrained.

### `analysis.py`

It must independently regenerate the five CSV files, three PNG files, and the report when executed using `python analysis.py --input /app/input --output /app/output`.

### `normalized_vle_points.csv`

42 rows, with each experimental point uniquely identified by the combination of `point_id` and `replicate`.

| Field | Type | Unit/Meaning |
|---|---|---|
| `point_id` | string | Experimental point identifier |
| `replicate` | integer | Independent replicate number |
| `temperature_K` | number | K |
| `pressure_kPa` | number | kPa, absolute pressure |
| `liquid_ethanol_mole_fraction` | number | Liquid-phase ethanol mole fraction |
| `liquid_water_mole_fraction` | number | Liquid-phase water mole fraction |
| `vapor_ethanol_mole_fraction` | number | Vapor-phase ethanol mole fraction |
| `vapor_water_mole_fraction` | number | Vapor-phase water mole fraction |
| `predicted_bubble_pressure_kPa` | number | kPa |
| `predicted_vapor_ethanol_mole_fraction` | number | Predicted vapor-phase ethanol mole fraction |
| `gamma_ethanol` | number | Ethanol activity coefficient |
| `gamma_water` | number | Water activity coefficient |
| `pressure_residual_kPa` | number | kPa |
| `vapor_residual` | number | Vapor-phase composition residual |
| `standardized_pressure_residual` | number | Standardized pressure residual |
| `standardized_vapor_residual` | number | Standardized vapor-phase composition residual |
| `replicate_fit_tau12` | number | NRTL `tau12` for this replicate |
| `replicate_fit_tau21` | number | NRTL `tau21` for this replicate |

### `replicate_nrtl_fits.csv`

3 rows, with each independent fit uniquely identified by `replicate`.

| Field | Type | Meaning |
|---|---|---|
| `replicate` | integer | Independent replicate number |
| `tau12` | number | NRTL parameter |
| `tau21` | number | NRTL parameter |
| `objective` | number | Objective-function value of the fit |
| `maximum_abs_standardized_residual` | number | Maximum absolute standardized residual |

### `nrtl_parameter_summary.csv`

1 row, with the following fields: `n_replicates` (integer), `alpha`, `tau12_mean`, `tau12_sd`, `tau21_mean`, `tau21_sd`, `weighted_rmse_mean`, `weighted_rmse_sd`, and `maximum_abs_standardized_residual` (all number), and `fit_status` (string, using `accepted` or `not_accepted`).

### `azeotrope_projection.csv`

1 row.

| Field | Type | Unit/Meaning |
|---|---|---|
| `pressure_kPa` | number | kPa |
| `ethanol_x_azeotrope` | number | Azeotropic liquid-phase ethanol mole fraction |
| `ethanol_y_azeotrope` | number | Azeotropic vapor-phase ethanol mole fraction |
| `temperature_K` | number | K |
| `gamma_ethanol` | number | Ethanol activity coefficient |
| `gamma_water` | number | Water activity coefficient |
| `target_ethanol_mole_fraction` | number | Target ethanol mole fraction |
| `target_reachability` | string | Use `reachable_by_simple_distillation` or `not_reachable_by_simple_distillation` |
| `assessment_status` | string | Use `accepted` or `not_accepted` |

### `distillation_screen.csv`

10 rows, with each screening composition uniquely identified by `liquid_ethanol_mole_fraction`.

| Field | Type | Unit/Meaning |
|---|---|---|
| `liquid_ethanol_mole_fraction` | number | Feed liquid-phase ethanol mole fraction |
| `bubble_temperature_K` | number | K |
| `vapor_ethanol_mole_fraction` | number | Equilibrium vapor-phase ethanol mole fraction |
| `relative_volatility_ethanol_to_water` | number | Relative volatility of ethanol to water |
| `gamma_ethanol` | number | Ethanol activity coefficient |
| `gamma_water` | number | Water activity coefficient |
| `single_stage_direction` | string | Use `ethanol_enriched_vapor`, `water_enriched_vapor`, or `near_azeotrope` |
| `target_0_95_reachable_from_this_feed` | string | Use `yes` or `no` |

### PNG Figures

`txy_diagram.png`, `yx_equilibrium.png`, and `vle_fit_residuals.png` are all required PNG files with dimensions of at least 800×500 pixels. They must respectively present the T–x–y diagram, the y–x diagram/azeotropic point, and the fit residuals, with axes and units labeled.

### `vle_nrtl_report.md`

A Markdown report is required. It must be consistent with the submitted CSV files and describe the conversion of GC responses and treatment of phase compositions, the three NRTL fits and their repeatability, the azeotrope projection, the enrichment direction near the azeotrope, and the attainability of the target by simple distillation.


Instruction:
# Reconstruction of Prior Austenite from Martensitic EBSD Grain Orientations and Quantification of KS Variants and Parent Grain Boundaries

A quenched-state EBSD map of a low-alloy steel has been segmented into martensitic child grains, with a small number of retained austenite orientation seeds preserved. The child-grain areas, centroids, and orientations; retained austenite seeds; child-grain adjacency boundaries; and cubic symmetry and Kurdjumov–Sachs variant operations are provided in /app/input.

Reconstruct the prior austenite grains, assign a parent_id and KS variant_id to each martensitic child grain, summarize the prior austenite orientations, areas, and reconstruction residuals, and calculate the variant area fractions within each parent. Then aggregate child-grain boundary segments crossing between parents into a prior austenite grain-boundary network, report the boundary lengths, parent-grain disorientations, and boundary classes, and provide a conclusion regarding reconstruction quality.

Generate analysis.py, child_variant_assignment.csv, parent_grains.csv, variant_statistics.csv, parent_boundary_network.csv, reconstruction_qc.csv, reconstructed_parent_map.png, variant_selection_heatmap.png, parent_boundary_network.png, and parent_reconstruction_report.md under /app/output. The summarized data shall retain counts, areas, means/standard deviations, angular units, and decision fields. The figures and report shall be consistent with the CSV files.

## Deliverables

The following content defines only the submission format and does not prescribe the implementation method or expected results. All 10 files listed below are required and shall be placed directly under `/app/output/`.

All CSV files shall be UTF-8 encoded, comma-delimited, and include headers. CSV column order is not prescribed; additional columns are permitted, but they shall not replace or alter the semantics of the required fields below.

### `/app/output/analysis.py`

- Format/encoding: Python source file, UTF-8.
- Content category: Analysis script used for the submission.

### `/app/output/child_variant_assignment.csv`

- Row semantics: Each row represents one martensitic child grain.
- Stable key: `child_grain_id`, unique in each row.
- Fields:

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `child_grain_id` | string | — | Child-grain identifier |
| `parent_id` | string | — | Reconstructed parent-grain identifier |
| `variant_id` | string | — | KS variant identifier |
| `area_um2` | number | µm² | Child-grain area |
| `centroid_x_um` | number | µm | x-coordinate of the child-grain centroid |
| `centroid_y_um` | number | µm | y-coordinate of the child-grain centroid |
| `seed_distance_um` | number | µm | Spatial distance between the child grain and the corresponding orientation seed |
| `seed_residual_deg` | number | ° | Residual angle relative to the orientation seed |
| `refined_residual_deg` | number | ° | Residual angle relative to the reconstructed parent orientation |
| `second_best_parent_residual_deg` | number | ° | Residual angle of the second-best parent-grain candidate |
| `parent_residual_margin_deg` | number | ° | Residual margin between parent-grain candidates |
| `assignment_status` | string | — | Child-grain assignment status |

### `/app/output/parent_grains.csv`

- Row semantics: Each row represents one reconstructed parent grain.
- Stable key: `parent_id`, unique in each row.
- Fields:

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `parent_id` | string | — | Reconstructed parent-grain identifier |
| `n_child_grains` | integer | — | Number of constituent child grains |
| `n_observed_variants` | integer | — | Number of observed variants |
| `area_um2` | number | µm² | Parent-grain area |
| `area_fraction` | number | 1 | Parent-grain area fraction |
| `centroid_x_um` | number | µm | x-coordinate of the area-weighted parent-grain centroid |
| `centroid_y_um` | number | µm | y-coordinate of the area-weighted parent-grain centroid |
| `mean_child_residual_deg` | number | ° | Mean child-grain residual |
| `sd_child_residual_deg` | number | ° | Standard deviation of child-grain residuals |
| `maximum_child_residual_deg` | number | ° | Maximum child-grain residual |
| `seed_drift_deg` | number | ° | Disorientation between the reconstructed parent orientation and the corresponding orientation seed |
| `qw` | number | 1 | Scalar component of the parent-grain orientation quaternion |
| `qx` | number | 1 | x-component of the parent-grain orientation quaternion |
| `qy` | number | 1 | y-component of the parent-grain orientation quaternion |
| `qz` | number | 1 | z-component of the parent-grain orientation quaternion |
| `phi1_deg` | number | ° | Bunge Euler angle `phi1` of the parent-grain orientation |
| `Phi_deg` | number | ° | Bunge Euler angle `Phi` of the parent-grain orientation |
| `phi2_deg` | number | ° | Bunge Euler angle `phi2` of the parent-grain orientation |

### `/app/output/variant_statistics.csv`

- Row semantics: Each row represents a combination of one parent grain and one KS variant, including combinations for which no child grain was observed.
- Stable key: The combination of `parent_id` and `variant_id`, unique in each row.
- Fields:

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `parent_id` | string | — | Reconstructed parent-grain identifier |
| `variant_id` | string | — | KS variant identifier |
| `n_child_grains` | integer | — | Number of child grains in this combination |
| `area_um2` | number | µm² | Total area of child grains in this combination |
| `parent_area_um2` | number | µm² | Area of the corresponding parent grain |
| `area_fraction_within_parent` | number | 1 | Area fraction of this variant within the corresponding parent grain |

### `/app/output/parent_boundary_network.csv`

- Row semantics: Each row represents one undirected aggregated grain boundary between a pair of reconstructed parent grains.
- Stable key: The undirected parent-grain pair formed by `parent_a` and `parent_b`, unique in each row.
- Fields:

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `parent_a` | string | — | Identifier of the parent grain on one side of the boundary |
| `parent_b` | string | — | Identifier of the parent grain on the other side of the boundary |
| `n_child_boundary_segments` | integer | — | Number of aggregated child-grain boundary segments |
| `total_boundary_length_um` | number | µm | Total length of the aggregated boundary |
| `parent_disorientation_deg` | number | ° | Disorientation angle between the parent grains |
| `disorientation_axis_h` | number | 1 | h-component of the disorientation axis |
| `disorientation_axis_k` | number | 1 | k-component of the disorientation axis |
| `disorientation_axis_l` | number | 1 | l-component of the disorientation axis |
| `axis_to_nearest_111_deg` | number | ° | Angle between the disorientation axis and the nearest `<111>` axis |
| `boundary_class` | string | — | Parent grain-boundary class |

### `/app/output/reconstruction_qc.csv`

- Row semantics: A single-row summary of reconstruction quality.
- Fields:

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `n_child_grains` | integer | — | Number of child grains |
| `n_reconstructed_parents` | integer | — | Number of reconstructed parent grains |
| `n_parent_boundaries` | integer | — | Number of aggregated parent grain boundaries |
| `assigned_area_fraction` | number | 1 | Area fraction of assigned child grains |
| `area_closure_fraction` | number | 1 | Area closure fraction |
| `mean_child_residual_deg` | number | ° | Mean child-grain residual |
| `maximum_child_residual_deg` | number | ° | Maximum child-grain residual |
| `maximum_seed_drift_deg` | number | ° | Maximum orientation-seed drift |
| `sigma3_boundary_count` | integer | — | Number of parent grain boundaries classified as `Sigma3` |
| `low_angle_boundary_count` | integer | — | Number of parent grain boundaries classified as `low_angle` |
| `general_boundary_count` | integer | — | Number of parent grain boundaries classified as `general` |
| `reconstruction_status` | string | — | Reconstruction quality status |

### Image Files

- `/app/output/reconstructed_parent_map.png`: Reconstructed parent-grain map in PNG format.
- `/app/output/variant_selection_heatmap.png`: Variant-selection heatmap in PNG format.
- `/app/output/parent_boundary_network.png`: Parent grain-boundary network plot in PNG format.
- All three images shall be openable, clearly labeled, and consistent with the results represented in the corresponding CSV files.

### `/app/output/parent_reconstruction_report.md`

- Format/encoding: Markdown, UTF-8.
- Content category: Reconstruction results, child-grain assignments, parent-grain summary, variant statistics, parent grain-boundary network, reconstruction quality, and consistency between the tables and images.


Instruction:
# Distinguishing Viscosity Effects and Quantifying the Thermodynamics of Aromatic Urea Self-Association by Variable-Temperature 19F PFG-NMR

The research group is investigating whether aromatic urea U17 undergoes reversible self-association in CDCl3. The attachments contain a set of 19F PFG-NMR experimental records at 288.15, 298.15, and 308.15 K, covering three independent sample preparations and ten concentrations; each sample also contains an inert TFTB internal reference. Different receiver gains and numbers of scans were used in the gradient series, and internal-reference blanks are provided at each temperature. In the sample table, train is to be used for model construction, whereas validation denotes concentrations reserved in advance that may be used for testing only after parameter determination.

Starting from the raw integrals, perform diffusion-decay fitting and repeatability analysis, recalculate the total monomer-equivalent concentration of U17, and account for the effect of sample viscosity on U17 diffusion. Compare two explanations, “viscosity changes only” and “reversible monomer–dimer association,” and report the dimerization equilibrium constant, monomer diffusion coefficient, and dimer-to-monomer diffusion ratio at the three temperatures, as well as the dimerization enthalpy, entropy, and free energy at 298.15 K; then provide the prediction errors for the held-out concentrations and the final QC conclusion.

Generate analysis.py, diffusion_fits.csv, diffusion_summary.csv, association_parameters.csv, validation_predictions.csv, association_qc.csv, attenuation_diagnostics.png, association_isotherms.png, vant_hoff_plot.png, and pfg_association_report.md under /app/output. Numerical results must retain units, the mean/SD across independent replicates, and train/validation identities. The figures, tables, and report must be verifiable from the CSV files. Do not read data from outside /app/input, do not hard-code reference results, and do not use validation data for parameter estimation.

## Deliverable Files

This section defines only the submission format and does not prescribe the analysis method or expected results. All paths listed below are required. All CSV files must be UTF-8 encoded and include headers; numeric fields must contain plain numeric values, with units expressed in field names or in the `unit` field. CSV column order is unrestricted, and additional columns are permitted, but the required fields specified below must be retained and their field names must not be replaced with aliases.

### `/app/output/analysis.py`

An executable plain-text analysis script used to reconstruct the remaining deliverables from the task inputs.

### `/app/output/diffusion_fits.csv`

Each row corresponds to one combination of `sample_id`, `temperature_K`, `species`, and `acquisition_replicate`; these four fields jointly constitute the stable row key.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `sample_id` | string | — | Sample identifier |
| `prep_replicate` | string | — | Independent sample-preparation identifier |
| `fit_role` | string | — | Data role (`blank`, `train`, or `validation`) |
| `temperature_K` | number | K | Experimental temperature |
| `species` | string | — | Signal category (`U17_CF3` or `TFTB_reference`) |
| `acquisition_replicate` | integer | — | Independent acquisition-replicate identifier |
| `n_points` | integer | — | Number of data points in the curve corresponding to this row |
| `D_m2_s` | number | m^2 s^-1 | Diffusion coefficient |
| `I0_corrected_counts` | number | counts | Corrected zero-attenuation signal intensity |
| `fit_rmse_fraction` | number | dimensionless | Fractional RMSE of the attenuation fit |
| `R2` | number | dimensionless | Coefficient of determination of the attenuation fit |

### `/app/output/diffusion_summary.csv`

Each row corresponds to one nonblank combination of `sample_id` and `temperature_K`; these two fields jointly constitute the stable row key.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `sample_id` | string | — | Sample identifier |
| `prep_replicate` | string | — | Independent sample-preparation identifier |
| `fit_role` | string | — | Data role (`train` or `validation`) |
| `temperature_K` | number | K | Experimental temperature |
| `total_concentration_mM` | number | mM | Total monomer-equivalent concentration of U17 |
| `analyte_D_mean_m2_s` | number | m^2 s^-1 | Mean U17 diffusion coefficient |
| `analyte_D_sd_m2_s` | number | m^2 s^-1 | Standard deviation of the U17 diffusion coefficient |
| `reference_D_mean_m2_s` | number | m^2 s^-1 | Mean TFTB diffusion coefficient in the sample |
| `reference_D_sd_m2_s` | number | m^2 s^-1 | Standard deviation of the TFTB diffusion coefficient in the sample |
| `blank_reference_D_m2_s` | number | m^2 s^-1 | Mean blank TFTB diffusion coefficient at the same temperature |
| `blank_reference_D_sd_m2_s` | number | m^2 s^-1 | Standard deviation of the blank TFTB diffusion coefficient at the same temperature |
| `relative_viscosity_factor` | number | dimensionless | Relative viscosity factor |
| `corrected_analyte_D_m2_s` | number | m^2 s^-1 | Mean corrected U17 diffusion coefficient |
| `corrected_analyte_D_sd_m2_s` | number | m^2 s^-1 | Standard deviation of the corrected U17 diffusion coefficient |

### `/app/output/association_parameters.csv`

A long-format parameter table in which each row corresponds to one combination of `parameter` and `temperature_K`; these two fields jointly constitute the stable row key. Leave `temperature_K` blank for global parameters.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `parameter` | string | — | Stable parameter key |
| `temperature_K` | number or empty | K | Temperature for a temperature-dependent parameter; blank for a global parameter |
| `estimate` | number | specified by `unit` | Parameter estimate |
| `sd` | number | same as `estimate` | Standard deviation across independent sample-preparation results |
| `unit` | string | — | Parameter unit |
| `n_prep_fits` | integer | — | Number of independent sample-preparation fits |

Use the following stable keys for `parameter` and `unit`:

| `parameter` | Semantics of `temperature_K` | `unit` |
|---|---|---|
| `K_dimer_M_inv` | Each experimental temperature | `M^-1` |
| `D_monomer_m2_s` | Each experimental temperature | `m^2 s^-1` |
| `D_dimer_over_D_monomer` | Blank (global) | `dimensionless` |
| `delta_H_dimerization` | Blank (global) | `kJ mol^-1` |
| `delta_S_dimerization` | Blank (global) | `J mol^-1 K^-1` |
| `delta_G_dimerization_298K` | 298.15 K | `kJ mol^-1` |

### `/app/output/validation_predictions.csv`

Each row corresponds to one combination of `sample_id` and `temperature_K` for a held-out sample; these two fields jointly constitute the stable row key. Include only `validation` data.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `sample_id` | string | — | Sample identifier |
| `prep_replicate` | string | — | Independent sample-preparation identifier |
| `temperature_K` | number | K | Experimental temperature |
| `total_concentration_mM` | number | mM | Total monomer-equivalent concentration of U17 |
| `observed_corrected_D_m2_s` | number | m^2 s^-1 | Observed corrected U17 diffusion coefficient |
| `observed_corrected_D_sd_m2_s` | number | m^2 s^-1 | Standard deviation of the observed corrected U17 diffusion coefficient |
| `predicted_corrected_D_m2_s` | number | m^2 s^-1 | Predicted corrected U17 diffusion coefficient |
| `standardized_residual` | number | dimensionless | Standardized residual |
| `predicted_dimer_fraction` | number | dimensionless | Predicted dimer fraction |

### `/app/output/association_qc.csv`

A single-row summary table.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `n_raw_rows` | integer | count | Number of raw data rows |
| `n_diffusion_curves` | integer | count | Number of diffusion-attenuation curves |
| `n_training_sample_temperature_rows` | integer | count | Number of training-set sample–temperature rows |
| `n_validation_sample_temperature_rows` | integer | count | Number of validation-set sample–temperature rows |
| `mean_attenuation_R2` | number | dimensionless | Mean R2 of the attenuation fits |
| `minimum_attenuation_R2` | number | dimensionless | Minimum R2 of the attenuation fits |
| `maximum_blank_reference_relative_sd` | number | dimensionless | Maximum relative standard deviation of the blank internal reference |
| `association_AICc` | number | dimensionless | AICc for the self-association explanation |
| `viscosity_only_AICc` | number | dimensionless | AICc for the viscosity-only explanation |
| `delta_AICc_association_vs_viscosity_only` | number | dimensionless | AICc difference between the two explanations |
| `maximum_abs_validation_standardized_residual` | number | dimensionless | Maximum absolute standardized residual for the held-out data |
| `receiver_gain_calibration_status` | string | — | Receiver-gain calibration status |
| `temperature_specific_viscosity_correction_status` | string | — | Temperature-specific viscosity-correction status |
| `association_model_status` | string | — | Self-association explanation status |
| `overall_status` | string | — | Overall QC status |
| `failure_reasons` | string | — | Reasons for QC failure; retain this field even when there are no reasons |

### Image Files

- `/app/output/attenuation_diagnostics.png`: PNG-format diagnostic plot of diffusion attenuation.
- `/app/output/association_isotherms.png`: PNG-format plot of concentration dependence at the three temperatures, distinguishing `train` from `validation` data.
- `/app/output/vant_hoff_plot.png`: PNG-format plot of temperature dependence.

### `/app/output/pfg_association_report.md`

A UTF-8 Markdown report. The report must cover data processing and correction, comparison of the two explanations, validation using the held-out data, interpretation of the thermodynamic results, and the final QC assessment and conclusion, and must ensure that the reported numerical values and figures can be verified from the CSV files above.


Instruction:
# Reconstruction of the Two-Dimensional Strain Tensor and Principal-Strain Hotspots from Indexed 4D-STEM Nanobeam Diffraction

Diffraction-peak detection and h/k indexing have already been completed for a set of nanobeam 4D-STEM data. The scan covers 21×17 positions, with 6 reciprocal-lattice peaks retained at each position; an independent standard sample was also acquired under the same detector conditions. The scan peak table, raw/certified q values for the standard sample, the undeformed reference reciprocal basis, ROI definitions, and quality requirements are provided in /app/input.

First calibrate the detector coordinates, then recover the local reciprocal basis and real-space deformation from the indexed peaks at each scan position. Separate lattice rotation from symmetric strain, and generate two-dimensional results for strain_xx, strain_yy, strain_xy, the principal strains, and the principal directions. Subsequently, perform ROI statistics, extract the centerline profile at y=160 nm, evaluate peak-fitting residuals, identify strain hotspots, and provide a conclusion regarding reconstruction quality.

Generate analysis.py, calibrated_diffraction_vectors.csv, strain_map.csv, region_summary.csv, strain_line_profile.csv, strain_qc.csv, strain_tensor_maps.png, principal_strain_map.png, strain_line_profile.png, and stem_strain_report.md under /app/output. Retain explicit units and mean/SD in the results, and ensure that the figures, tables, and report are consistent with the CSV files; do not read data from outside /app/input or hard-code reference results.

## Deliverable Files

The following defines only the submission format and does not prescribe the analysis method or expected results. All 10 paths listed below are required. All CSV files must use UTF-8 encoding, comma delimiters, decimal-point notation, and no index column. Column order is unrestricted, and additional columns are permitted, but the required fields below must use the specified names.

### `/app/output/analysis.py`

Text of the analysis script; it must be capable of generating the remaining deliverables from the public inputs in `/app/input`.

### `/app/output/calibrated_diffraction_vectors.csv`

Each row corresponds to one indexed diffraction vector at one scan position, with (`point_id`, `h`, `k`) as the stable key.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `point_id` | string | — | Scan-position identifier |
| `grid_i`, `grid_j` | integer | — | Scan-grid indices |
| `scan_x_nm`, `scan_y_nm` | number | nm | Scan coordinates |
| `h`, `k` | integer | — | Diffraction-peak indices |
| `qx_raw_nm_inv`, `qy_raw_nm_inv` | number | nm⁻¹ | Raw reciprocal-vector components |
| `qx_calibrated_nm_inv`, `qy_calibrated_nm_inv` | number | nm⁻¹ | Calibrated reciprocal-vector components |
| `qx_predicted_nm_inv`, `qy_predicted_nm_inv` | number | nm⁻¹ | Reciprocal-vector components corresponding to the local reconstruction |
| `qx_residual_nm_inv`, `qy_residual_nm_inv` | number | nm⁻¹ | Reciprocal-vector residual components |
| `intensity_counts` | number | counts | Peak intensity |
| `peak_sigma_nm_inv` | number | nm⁻¹ | Peak-position uncertainty |

### `/app/output/strain_map.csv`

Each row corresponds to one scan position, with `point_id` as the stable key.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `point_id` | string | — | Scan-position identifier |
| `grid_i`, `grid_j` | integer | — | Scan-grid indices |
| `scan_x_nm`, `scan_y_nm` | number | nm | Scan coordinates |
| `F11`, `F12`, `F21`, `F22` | number | dimensionless | Components of the real-space deformation gradient |
| `strain_xx`, `strain_yy`, `strain_xy` | number | dimensionless | Components of the symmetric strain tensor |
| `rotation_deg` | number | degree | Lattice rotation angle |
| `principal_strain_max`, `principal_strain_min` | number | dimensionless | Principal strains |
| `principal_direction_deg` | number | degree | Axial orientation angle of the maximum principal strain |
| `determinant_F` | number | dimensionless | Determinant of the deformation gradient |
| `q_fit_rmse_nm_inv` | number | nm⁻¹ | Summary of the local reciprocal-vector fitting residuals |

### `/app/output/region_summary.csv`

Each row corresponds to one reporting region, with `region_id` as the stable key.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `region_id` | string | — | Reporting-region identifier |
| `n_points` | integer | — | Number of scan positions within the region |
| `strain_xx_mean`, `strain_xx_sd`, `strain_yy_mean`, `strain_yy_sd`, `strain_xy_mean`, `strain_xy_sd` | number | dimensionless | Regional means and standard deviations of the strain-tensor components |
| `rotation_deg_mean`, `rotation_deg_sd` | number | degree | Regional mean and standard deviation of the lattice rotation angle |
| `principal_strain_max_mean`, `principal_strain_max_sd`, `principal_strain_min_mean`, `principal_strain_min_sd` | number | dimensionless | Regional means and standard deviations of the principal strains |
| `determinant_F_mean`, `determinant_F_sd` | number | dimensionless | Regional mean and standard deviation of the determinant of the deformation gradient |
| `q_fit_rmse_nm_inv_mean`, `q_fit_rmse_nm_inv_sd` | number | nm⁻¹ | Regional mean and standard deviation of the local reciprocal-vector fitting-residual summary |
| `principal_direction_axial_mean_deg` | number | degree | Regional axial mean angle of the principal direction |

### `/app/output/strain_line_profile.csv`

Each row corresponds to one scan position along the centerline, with `point_id` as the stable key.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `point_id` | string | — | Scan-position identifier |
| `scan_x_nm`, `scan_y_nm` | number | nm | Scan coordinates |
| `strain_xx`, `strain_yy`, `strain_xy` | number | dimensionless | Components of the symmetric strain tensor |
| `rotation_deg` | number | degree | Lattice rotation angle |
| `principal_strain_max`, `principal_strain_min` | number | dimensionless | Principal strains |
| `principal_direction_deg` | number | degree | Axial orientation angle of the maximum principal strain |
| `q_fit_rmse_nm_inv` | number | nm⁻¹ | Summary of the local reciprocal-vector fitting residuals |

### `/app/output/strain_qc.csv`

Single-row quality-summary table.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `calibration_a11`, `calibration_a12`, `calibration_a21`, `calibration_a22` | number | dimensionless | Components of the linear calibration transformation |
| `calibration_b1_nm_inv`, `calibration_b2_nm_inv` | number | nm⁻¹ | Calibration offset components |
| `calibration_determinant` | number | dimensionless | Determinant of the linear calibration transformation |
| `calibration_rmse_nm_inv` | number | nm⁻¹ | Summary of the calibration residuals |
| `n_scan_points`, `n_diffraction_vectors` | integer | — | Numbers of scan positions and diffraction vectors |
| `mean_q_fit_rmse_nm_inv`, `maximum_q_fit_rmse_nm_inv` | number | nm⁻¹ | Summary statistics for the local reciprocal-vector fitting residuals |
| `maximum_principal_strain` | number | dimensionless | Summary of the maximum principal strain |
| `hotspot_point_id` | string | — | Hotspot scan-position identifier |
| `hotspot_x_nm`, `hotspot_y_nm` | number | nm | Hotspot scan coordinates |
| `hotspot_principal_direction_deg` | number | degree | Axial angle of the principal direction at the hotspot |
| `matrix_left_abs_strain_max` | number | dimensionless | Absolute-strain summary for the `MATRIX_LEFT` region |
| `strain_reconstruction_status` | string | — | Reconstruction quality status |
| `failure_reasons` | string | — | Explanation of the quality status |

### `/app/output/strain_tensor_maps.png`

PNG image; display the two-dimensional results for the strain-tensor components and indicate the coordinates, units, and meaning of the colors.

### `/app/output/principal_strain_map.png`

PNG image; display the two-dimensional results for the principal strains and principal directions, and indicate the coordinates, units, colors, and meaning of the directions.

### `/app/output/strain_line_profile.png`

PNG image; display the centerline profile and indicate the coordinates, units, and meaning of the legend.

### `/app/output/stem_strain_report.md`

UTF-8 Markdown report; cover detector calibration, conventions for reciprocal-space and real-space results, local reconstruction, strain and rotation, principal strains and principal directions, regional statistics, the centerline profile, hotspots, fitting residuals, and the conclusion regarding reconstruction quality, while remaining consistent with the CSV files and images.


Instruction:
# Separation of True Switching Polarization and Cycling Degradation in HZO Ferroelectric Capacitors from Raw PUND Waveforms

A batch of TiN/Hf0.5Zr0.5O2/TiN ferroelectric capacitors underwent PUND measurements after 1, 10^3, and 10^5 bipolar cycles. The attachments contain the raw voltage-current waveforms for the P, U, N, and D pulses of three devices, independent current-source calibration data, quasi-static leakage I-V data, and measured electrode areas, film thicknesses, and series resistances. The raw current simultaneously contains dielectric displacement, leakage, domain switching, and instrument gain/offset errors.

Recover the positive and negative switching charges and remanent polarization; determine the series-resistance-corrected positive and negative coercive fields, coercive-field magnitude, and imprint field; and report the positive and negative leakage current densities at 1 MV cm-1. Output the results by device and cycling state, then summarize the mean/SD across the three devices, determine whether the samples exhibit wake-up, fatigue, or failure, and verify whether polarization retention, positive-negative switching consistency, imprint, and leakage satisfy the quality requirements.

Generate analysis.py, current_calibration_result.csv, pund_pulse_metrics.csv, ferroelectric_metrics.csv, cycling_summary.csv, ferroelectric_qc.csv, pund_diagnostics.png, cycling_stability.png, coercive_imprint_summary.png, and hzo_pund_report.md under /app/output. The results must retain device_id, cycle_count, units, and replicate statistics, and the figures and report must be verifiable against the CSV files; do not read data from outside /app/input or hard-code reference results.

## Deliverable Files

This section defines only the submission format and does not prescribe the analysis method or expected results. All files listed below are required and must be located in `/app/output/`. Additional files are permitted. CSV files must use UTF-8 encoding and include headers. Column order is unrestricted, and additional columns are permitted, but the standardized field names listed below must be retained; no field aliases are defined. Numeric fields must be written as numbers without unit strings appended within cells. All stable keys must be unique within their respective files.

### `/app/output/analysis.py`

A UTF-8 text source file used to reconstruct the remaining deliverables from `/app/input/`.

### `/app/output/current_calibration_result.csv`

A single-row global calibration record.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `current_gain` | number | dimensionless | Current gain |
| `current_offset_A` | number | A | Current zero offset |
| `calibration_R2` | number | dimensionless | Calibration coefficient of determination |
| `residual_sd_A` | number | A | Standard deviation of calibration residuals |
| `n_records` | integer | records | Number of calibration records |

### `/app/output/pund_pulse_metrics.csv`

One row per device, cycling state, and pulse; the stable key is `device_id`, `cycle_count`, `pulse_label`.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `device_id` | string | — | Device identifier |
| `cycle_count` | integer | cycles | Number of cycles |
| `pulse_label` | string | — | P, U, N, or D pulse identifier |
| `n_points` | integer | points | Number of pulse sample points |
| `peak_abs_current_mA` | number | mA | Peak absolute current |
| `peak_current_time_us` | number | µs | Time of current peak |
| `integrated_charge_nC` | number | nC | Integrated pulse charge |
| `mean_hold_current_uA` | number | µA | Mean current during the hold segment |

### `/app/output/ferroelectric_metrics.csv`

One row per device and cycling state; the stable key is `device_id`, `cycle_count`.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `device_id` | string | — | Device identifier |
| `cycle_count` | integer | cycles | Number of cycles |
| `electrode_area_um2` | number | µm² | Electrode area |
| `film_thickness_nm` | number | nm | Film thickness |
| `series_resistance_ohm` | number | Ω | Series resistance |
| `Qsw_positive_nC` | number | nC | Positive-polarity switching charge |
| `Qsw_negative_abs_nC` | number | nC | Magnitude of negative-polarity switching charge |
| `Pr_positive_uC_cm2` | number | µC cm⁻² | Positive-polarity remanent polarization |
| `Pr_negative_uC_cm2` | number | µC cm⁻² | Negative-polarity remanent polarization |
| `Pr_mean_uC_cm2` | number | µC cm⁻² | Aggregate remanent polarization for both polarities |
| `Pr_polarity_mismatch_percent` | number | % | Remanent-polarization mismatch between the two polarities |
| `Ec_positive_MV_cm` | number | MV cm⁻¹ | Positive-polarity coercive field |
| `Ec_negative_MV_cm` | number | MV cm⁻¹ | Negative-polarity coercive field |
| `coercive_field_magnitude_MV_cm` | number | MV cm⁻¹ | Coercive-field magnitude |
| `imprint_field_MV_cm` | number | MV cm⁻¹ | Imprint field |
| `positive_switch_peak_time_us` | number | µs | Positive-polarity switching-peak time |
| `negative_switch_peak_time_us` | number | µs | Negative-polarity switching-peak time |
| `leakage_J_positive_A_cm2` | number | A cm⁻² | Leakage current density under positive field |
| `leakage_J_negative_A_cm2` | number | A cm⁻² | Leakage current density under negative field |
| `leakage_J_mean_A_cm2` | number | A cm⁻² | Aggregate positive and negative leakage current density |
| `leakage_J_sd_A_cm2` | number | A cm⁻² | Standard deviation of leakage current density |

### `/app/output/cycling_summary.csv`

One row per cycling state; the stable key is `cycle_count`.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `cycle_count` | integer | cycles | Number of cycles |
| `n_devices` | integer | devices | Number of devices summarized |
| `Pr_mean_uC_cm2` | number | µC cm⁻² | Mean remanent polarization |
| `Pr_sd_uC_cm2` | number | µC cm⁻² | Standard deviation of remanent polarization |
| `coercive_field_mean_MV_cm` | number | MV cm⁻¹ | Mean coercive-field magnitude |
| `coercive_field_sd_MV_cm` | number | MV cm⁻¹ | Standard deviation of coercive-field magnitude |
| `imprint_field_mean_MV_cm` | number | MV cm⁻¹ | Mean imprint field |
| `imprint_field_sd_MV_cm` | number | MV cm⁻¹ | Standard deviation of imprint field |
| `leakage_J_mean_A_cm2` | number | A cm⁻² | Mean leakage current density |
| `leakage_J_sd_A_cm2` | number | A cm⁻² | Standard deviation of leakage current density |
| `wake_up_ratio_vs_cycle1` | number | dimensionless | Wake-up ratio relative to the initial cycle |
| `retention_vs_peak` | number | dimensionless | Polarization-retention ratio relative to the peak value |

### `/app/output/ferroelectric_qc.csv`

A single-row global summary and status record.

| Field | Type | Unit | Meaning |
|---|---|---|---|
| `n_waveform_rows` | integer | records | Number of waveform records |
| `n_pulse_records` | integer | records | Number of pulse records |
| `n_device_cycle_records` | integer | records | Number of device-cycle records |
| `n_devices` | integer | devices | Number of devices |
| `current_gain` | number | dimensionless | Current gain |
| `current_offset_A` | number | A | Current zero offset |
| `current_calibration_R2` | number | dimensionless | Current-calibration coefficient of determination |
| `initial_cycle_count` | integer | cycles | Initial cycling state |
| `peak_Pr_cycle_count` | integer | cycles | Cycling state corresponding to peak remanent polarization |
| `final_cycle_count` | integer | cycles | Final cycling state |
| `initial_Pr_mean_uC_cm2` | number | µC cm⁻² | Initial mean remanent polarization |
| `peak_Pr_mean_uC_cm2` | number | µC cm⁻² | Peak mean remanent polarization |
| `final_Pr_mean_uC_cm2` | number | µC cm⁻² | Final mean remanent polarization |
| `wake_up_ratio` | number | dimensionless | Wake-up ratio |
| `final_retention_vs_peak` | number | dimensionless | Final polarization-retention ratio relative to the peak value |
| `maximum_PUND_polarity_mismatch_percent` | number | % | Aggregate PUND polarity mismatch |
| `maximum_abs_imprint_field_MV_cm` | number | MV cm⁻¹ | Aggregate absolute imprint field |
| `maximum_leakage_J_A_cm2` | number | A cm⁻² | Aggregate leakage current density |
| `current_calibration_status` | string | — | Current-calibration status |
| `PUND_subtraction_status` | string | — | PUND status |
| `cycling_behavior` | string | — | Cycling-behavior category |
| `reliability_status` | string | — | Reliability status |
| `overall_status` | string | — | Overall status |
| `failure_reasons` | string | — | Description of failure reasons |

### Image Files

- `/app/output/pund_diagnostics.png`: PNG showing current-calibration and PUND-pulse diagnostic plots.
- `/app/output/cycling_stability.png`: PNG showing summary plots of cycling polarization and leakage.
- `/app/output/coercive_imprint_summary.png`: PNG showing summary plots of coercive and imprint fields.

### `/app/output/hzo_pund_report.md`

A UTF-8 Markdown report covering current calibration, PUND pulse and polarization results, coercive and imprint fields, leakage, cycling evolution, quality checks, and reliability conclusions; the results in the report must be correspondingly verifiable against the CSV files above.