Skip to content

Static data iosource #49

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

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft

Static data iosource #49

wants to merge 38 commits into from

Conversation

toqduj
Copy link
Collaborator

@toqduj toqduj commented Jun 5, 2025

Added an IoSource for static data loaded in from a yaml file. Has a path-like interface, see associated tests. Also had to fix MessageHandler to get it to work (or I misunderstood).

Can be used like this:

filepath = Path("../src/modacor/tests/io/static_data/static_data_example.yaml")
sm_iosource = StaticData(source_reference='defaults')
sm_iosource._load_from_yaml(filepath)  # you can add multiple if you want, will update (!) internal dict. 
sm_iosource.get_data('probe_properties/wavelength/value')  # always an np.ndarray, uses additional internal cache for speed in future access of the same data. 
sm_iosource.get_static_metadata('probe_properties/wavelength/unit')  # any type, here 'nm'

@toqduj toqduj requested a review from timsnow June 5, 2025 14:29
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.

1 participant