-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: master
Are you sure you want to change the base?
Conversation
…unction called get for quick loading of datasets.
unimpeded/unimpeded.py
Outdated
def __init__(self, **kwargs): | ||
self.model = kwargs.pop('model', None) | ||
self.data = kwargs.pop('data', None) | ||
self.method = kwargs.pop('method', None) | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this style
unimpeded/unimpeded.py
Outdated
|
||
#%% | ||
database = unimpeded('klcdm', 'bao.sdss_dr16', 'ns', 'local') | ||
samples = database.get() | ||
# %% |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
unimpeded/unimpeded.py
Outdated
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 |
There was a problem hiding this comment.
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.
unimpeded/unimpeded.py
Outdated
self.model = model | ||
self.dataset = dataset | ||
self.method = method |
There was a problem hiding this comment.
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
… class takes in a file path.
location = '/home/dlo26/rds/rds-dirac-dp192-63QXlf5HuFo/dlo26/' | ||
|
||
|
||
def test_get(): |
There was a problem hiding this comment.
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?
…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:
flake8 unimpeded tests
)pydocstyle --convention=numpy unimpeded
)python -m pytest
)