generated from FAIRChemistry/sdrdm-template
-
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.
update markdown implement librarian update parser
- Loading branch information
Showing
7 changed files
with
96 additions
and
162 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from .readers.gcparser import GCParser | ||
from .readers.gstaticparser import GstaticParser | ||
from .readers.mfmparser import MFMParser | ||
from .readers.librarian import Librarian | ||
from .calculus.calibrator import Calibrator | ||
from .calculus.faraday_efficiency import FaradayEfficiencyCalculator | ||
from .calculus.assign_peak_areas import PeakAreaAssignment |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,46 @@ | ||
from pathlib import Path | ||
from pydantic import BaseModel, PrivateAttr | ||
|
||
class Librarian(): | ||
|
||
|
||
class Librarian(BaseModel): | ||
|
||
root_directory: Path | ||
|
||
def enumerate_subdirectories(self, subdirectory=None): | ||
|
||
directory = self.root_directory | ||
if subdirectory != None: | ||
directory = directory / subdirectory | ||
if not isinstance(directory, Path): | ||
raise ValueError('Not a valid Path object.') | ||
if not directory.exists(): | ||
raise ValueError('Directory does not exist.') | ||
dir_dict = {index: dir for index, dir in enumerate([x for x in directory.iterdir() if x.is_dir()])} | ||
print(f'Parent directory: \n {directory} \nAvailable subdirectories:') | ||
for index, dir in dir_dict.items(): | ||
print(f'{index}: /{dir.name}') | ||
return dir_dict | ||
|
||
def enumerate_files(self, subdirectory=None, filter=None): | ||
|
||
directory = self.root_directory | ||
if subdirectory != None: | ||
directory = directory / subdirectory | ||
if not isinstance(directory, Path): | ||
raise ValueError('Not a valid Path object.') | ||
if not directory.exists(): | ||
raise ValueError('Directory does not exist.') | ||
suffix = '*' | ||
if filter != None: | ||
suffix = suffix + '.' + filter | ||
file_dict = {index: file for index, file in enumerate(directory.glob(suffix)) if file.is_file()} | ||
print(f'Directory: \n {directory} \nAvailable files:') | ||
for index, file in file_dict.items(): | ||
print(f'{index}: {file.name}') | ||
return file_dict | ||
|
||
@property | ||
def get_root_directory(self): | ||
return self.root_directory | ||
|
||
|
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