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

Add convenience methods #375

Conversation

yoshi74ls181
Copy link
Contributor

Added convenience methods add_tag, backup_file, save_text, and save_dict to DDH5Writer.
They enable us to save things in the same directory as the ddh5 file.
Usage example:

import qcodes as qc
from plottr.data.datadict_storage import DataDict, DDH5Writer

station = qc.Station()
data = DataDict(
    time=dict(unit="s"),
    voltage=dict(unit="V", axes=["time"]),
)

with DDH5Writer(data) as writer:
    writer.add_tag(["tag1", "tag2"])
    writer.backup_file(__file__)
    writer.save_text("note.md", "some note")
    writer.save_dict("station_snapshot.json", station.snapshot())
    writer.add_data(
        time=[1, 2, 3],
        voltage=[4, 5, 6],
    )

Copy link
Collaborator

@marcosfrenkel marcosfrenkel left a comment

Choose a reason for hiding this comment

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

Looks good! I have opened issue #376 with possible improvements for these functions

@yoshi74ls181
Copy link
Contributor Author

Thanks for the review! You can assign the issue to me, I'll work on it.

@marcosfrenkel marcosfrenkel merged commit 928face into toolsforexperiments:master Feb 20, 2023
@yoshi74ls181 yoshi74ls181 deleted the ddh5writer-convenience-methods branch February 20, 2023 20:24
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.

2 participants