-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added command-line entry point 'qpinfo' and updated docs
- Loading branch information
1 parent
7dadd1f
commit b1c69fd
Showing
9 changed files
with
119 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""command line interface""" | ||
import argparse | ||
import pathlib | ||
|
||
from .core import load_data | ||
from .file_formats import UnknownFileFormatError | ||
|
||
|
||
def qpinfo(): | ||
"""Print information of a quantitative phase imaging dataset""" | ||
parser = qpinfo_parser() | ||
args = parser.parse_args() | ||
|
||
path = pathlib.Path(args.path).resolve() | ||
try: | ||
ds = load_data(path) | ||
except UnknownFileFormatError: | ||
print("Unknown file format: {}".format(path)) | ||
return | ||
|
||
print("{} ({})".format(ds.__class__.__doc__, ds.__class__.__name__)) | ||
print("- number of images: {}".format(len(ds))) | ||
for key in ds.meta_data: | ||
print("- {}: {}".format(key, ds.meta_data[key])) | ||
|
||
|
||
def qpinfo_parser(): | ||
descr = "Show information about a quantitative phase imaging dataset" | ||
parser = argparse.ArgumentParser(description=descr) | ||
parser.add_argument('path', metavar='path', type=str, | ||
help='Data path') | ||
return parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters