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

Refactor data source for GenKwConfig #9079

Closed
xjules opened this issue Oct 29, 2024 · 1 comment
Closed

Refactor data source for GenKwConfig #9079

xjules opened this issue Oct 29, 2024 · 1 comment
Labels
improvement Something nice to have, that will make life easier for developers or users or both. release-notes:refactor PR changes code without changing ANY (!) behavior.

Comments

@xjules
Copy link
Contributor

xjules commented Oct 29, 2024

To be able to distinguish between the source of data when instantiating GenKwConfig we need to speicify either it's sample_prior, forward_init or design_matrix. Currently we rely on setting some flags in GenKwConfig; nevertheless this causes a lots of unnecessary if statements to check what the GenKw really is. Therefore we should implement each sub init_source as @DataClass instead.
For instance:

@dataclass
class DesignMatrix:
    name: Literal['design_matrix']= 'design_matrix'
    
@dataclass
class SamplePrior:
    name: Literal['sample_prior']= 'sample_prior'
    
@dataclass
class ForwardInit:
    name: Literal['init_file']= 'init_file'
    init_file: str

@dataclass
class GenKwConfig(ParameterConfig):
   ....
    init_source: Union[SamplePrior, ForwardInit, DesignMatrix] = SamplePrior()
@xjules xjules added this to SCOUT Oct 29, 2024
@xjules xjules converted this from a draft issue Oct 29, 2024
@xjules xjules added the improvement Something nice to have, that will make life easier for developers or users or both. label Oct 29, 2024
@xjules xjules changed the title Refactor init source for GenKwConfig Refactor data source for GenKwConfig Oct 29, 2024
@xjules xjules added the release-notes:refactor PR changes code without changing ANY (!) behavior. label Oct 29, 2024
@larsevj larsevj self-assigned this Oct 29, 2024
@xjules
Copy link
Contributor Author

xjules commented Feb 24, 2025

Closing this one as it is superseded by #10095

@xjules xjules closed this as completed Feb 24, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in SCOUT Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something nice to have, that will make life easier for developers or users or both. release-notes:refactor PR changes code without changing ANY (!) behavior.
Projects
Status: Done
Development

No branches or pull requests

4 participants