-
Notifications
You must be signed in to change notification settings - Fork 41
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
Issue a warning when accessing unavailable group index data (#1169) #1178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe tom should take a look too to make sure the warning message is sufficient. One thing I can imagine users will get caught up on is that they can't set
mode_spec.group_index_step = True
directly, and instead I might suggest something like
The group index was not computed. To calculate group index, pass `group_index_step = True` in the `ModeSpec`.
Also, does this require any backend changes? because now we'd need to load the n_group_raw
into the ModeSolverDataset
and ModeData
?
Yes, this will require both schema a backend changes I believe. I'm just waiting to see if this is the route we prefer, instead of changing the defaults depending on the class as originally proposed |
Thanks @lucas-flexcompute . I agree with Tyler's suggestion that a more descriptive message would be better especially for less experienced users. I personally wouldn't mind having |
I like this solution too. In fact I woke up at 3 or 4 am thinking that that's how it should be handled. :D (By now I seem to have a constant background process running, thinking about Tidy3D...) |
I often think about how to answer customers' tricky questions at night in the background 🤯 , which is really bad for sleep quality. Hope your sleep quality is unaffected by the background process... |
Time for a short vacation, maybe? :P |
9b78923
to
3440f96
Compare
Should we just put this in 2.4.2 and not 2.5? Seems ready to me. |
@momchil-flex doesn't the backend have to construct |
It does but I'm building a separate solver for 2.4.2 anyway. |
ok, any possible unintended consequences though? For example a |
Good point. Actually ideally we don't want for it to not be possible to load a 2.4 sim data in 2.5. Even this is kinda bad since someone upgrading won't be able to revisit their recent simulations. We're making a backwards-incompatible change to the |
I can't think of a way to warn without changing the |
@tylerflex, would it work if we defined an alias for n_group_raw: ModeIndexDataArray = pd.Field(
None,
alias="n_group",
title="Group Index",
description="Index associated with group velocity of the mode.",
) I don't think the alias would interfere with the actual field and property, right? |
I was thinking of something similar (basically define a property getter for Throwing out another idea, there's a notion of a def warn_n_group():
log.warning(...)
return None
n_group: ModeIndexDataArray = pd.Field(
default_factory = warn_n_group,
...
) could be one thing to try maybe? |
Eh, turns out the default factory runs on init time, not when the field is accessed, so that probably doesn't work. Was basically wondering if the function could have a default value as the return of a function that logs the warning, rather than just |
Setting the alias option does indeed work. I'm running this branch on prod without errors. However, once the server is updated, it'll send back data with |
Just to make sure I understand what you're saying we will make 2.5 be able to read in both data that has |
Correct mode solver data created with 2.5 won't be loadable in previous versions, data from previous versions can be loaded in 2.5 |
3440f96
to
b509148
Compare
Signed-off-by: Lucas Heitzmann Gabrielli <lucas@flexcompute.com>
b509148
to
849bea4
Compare
No description provided.