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

Refactoring the integration / integrand workflow in the cluster count calculation #353

Merged
merged 27 commits into from
Jan 23, 2024

Conversation

mattkwiecien
Copy link
Contributor

@mattkwiecien mattkwiecien commented Jan 8, 2024

This PR changes the cluster number counts likelihood workflow to support potentially more complex integrands.

  • Removed the Kernel abstract class and concept of a shared interface between components of the integrand.
    • The abstraction that this introduces doesn't fit well with the use case of kernels that may take an arbitrary number of arguments.
    • This includes removing the automated integrand building code from ClusterAbundance. The responsibility of assembling the integrand for the cluster number counts is now placed on the user in the form of ClusterRecipe
  • Added cluster_recipe module. This is where users can assemble a cluster number counts integrand using the pieces in firecrown.models.cluster
    • Updated the statistic to accept a cluster recipe.
    • Each cluster recipe defines (1) the statically typed method which computes a prediction for the number of clusters in redshift, richness bin and (2) the mapping from the numerical integrator to the statically typed integrand.
  • Added a pylint_plugins top level directory that enables ignoring of specific warnings on specific classes. Included an example to ignore the duplicate code warning (we agreed this should not apply to ClusterRecipe).
  • Removed old unused code
  • Added new tests.
  • Disabled the duplicate-code warning in tests, and too-few-public-methods in firecrown.

…, they accept a function to integrate and perform that integration. Adding the ability to pass extra arguments.
…emoving any generic construction of an integrand.

Leaving the cluster abundance class as a collections of methods users can use to construct their own cluster "recipes"
Note- H_V seems to perform best now, need to compare to old numbers.
* Updating the way numcosmo calls the wrapped function in the integrator for clarity
* Adding statically typed callables to the cluster recipes (forgot to do this one).
* Adding an init for cluster recipes

* Writing (really, moving) tests for the cluster recipes
* Adding docstrings

* Adding an unbinned cluster recipe as proof of concept.
@marcpaterno
Copy link
Collaborator

We agreed to have the tests/pylintrc configuration remove the check for duplicated code (but only in the tests).

@@ -12,7 +13,11 @@
from firecrown.models.cluster.recipes.cluster_recipe import ClusterRecipe


# pylint: disable=R0801
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed the disabling of the duplicated code complaint and agree that it should be relaxed for recipes.
We'd prefer to see the disabling being done in a file or directory level through pylintrc to having it on each class.

We should also use the named form, rather than the numeric form, of what is being disabled.

Copy link
Contributor Author

@mattkwiecien mattkwiecien Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is surprisingly hard to do with pylint. The best solution I've found is that you can write custom pylint plugins and dynamically append ignore statements to specific classes.

I implemented this by adding a new pylint_plugins directory to the root of the project (and added a readme explaining why). I then added a duplicate_code.py which contains the custom plugin that can ignore the duplicate-code warning, and inside that I only add the ignore comment to firecrown.models.cluster.recipes classes.

Then, I updated the pylint rc files to load this plugin by default.

I pushed this up in the most recent commit.

@mattkwiecien mattkwiecien marked this pull request as ready for review January 18, 2024 18:45
@marcpaterno marcpaterno merged commit a65e684 into master Jan 23, 2024
8 checks passed
@marcpaterno marcpaterno deleted the cl-like-gen branch January 23, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants