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

DRAFT: feature: partial caching of chromatic Fourier design matrix #400

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jeremy-baier
Copy link

This PR adds the ability to cache portions of the construction of the chromatic Fourier design matrix.
Initially testing on NG15yr data shows a 10x speed up to the recalculation of the chromatic Fmat construction.
This constitutes anywhere between a 3% to 15% speed up of the overall likelihood calculation for single pulsar noise when sampling in the chromatic index, alpha.

As the function docstrings say, the actual caching occurs via the @function decorator, which now wraps the later function, caching the initially passed arguments which include the achromatic portion of the Fourier design matrix and the division of TOA observational frequencies by a reference frequency.

This will be implemented in the chromatic_noise_block() of enterprise_extensions for automatic caching when sampling in the chromatic index.

@AaronDJohnson
Copy link
Collaborator

@jeremy-baier linting failed. Can you run the linter? I think enterprise may be on a slightly older version of flake8/black. So just check to see what version it is using..

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.41%. Comparing base (efae9b0) to head (88e9bfa).
Report is 4 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #400      +/-   ##
==========================================
+ Coverage   85.33%   85.41%   +0.07%     
==========================================
  Files          13       13              
  Lines        3158     3167       +9     
==========================================
+ Hits         2695     2705      +10     
+ Misses        463      462       -1     
Files with missing lines Coverage Δ
enterprise/signals/gp_bases.py 73.56% <100.00%> (+3.05%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 447ddae...88e9bfa. Read the comment docs.

@jeremy-baier
Copy link
Author

@AaronDJohnson looks like everything is passing now except one part of the code cov. Does that just mean I have to make a test for the 2 added functions?

@AaronDJohnson
Copy link
Collaborator

@jeremy-baier codecov measures the number of lines covered by tests. So more tests will increase codecov % as long as those lines that you're covering are not already tested.

@jeremy-baier
Copy link
Author

@AaronDJohnson I added a test which covers both of the added functions. This seemed to satisfy the codecov bot.
I think this PR is ready for merge now!

@jeremy-baier jeremy-baier changed the title feature: partial caching of chromatic Fourier design matrix DRAFT: feature: partial caching of chromatic Fourier design matrix Sep 26, 2024
@jeremy-baier
Copy link
Author

marking this as a draft for a second because I need to check one part of the compatibility with enterprise_extensions

@vhaasteren vhaasteren marked this pull request as draft November 27, 2024 19:22
@vhaasteren
Copy link
Member

@jeremy-baier , I marked it as a draft by just using the feature. Or did you by now verified this is compatible?

@jeremy-baier
Copy link
Author

hi @vhaasteren, thanks for following up on this.
so i verified that it was not compatible with enterprise_extensions’s chromatic noise block, and was waiting to see if I could find a way to make it compatible. so far i have not (and i tried for a while). however, this code is still useful as it does provide a speed up. it’s just that one can’t use that speed up and set their model up with enterprise_extensions.
if someone else, want’s to try to make this work with enterprise_extensions, i would gladly accept some help here. otherwise, i think it is worth merging as is. (and the user just can’t use the chromatic noise block).

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.

3 participants