-
Notifications
You must be signed in to change notification settings - Fork 18
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
🩹Fix for when the backsweep is a parameter rather than constant #1422
Changes from 3 commits
91fde44
3490e52
b788092
b2df4f7
3c4b3d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
from glotaran.model.errors import ItemIssue | ||
from glotaran.model.item import Attribute | ||
from glotaran.model.item import ParameterType | ||
from glotaran.parameter.parameter import Parameter | ||
|
||
if TYPE_CHECKING: | ||
from glotaran.parameter import Parameters | ||
|
@@ -172,6 +173,8 @@ | |
scales = self.scale or [1.0] * nr_gaussians | ||
backsweep = self.backsweep is not None | ||
backsweep_period = self.backsweep if backsweep else 0 | ||
if isinstance(backsweep_period, Parameter): | ||
backsweep_period = backsweep_period.value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (llm): Directly accessing the |
||
|
||
parameters: list[GaussianActivationParameters] = [ | ||
GaussianActivationParameters( | ||
|
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.
Since
Parameter
implements__float__
we could simply change the assignment toThat way we also wouldn't need the type ignore in line 185
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.
Tried to adopt that suggestion ...
But:
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.
That said using a pydantic
Model
instead ofdataclass
forGaussianActivationParameters
should also take proper care of type coercion.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.
Since it is a drop in replacement, I have no objection to change it.
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.
This is limitation of mypy, since it cannot understand that the type is narrowed done at that point. Either ignore it or add an assert that is of float instance.