-
Notifications
You must be signed in to change notification settings - Fork 2
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
Extend data info #75
base: master
Are you sure you want to change the base?
Extend data info #75
Conversation
5b91394
to
86443d8
Compare
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.
We need to agree on a format of doctests before updating them.
|
||
Examples | ||
-------- | ||
1. Creating data object. | ||
1. Creating data object using `dirname` |
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.
1. Creating data object using `dirname` | |
1. Creating data object using `path` |
>>> data = mdata.Data( | ||
path="/home/zulfigak/ubermag_devtools/repos/micromagneticdata/micromagneticdata/tests/test_sample/rectangle" |
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.
>>> data = mdata.Data( | |
path="/home/zulfigak/ubermag_devtools/repos/micromagneticdata/micromagneticdata/tests/test_sample/rectangle" | |
>>> path = Path(__file__).parent / 'tests' / 'test_sample' | |
>>> data = mdata.Data(path=path) |
1. Creating data object. | ||
1. Creating data object using `dirname` | ||
|
||
>>> import micromagneticdata as mdata |
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.
>>> import micromagneticdata as mdata | |
>>> import micromagneticdata as mdata | |
>>> from pathlib import Path |
... | ||
>>> dirname = os.path.join(os.path.dirname(__file__), 'tests', 'test_sample') | ||
>>> data = md.Data(name='rectangle', dirname=dirname) | ||
>>> data = mdata.Data(name='rectangle', dirname=dirname) | ||
... |
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.
... |
1. Representation string using `path` | ||
|
||
>>> import micromagneticdata as mdata | ||
... | ||
>>> data = mdata.Data( | ||
path="/home/zulfigak/ubermag_devtools/repos/micromagneticdata/micromagneticdata/tests/test_sample/rectangle" | ||
) | ||
>>> data | ||
Data(...) | ||
|
||
2. Representation string using `name` and `dirname` |
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.
Two comments for all examples:
- Do not (!) use an absolute path corresponding to the directory structure on your laptop. Instead use
Path(__file__)
as proposed as a change in one of my previous comments. - Showing the two different initialisation methods in all example is in my opinion not required. I would lean towards only showing
path
. Opinion @samjrholt ?
@@ -169,7 +244,7 @@ def __getitem__(self, item): | |||
return md.Drive( | |||
name=self.name, | |||
number=range(self.n)[item], | |||
dirname=self.dirname, | |||
dirname=str(self.dirname), |
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.
I would prefer to allow pathlib.Path for dirname in Drive.
extend data info to take path as input argument and deprecated the
dirname