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

Upgrading mflike to v0.8.4 in LAT_MFLike #133

Merged
merged 18 commits into from
Jun 6, 2023
Merged

Conversation

sgiardie
Copy link
Collaborator

@sgiardie sgiardie commented May 23, 2023

As the title suggests, updating the mflike version to the latest simonsobs/LAT_MFLike one (so far).
Several changes to be made also to the Foregrounds and BandPass classes, in order to substitute lists of frequencies with list of experiment_frequency, useful when using more experiments or more arrays sharing the same freq.

Also, some outdated functions in bandpass.py will be removed and the bug related to transmission in the presence of bandpass shift will be solved.

More details in this LAT_MFLike pull request.

Solving issue #130

@sgiardie sgiardie added the mflike Related to mflike likelihood label May 24, 2023
@sgiardie sgiardie marked this pull request as draft May 24, 2023 10:20
@sgiardie sgiardie added the enhancement New feature or request label May 24, 2023
@sgiardie sgiardie changed the title Upgrading mflike to v0.8.3 in LAT_MFLike Upgrading mflike to v0.8.4 in LAT_MFLike May 30, 2023
@sgiardie sgiardie marked this pull request as ready for review June 1, 2023 10:46
@sgiardie
Copy link
Collaborator Author

sgiardie commented Jun 1, 2023

I have set up the new mflike version and changed bandpass.py and foreground.py accordingly.
As already said, the main change in mflike is the fact that list of the nominal frequency of each channel is substituted by a list of the channel names experiment_freq. This is implemented also in theoryforge_MFLike.py, bandpass.py and foreground.py.
The default is now that the passbands for each channel are read from the sacc file used as data for mflike. These are then passed to bandpass.py from theoryforge_MFLike.py --> foreground.py inside a bands dictionary, to allow the computation of the bandpass transmissions then used to integrate the foreground spectra.

To allow the Theoryforge_MFLike and Foreground classes to work as standalone, I have also defined the variables exp_ch and eff_freqs in the respective yamls. This allows the construction of the bands dictionary which would normally be passed by MFLike. In this case, the passbands would be just Dirac delta at the effective frequency.
The Banpass class still requires to be called by Foreground, which passes the bands dictionary. If we would like the _bandpass_construction function to be called initializing only Banpass, we should define the exp_ch and eff_freqs variables also in the Banpass.yaml.

The tests and documentations for MFLike, Foreground and Bandpass have been fixed.

@sgiardie
Copy link
Collaborator Author

sgiardie commented Jun 1, 2023

Regarding the passband construction, there are now three options to be selected in the BandPass.yaml:

  • reading the passbands stored in the bands dictionary (passed from mflike --> theoryforge --> foreground) and multiply them for the appropriate conversion factors
  • building a top-hat passband using the nsteps and bandwidth params. This passband can also be a Dirac delta for nsteps = 1 and bandwidth = 0. The effective frequency used comes again from the bands dictionary
  • reading the passbands stored in an external file, which should have exactly the name of the corresponding array in the format exp_ch (with no other extensions, e.g. LAT_93)
    Also in the second and third case the appropriate dB/dT factors are applied to the passbands.

The new test_bandpass tests all of the options

soliket/BandPass.yaml Show resolved Hide resolved
soliket/BandPass.yaml Outdated Show resolved Hide resolved
soliket/bandpass.py Show resolved Hide resolved
soliket/bandpass.py Outdated Show resolved Hide resolved
soliket/bandpass.py Outdated Show resolved Hide resolved
soliket/foreground.py Outdated Show resolved Hide resolved
TE: [2, 5000]
ET: [2, 5000]
EE: [2, 5000]
TT: [50, 5000]
Copy link
Collaborator

Choose a reason for hiding this comment

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

is 5000 the correct lmx for data in yaml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure, I just used what was left there

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok! This might not be relevant for the current release, but maybe good to check with PS whether this is the correct lmax for data cut

soliket/mflike/TheoryForge_MFLike.yaml Show resolved Hide resolved
@@ -37,7 +38,7 @@

class MFLike(GaussianLikelihood, InstallableLikelihood):
_url = "https://portal.nersc.gov/cfs/sobs/users/MFLike_data"
_release = "v0.6"
_release = "v0.7.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this correct? shouldn't it be v0.8.3?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I left it like in LAT_MFLike, maybe there is no v0.8 folder on nersc

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok! Again, it would be nice to check with PS people. I think it makes sense to update the data versioning to reflect the code versioning

@mgerbino mgerbino added this to the v0.1 milestone Jun 5, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2023

Codecov Report

Merging #133 (83f673c) into master (381675b) will increase coverage by 2.29%.
The diff coverage is 83.68%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #133      +/-   ##
==========================================
+ Coverage   73.12%   75.42%   +2.29%     
==========================================
  Files          30       30              
  Lines        1935     1961      +26     
==========================================
+ Hits         1415     1479      +64     
+ Misses        520      482      -38     
Impacted Files Coverage Δ
soliket/foreground.py 92.30% <75.00%> (-3.25%) ⬇️
soliket/mflike/theoryforge_MFLike.py 83.67% <75.00%> (-2.54%) ⬇️
soliket/bandpass.py 91.26% <87.69%> (+46.36%) ⬆️
soliket/mflike/mflike.py 81.00% <91.66%> (+0.11%) ⬆️

@sgiardie sgiardie requested a review from mgerbino June 6, 2023 10:08
mgerbino
mgerbino previously approved these changes Jun 6, 2023
TE: [2, 5000]
ET: [2, 5000]
EE: [2, 5000]
TT: [50, 5000]
Copy link
Collaborator

Choose a reason for hiding this comment

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

ok! This might not be relevant for the current release, but maybe good to check with PS whether this is the correct lmax for data cut

@@ -37,7 +38,7 @@

class MFLike(GaussianLikelihood, InstallableLikelihood):
_url = "https://portal.nersc.gov/cfs/sobs/users/MFLike_data"
_release = "v0.6"
_release = "v0.7.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok! Again, it would be nice to check with PS people. I think it makes sense to update the data versioning to reflect the code versioning

@mgerbino
Copy link
Collaborator

mgerbino commented Jun 6, 2023

Closing this PR will supersede issue #90

Copy link
Collaborator

@itrharrison itrharrison left a comment

Choose a reason for hiding this comment

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

lgtm!

@itrharrison itrharrison merged commit cd28f57 into master Jun 6, 2023
@itrharrison itrharrison deleted the upgrade_mflike branch June 6, 2023 19:44
mgerbino pushed a commit that referenced this pull request Oct 4, 2023
* first modifications to switch from freqs to exp_freqs

* fix parenthesys

* fixing codestyle

* more modifications in bandpass and foreground

* more modifications and docs

* updating mflike and theoryforge

* fixing style

* fixing bandpass test

* fixing text foreground

* adding test data for bandpass

* fix bandpass docs

* fixing mflike test and bandpass docs

* fixing conflict with master on index.rst

* fix path in test_bandpass

* fixing problem in test_bandpass for tox tests

* addressing comments

* Update soliket/mflike/mflike.py

---------

Co-authored-by: Ian Harrison <itrharrison@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mflike Related to mflike likelihood
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade mflike version to v0.8.4 from LAT_MFLike Freeze SOLikeT MFLike to v0.7 from LAT_MFLike
4 participants