Skip to content

Barseq blackbox acquisition#1781

Merged
dougollerenshaw merged 25 commits into
devfrom
barseq_blackbox_acquisition
Apr 3, 2026
Merged

Barseq blackbox acquisition#1781
dougollerenshaw merged 25 commits into
devfrom
barseq_blackbox_acquisition

Conversation

@dougollerenshaw

Copy link
Copy Markdown
Contributor

Creates simple black-box style acquisition.json files for barseq acquisitions for subjects 780345 and 780346.

Note that I had a much more involved/complicated PR that attempted to capture the actual acquisition details here: #1690

I abandoned that effort after Polina shared the raw data paths and @saskiad and I spent some time trying to understand the structure of the actual raw acquisition files. We realized there was simply too much we didn't understand about how the image files were acquired and subsequently processed for us to be able to accurately capture the process for now.

This PR closes https://github.com/AllenNeuralDynamics/aind-scientific-computing/issues/569 and closes #1761

@dougollerenshaw dougollerenshaw requested a review from saskiad March 20, 2026 20:51
Comment thread examples/barseq_780345_acquisition.json Outdated
"https://www.protocols.io/view/barseq-2-5-kqdg3ke9qv25/v1"
],
"ethics_review_id": null,
"instrument_id": "Dogwood",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there shouldn't be an instrument for black box

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure here? I can understand instrument not being required in a black-box acquisition. But in this case we have the instrument name and the corresponding instrument.json. I don't see a downside to including it. I can remove if you'd still prefer, but I just wanted to double check first.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'm sure. We are treating this as we send it to a team and they send us something back. What they do is a black box.

