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

Replace constraints with dependent Parameters #34

Open
damskii9992 opened this issue Jul 16, 2024 Discussed in #10 · 0 comments
Open

Replace constraints with dependent Parameters #34

damskii9992 opened this issue Jul 16, 2024 Discussed in #10 · 0 comments
Assignees
Labels
chore PR label enhancement New feature or request, PR label
Milestone

Comments

@damskii9992
Copy link
Contributor

Discussed in #10

Originally posted by damskii9992 June 7, 2024

General

It can be beneficial in a model to have Parameters which are defined through a relation to other parameters/descriptors. These dependent parameters are defined by their relation and thus should not be fitted during minimization. Their value should be updated when the values of the independent parameters which they depend on are changed. It should be possible to easily convert a dependent parameter to a dependent parameter and vice versa.

Current Implementation

Currently, this is handled by the "constraints" objects which are created separately and then assigned to the parameter, such as:

a = Parameter(name='a', value=0.2)
b = Parameter(name='b', value=1)
constraint = ObjConstraint(a, '2*', b)
b.user_constraints['SET_A'] = constraint

Requirements

  • When an independent parameter value is changed, it should update the values of all the parameters which depend directly on it. When doing this update, signals should also be send to the GUI frontend to reflect this change.
  • Making a parameter dependent should be easy and user-friendly, both when generated and when changed by the setter, by allowing direct expressions such as: 'value=a+2*b' in the value field
  • A dependent parameter should also be easy to change back into an independent parameter
  • Dependent parameters should not be included in the fitting procedure
  • [Optional] It should be possible to visualize a dependency tree to get an overview of all parameter dependencies

Implementation

  • '_is_independent' boolean variable, for checks
  • 'list_of_dependents' list variable with UIDs of parameters that depend on the parameter
  • '_update' method, to be called on dependent parameters when their independent dependency is changed
  • Logic to ensure no broken, cyclic or secondary (for now) dependencies
@damskii9992 damskii9992 added enhancement New feature or request, PR label chore PR label labels Jul 16, 2024
@damskii9992 damskii9992 self-assigned this Jul 16, 2024
@damskii9992 damskii9992 changed the title ADR Suggestion, Dependent Parameters Replace constraints with dependent Parameters Jul 16, 2024
@rozyczko rozyczko added this to the Milestone 1 milestone Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore PR label enhancement New feature or request, PR label
Projects
None yet
Development

No branches or pull requests

2 participants