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

Extend data info #75

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

Extend data info #75

wants to merge 4 commits into from

Conversation

kzqureshi
Copy link
Contributor

extend data info to take path as input argument and deprecated the dirname

@kzqureshi kzqureshi requested a review from lang-m October 28, 2024 09:13
@kzqureshi kzqureshi linked an issue Dec 13, 2024 that may be closed by this pull request
Copy link
Member

@lang-m lang-m left a 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`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
1. Creating data object using `dirname`
1. Creating data object using `path`

Comment on lines +43 to +44
>>> data = mdata.Data(
path="/home/zulfigak/ubermag_devtools/repos/micromagneticdata/micromagneticdata/tests/test_sample/rectangle"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> 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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> 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)
...
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
...

Comment on lines +99 to +109
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`
Copy link
Member

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),
Copy link
Member

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.

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.

Initialisation of Data object
2 participants