Shared memories of event details in the human brain are altered by misinformation and test expectations.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 340 lines · 11 KB · CC-BY-4.0
- #!/usr/bin/env python3
- """Calculate ROI-based inter-subject pattern similarity (ISPS) for one subject pair.
- Subject-pair, single-ROI mode. Four input tables are required: subject A
- behavior + neural pattern, subject B behavior + neural pattern. Computes
- ISPS for one ROI between the two subjects.
- WSLD: similarity to the partner's vector for the same stimulus.
- BSLD: mean similarity to the partner's *other slides within
- the same event*.
- """
- from __future__ import annotations
- import argparse
- import csv
- import math
- import os
- from collections import defaultdict
- from typing import Dict, Iterable, List, Sequence, Tuple
- PAIR_OUTPUT_COLUMNS = [
- "paired_id",
- "subject_id",
- "pair_subject_id",
- "stim_events",
- "stim_slides",
- "stim_type",
- "memory_type",
- "smltp",
- "stim_version",
- "isps",
- ]
- PAIR_BEHAVIOR_COLUMNS = {
- "subject_id",
- "stim_events",
- "stim_slides",
- "stim_type",
- "stim_version",
- }
- PAIR_NEURAL_ID_COLUMNS = {"subject_id", "stim_events", "stim_slides"}
- def parse_args() -> argparse.Namespace:
- parser = argparse.ArgumentParser(
- description="Compute single-ROI inter-subject pattern similarity for a subject pair."
- )
- parser.add_argument("--output", help="Output CSV/TSV path.")
- parser.add_argument("--output-dir", help="Output directory for pair/ROI mode.")
- parser.add_argument("--subject-a-behavior", help="Subject A behavior TSV/CSV.")
- parser.add_argument("--subject-a-neural", help="Subject A single-ROI neural TSV/CSV.")
- parser.add_argument("--subject-b-behavior", help="Subject B behavior TSV/CSV.")
- parser.add_argument("--subject-b-neural", help="Subject B single-ROI neural TSV/CSV.")
- parser.add_argument("--roi-name", help="ROI name used in the pair/ROI output filename.")
- return parser.parse_args()
- def delimiter_for_path(path: str) -> str:
- return "\t" if path.endswith((".tsv", ".tsv.gz")) else ","
- def read_table(path: str) -> List[Dict[str, str]]:
- delimiter = delimiter_for_path(path)
- with open(path, newline="") as f:
- rows = list(csv.DictReader(f, delimiter=delimiter))
- if not rows:
- raise ValueError(f"Input table has no rows: {path}")
- return rows
- def require_columns(rows: List[Dict[str, str]], required: set[str], label: str) -> None:
- missing = required - set(rows[0])
- if missing:
- raise ValueError(f"{label} is missing required columns: {sorted(missing)}")
- def clean_str(value: object) -> str:
- return str(value).strip()
- def pearson(x: Sequence[float], y: Sequence[float]) -> float:
- pairs = [
- (float(a), float(b))
- for a, b in zip(x, y)
- if not (math.isnan(float(a)) or math.isnan(float(b)))
- ]
- if len(pairs) < 2:
- return math.nan
- xs = [a for a, _ in pairs]
- ys = [b for _, b in pairs]
- mean_x = sum(xs) / len(xs)
- mean_y = sum(ys) / len(ys)
- dx = [a - mean_x for a in xs]
- dy = [b - mean_y for b in ys]
- ss_x = sum(a * a for a in dx)
- ss_y = sum(b * b for b in dy)
- if ss_x <= 0 or ss_y <= 0:
- return math.nan
- return sum(a * b for a, b in zip(dx, dy)) / math.sqrt(ss_x * ss_y)
- def fisher_z(r: float) -> float:
- """Return Fisher's z transform for a Pearson correlation."""
- if r is None or math.isnan(float(r)):
- return math.nan
- clipped = max(min(float(r), 0.999999), -0.999999)
- return math.atanh(clipped)
- def average(values: Iterable[float]) -> float:
- vals = [v for v in values if not math.isnan(v)]
- if not vals:
- return math.nan
- return sum(vals) / len(vals)
- def subject_pair_label(subject_a: str, subject_b: str) -> str:
- return "_".join(sorted([clean_str(subject_a), clean_str(subject_b)]))
- def pair_version_label(version_a: str, version_b: str) -> str:
- return "same" if clean_str(version_a) == clean_str(version_b) else "diff"
- def sort_key_event_slide(row: Dict[str, object]) -> Tuple[int, int, str, str]:
- try:
- event = int(clean_str(row["stim_events"]))
- except ValueError:
- event = 0
- try:
- slide = int(clean_str(row["stim_slides"]))
- except ValueError:
- slide = 0
- return event, slide, clean_str(row["subject_id"]), clean_str(row["stim_slides"])
- def merge_subject_behavior_neural(
- behavior_path: str,
- neural_path: str,
- ) -> List[Dict[str, object]]:
- behavior_rows = read_table(behavior_path)
- neural_rows = read_table(neural_path)
- require_columns(behavior_rows, PAIR_BEHAVIOR_COLUMNS, behavior_path)
- require_columns(neural_rows, PAIR_NEURAL_ID_COLUMNS, neural_path)
- voxel_cols = [col for col in neural_rows[0] if col not in PAIR_NEURAL_ID_COLUMNS]
- if not voxel_cols:
- raise ValueError(f"{neural_path} must include one or more voxel columns.")
- neural_by_key: Dict[Tuple[str, str, str], Dict[str, str]] = {}
- for row in neural_rows:
- key = (
- clean_str(row["subject_id"]),
- clean_str(row["stim_events"]),
- clean_str(row["stim_slides"]),
- )
- neural_by_key[key] = row
- merged: List[Dict[str, object]] = []
- event_versions: Dict[Tuple[str, str], str] = {}
- for row in behavior_rows:
- key = (
- clean_str(row["subject_id"]),
- clean_str(row["stim_events"]),
- clean_str(row["stim_slides"]),
- )
- if key not in neural_by_key:
- raise ValueError(
- "No neural row for behavior key "
- f"subject={key[0]} event={key[1]} slide={key[2]}"
- )
- event_key = (key[0], key[1])
- version = clean_str(row["stim_version"])
- previous_version = event_versions.setdefault(event_key, version)
- if previous_version != version:
- raise ValueError(
- "stim_version must be constant within each subject/event: "
- f"subject={key[0]} event={key[1]}"
- )
- neural_row = neural_by_key[key]
- merged.append(
- {
- "subject_id": key[0],
- "stim_events": key[1],
- "stim_slides": key[2],
- "stim_type": clean_str(row["stim_type"]),
- "memory_type": clean_str(row.get("memory_type", "")),
- "stim_version": version,
- "vector": [float(neural_row[col]) for col in voxel_cols],
- }
- )
- return sorted(merged, key=sort_key_event_slide)
- def compute_pair_roi_isps_rows(
- subject_a_rows: List[Dict[str, object]],
- subject_b_rows: List[Dict[str, object]],
- ) -> List[Dict[str, object]]:
- if not subject_a_rows or not subject_b_rows:
- return []
- subject_a = clean_str(subject_a_rows[0]["subject_id"])
- subject_b = clean_str(subject_b_rows[0]["subject_id"])
- subject_pair = subject_pair_label(subject_a, subject_b)
- rows_by_subject = {
- subject_a: subject_a_rows,
- subject_b: subject_b_rows,
- }
- rows_by_subject_event_slide: Dict[Tuple[str, str, str], Dict[str, object]] = {}
- rows_by_subject_event: Dict[Tuple[str, str], List[Dict[str, object]]] = defaultdict(list)
- for subject_rows in rows_by_subject.values():
- for row in subject_rows:
- key = (
- clean_str(row["subject_id"]),
- clean_str(row["stim_events"]),
- clean_str(row["stim_slides"]),
- )
- rows_by_subject_event_slide[key] = row
- rows_by_subject_event[(key[0], key[1])].append(row)
- output_rows: List[Dict[str, object]] = []
- for subject_id, pair_subject_id in ((subject_a, subject_b), (subject_b, subject_a)):
- for target in rows_by_subject[subject_id]:
- event = clean_str(target["stim_events"])
- slide = clean_str(target["stim_slides"])
- pair_same_key = (pair_subject_id, event, slide)
- if pair_same_key not in rows_by_subject_event_slide:
- continue
- pair_same = rows_by_subject_event_slide[pair_same_key]
- pair_event_rows = [
- row
- for row in rows_by_subject_event[(pair_subject_id, event)]
- if clean_str(row["stim_slides"]) != slide
- ]
- if not pair_event_rows:
- continue
- wsld = fisher_z(pearson(target["vector"], pair_same["vector"]))
- bsld = average(
- fisher_z(pearson(target["vector"], pair_row["vector"]))
- for pair_row in pair_event_rows
- )
- stim_version = pair_version_label(target["stim_version"], pair_same["stim_version"])
- common = {
- "paired_id": subject_pair,
- "subject_id": subject_id,
- "pair_subject_id": pair_subject_id,
- "stim_events": event,
- "stim_slides": slide,
- "stim_type": clean_str(target["stim_type"]),
- "memory_type": clean_str(target.get("memory_type", "")),
- "stim_version": stim_version,
- }
- output_rows.append({**common, "smltp": "wsld", "isps": wsld})
- output_rows.append({**common, "smltp": "bsld", "isps": bsld})
- return sorted(
- output_rows,
- key=lambda row: (
- int(row["stim_events"]),
- int(row["stim_slides"]),
- row["subject_id"],
- row["smltp"],
- ),
- )
- def write_pair_rows(path: str, rows: Iterable[Dict[str, object]]) -> None:
- output_dir = os.path.dirname(path)
- if output_dir:
- os.makedirs(output_dir, exist_ok=True)
- delimiter = delimiter_for_path(path)
- with open(path, "w", newline="") as f:
- writer = csv.DictWriter(f, fieldnames=PAIR_OUTPUT_COLUMNS, delimiter=delimiter)
- writer.writeheader()
- for row in rows:
- clean_row = dict(row)
- isps = clean_row["isps"]
- clean_row["isps"] = (
- "" if isps is None or math.isnan(float(isps)) else f"{float(isps):.8f}"
- )
- writer.writerow(clean_row)
- def run_pair_roi_mode(args: argparse.Namespace) -> str:
- required_args = {
- "--subject-a-behavior": args.subject_a_behavior,
- "--subject-a-neural": args.subject_a_neural,
- "--subject-b-behavior": args.subject_b_behavior,
- "--subject-b-neural": args.subject_b_neural,
- "--roi-name": args.roi_name,
- }
- missing_args = [name for name, value in required_args.items() if not value]
- if missing_args:
- raise SystemExit("Pair/ROI mode is missing: " + ", ".join(missing_args))
- subject_a_rows = merge_subject_behavior_neural(
- args.subject_a_behavior,
- args.subject_a_neural,
- )
- subject_b_rows = merge_subject_behavior_neural(
- args.subject_b_behavior,
- args.subject_b_neural,
- )
- rows = compute_pair_roi_isps_rows(subject_a_rows, subject_b_rows)
- subject_pair = subject_pair_label(
- subject_a_rows[0]["subject_id"],
- subject_b_rows[0]["subject_id"],
- )
- output_path = args.output
- if not output_path:
- output_dir = args.output_dir or "."
- output_path = os.path.join(
- output_dir,
- f"{subject_pair}_{args.roi_name}_isps.tsv",
- )
- write_pair_rows(output_path, rows)
- return output_path
- def main() -> None:
- args = parse_args()
- run_pair_roi_mode(args)
- if __name__ == "__main__":
- main()
01_calculate_roi_isps.py, under CC-BY-4.0 · at the source
Overview
- State Key Laboratory of Cognitive Neuroscience and Learning, Beijing Normal University, Beijing, China
- Institute of Developmental Psychology, Beijing Normal University, Beijing, China
- IDG/McGovern Institute for Brain Research, Beijing Normal University, Beijing, China
- Department of Psychology, University of California, Irvine, California, United States of America
Abstract
Shared memories of event details are crucial to eyewitness testimony. When different people encode or recall the same event, similar scene-specific neural activity patterns emerge across individual brains. However, it remains unclear whether these patterns are specific to event details and how test expectancy (i.e., expecting free recall or general memory tests) and misinformation affect them. In this study, 100 participants were randomly assigned to view one of two versions of each event. Both versions featured identical scenarios, but with different details. About half of the participants were informed about the upcoming free recall before viewing events, while the others were told to expect a general memory test. Functional magnetic resonance imaging was used to record their brain activity during four stages: viewing original events, initial free recall, reading misinformation, and final free recall of original events. The neuroimaging data were analyzed based on the similarity of neural patterns across participants. Test expectancy increased the similarity of detail-specific neural activity patterns between individuals when they viewed original events in brain regions relevant for visual attention. Misinformation increased the likelihood of people forming shared false memories of event details. People who formed shared false memories exhibited similar detail-specific patterns of activity in the dorsomedial prefrontal cortex when reading misinformation. People who formed shared true memories exhibited similar detail-specific patterns of activity in the inferior parietal lobe when viewing original events, as well as in the ventrolateral prefrontal cortex and middle temporal gyrus when recalling them after exposure to misinformation. Our findings revealed that different brain regions of the default mode network play distinct roles in the encoding and recall of event details shared by individuals.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above.
Zenodo 20656852
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
3 files
- 01_calculate_roi_isps.py
, Python, 340 lines - 02_subject_level_all_cri
tical_ttest.R , R, 289 lines - 03_trial_level_specifici
ty_lmer_permutation.R , R, 353 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 3 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data Availability
All relevant data is available within the manuscript and Supporting information files. Analysis code is available on Zenodo at: https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 11 MeSH terms, 4 funders, 82 references.
Cite
This paper
Shao, X., Chen, C., Loftus, E. F., & Zhu, B. (2026). Shared memories of event details in the human brain are altered by misinformation and test expectations. PLoS biology, 24(7), e3003886. https://
BibTeX
@article{shao2026shared,
author = {Shao, Xuhao and Chen, Chuansheng and Loftus, Elizabeth F. and Zhu, Bi},
title = {{Shared memories of event details in the human brain are altered by misinformation and test expectations}},
journal = {PLoS biology},
year = {2026},
month = jul,
volume = {24},
number = {7},
pages = {e3003886},
publisher = {PLOS},
issn = {1544-9173},
doi = {10.1371/
url = {https://
pmid = {42406796},
pmcid = {PMC13336189}
}
RIS
TY - JOUR
AU - Shao, Xuhao
AU - Chen, Chuansheng
AU - Loftus, Elizabeth F.
AU - Zhu, Bi
TI - Shared memories of event details in the human brain are altered by misinformation and test expectations
T2 - PLoS biology
J2 - PLoS Biol
PY - 2026
DA - 2026/
VL - 24
IS - 7
SP - e3003886
SN - 1544-9173
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"type": "article-journal",
"title": "Shared memories of event details in the human brain are altered by misinformation and test expectations",
"container-title": "PLoS biology",
"author": [
{
"family": "Shao",
"given": "Xuhao"
},
{
"family": "Chen",
"given": "Chuansheng"
},
{
"family": "Loftus",
"given": "Elizabeth F."
},
{
"family": "Zhu",
"given": "Bi"
}
],
"container-title-short":
"volume": "24",
"issue": "7",
"page": "e3003886",
"DOI": "10.1371/
"PMID": "42406796",
"PMCID": "PMC13336189",
"ISSN": "1544-9173",
"publisher": "PLOS",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
6
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s44271-026-00481-0 [code]
- Natural language processing captures memory content associated with shared neural patterns at encoding and retrieval.Journal: Communications psychologyIn common: lme4, cognitive, 7 references
- [2] doi:10.1016/j.neuroimage.2026.122171 [code]
- A conserved node degree-based backbone and flexible hub organization of brain connectome during naturalistic movie watching.Journal: NeuroImageIn common: fMRI, 5 references
- [3] doi:10.1073/pnas.2530482123 [code]
- The detection of episodic memory in others biases social choice.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: lme4, cognitive, 3 references
- [4] doi:10.1038/s41467-026-71428-6 [code]
- Binding items to contexts through conjunctive neural representations with the method of loci.Journal: Nature communicationsIn common: lme4, 3 references
- [5] doi:10.1038/s41467-026-73914-3 [code]
- Cortical reinstatement of causally related events sparks narrative insights by updating neural representation patterns.Journal: Nature communicationsIn common: lme4, cognitive, 2 references
- [6] doi:10.1371/journal.pbio.3003666 [code]
- Emotion regulation success involves systematic gradient-based reconfigurations of large-scale activation patterns in the human brain.Journal: PLoS biologyIn common: lme4, data.table, fMRI, cognitive, 1 reference
- [7] doi:10.1038/s41467-026-76452-0 [code]
- Music evokes shared neural representations of imagined narratives across sensory modalities.Journal: Nature communicationsIn common: cognitive, 3 references
- [8] doi:10.1038/s41597-026-07676-4 [code]
- A neuroimaging dataset combining movie-watching, eye-tracking, sensorimotor mapping, and cognitive tasks.Journal: Scientific dataIn common: 3 references
- [9] doi:10.1038/s41598-026-58866-4 [code]
- A neurocognitive interactive activation model of semantic priming in lexical decisions.Journal: Scientific reportsIn common: lme4, fMRI, cognitive, 1 reference
- [10] doi:10.1162/imag.a.1349 [code]
- Rapid cortical mapping with cross-participant encoding models.Journal: Imaging neuroscience (Cambridge, Mass.)In common: fMRI, cognitive, 2 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 3 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:df10e1b626ec4557…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
