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

Creating and sharing new attributes to enrich metadata #195

Open
jacopoabramo opened this issue Dec 13, 2023 · 4 comments
Open

Creating and sharing new attributes to enrich metadata #195

jacopoabramo opened this issue Dec 13, 2023 · 4 comments

Comments

@jacopoabramo
Copy link
Collaborator

I'm currently in contact with other parties that are working on ImSwitch to implement a new set of Widget/Controllers for their application. One thing I'm trying to wrap my mind around is to add new shared attributes on a general controller in order to give the possibility to developers to add their own set of metadata. @kasasxav it is not very clear to me from the documentation how to achieve this. Could you give me a brief rundown? I'll add the notes to the documentation in a more formatted way.

@kasasxav
Copy link
Collaborator

kasasxav commented Dec 13, 2023

Hi @jacopoabramo , check the class sharedAttributes, and how it's implemented in the different classes.

All widget controllers by default have the function setSharedAttr, since they inherit it. So if you do that with new data it will automatically be included as metadata in the hdf5 file.

You can see how it's done in any of the controllers, for example the LaserController.

It's probably not included in the Documentation, feel free ot include it :)

@kasasxav
Copy link
Collaborator

kasasxav commented Dec 13, 2023

Actually better check in PositionersController, the Laser one is weird.

for axis in pManager.axes:
                self.setSharedAttr(pName, axis, _positionAttr, pManager.position[axis])
                if speed:
                    self.setSharedAttr(pName, axis, _positionAttr, pManager.speed)

@jacopoabramo
Copy link
Collaborator Author

Awesome, thanks. I'll try to document this and then close the issue.

@beniroquai
Copy link
Collaborator

Tested. Works! Thanks a lot @kasasxav! :)
@jacopoabramo would it make sense to refactor the structure to make this compatible with existing "standards" á la FAIR?

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

No branches or pull requests

3 participants