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

Creating a class with .get() function for quick and convenient loading of datasets #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

DilyOng
Copy link

@DilyOng DilyOng commented Mar 21, 2024

…unction called get for quick loading of datasets.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue)

Checklist:

  • I have performed a self-review of my own code
  • My code is PEP8 compliant (flake8 unimpeded tests)
  • My code contains compliant docstrings (pydocstyle --convention=numpy unimpeded)
  • New and existing unit tests pass locally with my changes (python -m pytest)
  • I have added tests that prove my fix is effective or that my feature works
  • I have appropriately incremented the semantic version number in both README.rst and unimpeded/_version.py

…unction called get for quick loading of datasets.
@williamjameshandley williamjameshandley mentioned this pull request Mar 21, 2024
6 tasks
Comment on lines 8 to 12
def __init__(self, **kwargs):
self.model = kwargs.pop('model', None)
self.data = kwargs.pop('data', None)
self.method = kwargs.pop('method', None)
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Use this style

Comment on lines 25 to 29

#%%
database = unimpeded('klcdm', 'bao.sdss_dr16', 'ns', 'local')
samples = database.get()
# %%
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be put into a test function in tests/test_unimpeded.py

Copy link
Author

Choose a reason for hiding this comment

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

Done

Comment on lines 20 to 24
if self.location == 'hpc':
samples = read_chains(f"/home/dlo26/rds/rds-dirac-dp192-63QXlf5HuFo/dlo26/{self.method}/{self.model}/{self.dataset}/{self.dataset}_polychord_raw/{self.dataset}") # for hpc
elif self.location == 'local':
samples = read_chains(f"../../{self.method}/{self.model}/{self.dataset}/{self.dataset}_polychord_raw/{self.dataset}")
return samples
Copy link
Contributor

Choose a reason for hiding this comment

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

you should read from self.location, and have 'hpc' and 'local' processing as part of your own personal scripts.

Comment on lines 14 to 16
self.model = model
self.dataset = dataset
self.method = method
Copy link
Contributor

Choose a reason for hiding this comment

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

these should be arguments of .get. For now one would only want location as a kwarg

location = '/home/dlo26/rds/rds-dirac-dp192-63QXlf5HuFo/dlo26/'


def test_get():
Copy link
Author

Choose a reason for hiding this comment

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

In test_get(), how can I use assert statement to test whether the correct dataset is loaded?

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