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

Stricter needed parameters check and save meta data to samples #80

Merged
merged 6 commits into from
Feb 9, 2023

Conversation

dachengx
Copy link
Collaborator

@dachengx dachengx commented Feb 8, 2023

  1. Drop all unneeded parameters when initializing the context
  2. Save meta data to MCMC samples(h5 file)

if metadata is None:
metadata = {
'version': '0.0',
'date': datetime.now().strftime('%Y%m%d_%H:%M:%S')
Copy link

Choose a reason for hiding this comment

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

[pep8] reported by reviewdog 🐶
C812 missing trailing comma

return self.par_config
from_parameters.append(v)
needed_parameters.add(k)
for k, v in likelihood['components'].items():
Copy link

Choose a reason for hiding this comment

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

[pep8] reported by reviewdog 🐶
B007 Loop control variable 'v' not used within the loop body. If this is intended, start the name with an underscore.

@coveralls
Copy link

coveralls commented Feb 8, 2023

Pull Request Test Coverage Report for Build 4130527108

  • 28 of 37 (75.68%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.2%) to 77.366%

Changes Missing Coverage Covered Lines Changed/Added Lines %
appletree/context.py 22 31 70.97%
Files with Coverage Reduction New Missed Lines %
appletree/context.py 1 80.25%
Totals Coverage Status
Change from base Build 4047518709: -0.2%
Covered Lines: 1463
Relevant Lines: 1891

💛 - Coveralls

@dachengx dachengx marked this pull request as ready for review February 8, 2023 19:38
@zihaoxu98
Copy link
Collaborator

Thanks! Can we also save the instruction of context in meta as well? Then in principle it should be able to recover the whole fitting.

@dachengx
Copy link
Collaborator Author

dachengx commented Feb 9, 2023

Thanks! Can we also save the instruction of context in meta as well? Then in principle it should be able to recover the whole fitting.

Good idea. I will add it.

from appletree import randgen
from appletree import Parameter
from appletree import Likelihood
from appletree.utils import load_json
from appletree.share import set_global_config
from appletree.share import _cached_configs, set_global_config
Copy link

Choose a reason for hiding this comment

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

[pep8] reported by reviewdog 🐶
WPS450 Found protected object import: _cached_configs

if self.backend_h5 is not None:
name = self.sampler.backend.name
with h5py.File(self.backend_h5, 'r+') as opt:
opt[name].attrs['metadata'] = json.dumps(metadata)
Copy link

Choose a reason for hiding this comment

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

[pep8] reported by reviewdog 🐶
WPS204 Found overused expression: opt[name]; used 6 > 4

Copy link
Collaborator Author

@dachengx dachengx left a comment

Choose a reason for hiding this comment

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

Here we also change the prior of nex_ni_ratio which was induced as a typo. Ref: xenon:xenonnt:zihao:bbf_sr0_er_model_summary#numbers

@zihaoxu98 zihaoxu98 merged commit 888dbdb into master Feb 9, 2023
@dachengx dachengx deleted the set_blobs_dtype branch February 9, 2023 05:31
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