Add .edf and .gb (General Binary) adapters for ALS BL7.3.3#4
Add .edf and .gb (General Binary) adapters for ALS BL7.3.3#4
.edf and .gb (General Binary) adapters for ALS BL7.3.3#4Conversation
|
Can you please add an |
|
The |
|
Sorry, misread the structure in an IDE that flattens empty dirs. I like the adapters and exporters packages |
…ient]>=0.2.8` a core dependency in `pyproject.toml`
Otherwise test CI fails with missing module error
|
Since the initial review comments the following changes were made:
|
|
Some additional notes: This builds on previous work in mlexchange/workflow-viz, in particular also mlexchange/workflow-viz/pull/2 by @rajasriramoju
|
dylanmcreynolds
left a comment
There was a problem hiding this comment.
I left a comment about logging that is pretty unimportant, happy to merge without.
| **kwargs: Optional[Any], | ||
| ) -> None: | ||
| """Adapter for `.edf` files (e.g. PILATUS3 2M) at ALS beamline 7.3.3.""" | ||
| filepath = path_from_uri(data_uri) |
There was a problem hiding this comment.
I think I'd like to used the unused logger here to printout what file is being processed.
There was a problem hiding this comment.
Added a logger.debug call.
| **kwargs: Optional[Any], | ||
| ) -> None: | ||
| """Adapter for a stitched detector image .gb produced at ALS beamline 7.3.3.""" | ||
| filepath_gb = path_from_uri(data_uri) |
There was a problem hiding this comment.
I think I'd like to used the unused logger here to printout what file is being processed.
There was a problem hiding this comment.
Added a logger.debug call.
tests/test_main.py
Outdated
| @@ -1,2 +1,2 @@ | |||
| def test_main_function(): | |||
| def test_main_function() -> None: | |||
There was a problem hiding this comment.
What an important Type hint :) . Perhaps we should remove this file.
Builds on the initial adapter skeleton to add two working file adapters for the PILATUS 2M detector at beamline 7.3.3:
EDFAdapter: reads.edfimage files viafabio, merging EDF header fields with metadata from a companion .txt fileGeneralBinaryPilatus2MAdapter: reads stitched.gbfloat32 images, combining metadata from paired _hi and _lo EDF companions; selects the later acquisition dateBoth adapters subclass
ArrayAdapter.Includes round-trip integration tests (register, then read via tiled client) and unit tests for metadata parsing and merging logic. Test fixtures use synthetic data derived from real example files, with PI names anonymized.
Requires
pip install ".[bl733]"for fabio.To use the example config, populate a folder
.datawith.edf.gband compainion.edffiles and run:and
Some considerations:
.txtand.edffiles are not registered as explicit data sources. This simplifies registration as a single file can serve as the "trigger" to register a scan and no custom detection of mimetime is needed, as the file ending directly translated to the mimetype). This does mean that built-in download capabilities in Tiled will not include these additional files. We have two option to make native download possible: A custom exporter that exports the full set of side-car, or switching to combined mimetypes (edf+txt), (gb+2txt+2edf). test_image_file_with_sidecar_metadata_fileArrayAdapter(e.g. bluesky/tiled/adapters/jpeg.py) orAdapter[ArrayStructure](e.g. bluesky/tiled/adapters/npy.py. I chooseArrayAdapterasAdapter[ArrayStructure]versions seem to be earmarked for refactoring, see Adapter Rationalisation bluesky/tiled#1066