Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support registering internal groups/dataset in HDF5. #687

Merged
merged 8 commits into from
Mar 21, 2024

Conversation

danielballan
Copy link
Member

@danielballan danielballan commented Mar 11, 2024

A wrapper function takes the same parameters as HDF5Adapter but additionally exposes an optional path, a list of strings navigating to a group or dataset nested inside an HDF5 file.

@danielballan
Copy link
Member Author

Demo of registering a DataSource with shape (1, 5, 5) and then updating that shape to be (2, 5, 5) via PUT /data_source/{path}?data_source={data_source_id}

from tiled.client import from_uri
from tiled.structures.core import StructureFamily
from tiled.structures.data_source import Asset, DataSource, Management
from tiled.structures.array import ArrayStructure, BuiltinDtype
import numpy

c = from_uri('http://localhost:8000', api_key='secret')
arr = numpy.ones((1, 5, 5))
structure = ArrayStructure.from_array(arr)
data_source = DataSource(management='external', mimetype='application/x-hdf5', structure_family='array', structure=structure, assets=[Asset(data_uri='file://localhost/tmp/test.h5', is_directory=False, parameter='data_uri')])
ac = c.new(structure_family='array', data_sources=[data_source])
url = ac.uri.replace('/metadata/', '/data_source/')
ac.refresh()
ds = ac.data_sources()[0]
ds['structure']['shape'] = [2, 5, 5]
ds['structure']['chunks'] = [[dim] for dim in [2, 5, 5]]
ac.context.http_client.put(url, json={'data_source': ds}, params={'data_source': 1})

@danielballan danielballan marked this pull request as ready for review March 20, 2024 18:13
@danielballan danielballan merged commit c2f4e60 into bluesky:main Mar 21, 2024
8 checks passed
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.

None yet

2 participants