neurostuff / NiMARE

Coordinate- and image-based meta-analysis in Python
https://nimare.readthedocs.io
MIT License
182 stars 58 forks source link

[FIX] do not initialize kernel object #907

Closed jdkent closed 1 week ago

jdkent commented 1 week ago

Closes #906

Changes proposed in this pull request:

Summary by Sourcery

Bug Fixes:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

The PR modifies the initialization of the MKDAChi2 class by changing how the kernel_transformer parameter is handled. Instead of creating a default MKDAKernel instance with no arguments, it now passes the MKDAKernel class itself as the default value, allowing users to initialize it with custom arguments when needed.

Updated class diagram for MKDAChi2 initialization

classDiagram
    class MKDAChi2 {
        - kernel_transformer: MKDAKernel
        + kernel_transformer: Class<Kernel>
        prior: float
        memory: Memory
        memory_level: int
    }
    class MKDAKernel {
    }
    class Memory {
        location: None
        verbose: int
    }
    MKDAChi2 --> MKDAKernel
    MKDAChi2 --> Memory
    note for MKDAChi2 "kernel_transformer is now a class reference, allowing custom initialization."

File-Level Changes

Change Details Files
Modified default parameter initialization in MKDAChi2 class constructor
  • Changed kernel_transformer default from instantiated MKDAKernel() to MKDAKernel class reference
  • Enables passing custom arguments to kernel_transformer during initialization
nimare/meta/cbma/mkda.py

Assessment against linked issues

Issue Objective Addressed Explanation
#906 Fix the warning about MKDAKernel arguments being ignored due to premature initialization

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).