Comment thread examples/barseq_780345_acquisition.json Outdated
Comment thread examples/barseq_acquisition.py Outdated
# Source: /allen/aind/stage/barseq/20250303_780345_slide7_maxprojection/experiment_detail.txt
# /allen/aind/stage/barseq/20250305_780345_slide8_maxprojection/experiment_detail.txt
# /allen/aind/stage/barseq/20250317_780345_slide9_maxprojection/experiment_detail.txt
"experimenters": ["Mara Rue", "Shannon Khem", "Tracy"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're doing black box, I'd have this be Barseq team and not name people.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. See 0272459

Comment thread examples/barseq_acquisition.py Outdated

# Instrument ID for the Nikon Ti2-E "Dogwood" spinning disk confocal.
# Source: aind-data-schema barseq instrument PR #1685
INSTRUMENT_ID = "Dogwood"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no instrument id for black box.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment above: #1781 (comment)

@dbirman dbirman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine from my perspective. I wouldn't include paths to S3, relative, or VAST locations in general

Comment thread examples/barseq_780346_acquisition.json Outdated
@dougollerenshaw dougollerenshaw requested a review from dbirman April 1, 2026 20:20
@dougollerenshaw

Copy link
Copy Markdown
Contributor Author

This PR now includes a new "ExternalDataStream" class that makes instrument_id optional.

Note that the two json files in the examples/2026.01.16_barseq_acquisition will be removed before merging. These are only here to verify that the actual acquisition files are reasonable.

@dbirman dbirman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting some changes, see comments.

Also, I think you still need to add a test in test_metadata.py that creates a Metadata object with an acquisition that has only an external data stream and no instrument. This should crash the Metadata-level validator that checks the core file requirements and then we can modify how the requirements work to allow this.

Comment thread src/aind_data_schema/core/acquisition.py Outdated
Comment thread src/aind_data_schema/core/acquisition.py Outdated
Comment thread tests/test_acquisition.py
Comment thread examples/2026.01.16_barseq_acquisition/barseq_780345_acquisition.json Outdated
Comment thread examples/barseq_acquisition.py
@dougollerenshaw

Copy link
Copy Markdown
Contributor Author

Requesting some changes, see comments.

Also, I think you still need to add a test in test_metadata.py that creates a Metadata object with an acquisition that has only an external data stream and no instrument. This should crash the Metadata-level validator that checks the core file requirements and then we can modify how the requirements work to allow this.

See this commit: aa5f520

@dougollerenshaw

Copy link
Copy Markdown
Contributor Author

OK, I think everything is addressed. Mind another look?

@dougollerenshaw dougollerenshaw requested a review from dbirman April 3, 2026 00:41

@dbirman dbirman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, hard to know whether every edge case is handled for data_stream having two kinds of objects now but we'll find out pretty quickly if there are issues!

A few minor comments on wording, not critical to change them but I think it will be a tiny bit easier for users with the changes.

Comment thread docs/source/acquisition.md Outdated
| `protocol_id` | `Optional[List[str]]` | Protocol ID (DOI for protocols.io) |
| `ethics_review_id` | `Optional[List[str]]` | Ethics review ID |
| `instrument_id` | `str` | Instrument ID (Should match the Instrument.instrument_id) |
| `instrument_id` | `Optional[str]` | Instrument ID (Should match the Instrument.instrument_id. Required when data_streams contains a DataStream.) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking but I think my preferred language is "Required when instrument metadata is available."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See d29c08d

Comment thread docs/source/acquisition.md Outdated
| `calibrations` | List[[Calibration](components/measurements.md#calibration) or [VolumeCalibration](components/measurements.md#volumecalibration) or [PowerCalibration](components/measurements.md#powercalibration)] | Calibrations (List of calibration measurements taken prior to acquisition.) |
| `maintenance` | List[[Maintenance](components/measurements.md#maintenance)] | Maintenance (List of maintenance on instrument prior to acquisition.) |
| `data_streams` | List[[DataStream](acquisition.md#datastream)] | Data streams (A data stream is a collection of devices that are acquiring data simultaneously. Each acquisition can include multiple streams. Streams should be split when configurations are changed.) |
| `data_streams` | List[[DataStream](acquisition.md#datastream) or [ExternalDataStream](acquisition.md#externaldatastream)] | Data streams (A data stream is a collection of devices that are acquiring data simultaneously. Each acquisition can include multiple streams. Streams should be split when configurations are changed. Use ExternalDataStream for acquisitions performed externally where full instrument metadata is unavailable.) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above here "for acquisitions where instrument metadata is unavailable."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see d29c08d

Comment thread docs/source/acquisition.md Outdated

### ExternalDataStream

A simplified data stream for acquisitions performed externally, where full instrument metadata is unavailable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop the "full". If there's partial instrument metadata we would still want it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See d29c08d

@dougollerenshaw dougollerenshaw dismissed saskiad’s stale review April 3, 2026 01:57

Stale review. Dan has approved after updates.

@dougollerenshaw dougollerenshaw added this pull request to the merge queue Apr 3, 2026
@dougollerenshaw dougollerenshaw removed the request for review from saskiad April 3, 2026 01:57
Merged via the queue into dev with commit 1f0a7d9 Apr 3, 2026
6 checks passed
@dougollerenshaw dougollerenshaw deleted the barseq_blackbox_acquisition branch April 3, 2026 01:59
dbirman added a commit that referenced this pull request May 6, 2026
* Allow specimen_id to be a list (#1770)

* Allow specimen_id to be a list

* Removed nonetype test

* Fixed specimen names in test

* Updated specimen_id description to clarify expectation during in-vivo sessions

* Spread args over multi lines to avoid lint fail

* docs: rebuild docs (#1771)

* docs: minor fixes to acquisition.md

* docs: remove bad directives and links

* docs: improve description for AcquisitionSubjectDetails (#1772)

* docs: improve description for AcquisitionSubjectDetails

* docs: rebuild docs

* fix: throw warnings when users include multiple identically named devices in the Instrument (#1773)

* fix: allow both planar and regular sectioning in sectioning procedures (#1777)

* fix: allow NHPSubject as subject_details option (#1778)

* docs: auto-build docs on opening PR (#1760)

* docs: auto-build docs on opening PR

* update docs [skip actions]

* docs: update contribution.md

* update docs [skip actions]

* chore: remove all unnecessary graphviz dependencies

* update docs [skip actions]

* update docs [skip actions]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Handle lists of specimen IDs in procedures validator (#1783)

* Handle lists of specimen IDs in procedures validator

* Fix to properly handle individual str as well as lists of str

* refactor: simplifying code a tiny bit

---------

Co-authored-by: Dan Birman <danbirman@gmail.com>

* Add ticket linking workflow (#1785)

* Barseq blackbox acquisition (#1781)

* First pass at minimal blackbox acquisition. Has file that generates acquisition for two subjects, plus json outputs

* Added reference to output files

* Added specimen IDs to barseq acquisitions

* Removed readme file

* Updating examples/barseq_acquisition.py docstring

* Cleaned up comments in examples/barseq_acquisition.py

* Set timestamps to pacific with offset

* Changed experimenters to 'Barseq team'

* Removed references to local paths, removed duplicate jsons

* Added ExternalDataStream, made instrument optional, added test, updated example barseq

* Updated example json outputs for barseq subjects

* update docs [skip actions]

* Linting fixes

* Used DiscriminatedList

* Clean up stream adding logic

* Simplify barseq acquisition example

* Removed jsons

* clean up test and import properly

* Add ExternalDataStream support to Metadata validators and test that no instrument warning is raised for external acquisitions.

* Wording updates as suggested by Dan

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* 1792 quality control validator has a bug at line 307 where it fails to check metrics before doing metrics0 (#1793)

* fix: validator would trigger on empty metrics

* fix: do this upfront by bypassing the validator, adds a test

* chore: delete CHANGELOG.md (#1799)

* chore: delete CHANGELOG.md

* update docs [skip actions]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* refactor: replace root calls to logging with module-level loggers (#1800)

* fix: issue with actions being skipped unnecessarily

* refactor: replace root logger with local loggers

* test: fixes to logger patches

* docs: improve docstring (#1748)

* docs: improve docstring

* docs: update specimen ID

* docs: clarify suffix

* docs: better writing

* update docs

* fix: bad merge

* update docs

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* refactor: only allow wrapped NonSurgeryInjections in Procedures.subject_procedures (#1802)

* refactor: only allow Injections in Procedures.subject_procedures when wrapped with an InjectionProcedure

* chore: add ethics_review_id/protocol_id

* fix: only allow Injection, BrainInjection requires a full CS from Surgery

* update docs [skip actions]

* refactor: NonSurgicalInjection

* update docs

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Add missing `tzdata` dependency (#1811)

* Add git hash to Code model (#1813)

* Add git hash to Code model

* update docs

* Increase hash length upper bound

* Change property name and emit warning if hash and version are not defined

* Refactor type alias

* update docs

* Break lines

* Update tests to reflect longer hashes

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* feat: add barseq instrument (#1685)

* feat: add barseq instrument

* refactor: SlapPlane -> Slap2Plane

* Revert "refactor: SlapPlane -> Slap2Plane"

This reverts commit 6f193b8.

* chore: lint

* refactor: fix serialization code in example

* fix: fix issues blocking build

* chore: fix write function for instrument example

* fix: specimen_ids validator correctly flattens lists (#1763)

* feat: working on procedures_sectioning example

* feat: continuing to develop chunk sections

* chore: embed slide regions in python code

* chore: lint

* chore: docstrings

* chore: lint

* chore: remove full sectioning file

---------

Co-authored-by: Doug Ollerenshaw <doug.ollerenshaw@alleninstitute.org>

* chore: bump version

* bump schema version [skip actions]

* chore: bump metadata

* bump schema version [skip actions]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Doug Ollerenshaw <doug.ollerenshaw@alleninstitute.org>
Co-authored-by: gouwens <ngouwens@gmail.com>
Co-authored-by: Bruno Cruz <7049351+bruno-f-cruz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Black box" acquisition

3 participants