Skip to content

Control warnings when loading simulation data from file #2234

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

Open
dmarek-flex opened this issue Feb 7, 2025 · 5 comments
Open

Control warnings when loading simulation data from file #2234

dmarek-flex opened this issue Feb 7, 2025 · 5 comments

Comments

@dmarek-flex
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I found this slightly annoying issue when working with the TerminalComponentModeler. Whenever I interact with the BatchData to perform post-processing I need to access SimulationData, which triggers a load from a file. When loading the file, the Simulation gets validated and any warnings are emitted. In my notebook, after many of the cells showing simple post processing steps, there are now a bunch of warnings.

Even in steps like

s_matrix = modeler.run()

there can be many duplicate warnings, since the SimulationData is accessed many times to compute scattering parameters. See the attached screenshots for an example, although some of these duplicates may be emitted from a different part of the code.

Describe the solution you'd like
Some internal functionality for loading SimulationData without warnings/validation from the Simulation. So that I can do

sim_data = batch_data["some_task_name"]

and not get any warnings.

@tylerflex @lucas-flexcompute I think you both have worked on Batch and BatchData.

Image

Image

Image

@dmarek-flex
Copy link
Contributor Author

@weiliangjin2021 had a suggestion for adding a feature that skips validation when loading from file, which I will try out soon.

@yaugenst-flex
Copy link
Collaborator

I guess this is another incentive to switch to pydantic v2. There, model_construct makes this trivial (we could just call model_construct in .from_file()). Right now I don't really see an easy way of doing this other than implementing some recursive construct() call.

@dmarek-flex
Copy link
Contributor Author

I was trying this but yeah construct() only creates the top-level model. Unfortunately, I think even model_construct() still only creates the top-level model, see here

@momchil-flex
Copy link
Collaborator

The hacky workaround is to change the log level around internal pieces of code that we want to avoid issuing warnings...

@dmarek-flex
Copy link
Contributor Author

Is it worth it for me to create a PR with this hacky workaround for BatchData? Otherwise I will just add something specific for the ComponentModelers.

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