-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #986 from IanCa/develop
Add a new add_hed_ids script. Minor documentation corrections
- Loading branch information
Showing
5 changed files
with
31 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from hed.schema import load_schema_version | ||
from hed.scripts.script_util import get_prerelease_path | ||
from hed.scripts.convert_and_update_schema import convert_and_update | ||
import argparse | ||
from hed.schema.schema_io.df2schema import SchemaLoaderDF | ||
|
||
# Slightly tweaked version of convert_and_update_schema.py with a new main function to allow different parameters. | ||
def main(): | ||
parser = argparse.ArgumentParser(description='Add hed ids to a specific schema.') | ||
parser.add_argument('repo_path', help='The location of the hed-schemas directory') | ||
parser.add_argument('schema_name', help='The name of the schema("standard" for standard schema) to modify') | ||
parser.add_argument('schema_version', help='The schema version to modify') | ||
|
||
args = parser.parse_args() | ||
|
||
basepath = get_prerelease_path(args.repo_path, schema_name=args.schema_name, schema_version=args.schema_version) | ||
filenames = list(SchemaLoaderDF.convert_filenames_to_dict(basepath).values()) | ||
set_ids = True | ||
|
||
# Trigger a local cache hit (this ensures trying to load withStandard schemas will work properly) | ||
_ = load_schema_version("8.2.0") | ||
|
||
return convert_and_update(filenames, set_ids) | ||
|
||
|
||
if __name__ == "__main__": | ||
exit(main()) |
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